购物车和订单中心以及优惠券相关功能初版

This commit is contained in:
xiaowang
2026-02-27 16:44:41 +08:00
parent 3529a73d84
commit 43f31eed53
36 changed files with 1785 additions and 24 deletions
+16 -10
View File
@@ -5,16 +5,16 @@ const router = createRouter({
routes: [
{
path: '/',
name: 'home',
component: () => import('../views/HomeView.vue'),
meta: { requiresAuth: true, isAdmin: false }
},
{
path: '/auth',
name: 'auth',
component: () => import('../views/AuthView.vue'),
meta: { requiresAuth: false, hideNav: true, isAdmin: false }
},
{
path: '/home',
name: 'home',
component: () => import('../views/HomeView.vue'),
meta: { requiresAuth: true, isAdmin: false }
},
{
path: '/products',
name: 'products',
@@ -123,6 +123,12 @@ const router = createRouter({
meta: { requiresAuth: true, isAdmin: true, hideNav: true, permissionCode: 'order:view' }
}
]
},
{
path: '/:pathMatch(.*)*',
name: 'not-found',
component: () => import('../views/NotFoundView.vue'),
meta: { requiresAuth: false, hideNav: true, isAdmin: false }
}
]
})
@@ -226,11 +232,11 @@ router.beforeEach((to, _from, next) => {
const token = localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken')
if (requiresAuth && !token) {
next('/auth')
} else if (to.path === '/auth' && token) {
next('/')
} else if (to.path === '/' && !token) {
next('/auth')
} else if (to.path === '/' && token) {
next('/home')
} else if (to.path === '/home' && !token) {
next('/')
} else {
next()
}