Files
blind-select/frontend-admin/src/router/index.js
T
admin 06488f0237 Initial commit: 帮我选盲选应用
功能:
- Go后端 (Gin + GORM + PostgreSQL)
- UniApp用户端 (iOS/Android/小程序)
- DaisyUI5后台管理
- JWT认证 + 微信登录
- 盲选加权算法
- 会员系统 + 优惠券
- 打分评价 + 偏好学习
2026-06-08 20:18:31 +00:00

33 lines
1.2 KiB
JavaScript

import { createRouter, createWebHistory } from 'vue-router'
const routes = [
{ path: '/login', name: 'Login', component: () => import('../views/Login.vue') },
{
path: '/',
component: () => import('../App.vue'),
children: [
{ path: '', redirect: '/dashboard' },
{ path: 'dashboard', name: 'Dashboard', component: () => import('../views/Dashboard.vue') },
{ path: 'merchants', name: 'Merchants', component: () => import('../views/Merchants.vue') },
{ path: 'packages', name: 'Packages', component: () => import('../views/Packages.vue') },
{ path: 'coupons', name: 'Coupons', component: () => import('../views/Coupons.vue') },
{ path: 'users', name: 'Users', component: () => import('../views/Users.vue') },
{ path: 'reviews', name: 'Reviews', component: () => import('../views/Reviews.vue') },
{ path: 'statistics', name: 'Statistics', component: () => import('../views/Statistics.vue') },
],
},
]
const router = createRouter({
history: createWebHistory(),
routes,
})
router.beforeEach((to, from, next) => {
const token = localStorage.getItem('admin_token')
if (to.name !== 'Login' && !token) next({ name: 'Login' })
else next()
})
export default router