Browse Source

fix: 流程性能提升

liuc 4 months ago
parent
commit
55e6d162f3
1 changed files with 10 additions and 2 deletions
  1. 10 2
      src/main.js

+ 10 - 2
src/main.js

@@ -75,8 +75,16 @@ import CommonNoPageTable from './components/common/common-table-no-page/index.vu
  */
 async function getLoginInfo() {
   try {
-    //获取登录用户信息
-    const res = await loginApi.getLoginInfo();
+    let res = {}
+    const url = window.location.href
+    const key = "_loginKey_"
+    const loginInfoRes = localStorage.getItem(key)
+    if (url.indexOf("formWork") > 0 && loginInfoRes && loginInfoRes.length > 20) {
+      res = JSON.parse(loginInfoRes)
+    } else {
+      res = await loginApi.getLoginInfo();
+      localStorage.setItem(key, JSON.stringify(res))
+    }
     //构建系统的路由
     let menuRouterList = res.data.menuList.filter((e) => e.path || e.frameUrl);
     buildRoutes(menuRouterList);