fix: bug#10532、10531、10530、10527、10534、10529
This commit is contained in:
parent
8dd84e062d
commit
0b99ea0096
|
@ -1,14 +1,17 @@
|
|||
import { defineStore } from 'pinia';
|
||||
import { systemVersion } from '@/api/comm'
|
||||
import { useMenuStore } from './menu'
|
||||
import { getDetails_api } from '@/api/system/basis';
|
||||
|
||||
export const useSystem = defineStore('system', {
|
||||
state: () => ({
|
||||
isCommunity: false
|
||||
isCommunity: false,
|
||||
configInfo: [] as any[]
|
||||
}),
|
||||
actions: {
|
||||
getSystemVersion(): Promise<any[]> {
|
||||
return new Promise(async(res, rej) => {
|
||||
this.getSystemConfig();
|
||||
return new Promise(async (res, rej) => {
|
||||
const resp = await systemVersion()
|
||||
if (resp.success && resp.result) {
|
||||
const isCommunity = resp.result.edition === 'community'
|
||||
|
@ -19,6 +22,12 @@ export const useSystem = defineStore('system', {
|
|||
res(menuData)
|
||||
}
|
||||
})
|
||||
},
|
||||
getSystemConfig() {
|
||||
const params = ['front', 'amap', 'paths'];
|
||||
getDetails_api(params).then(({ status, result }: any) => {
|
||||
this.configInfo = status === 200 ? [...result] : [];
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
|
@ -292,6 +292,7 @@ import { LocalStore } from '@/utils/comm';
|
|||
|
||||
import { save_api, getDetails_api } from '@/api/system/basis';
|
||||
import { usePermissionStore } from '@/store/permission';
|
||||
import { useSystem } from '@/store/system';
|
||||
|
||||
const action = `${BASE_API_PATH}/file/static`;
|
||||
const headers = { [TOKEN_KEY]: LocalStore.get(TOKEN_KEY) };
|
||||
|
@ -302,9 +303,9 @@ const form = reactive<formType>({
|
|||
headerTheme: 'light',
|
||||
apiKey: '',
|
||||
'base-path': `${window.location.origin}/api`,
|
||||
logo: '/public/logo.png',
|
||||
ico: '/public/favicon.ico',
|
||||
backgroud: '/public/images/login.png',
|
||||
logo: '',
|
||||
ico: '',
|
||||
backgroud: '',
|
||||
},
|
||||
rulesFrom: {
|
||||
title: [
|
||||
|
@ -337,31 +338,18 @@ const form = reactive<formType>({
|
|||
iconLoading: false, // 页签加载状态
|
||||
saveLoading: false,
|
||||
getDetails: () => {
|
||||
const params = ['front', 'amap', 'paths'];
|
||||
getDetails_api(params).then((resp: any) => {
|
||||
const basis = resp.result?.filter(
|
||||
(item: any) => item.scope === 'front',
|
||||
);
|
||||
const api = resp.result?.filter(
|
||||
(item: any) => item.scope === 'amap',
|
||||
);
|
||||
const basePath = resp.result?.filter(
|
||||
(item: any) => item.scope === 'paths',
|
||||
);
|
||||
form.formValue = {
|
||||
...basis[0].properties,
|
||||
apiKey: api[0].properties.apiKey,
|
||||
'base-path': basePath[0].properties['base-path'],
|
||||
logo: form.formValue.logo || '/public/logo.png',
|
||||
ico: form.formValue.ico || '/public/favicon.ico',
|
||||
backgroud:
|
||||
form.formValue.backgroud || '/public/images/login.png',
|
||||
};
|
||||
// localStorage.setItem(
|
||||
// SystemConst.AMAP_KEY,
|
||||
// api[0].properties.apiKey,
|
||||
// );
|
||||
});
|
||||
const configInfo = useSystem().$state.configInfo;
|
||||
const basis = configInfo.find((item: any) => item.scope === 'front');
|
||||
const api = configInfo.find((item: any) => item.scope === 'amap');
|
||||
const basePath = configInfo.find((item: any) => item.scope === 'paths');
|
||||
form.formValue = {
|
||||
...basis.properties,
|
||||
apiKey: api.properties.apiKey,
|
||||
'base-path': basePath.properties['base-path'],
|
||||
logo: basis.properties.logo || '/public/logo.png',
|
||||
ico: basis.properties.ico || '/public/favicon.ico',
|
||||
backgroud: basis.properties.backgroud || '/public/images/login.png',
|
||||
};
|
||||
},
|
||||
clickSave: () => {
|
||||
const hasPermission = usePermissionStore().hasPermission;
|
||||
|
|
Loading…
Reference in New Issue