diff --git a/demo/frontend/src/views/Home.vue b/demo/frontend/src/views/Home.vue index b535b6e..66ca47a 100644 --- a/demo/frontend/src/views/Home.vue +++ b/demo/frontend/src/views/Home.vue @@ -1,149 +1,203 @@ @@ -151,19 +205,17 @@ import { ref, onMounted } from 'vue' import { useRouter } from 'vue-router' import { useUserStore } from '@/stores/user' -import { useOrderStore } from '@/stores/orders' -import { getOrderStats } from '@/api/orders' import { ElMessage } from 'element-plus' const router = useRouter() const userStore = useUserStore() -const orderStore = useOrderStore() -const stats = ref({}) -const recentOrders = ref([]) -const loading = ref(false) +// 导航功能 +const goToUsers = () => { + ElMessage.info('跳转到会员管理') + // router.push('/admin/users') +} -// 功能卡片点击事件 const goToOrders = () => { if (userStore.isAuthenticated) { router.push('/orders') @@ -173,264 +225,500 @@ const goToOrders = () => { } } -const goToPayments = () => { - router.push('/payments') +const goToAPI = () => { + ElMessage.info('跳转到API管理') + // router.push('/admin/api') } -const goToAdmin = () => { - if (userStore.isAuthenticated) { - if (userStore.isAdmin) { - router.push('/admin/orders') - } else { - ElMessage.warning('需要管理员权限') - } - } else { - ElMessage.warning('请先登录') - router.push('/login') - } +const goToTasks = () => { + ElMessage.info('跳转到生成任务记录') + // router.push('/admin/tasks') } -// 获取统计数据 -const fetchStats = async () => { - try { - const response = await getOrderStats() - if (response.success) { - stats.value = response.data - } - } catch (error) { - console.error('Fetch stats error:', error) - } -} - -// 获取最近订单 -const fetchRecentOrders = async () => { - try { - loading.value = true - const response = await orderStore.fetchOrders({ page: 0, size: 5 }) - if (response.success) { - recentOrders.value = orderStore.orders - } - } catch (error) { - console.error('Fetch recent orders error:', error) - } finally { - loading.value = false - } -} - -// 获取状态类型 -const getStatusType = (status) => { - const statusMap = { - 'PENDING': 'warning', - 'CONFIRMED': 'info', - 'PAID': 'primary', - 'PROCESSING': '', - 'SHIPPED': 'success', - 'DELIVERED': 'success', - 'COMPLETED': 'success', - 'CANCELLED': 'danger', - 'REFUNDED': 'info' - } - return statusMap[status] || '' -} - -// 获取状态文本 -const getStatusText = (status) => { - const statusMap = { - 'PENDING': '待支付', - 'CONFIRMED': '已确认', - 'PAID': '已支付', - 'PROCESSING': '处理中', - 'SHIPPED': '已发货', - 'DELIVERED': '已送达', - 'COMPLETED': '已完成', - 'CANCELLED': '已取消', - 'REFUNDED': '已退款' - } - return statusMap[status] || status -} - -// 格式化日期 -const formatDate = (dateString) => { - const date = new Date(dateString) - return date.toLocaleDateString('zh-CN', { - year: 'numeric', - month: '2-digit', - day: '2-digit', - hour: '2-digit', - minute: '2-digit' - }) +const goToSettings = () => { + ElMessage.info('跳转到系统设置') + // router.push('/admin/settings') } onMounted(() => { - if (userStore.isAuthenticated) { - fetchStats() - fetchRecentOrders() - } + // 初始化数据 })