Add admin-frontend and user-frontend standalone projects, certification/invoice/discovery features, fix auth header and theme consistency

This commit is contained in:
TradeMate Dev
2026-05-22 18:35:30 +08:00
parent 18c6cf5406
commit 52dba37f22
79 changed files with 10333 additions and 248 deletions
+85
View File
@@ -0,0 +1,85 @@
import { createRouter, createWebHistory } from 'vue-router'
import AdminLayout from '@/layouts/AdminLayout.vue'
const routes = [
{ path: '/login', redirect: '/' },
{ path: '/', name: 'Landing', component: () => import('@/views/Landing.vue') },
{
path: '/dashboard',
component: AdminLayout,
meta: { requiresAuth: true },
children: [
{ path: '', name: 'Dashboard', component: () => import('@/views/Dashboard.vue'), meta: { title: '概览' } },
]
},
{
path: '/users',
component: AdminLayout,
meta: { requiresAuth: true },
children: [
{ path: '', name: 'Users', component: () => import('@/views/Users.vue'), meta: { title: '用户' } },
]
},
{
path: '/stats',
component: AdminLayout,
meta: { requiresAuth: true },
children: [
{ path: '', name: 'Stats', component: () => import('@/views/Stats.vue'), meta: { title: '统计' } },
]
},
{
path: '/logs',
component: AdminLayout,
meta: { requiresAuth: true },
children: [
{ path: '', name: 'Logs', component: () => import('@/views/Logs.vue'), meta: { title: '日志' } },
]
},
{
path: '/config',
component: AdminLayout,
meta: { requiresAuth: true },
children: [
{ path: '', name: 'Config', component: () => import('@/views/Config.vue'), meta: { title: '配置' } },
]
},
{
path: '/quota',
component: AdminLayout,
meta: { requiresAuth: true },
children: [
{ path: '', name: 'Quota', component: () => import('@/views/Quota.vue'), meta: { title: '翻译配额' } },
]
},
{
path: '/certifications',
component: AdminLayout,
meta: { requiresAuth: true },
children: [
{ path: '', name: 'Certifications', component: () => import('@/views/Certifications.vue'), meta: { title: '认证审核' } },
]
},
{
path: '/invoices',
component: AdminLayout,
meta: { requiresAuth: true },
children: [
{ path: '', name: 'Invoices', component: () => import('@/views/Invoices.vue'), meta: { title: '发票管理' } },
]
},
]
const router = createRouter({ history: createWebHistory('/admin/'), routes })
router.beforeEach((to, from, next) => {
if (to.meta?.requiresAuth) {
const token = localStorage.getItem('admin_token')
if (!token) next({ name: 'Login', query: { redirect: to.fullPath } })
else next()
} else {
next()
}
})
export default router