refactor: 刷新页面获取最新权限
--bug=1018835 --user=刘瑞斌 【系统设置】修改用户组权限后,刷新页面没生效,需要退出重新登录才行 https://www.tapd.cn/55049933/s/1282713
This commit is contained in:
parent
b1df71c717
commit
efae671f29
|
@ -100,22 +100,6 @@ export default {
|
|||
this.isFixed = localStorage.getItem('app-fixed') === 'true' || false;
|
||||
this.isCollapse = this.isFixed === true ? false : true;
|
||||
},
|
||||
beforeCreate() {
|
||||
if (checkMicroMode()) {
|
||||
return;
|
||||
}
|
||||
const userStore = useUserStore();
|
||||
userStore.getIsLogin()
|
||||
.then(response => {
|
||||
if (window.location.href.endsWith('/#/login')) {
|
||||
window.location.replace("/#/setting/personsetting");
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
userStore.userLogout();
|
||||
window.location.replace('/#/login');
|
||||
});
|
||||
},
|
||||
// 提供可注入子组件属性
|
||||
provide() {
|
||||
return {
|
||||
|
|
|
@ -59,6 +59,13 @@ const createRouter = () => new Router({
|
|||
|
||||
const router = createRouter()
|
||||
|
||||
let userStore = null;
|
||||
// 刷新整个页面会到这里
|
||||
import('@/store').then(async ({useUserStore}) => {
|
||||
userStore = useUserStore();
|
||||
await userStore.getIsLogin()
|
||||
});
|
||||
|
||||
let store = null;
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
if (store === null) {
|
||||
|
|
Loading…
Reference in New Issue