fix: move admin and web to correct locations

This commit is contained in:
bwstudio
2026-05-21 21:45:31 +08:00
parent 89fa43d5fa
commit 7f51d200f1
36 changed files with 566 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
import { createRouter, createWebHistory } from 'vue-router'
const routes = [
{
path: '/login',
name: 'Login',
component: () => import('@/views/login/index.vue')
},
{
path: '/',
component: () => import('@/layout/index.vue'),
children: [
{ path: '', redirect: '/dashboard' },
{ path: 'dashboard', name: 'Dashboard', component: () => import('@/views/dashboard/index.vue') },
{ path: 'jokes', name: 'JokeList', component: () => import('@/views/joke/List.vue') },
{ path: 'jokes/edit/:id?', name: 'JokeEdit', component: () => import('@/views/joke/Edit.vue') },
{ path: 'category/type', name: 'CategoryType', component: () => import('@/views/category/Type.vue') },
{ path: 'category/crowd', name: 'CategoryCrowd', component: () => import('@/views/category/Crowd.vue') },
]
}
]
const router = createRouter({
history: createWebHistory(),
routes
})
router.beforeEach((to, from, next) => {
const token = localStorage.getItem('token')
if (to.path !== '/login' && !token) {
next('/login')
} else {
next()
}
})
export default router