Commit b1a069ca by caoyanzhi

update: 切换商户后页面无权访问就回首页

parent 23214280
...@@ -114,7 +114,15 @@ export default { ...@@ -114,7 +114,15 @@ export default {
const menu = rightList.find(el => el.menuUrl == toPath.substr(1)); const menu = rightList.find(el => el.menuUrl == toPath.substr(1));
// 页面第一次打开后,校验权限的beforeEach还没有创建,所以需要手动校验一下页面权限 // 页面第一次打开后,校验权限的beforeEach还没有创建,所以需要手动校验一下页面权限
if (menu && menu.hasRight == 0) { if (menu && menu.hasRight == 0) {
this.$router.push({ path: '/403' }); // 切换商户后,如果当前页面无访问权限,就回首页
// 如果地址栏中输入无权访问的路径,就到403
const hbReloadPath = sessionStorage.getItem('hbReloadPath') || '';
if (menu.menuUrl == hbReloadPath.substr(1)) {
this.$router.push('/index');
sessionStorage.removeItem('hbReloadPath');
} else {
this.$router.push({ path: '/403' });
}
} }
consoleButtonCode(menu); consoleButtonCode(menu);
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
......
...@@ -90,7 +90,10 @@ export default { ...@@ -90,7 +90,10 @@ export default {
} }
this.isExpired = result; this.isExpired = result;
if (!result) { if (!result) {
location.reload(); sessionStorage.setItem('hbReloadPath', this.$route.path);
setTimeout(() => {
location.reload();
}, 100);
} }
}) })
.finally(() => this.$emit('changeStore', false)); .finally(() => this.$emit('changeStore', false));
......
...@@ -67,8 +67,6 @@ export default { ...@@ -67,8 +67,6 @@ export default {
provideData.layoutVm = this; provideData.layoutVm = this;
this.enterpriseId = JSON.parse(sessionStorage.getItem('userInfos') || '{}').enterpriseId; this.enterpriseId = JSON.parse(sessionStorage.getItem('userInfos') || '{}').enterpriseId;
this.$on('command', this.onCommand); this.$on('command', this.onCommand);
// this.flatMenuList = this.getFlatMenuList(this.menuList);
// this.activedMenu = this.getActivedMenu(this.getMenuByPath(this.$route.path.slice(1)));
this.getEnterpriseSecret(); this.getEnterpriseSecret();
}, },
methods: { methods: {
......
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