feat: 修改登录界面,登录验证使用后端接口,修改侧边栏

This commit is contained in:
cheng
2024-02-16 23:19:49 +08:00
parent ff27074ebd
commit a3887dde7a
23 changed files with 2273 additions and 1973 deletions

View File

@@ -1,36 +0,0 @@
export default {
path: "/error",
redirect: "/error/403",
meta: {
icon: "informationLine",
title: "异常页面",
// showLink: false,
rank: 9
},
children: [
{
path: "/error/403",
name: "403",
component: () => import("@/views/error/403.vue"),
meta: {
title: "403"
}
},
{
path: "/error/404",
name: "404",
component: () => import("@/views/error/404.vue"),
meta: {
title: "404"
}
},
{
path: "/error/500",
name: "500",
component: () => import("@/views/error/500.vue"),
meta: {
title: "500"
}
}
]
} as RouteConfigsTable;

29
src/router/modules/qa.ts Normal file
View File

@@ -0,0 +1,29 @@
export default {
path: "/qa",
redirect: "/qa/chat",
component: () => import("@/views/qa/index.vue"),
meta: {
icon: "lollipop",
title: "问答系统",
// showLink: false,
rank: 10
},
children: [
{
path: "/qa/chat",
name: "chat",
component: () => import("@/views/qa/chat/index.vue"),
meta: {
title: "对话"
}
},
{
path: "/qa/triad",
name: "triad",
component: () => import("@/views/qa/triad/index.vue"),
meta: {
title: "三元组"
}
}
]
} as RouteConfigsTable;

View File

@@ -16,7 +16,7 @@ import {
storageSession,
isIncludeAllChildren
} from "@pureadmin/utils";
import { getConfig } from "@/config";
// import { getConfig } from "@/config";
import { menuType } from "@/layout/types";
import { buildHierarchyTree } from "@/utils/tree";
import { sessionKey, type DataInfo } from "@/utils/auth";
@@ -27,7 +27,7 @@ const IFrame = () => import("@/layout/frameView.vue");
const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}");
// 动态路由
import { getAsyncRoutes } from "@/api/routes";
// import { getAsyncRoutes } from "@/api/routes";
function handRank(routeInfo: any) {
const { name, path, parentId, meta } = routeInfo;
@@ -181,34 +181,44 @@ function handleAsyncRoutes(routeList) {
addPathMatch();
}
/** 初始化路由(`new Promise` 写法防止在异步请求中造成无限循环)*/
// function initRouter() {
// if (getConfig()?.CachingAsyncRoutes) {
// // 开启动态路由缓存本地sessionStorage
// const key = "async-routes";
// const asyncRouteList = storageSession().getItem(key) as any;
// if (asyncRouteList && asyncRouteList?.length > 0) {
// return new Promise(resolve => {
// handleAsyncRoutes(asyncRouteList);
// resolve(router);
// });
// } else {
// return new Promise(resolve => {
// getAsyncRoutes().then(({ data }) => {
// handleAsyncRoutes(cloneDeep(data));
// storageSession().setItem(key, data);
// resolve(router);
// });
// });
// }
// } else {
// return new Promise(resolve => {
// getAsyncRoutes().then(({ data }) => {
// handleAsyncRoutes(cloneDeep(data));
// resolve(router);
// });
// });
// }
// }
/** 初始化路由(`new Promise` 写法防止在异步请求中造成无限循环)*/
function initRouter() {
if (getConfig()?.CachingAsyncRoutes) {
// 开启动态路由缓存本地sessionStorage
const key = "async-routes";
const asyncRouteList = storageSession().getItem(key) as any;
if (asyncRouteList && asyncRouteList?.length > 0) {
return new Promise(resolve => {
handleAsyncRoutes(asyncRouteList);
resolve(router);
});
} else {
return new Promise(resolve => {
getAsyncRoutes().then(({ data }) => {
handleAsyncRoutes(cloneDeep(data));
storageSession().setItem(key, data);
resolve(router);
});
});
}
} else {
return new Promise(resolve => {
getAsyncRoutes().then(({ data }) => {
handleAsyncRoutes(cloneDeep(data));
resolve(router);
});
});
}
return new Promise(resolve => {
// 假设有静态路由配置
const staticRoutes = [];
handleAsyncRoutes(staticRoutes);
resolve(router);
});
}
/**