fix(系统设置): 修复上传license后刷新左侧菜单不能及时显示的问题

--bug=1020767 --user=刘瑞斌 【系统设置】离线包安装后,上传license,系统左侧的菜单会变成空白的 https://www.tapd.cn/55049933/s/1315863
This commit is contained in:
CaptainB 2022-12-15 14:00:11 +08:00 committed by 刘瑞斌
parent a3d1016912
commit d4ba871b97
2 changed files with 23 additions and 6 deletions

View File

@ -156,10 +156,16 @@ export default {
if (!hasLicense()) {
return;
}
ModuleEvent.$on(MODULE_CHANGE, (key, status) => {
getModuleList().then(() => {
this.menuKey++;
getModuleList()
.then(response => {
response.data.forEach(m => {
this.modules[m.key] = m.status;
});
localStorage.setItem('modules', JSON.stringify(this.modules));
})
.catch(() => {
});
ModuleEvent.$on(MODULE_CHANGE, (key, status) => {
this.$set(this.modules, key, status);
this.menuKey++;
});

View File

@ -63,8 +63,9 @@
<script>
import MsValidLicense from "./ValidLicense";
import {hasPermission} from "metersphere-frontend/src/utils/permission";
import {getLicense, saveLicense} from "../../../api/license";
import {hasPermission, saveLicense, hasLicense} from "metersphere-frontend/src/utils/permission";
import {getLicense} from "../../../api/license";
import {getModuleList} from "metersphere-frontend/src/api/module";
export default {
name: "MxLicense",
@ -108,7 +109,17 @@ export default {
this.license.licenseCount = value.license.licenseCount;
this.license.status = value.status;
saveLicense(value.status);
window.location.reload();
if (hasLicense()) {
getModuleList()
.then(response => {
let modules = {};
response.data.forEach(m => {
modules[m.key] = m.status;
});
localStorage.setItem('modules', JSON.stringify(modules));
location.reload();
})
}
}
},
}