Commit 10d18ac8 by caoyanzhi

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

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