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