Skip to content

Commit

Permalink
fix: 处理从staff界面跳转到用户组详情,需要提供默认管理员身份
Browse files Browse the repository at this point in the history
  • Loading branch information
lhzzforever committed Jul 9, 2024
1 parent 12f1e69 commit a71986e
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions frontend/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,31 +222,20 @@ export const beforeEach = async (to, from, next) => {
if (existValue('externalApp') || to.query.noFrom) {
next();
} else {
// 处理从staff界面跳转到用户组详情,需要提供默认管理员身份
if ((curRoleId === 0 || ['', 'staff'].includes(curRole)) && curRoleList.length > 0) {
const { id } = curRoleList[0];
[curRoleId, currentRoleId] = [id, id];
store.commit('updateCurRoleId', id);
await getManagerInfo();
}
next();
// next({ path: `${SITE_URL}${defaultRoute[navIndex]}` });
}
} else {
next();
}
}
} else if (to.name === 'userGroup') {
if (existValue('externalApp')) { // 外部嵌入页面
next();
} else {
if (curRole === 'staff') {
// 单独处理返回个人staff不需要重定向我的权限的路由
const routeNavMap = [
[(name) => !getNavRouterDiff(0).includes(name), () => next()],
[(name) => ['ratingManager'].includes(name), () => next({ path: `${SITE_URL}${to.fullPath}` })]
];
const getRouteNav = routeNavMap.find((item) => item[0](to.name));
if (getRouteNav) {
getRouteNav[1]();
}
} else {
next();
}
}
} else {
// 邮件点击续期跳转过来的链接需要做身份的前置判断
if (to.name === 'groupPermRenewal' && ['email', 'notification'].includes(to.query.source) && currentRoleId) {
Expand Down

0 comments on commit a71986e

Please sign in to comment.