fix: 修改oss接口不会动态更改的问题

This commit is contained in:
奔跑的面条
2022-05-31 11:18:34 +08:00
parent 7f2344c82c
commit a89164f885
18 changed files with 113 additions and 41 deletions
+9 -1
View File
@@ -12,10 +12,18 @@ export interface UserInfoType {
[SystemStoreUserInfoEnum.NICK_NAME]?: string,
}
export interface FetchInfoType {
OSSUrl?: string,
}
export enum SystemStoreEnum {
USER_INFO = 'userInfo'
// 用户
USER_INFO = 'userInfo',
// 请求
FETCH_INFO = 'fetchInfo'
}
export interface SystemStoreType {
[SystemStoreEnum.USER_INFO]: UserInfoType
[SystemStoreEnum.FETCH_INFO]: FetchInfoType
}
+13 -3
View File
@@ -1,5 +1,5 @@
import { defineStore } from 'pinia'
import { SystemStoreType, SystemStoreEnum } from './systemStore.d'
import { SystemStoreType, UserInfoType, FetchInfoType } from './systemStore.d'
import { setLocalStorage, getLocalStorage } from '@/utils'
import { StorageEnum } from '@/enums/storageEnum'
@@ -16,13 +16,23 @@ export const useSystemStore = defineStore({
userName: undefined,
userToken: undefined,
nickName: undefined
},
fetchInfo: {
OSSUrl: undefined
}
},
getters: {},
getters: {
getUserInfo(): UserInfoType {
return this.userInfo
},
getFetchInfo(): FetchInfoType {
return this.fetchInfo
},
},
actions: {
setItem<T extends keyof SystemStoreType, K extends SystemStoreType[T]>(key: T, value: K): void {
this.$patch(state => {
state[key]= value
state[key] = value
});
setLocalStorage(GO_SYSTEM_STORE, this.$state)
}