157 lines
4.3 KiB
TypeScript
157 lines
4.3 KiB
TypeScript
import type { RouteRecordRaw } from 'vue-router'
|
|
|
|
const pageTitle = (name: string): string => {
|
|
return `pagesTitle.${name}`
|
|
}
|
|
/**
|
|
* 后台基础路由路径
|
|
*/
|
|
export const adminBaseRoutePath = '/admin'
|
|
export const adminBaseRoute = {
|
|
path: adminBaseRoutePath,
|
|
name: 'admin',
|
|
component: () => import('@/layouts/admin/index.vue'),
|
|
// 直接重定向到 loading 路由
|
|
redirect: adminBaseRoutePath + '/loading',
|
|
meta: {
|
|
title: `pagesTitle.admin`
|
|
},
|
|
children: [
|
|
{
|
|
path: 'loading/:to?',
|
|
name: 'adminMainLoading',
|
|
component: () => import('@/layouts/common/components/loading.vue'),
|
|
meta: {
|
|
title: `pagesTitle.loading`
|
|
}
|
|
},
|
|
|
|
{
|
|
// 在线补召
|
|
path: '/supplementaryRecruitment',
|
|
name: 'supplementaryRecruitment',
|
|
component: () => import('@/views/govern/device/control/supplementaryRecruitment.vue'),
|
|
meta: {
|
|
title: pageTitle('router.supplementaryRecruitment')
|
|
}
|
|
},
|
|
{
|
|
// 版本维护
|
|
path: '/version',
|
|
name: 'version',
|
|
component: () => import('@/views/govern/manage/basic/version.vue'),
|
|
meta: {
|
|
title: pageTitle('router.version')
|
|
}
|
|
},
|
|
|
|
{
|
|
path: 'cockpit',
|
|
name: '项目管理',
|
|
meta: {
|
|
title: pageTitle('runManage'),
|
|
icon: 'ep:management',
|
|
alwaysShow: true
|
|
},
|
|
children: [
|
|
{
|
|
path: 'popup',
|
|
component: () => import('@/views/pqs/cockpit/setUp/components/popup.vue'),
|
|
name: '新增项目',
|
|
meta: {
|
|
title: pageTitle('router.popup')
|
|
}
|
|
},
|
|
{
|
|
path: 'view',
|
|
component: () => import('@/views/pqs/cockpit/setUp/components/view.vue'),
|
|
name: '预览项目',
|
|
meta: {
|
|
title: pageTitle('router.view')
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
|
|
/*
|
|
* 静态路由
|
|
* 自动加载 ./static 目录的所有文件,并 push 到以下数组
|
|
*/
|
|
const staticRoutes: Array<RouteRecordRaw> = [
|
|
adminBaseRoute,
|
|
{
|
|
path: '/',
|
|
redirect: to => {
|
|
return {
|
|
name: 'adminMainLoading'
|
|
}
|
|
}
|
|
},
|
|
{
|
|
// 管理员登录页 - 不放在 adminBaseRoute.children 因为登录页不需要使用后台的布局
|
|
path: '/login',
|
|
name: 'login',
|
|
component: () => import('@/views/user/login.vue'),
|
|
meta: {
|
|
title: pageTitle('login')
|
|
}
|
|
},
|
|
{
|
|
path: '/:path(.*)*',
|
|
redirect: '/404'
|
|
},
|
|
{
|
|
path: '/:path(.*)*',
|
|
redirect: '/policy'
|
|
},
|
|
{
|
|
path: '/:path(.*)*',
|
|
redirect: '/agreement'
|
|
},
|
|
{
|
|
path: '/404',
|
|
name: 'notFound',
|
|
component: () => import('@/views/common/error/404.vue'),
|
|
meta: {
|
|
title: pageTitle('notFound') // 页面不存在
|
|
}
|
|
},
|
|
{
|
|
// 隐私政策
|
|
path: '/policy',
|
|
name: 'policy',
|
|
component: () => import('@/views/common/policy/index.vue'),
|
|
meta: {
|
|
title: pageTitle('policy') // 页面不存在
|
|
}
|
|
},
|
|
{
|
|
// 用户协议
|
|
path: '/agreement',
|
|
name: 'agreement',
|
|
component: () => import('@/views/common/agreement/index.vue'),
|
|
meta: {
|
|
title: pageTitle('agreement') // 页面不存在
|
|
}
|
|
},
|
|
{
|
|
// 后台找不到页面了-可能是路由未加载上
|
|
path: adminBaseRoutePath + ':path(.*)*',
|
|
redirect: to => {
|
|
return {
|
|
name: 'adminMainLoading',
|
|
params: {
|
|
to: JSON.stringify({
|
|
path: to.path,
|
|
query: to.query
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
|
|
export default staticRoutes
|