531 lines
13 KiB
JavaScript
531 lines
13 KiB
JavaScript
|
|
import { createRouter, createWebHistory } from 'vue-router'
|
|||
|
|
import { ElMessage } from 'element-plus'
|
|||
|
|
import LotterySelection from '../views/LotterySelection.vue'
|
|||
|
|
import LotteryPremium from '../views/LotteryPremium.vue'
|
|||
|
|
import Home from '../views/ssq/Home.vue'
|
|||
|
|
import DltHome from '../views/dlt/Home.vue'
|
|||
|
|
import LotteryInfo from '../views/LotteryInfo.vue'
|
|||
|
|
import Profile from '../views/Profile.vue'
|
|||
|
|
import Login from '../views/Login.vue'
|
|||
|
|
import Register from '../views/Register.vue'
|
|||
|
|
import ResetPassword from '../views/ResetPassword.vue'
|
|||
|
|
import PredictRecords from '../views/PredictRecords.vue'
|
|||
|
|
import DltPredictRecords from '../views/dlt/PredictRecords.vue'
|
|||
|
|
|
|||
|
|
import ExcelImportManagement from '../views/ExcelImportManagement.vue'
|
|||
|
|
import ExchangeRecords from '../views/ExchangeRecords.vue'
|
|||
|
|
import TrendAnalysis from '../views/ssq/TrendAnalysis.vue'
|
|||
|
|
import SurfaceAnalysis from '../views/ssq/SurfaceAnalysis.vue'
|
|||
|
|
import LineAnalysis from '../views/ssq/LineAnalysis.vue'
|
|||
|
|
import SsqTableAnalysis from '../views/ssq/SsqTableAnalysis.vue'
|
|||
|
|
import DataAnalysis from '../views/DataAnalysis.vue'
|
|||
|
|
import HelpCenter from '../views/HelpCenter.vue'
|
|||
|
|
import AboutUs from '../views/AboutUs.vue'
|
|||
|
|
import UserAgreement from '../views/UserAgreement.vue'
|
|||
|
|
import UserGuide from '../views/UserGuide.vue'
|
|||
|
|
import MemberAgreement from '../views/MemberAgreement.vue'
|
|||
|
|
import HitAnalysis from '../views/ssq/HitAnalysis.vue'
|
|||
|
|
import DltHitAnalysis from '../views/dlt/HitAnalysis.vue'
|
|||
|
|
import UsageStats from '../views/ssq/UsageStats.vue'
|
|||
|
|
import DltUsageStats from '../views/dlt/UsageStats.vue'
|
|||
|
|
import PrizeStatistics from '../views/ssq/PrizeStatistics.vue'
|
|||
|
|
import DltPrizeStatistics from '../views/dlt/PrizeStatistics.vue'
|
|||
|
|
|
|||
|
|
// 双色球相关页面
|
|||
|
|
import SsqLottery from '../views/ssq/Lottery.vue'
|
|||
|
|
|
|||
|
|
// 大乐透相关页面
|
|||
|
|
import DltLottery from '../views/dlt/Lottery.vue'
|
|||
|
|
import DltTableAnalysis from '../views/dlt/DltTableAnalysis.vue'
|
|||
|
|
import DltSurfaceAnalysis from '../views/dlt/SurfaceAnalysis.vue'
|
|||
|
|
import DltLineAnalysis from '../views/dlt/LineAnalysis.vue'
|
|||
|
|
import DltTrendAnalysis from '../views/dlt/TrendAnalysis.vue'
|
|||
|
|
|
|||
|
|
// 精推版页面
|
|||
|
|
import JtSsqHome from '../views/jt/SsqHome.vue'
|
|||
|
|
import JtDltHome from '../views/jt/DltHome.vue'
|
|||
|
|
|
|||
|
|
|
|||
|
|
// 后台管理相关组件
|
|||
|
|
import AdminLogin from '../views/admin/AdminLogin.vue'
|
|||
|
|
import AdminLayout from '../views/admin/layout/AdminLayout.vue'
|
|||
|
|
import AdminVipCodeManagement from '../views/admin/VipCodeManagement.vue'
|
|||
|
|
import AdminExcelImportManagement from '../views/admin/ExcelImportManagement.vue'
|
|||
|
|
import AdminDltExcelImportManagement from '../views/admin/DltExcelImportManagement.vue'
|
|||
|
|
import AdminPredictionManagement from '../views/admin/PredictionManagement.vue'
|
|||
|
|
import AdminDltPredictionManagement from '../views/admin/DltPredictionManagement.vue'
|
|||
|
|
import AdminPrizeStatistics from '../views/admin/PrizeStatistics.vue'
|
|||
|
|
import AdminDltPrizeStatistics from '../views/admin/DltPrizeStatistics.vue'
|
|||
|
|
import AdminUsageStats from '../views/ssq/UsageStats.vue'
|
|||
|
|
import AdminDltUsageStats from '../views/dlt/UsageStats.vue'
|
|||
|
|
|
|||
|
|
const routes = [
|
|||
|
|
// 前台用户路由
|
|||
|
|
{
|
|||
|
|
path: '/',
|
|||
|
|
name: 'LotterySelection',
|
|||
|
|
component: LotterySelection
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/lottery-premium',
|
|||
|
|
name: 'LotteryPremium',
|
|||
|
|
component: LotteryPremium
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/shuangseqiu',
|
|||
|
|
name: 'Shuangseqiu',
|
|||
|
|
component: Home
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/daletou',
|
|||
|
|
name: 'DaLeTou',
|
|||
|
|
component: DltHome
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/jt/shuangseqiu',
|
|||
|
|
name: 'JtShuangseqiu',
|
|||
|
|
component: JtSsqHome
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/jt/daletou',
|
|||
|
|
name: 'JtDaLeTou',
|
|||
|
|
component: JtDltHome
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/lottery-info',
|
|||
|
|
name: 'LotteryInfo',
|
|||
|
|
component: LotteryInfo
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/lottery-info/ssq',
|
|||
|
|
name: 'SsqLottery',
|
|||
|
|
component: SsqLottery
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/lottery-info/dlt',
|
|||
|
|
name: 'DltLottery',
|
|||
|
|
component: DltLottery
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/dlt-table-analysis',
|
|||
|
|
name: 'DltTableAnalysis',
|
|||
|
|
component: DltTableAnalysis,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/dlt-surface-analysis',
|
|||
|
|
name: 'DltSurfaceAnalysis',
|
|||
|
|
component: DltSurfaceAnalysis,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/dlt-line-analysis',
|
|||
|
|
name: 'DltLineAnalysis',
|
|||
|
|
component: DltLineAnalysis,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/dlt-trend-analysis',
|
|||
|
|
name: 'DltTrendAnalysis',
|
|||
|
|
component: DltTrendAnalysis,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/profile',
|
|||
|
|
name: 'Profile',
|
|||
|
|
component: Profile
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/login',
|
|||
|
|
name: 'Login',
|
|||
|
|
component: Login
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/reset-password',
|
|||
|
|
name: 'ResetPassword',
|
|||
|
|
component: ResetPassword
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/register',
|
|||
|
|
name: 'Register',
|
|||
|
|
component: Register
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/predict-records',
|
|||
|
|
name: 'PredictRecords',
|
|||
|
|
component: PredictRecords
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/dlt/predict-records',
|
|||
|
|
name: 'DltPredictRecords',
|
|||
|
|
component: DltPredictRecords,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
{
|
|||
|
|
path: '/excel-import',
|
|||
|
|
name: 'ExcelImportManagement',
|
|||
|
|
component: ExcelImportManagement
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/exchange-records',
|
|||
|
|
name: 'ExchangeRecords',
|
|||
|
|
component: ExchangeRecords
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/trend-analysis',
|
|||
|
|
name: 'TrendAnalysis',
|
|||
|
|
component: TrendAnalysis
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/surface-analysis',
|
|||
|
|
name: 'SurfaceAnalysis',
|
|||
|
|
component: SurfaceAnalysis
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/line-analysis',
|
|||
|
|
name: 'LineAnalysis',
|
|||
|
|
component: LineAnalysis,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/data-analysis',
|
|||
|
|
name: 'DataAnalysis',
|
|||
|
|
component: DataAnalysis,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/hit-analysis',
|
|||
|
|
name: 'HitAnalysis',
|
|||
|
|
component: HitAnalysis,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/daletou/hit-analysis',
|
|||
|
|
name: 'DltHitAnalysis',
|
|||
|
|
component: DltHitAnalysis,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/usage-stats',
|
|||
|
|
name: 'UsageStats',
|
|||
|
|
component: UsageStats,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/daletou/usage-stats',
|
|||
|
|
name: 'DltUsageStats',
|
|||
|
|
component: DltUsageStats,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/prize-statistics',
|
|||
|
|
name: 'PrizeStatistics',
|
|||
|
|
component: PrizeStatistics,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/daletou/prize-statistics',
|
|||
|
|
name: 'DltPrizeStatistics',
|
|||
|
|
component: DltPrizeStatistics,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/help-center',
|
|||
|
|
name: 'HelpCenter',
|
|||
|
|
component: HelpCenter,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/about-us',
|
|||
|
|
name: 'AboutUs',
|
|||
|
|
component: AboutUs,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/user-agreement',
|
|||
|
|
name: 'UserAgreement',
|
|||
|
|
component: UserAgreement,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/user-guide',
|
|||
|
|
name: 'UserGuide',
|
|||
|
|
component: UserGuide,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/member-agreement',
|
|||
|
|
name: 'MemberAgreement',
|
|||
|
|
component: MemberAgreement,
|
|||
|
|
meta: { requiresAuth: true }
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/table-analysis',
|
|||
|
|
name: 'SsqTableAnalysis',
|
|||
|
|
component: SsqTableAnalysis
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
|
|||
|
|
// 后台管理路由 - 完全隔离
|
|||
|
|
{
|
|||
|
|
path: '/cpzsadmin/login',
|
|||
|
|
name: 'AdminLogin',
|
|||
|
|
component: AdminLogin,
|
|||
|
|
meta: {
|
|||
|
|
title: '后台登录',
|
|||
|
|
requiresAuth: false,
|
|||
|
|
isAdmin: true
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: '/cpzsadmin',
|
|||
|
|
component: AdminLayout,
|
|||
|
|
meta: {
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
},
|
|||
|
|
children: [
|
|||
|
|
{
|
|||
|
|
path: '',
|
|||
|
|
redirect: '/cpzsadmin/dashboard'
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'dashboard',
|
|||
|
|
name: 'AdminDashboard',
|
|||
|
|
component: () => import('../views/admin/Dashboard.vue'),
|
|||
|
|
meta: {
|
|||
|
|
title: '控制面板',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'vip-code',
|
|||
|
|
name: 'AdminVipCodeManagement',
|
|||
|
|
component: AdminVipCodeManagement,
|
|||
|
|
meta: {
|
|||
|
|
title: '会员码管理',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'excel-import',
|
|||
|
|
meta: {
|
|||
|
|
title: '数据导入',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
},
|
|||
|
|
children: [
|
|||
|
|
{
|
|||
|
|
path: '',
|
|||
|
|
name: 'AdminExcelImportManagement',
|
|||
|
|
component: AdminExcelImportManagement,
|
|||
|
|
meta: {
|
|||
|
|
title: '数据导入',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'ssq',
|
|||
|
|
name: 'AdminExcelImportSSQ',
|
|||
|
|
component: AdminExcelImportManagement,
|
|||
|
|
meta: {
|
|||
|
|
title: '双色球数据导入',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'dlt',
|
|||
|
|
name: 'AdminExcelImportDLT',
|
|||
|
|
component: AdminDltExcelImportManagement,
|
|||
|
|
meta: {
|
|||
|
|
title: '大乐透数据导入',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'prediction',
|
|||
|
|
meta: {
|
|||
|
|
title: '推测管理',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
},
|
|||
|
|
children: [
|
|||
|
|
{
|
|||
|
|
path: 'ssq',
|
|||
|
|
name: 'AdminPredictionSSQ',
|
|||
|
|
component: AdminPredictionManagement,
|
|||
|
|
meta: {
|
|||
|
|
title: '双色球推测管理',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'dlt',
|
|||
|
|
name: 'AdminPredictionDLT',
|
|||
|
|
component: AdminDltPredictionManagement,
|
|||
|
|
meta: {
|
|||
|
|
title: '大乐透推测管理',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'prize-statistics',
|
|||
|
|
meta: {
|
|||
|
|
title: '奖金统计',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
},
|
|||
|
|
children: [
|
|||
|
|
{
|
|||
|
|
path: 'ssq',
|
|||
|
|
name: 'AdminPrizeStatisticsSSQ',
|
|||
|
|
component: AdminPrizeStatistics,
|
|||
|
|
meta: {
|
|||
|
|
title: '双色球奖金统计',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'dlt',
|
|||
|
|
name: 'AdminPrizeStatisticsDLT',
|
|||
|
|
component: AdminDltPrizeStatistics,
|
|||
|
|
meta: {
|
|||
|
|
title: '大乐透奖金统计',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'usage-stats',
|
|||
|
|
meta: {
|
|||
|
|
title: '使用统计',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
},
|
|||
|
|
children: [
|
|||
|
|
{
|
|||
|
|
path: 'ssq',
|
|||
|
|
name: 'AdminUsageStatsSSQ',
|
|||
|
|
component: AdminUsageStats,
|
|||
|
|
meta: {
|
|||
|
|
title: '双色球使用统计',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'dlt',
|
|||
|
|
name: 'AdminUsageStatsDLT',
|
|||
|
|
component: AdminDltUsageStats,
|
|||
|
|
meta: {
|
|||
|
|
title: '大乐透使用统计',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'user-list',
|
|||
|
|
name: 'AdminUserList',
|
|||
|
|
component: () => import('../views/admin/UserList.vue'),
|
|||
|
|
meta: {
|
|||
|
|
title: '用户列表',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'operation-history',
|
|||
|
|
name: 'AdminOperationHistory',
|
|||
|
|
component: () => import('../views/admin/OperationHistory.vue'),
|
|||
|
|
meta: {
|
|||
|
|
title: '操作历史',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
path: 'announcement',
|
|||
|
|
name: 'AdminAnnouncementManagement',
|
|||
|
|
component: () => import('../views/admin/AnnouncementManagement.vue'),
|
|||
|
|
meta: {
|
|||
|
|
title: '公告管理',
|
|||
|
|
requiresAuth: true,
|
|||
|
|
isAdmin: true
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
// 404 页面
|
|||
|
|
{
|
|||
|
|
path: '/:pathMatch(.*)*',
|
|||
|
|
name: 'NotFound',
|
|||
|
|
component: () => import('../views/NotFound.vue')
|
|||
|
|
}
|
|||
|
|
]
|
|||
|
|
|
|||
|
|
const router = createRouter({
|
|||
|
|
history: createWebHistory(),
|
|||
|
|
routes
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
// 路由守卫 - 权限控制
|
|||
|
|
router.beforeEach((to, from, next) => {
|
|||
|
|
// 设置页面标题
|
|||
|
|
if (to.meta.title) {
|
|||
|
|
document.title = to.meta.title + ' - 彩票推测系统'
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 后台管理路由权限检查
|
|||
|
|
if (to.meta.isAdmin) {
|
|||
|
|
// 如果是登录页面,直接放行
|
|||
|
|
if (to.name === 'AdminLogin') {
|
|||
|
|
next()
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 从store中导入userStore
|
|||
|
|
import('../store/user.js').then(({ userStore }) => {
|
|||
|
|
// 检查是否已登录(使用session存储)
|
|||
|
|
if (!userStore.isAdminLoggedIn()) {
|
|||
|
|
ElMessage.error('请先登录后台管理系统')
|
|||
|
|
next('/cpzsadmin/login')
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 检查是否是管理员或VIP用户
|
|||
|
|
const adminInfo = JSON.parse(sessionStorage.getItem('adminInfo') || '{}')
|
|||
|
|
if (adminInfo.userRole === 'user') {
|
|||
|
|
ElMessage.error('您没有权限访问后台管理系统')
|
|||
|
|
next('/cpzsadmin/login')
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
next()
|
|||
|
|
}).catch(error => {
|
|||
|
|
console.error('加载用户状态出错:', error)
|
|||
|
|
next('/cpzsadmin/login')
|
|||
|
|
})
|
|||
|
|
} else {
|
|||
|
|
next()
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
export default router
|