新增玩家手动充值全流程(收款方式配置、充值下单/审核、钱包上分), 支持邀请码注册、邀请历史与专属返水率;完善后台代理/玩家管理与响应式操作栏, 并补充前台注册、充值页及多语言错误码。 Co-authored-by: Cursor <cursoragent@cursor.com>
46 lines
2.6 KiB
TypeScript
46 lines
2.6 KiB
TypeScript
import { createRouter, createWebHistory } from 'vue-router';
|
|
import { useAuthStore } from '../stores/auth.ts';
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(),
|
|
routes: [
|
|
{ path: '/login', component: () => import('../views/LoginView.vue') },
|
|
{ path: '/register', component: () => import('../views/RegisterView.vue') },
|
|
{
|
|
path: '/',
|
|
component: () => import('../layouts/MainLayout.vue'),
|
|
children: [
|
|
// 公开页面 — 无需登录即可浏览
|
|
{ path: '', component: () => import('../views/HomeView.vue'), meta: { keepAlive: true } },
|
|
{ path: 'bet', component: () => import('../views/FootballView.vue'), meta: { keepAlive: true } },
|
|
{ path: 'football', redirect: '/bet' },
|
|
{ path: 'match/:id', component: () => import('../views/MatchDetailView.vue') },
|
|
// 需要登录的页面
|
|
{ path: 'bets', component: () => import('../views/MyBetsView.vue'), meta: { keepAlive: true, requiresAuth: true } },
|
|
{ path: 'bets/:betNo', component: () => import('../views/BetDetailView.vue'), meta: { requiresAuth: true } },
|
|
{ path: 'wallet', component: () => import('../views/WalletView.vue'), meta: { keepAlive: true, requiresAuth: true } },
|
|
{ path: 'wallet/detail', component: () => import('../views/WalletDetailView.vue'), meta: { requiresAuth: true } },
|
|
{ path: 'wallet/cashbacks', component: () => import('../views/CashbackRecordsView.vue'), meta: { requiresAuth: true } },
|
|
{ path: 'wallet/recharge', component: () => import('../views/RechargeView.vue'), meta: { requiresAuth: true } },
|
|
{ path: 'wallet/recharge/history', component: () => import('../views/RechargeHistoryView.vue'), meta: { requiresAuth: true } },
|
|
{ path: 'wallet/transactions/:transactionId', component: () => import('../views/WalletTransactionDetailView.vue'), meta: { requiresAuth: true } },
|
|
{ path: 'profile', component: () => import('../views/ProfileView.vue'), meta: { keepAlive: true, requiresAuth: true } },
|
|
{ path: 'profile/cashbacks', component: () => import('../views/CashbackRecordsView.vue'), meta: { requiresAuth: true } },
|
|
{ path: 'profile/edit', component: () => import('../views/ProfileEditView.vue'), meta: { requiresAuth: true } },
|
|
],
|
|
},
|
|
],
|
|
});
|
|
|
|
router.beforeEach((to) => {
|
|
const auth = useAuthStore();
|
|
if ((to.path === '/login' || to.path === '/register') && auth.token) return '/';
|
|
// 需要登录的页面 — 未登录时弹出登录提示,留在当前页
|
|
if (to.meta.requiresAuth && !auth.token) {
|
|
auth.showLoginPrompt(to.fullPath);
|
|
return false;
|
|
}
|
|
});
|
|
|
|
export default router;
|