|
@@ -8,6 +8,7 @@ import { ROLES_KEY, TOKEN_KEY, USER_INFO_KEY } from '/@/enums/cacheEnum';
|
|
|
import { getAuthCache, setAuthCache } from '/@/utils/auth';
|
|
import { getAuthCache, setAuthCache } from '/@/utils/auth';
|
|
|
import { GetUserInfoModel, LoginParams } from '/@/api/sys/model/userModel';
|
|
import { GetUserInfoModel, LoginParams } from '/@/api/sys/model/userModel';
|
|
|
import { doLogout, getUserInfo, loginApi } from '/@/api/sys/user';
|
|
import { doLogout, getUserInfo, loginApi } from '/@/api/sys/user';
|
|
|
|
|
+import { getAllConstSelectorWithOptions } from '/@/api/sys/admin';
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
import { router } from '/@/router';
|
|
import { router } from '/@/router';
|
|
@@ -23,6 +24,7 @@ interface UserState {
|
|
|
roleList: RoleEnum[];
|
|
roleList: RoleEnum[];
|
|
|
sessionTimeout?: boolean;
|
|
sessionTimeout?: boolean;
|
|
|
lastUpdateTime: number;
|
|
lastUpdateTime: number;
|
|
|
|
|
+ constSelectorWithOptions: [];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export const useUserStore = defineStore({
|
|
export const useUserStore = defineStore({
|
|
@@ -38,6 +40,8 @@ export const useUserStore = defineStore({
|
|
|
sessionTimeout: false,
|
|
sessionTimeout: false,
|
|
|
// Last fetch time
|
|
// Last fetch time
|
|
|
lastUpdateTime: 0,
|
|
lastUpdateTime: 0,
|
|
|
|
|
+
|
|
|
|
|
+ constSelectorWithOptions: [],
|
|
|
}),
|
|
}),
|
|
|
getters: {
|
|
getters: {
|
|
|
getUserInfo(): UserInfo {
|
|
getUserInfo(): UserInfo {
|
|
@@ -55,6 +59,9 @@ export const useUserStore = defineStore({
|
|
|
getLastUpdateTime(): number {
|
|
getLastUpdateTime(): number {
|
|
|
return this.lastUpdateTime;
|
|
return this.lastUpdateTime;
|
|
|
},
|
|
},
|
|
|
|
|
+ getAllConstSelectorWithOptions(): any[] {
|
|
|
|
|
+ return this.constSelectorWithOptions || getAllConstSelectorWithOptions();
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
actions: {
|
|
actions: {
|
|
|
setToken(info: string | undefined) {
|
|
setToken(info: string | undefined) {
|
|
@@ -168,6 +175,11 @@ export const useUserStore = defineStore({
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ async getAllConstSelectorWithOptionsAction() {
|
|
|
|
|
+ const data = await getAllConstSelectorWithOptions();
|
|
|
|
|
+ this.constSelectorWithOptions = data;
|
|
|
|
|
+ // setAuthCache(USER_INFO_KEY, data);
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
|
|
|