- 添加API服务层(src/service/) - HTTP客户端配置 - 登录认证API - 系统管理API(用户、角色、菜单、部门、字典、文件等) - 监控API(在线用户、服务器、缓存、Redis等) - 添加路由系统(src/router/) - 路由实例配置 - 路由守卫逻辑 - 静态路由和内置路由 - 添加状态管理(src/store/) - 认证状态(auth) - 路由状态(router) - 应用状态(app) - 标签页状态(tab) - 字典状态(dict)
78 lines
1.6 KiB
TypeScript
78 lines
1.6 KiB
TypeScript
import type { RouteRecordRaw } from 'vue-router'
|
|
import { safeAsyncComponent } from '@/utils/component-guard'
|
|
|
|
/* 页面中的一些固定路由,错误页等 */
|
|
export const routes: RouteRecordRaw[] = [
|
|
{
|
|
path: '/',
|
|
name: 'root',
|
|
redirect: '/appRoot',
|
|
children: [
|
|
],
|
|
},
|
|
{
|
|
path: '/login',
|
|
name: 'login',
|
|
component: safeAsyncComponent(
|
|
() => import('@/views/login/index.vue'),
|
|
{ delay: 0, timeout: 8000 },
|
|
),
|
|
meta: {
|
|
title: '登录',
|
|
withoutTab: true,
|
|
},
|
|
},
|
|
{
|
|
path: '/403',
|
|
name: '403',
|
|
component: safeAsyncComponent(
|
|
() => import('@/views/error/403/index.vue'),
|
|
{ delay: 0, timeout: 5000 },
|
|
),
|
|
meta: {
|
|
title: '用户无权限',
|
|
withoutTab: true,
|
|
},
|
|
},
|
|
{
|
|
path: '/404',
|
|
name: '404',
|
|
component: safeAsyncComponent(
|
|
() => import('@/views/error/404/index.vue'),
|
|
{ delay: 0, timeout: 5000 },
|
|
),
|
|
meta: {
|
|
title: '找不到页面',
|
|
icon: 'icon-park-outline:ghost',
|
|
withoutTab: true,
|
|
},
|
|
},
|
|
{
|
|
path: '/500',
|
|
name: '500',
|
|
component: safeAsyncComponent(
|
|
() => import('@/views/error/500/index.vue'),
|
|
{ delay: 0, timeout: 5000 },
|
|
),
|
|
meta: {
|
|
title: '服务器错误',
|
|
icon: 'icon-park-outline:close-wifi',
|
|
withoutTab: true,
|
|
},
|
|
},
|
|
{
|
|
path: '/:pathMatch(.*)*',
|
|
component: safeAsyncComponent(
|
|
() => import('@/views/error/404/index.vue'),
|
|
{ delay: 0, timeout: 5000 },
|
|
),
|
|
name: 'notFound',
|
|
meta: {
|
|
title: '找不到页面',
|
|
icon: 'icon-park-outline:ghost',
|
|
withoutTab: true,
|
|
},
|
|
},
|
|
|
|
]
|