85 lines
6.3 KiB
JavaScript
85 lines
6.3 KiB
JavaScript
import AppLayout from '@/layout/AppLayout.vue';
|
||
import { createRouter, createWebHistory } from 'vue-router';
|
||
|
||
const TitlePage = () => import('@/views/portal/TitlePage.vue');
|
||
const NotFoundPage = () => import('@/views/pages/NotFound.vue');
|
||
|
||
const APP_NAME = 'Portal';
|
||
|
||
const router = createRouter({
|
||
history: createWebHistory(),
|
||
routes: [
|
||
{
|
||
path: '/',
|
||
component: AppLayout,
|
||
children: [
|
||
{ path: '', name: 'home', component: TitlePage, meta: { title: '首页推荐内容列表' } },
|
||
{ path: 'tags', name: 'tags', component: TitlePage, meta: { title: '内容分类(Tag 列表)' } },
|
||
{ path: 'tags/:tagId', name: 'tagDetail', component: TitlePage, meta: { title: 'Tag 详情(聚合列表)' } },
|
||
{ path: 'search', name: 'search', component: TitlePage, meta: { title: '搜索' } },
|
||
{ path: 'contents/:contentId', name: 'contentDetail', component: TitlePage, meta: { title: '内容详情页' } },
|
||
{ path: 'tenants/:tenantId', name: 'tenantHome', component: TitlePage, meta: { title: '租户个人主页' } },
|
||
|
||
{ path: 'help', name: 'help', component: TitlePage, meta: { title: '帮助中心/客服' } },
|
||
{ path: 'terms', name: 'terms', component: TitlePage, meta: { title: '服务条款' } },
|
||
{ path: 'privacy', name: 'privacy', component: TitlePage, meta: { title: '隐私政策' } },
|
||
{ path: 'maintenance', name: 'maintenance', component: TitlePage, meta: { title: '维护中' } },
|
||
|
||
{ path: 'checkout', name: 'checkout', component: TitlePage, meta: { title: '下单/确认订单' } },
|
||
{ path: 'payment/result', name: 'paymentResult', component: TitlePage, meta: { title: '支付结果' } },
|
||
|
||
{ path: 'me', name: 'me', component: TitlePage, meta: { title: '个人中心' } },
|
||
{ path: 'me/orders', name: 'meOrders', component: TitlePage, meta: { title: '我的订单列表' } },
|
||
{ path: 'me/orders/:orderId', name: 'meOrderDetail', component: TitlePage, meta: { title: '订单详情' } },
|
||
{ path: 'me/after-sales', name: 'meAfterSales', component: TitlePage, meta: { title: '售后/退款' } },
|
||
{ path: 'me/invoices', name: 'meInvoices', component: TitlePage, meta: { title: '发票/收据' } },
|
||
{ path: 'me/profile', name: 'meProfile', component: TitlePage, meta: { title: '个人资料' } },
|
||
{ path: 'me/security', name: 'meSecurity', component: TitlePage, meta: { title: '安全设置' } },
|
||
{ path: 'me/favorites', name: 'meFavorites', component: TitlePage, meta: { title: '收藏/关注' } },
|
||
{ path: 'me/history', name: 'meHistory', component: TitlePage, meta: { title: '浏览历史' } },
|
||
{ path: 'me/notifications', name: 'meNotifications', component: TitlePage, meta: { title: '消息通知/站内信' } },
|
||
{ path: 'me/addresses', name: 'meAddresses', component: TitlePage, meta: { title: '地址簿' } },
|
||
|
||
{ path: 'settings/account/close', name: 'closeAccount', component: TitlePage, meta: { title: '账号注销' } },
|
||
|
||
{ path: 'tenant/apply', name: 'tenantApply', component: () => import('@/views/tenant/TenantApply.vue'), meta: { title: '申请创作者' } },
|
||
{ path: 'tenant/apply/status', name: 'tenantApplyStatus', component: () => import('@/views/tenant/TenantApply.vue'), meta: { title: '创作者申请状态' } },
|
||
{ path: 'tenant/switch', name: 'tenantSwitch', component: TitlePage, meta: { title: '租户切换' } },
|
||
|
||
{ path: 'admin', name: 'adminDashboard', component: TitlePage, meta: { title: '管理概览(仪表盘)' } },
|
||
{ path: 'admin/contents', name: 'adminContents', component: TitlePage, meta: { title: '内容列表(管理)' } },
|
||
{ path: 'admin/contents/new', name: 'adminContentNew', component: TitlePage, meta: { title: '内容发布' } },
|
||
{ path: 'admin/contents/:contentId/edit', name: 'adminContentEdit', component: TitlePage, meta: { title: '内容编辑' } },
|
||
{ path: 'admin/assets', name: 'adminAssets', component: TitlePage, meta: { title: '素材库' } },
|
||
{ path: 'admin/orders', name: 'adminOrders', component: TitlePage, meta: { title: '订单列表(管理)' } },
|
||
{ path: 'admin/orders/:orderId', name: 'adminOrderDetail', component: TitlePage, meta: { title: '订单详情(管理)' } },
|
||
{ path: 'admin/tenants', name: 'adminTenants', component: TitlePage, meta: { title: '租户列表(管理)' } },
|
||
{ path: 'admin/settings', name: 'adminSettings', component: TitlePage, meta: { title: '租户设置' } },
|
||
{ path: 'admin/team', name: 'adminTeam', component: TitlePage, meta: { title: '团队成员与权限' } },
|
||
{ path: 'admin/audit-logs', name: 'adminAuditLogs', component: TitlePage, meta: { title: '操作日志' } },
|
||
{ path: 'admin/finance', name: 'adminFinance', component: TitlePage, meta: { title: '财务结算/提现' } }
|
||
]
|
||
},
|
||
|
||
{ path: '/auth/login', name: 'login', component: () => import('@/views/pages/auth/Login.vue'), meta: { title: '登录' } },
|
||
{ path: '/auth/register', name: 'register', component: () => import('@/views/pages/auth/Register.vue'), meta: { title: '注册' } },
|
||
{ path: '/auth/forgot-password', name: 'forgotPassword', component: () => import('@/views/pages/auth/ForgotPassword.vue'), meta: { title: '忘记密码' } },
|
||
{ path: '/auth/verify', name: 'verify', component: TitlePage, meta: { title: '验证(邮箱/手机)' } },
|
||
|
||
{ path: '/404', name: 'notFound', component: NotFoundPage, meta: { title: '404' } },
|
||
{ path: '/500', name: 'serverError', component: TitlePage, meta: { title: '500' } },
|
||
{ path: '/:pathMatch(.*)*', name: 'catchAll', component: NotFoundPage, meta: { title: '404' } }
|
||
]
|
||
});
|
||
|
||
router.afterEach((to) => {
|
||
const title = to.meta?.title;
|
||
if (typeof title === 'string' && title.length > 0) {
|
||
document.title = `${title} - ${APP_NAME}`;
|
||
} else {
|
||
document.title = APP_NAME;
|
||
}
|
||
});
|
||
|
||
export default router;
|