Commit 10d18ac8 by caoyanzhi

fix: 修复跳转后页面空白的bug

parent 7310c2a3
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
* @LastEditTime: 2020-08-17 15:31:44 * @LastEditTime: 2020-08-17 15:31:44
*/ */
import { request } from './request.js'; import { request } from './request.js';
import { origin } from '@/config';
// 项目中配置的路由信息 // 项目中配置的路由信息
let projectRoutes = []; let projectRoutes = [];
...@@ -17,11 +16,15 @@ let accessPath = []; ...@@ -17,11 +16,15 @@ let accessPath = [];
let itemPermission = {}; let itemPermission = {};
function getGicMenu() { function getGicMenu() {
const getUserMenu = request({ url: '/hb-manage-web/list-staff-role-menu' }).then(res => { const getUserMenu = new Promise(resolve => {
accessPath = getProjectMenu(res.result || []); request({ url: '/hb-manage-web/list-staff-role-menu' }).then(res => {
accessPath = getProjectMenu(res.result || []);
}).finally(resolve);
}); });
const getUserOperation = request({ url: '/hb-manage-web/list-staff-role-opeation' }).then(res => { const getUserOperation = new Promise(resolve => {
itemPermission = getItemPerm(res.result || []); request({ url: '/hb-manage-web/list-staff-role-opeation' }).then(res => {
itemPermission = getItemPerm(res.result || []);
}).finally(resolve);
}); });
return Promise.all([ getUserMenu, getUserOperation ]); return Promise.all([ getUserMenu, getUserOperation ]);
} }
...@@ -69,7 +72,7 @@ function intercept(to, from, next) { ...@@ -69,7 +72,7 @@ function intercept(to, from, next) {
}; };
// 无权限访问 // 无权限访问
if (projectRoutes.some(el => el == to.path) || accessPath.length == 0) { if (projectRoutes.some(el => el == to.path) || accessPath.length == 0) {
window.location.href = `${origin}/haoban-4/#/gic-error`; next('/gic-error');
} else { } else {
next(accessPath[0]); next(accessPath[0]);
} }
......
...@@ -52,7 +52,7 @@ const request = (opt, params) => { ...@@ -52,7 +52,7 @@ const request = (opt, params) => {
if (resp.code == notAuthCode) { if (resp.code == notAuthCode) {
window.location.href = `${origin}/haoban-4/#/login`; window.location.href = `${origin}/haoban-4/#/login`;
return; return reject(resp);
} }
if (requestConfig.useIntercept && resp.code != succCode) { if (requestConfig.useIntercept && resp.code != succCode) {
Message({ Message({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment