统一甲屿云命名体系
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
|
||||
import { useSessionStore } from '@/stores/session'
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{ path: '/', redirect: '/planning' },
|
||||
{ path: '/login', name: 'login', component: () => import('@/views/LoginView.vue'), meta: { public: true, hideTab: true } },
|
||||
{ path: '/register', name: 'register', component: () => import('@/views/RegisterView.vue'), meta: { public: true, hideTab: true, title: '注册账号' } },
|
||||
{ path: '/planning', name: 'planning', component: () => import('@/views/PlanningView.vue'), meta: { tab: true } },
|
||||
{ path: '/customers', name: 'customers', component: () => import('@/views/CustomersView.vue'), meta: { tab: true } },
|
||||
{ path: '/customers/:id', name: 'customer-detail', component: () => import('@/views/CustomerDetailView.vue'), meta: { title: '客户详情' } },
|
||||
{ path: '/employees', name: 'employees', component: () => import('@/views/EmployeesView.vue'), meta: { tab: true } },
|
||||
{ path: '/employees/:id', name: 'employee-detail', component: () => import('@/views/EmployeeDetailView.vue'), meta: { title: '员工详情' } },
|
||||
{ path: '/employees/:id/schedule', name: 'schedule-setting', component: () => import('@/views/ScheduleSettingView.vue'), meta: { title: '排班设置' } },
|
||||
{ path: '/employees/:id/leave', name: 'leave-management', component: () => import('@/views/LeaveManagementView.vue'), meta: { title: '请假管理' } },
|
||||
{ path: '/employees/:id/color', name: 'color-setting', component: () => import('@/views/ColorSettingView.vue'), meta: { title: '颜色设置' } },
|
||||
{ path: '/employees/:id/orders', name: 'employee-orders', component: () => import('@/views/EmployeeOrdersView.vue'), meta: { title: '员工作品/订单' } },
|
||||
{ path: '/appointments/new', name: 'appointment-form', component: () => import('@/views/AppointmentFormView.vue'), meta: { title: '新建预约' } },
|
||||
{ path: '/appointments/:id', name: 'appointment-detail', component: () => import('@/views/AppointmentDetailView.vue'), meta: { title: '预约详情' } },
|
||||
{ path: '/appointments/:id/transfer', name: 'artist-transfer', component: () => import('@/views/ArtistTransferView.vue'), meta: { title: '改派预约' } },
|
||||
{ path: '/profile', name: 'profile', component: () => import('@/views/ProfileView.vue'), meta: { tab: true } },
|
||||
{ path: '/shop-settings', name: 'shop-settings', component: () => import('@/views/ShopSettingsView.vue'), meta: { title: '店铺设置' } },
|
||||
{ path: '/export', name: 'export', component: () => import('@/views/ExportView.vue'), meta: { title: '导出' } },
|
||||
{ path: '/password', name: 'password', component: () => import('@/views/PasswordView.vue'), meta: { title: '修改密码' } },
|
||||
{ path: '/about', name: 'about', component: () => import('@/views/AboutView.vue'), meta: { title: '关于' } },
|
||||
{ path: '/:pathMatch(.*)*', redirect: '/planning' }
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory('/jy-salon-front/'),
|
||||
routes
|
||||
})
|
||||
|
||||
router.beforeEach(to => {
|
||||
const session = useSessionStore()
|
||||
if (!to.meta.public && !session.isLoggedIn) {
|
||||
return '/login'
|
||||
}
|
||||
if ((to.name === 'login' || to.name === 'register') && session.isLoggedIn) {
|
||||
return '/planning'
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
export default router
|
||||
Reference in New Issue
Block a user