diff --git a/src/App.vue b/src/App.vue index 7ae1872..68fd092 100644 --- a/src/App.vue +++ b/src/App.vue @@ -12,8 +12,8 @@ diff --git a/src/views/Login.vue b/src/views/Login.vue deleted file mode 100644 index ff13312..0000000 --- a/src/views/Login.vue +++ /dev/null @@ -1,174 +0,0 @@ - - - - - diff --git a/src/views/PaymentResult.vue b/src/views/PaymentResult.vue deleted file mode 100644 index 2192784..0000000 --- a/src/views/PaymentResult.vue +++ /dev/null @@ -1,142 +0,0 @@ - - - - - diff --git a/src/views/Profile.vue b/src/views/Profile.vue index 00c368d..07decb6 100644 --- a/src/views/Profile.vue +++ b/src/views/Profile.vue @@ -6,18 +6,20 @@
- - {{ userInfo.username?.charAt(0)?.toUpperCase() || 'U' }} + + {{ (userInfo.name || userInfo.username || userStore.username || 'U').charAt(0).toUpperCase() }}
- {{ userInfo.username || '用户' }} -
尊贵会员
+ {{ userInfo.name || userInfo.username || userStore.username || '用户' }} +
尊贵会员
普通用户
@@ -53,14 +55,14 @@
- {{ planLabel(o.plan_type) }} - {{ formatDate(o.created_at) }} + {{ planLabel(o.goods_name) }} + {{ formatDate(o.pay_time) }}
- ¥{{ o.amount }} - + ¥{{ o.total_fee }} +
@@ -83,14 +85,14 @@
- {{ planLabel(o.plan_type) }} - {{ formatDate(o.created_at) }} + {{ planLabel(o.goods_name) }} + {{ formatDate(o.pay_time) }}
- ¥{{ o.amount }} - + ¥{{ o.total_fee }} +
@@ -107,8 +109,9 @@ import { ElMessage, ElMessageBox } from 'element-plus' import api from '@/api' import { useUserStore } from '@/stores/user' import { checkUserVip } from '@/utils/appUtils' -import BaseDialog from '@/components/BaseDialog.vue' -import WarningFooter from '@/components/WarningFooter.vue' +import BaseDialog from '@/components/common/BaseDialog.vue' +import WarningFooter from '@/components/common/WarningFooter.vue' +import authService from '@/api/authService.js' const router = useRouter() const userStore = useUserStore() @@ -119,38 +122,7 @@ const userInfo = reactive({ membership_expire_at: null, created_at: '' }) -const defaultOrder = [ - { - plan_type: '月卡会员', - created_at: '2026.6.1-2026.7.1', - amount: '19.90', - status: '进行中' - }, - { - plan_type: '月卡会员', - created_at: '2026.1.1-2026.2.1', - amount: '19.90', - status: '已过期' - }, - { - plan_type: '月卡会员', - created_at: '2026.1.1-2026.2.1', - amount: '19.90', - status: '已过期' - }, - { - plan_type: '月卡会员', - created_at: '2026.1.1-2026.2.1', - amount: '19.90', - status: '已过期' - }, - { - plan_type: '月卡会员', - created_at: '2026.1.1-2026.2.1', - amount: '19.90', - status: '已过期' - }, -] +const defaultOrder = [] const isVip = ref(false) const dialogVisible = ref(false) const worksCount = ref(1) @@ -158,26 +130,35 @@ const ordersCount = ref(0) const orders = ref(defaultOrder) const productMap = ref({}) // productId -> productName 映射 -onMounted(() => { - // 优先从 userStore 读取(注册/登录时已设置),立即显示页面 - if (userStore.username) { - userInfo.username = userStore.username - userInfo.avatar_url = userStore.avatarUrl || '' - isVip.value = userStore.isVip - // 静默请求补充 email/created_at 等字段,失败不弹提示 - api.auth.profileSilent().then(res => { - Object.assign(userInfo, res) - isVip.value = !!res.is_vip - }).catch(() => { }) - } else { - api.auth.profileSilent().then(res => { - Object.assign(userInfo, res) - isVip.value = !!res.is_vip - }).catch(() => { }) - } - loadStats() +onMounted(async () => { + try { + const data = await userStore.fetchProfile() + if (data) { + Object.assign(userInfo, data) + } + } catch (e) { } + + // 从本地缓存补全 userInfo 视图属性 + try { + const local = JSON.parse(localStorage.getItem('user_info') || '{}') + Object.assign(userInfo, local) + } catch (e) { } + + loadStats(); + getOrders(); }) +async function getOrders() { + try { + const res = await authService.getOrder({ status: 2 }) + if (res.code == 0 && res.data) { + console.log("订单列表", res.data) + orders.value = res.data + ordersCount.value = res.data.length + } + } catch (error) { } +} + async function loadStats() { // try { // const [wRes, oRes, pRes] = await Promise.all([ diff --git a/src/views/Register.vue b/src/views/Register.vue deleted file mode 100644 index 8620f00..0000000 --- a/src/views/Register.vue +++ /dev/null @@ -1,168 +0,0 @@ - - - - - diff --git a/src/views/Works.vue b/src/views/Works.vue deleted file mode 100644 index e6b6eed..0000000 --- a/src/views/Works.vue +++ /dev/null @@ -1,139 +0,0 @@ - - - - - diff --git a/src/views/article/detail.vue b/src/views/article/detail.vue new file mode 100644 index 0000000..e9c3da1 --- /dev/null +++ b/src/views/article/detail.vue @@ -0,0 +1,653 @@ + + + + + \ No newline at end of file diff --git a/src/views/article/list.vue b/src/views/article/list.vue new file mode 100644 index 0000000..ba7894f --- /dev/null +++ b/src/views/article/list.vue @@ -0,0 +1,310 @@ + + + + + \ No newline at end of file diff --git a/src/views/index/index.vue b/src/views/index/index.vue index 09784c0..fc37ec0 100644 --- a/src/views/index/index.vue +++ b/src/views/index/index.vue @@ -55,7 +55,7 @@