fix(系统设置): 超过License限制数量后未提示

--bug=1018975 --user=李玉号 【License】MS系统用户超过License权限限制数量后,admin登录无任何提醒
https://www.tapd.cn/55049933/s/1283146
This commit is contained in:
shiziyuan9527 2022-10-31 11:21:55 +08:00 committed by 刘瑞斌
parent bb67d77a50
commit e7c10682c1
4 changed files with 15 additions and 11 deletions

View File

@ -9,6 +9,8 @@
<script>
import {getLicense, getSystemUserSize} from "../api/license";
import {saveLicense} from "../utils/permission";
import {useUserStore} from "@/store";
export default {
name: "MxLicenseMessage",
@ -18,6 +20,7 @@ export default {
}
},
created() {
const store = useUserStore();
this.result = getLicense()
.then(response => {
let data = response.data;
@ -26,18 +29,14 @@ export default {
}
saveLicense(data.status)
if (data.status !== 'valid') {
localStorage.setItem('setShowLicenseCountWarning', "false");
store.showLicenseCountWarning = false;
return;
}
let licenseCount = data.license.count;
getSystemUserSize()
.then(res => {
let userCount = res ? res.data : 0;
if (userCount > licenseCount) {
localStorage.setItem('setShowLicenseCountWarning', "true");
} else {
localStorage.setItem('setShowLicenseCountWarning', "false");
}
store.showLicenseCountWarning = userCount > licenseCount;
});
})
.catch(e => {

View File

@ -59,11 +59,14 @@ const createRouter = () => new Router({
const router = createRouter()
let userStore = null;
// 刷新整个页面会到这里
import('@/store').then(async ({useUserStore}) => {
userStore = useUserStore();
await userStore.getIsLogin()
const userStore = useUserStore();
try {
await userStore.getIsLogin();
} catch (e) {
// nothing
}
});
let store = null;

View File

@ -40,6 +40,7 @@ export default {
id: TokenKey,
state: () => ({
language: getLanguage(),
showLicenseCountWarning: false,
}),
persist: true,
getters: {

View File

@ -24,14 +24,15 @@ import {getCurrentUser} from "metersphere-frontend/src/utils/token";
import {GROUP_SYSTEM} from "metersphere-frontend/src/utils/constants";
import MsHeaderRightMenus from "metersphere-frontend/src/components/layout/HeaderRightMenus";
import {hasPermissions} from "metersphere-frontend/src/utils/permission";
import {useUserStore} from "@/store";
const store = useUserStore();
export default {
name: "MsSetting",
components: {MsMainContainer, MsContainer, MsAsideContainer, MsSettingMenu, MsCurrentUser, MsHeaderRightMenus},
computed: {
isShowWarning() {
return false;
return store.showLicenseCountWarning;
},
isSystemGroup() {
let user = getCurrentUser();