fix: 兼容旧前端可改配置文件
This commit is contained in:
@@ -8,6 +8,7 @@ import { changeValue } from '@/api/system/config';
|
||||
import { uploadFile } from '@/api/tool/file';
|
||||
import { FileType } from 'ant-design-vue/lib/upload/interface';
|
||||
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
|
||||
import { sessionGet } from '@/utils/cache-session-utils';
|
||||
const appStore = useAppStore();
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -62,8 +63,11 @@ function fnUpload(up: UploadRequestOption) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success('文件上传成功,提交保存生效', 3);
|
||||
state.filePath = res.data.fileName;
|
||||
const baseApi = import.meta.env.VITE_API_BASE_URL;
|
||||
state.flag = `${baseApi}${res.data.fileName}`;
|
||||
// 兼容旧前端可改配置文件
|
||||
const baseUrl = import.meta.env.PROD
|
||||
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
|
||||
: import.meta.env.VITE_API_BASE_URL;
|
||||
state.flag = `${baseUrl}${res.data.fileName}`;
|
||||
} else {
|
||||
message.error(res.msg, 3);
|
||||
}
|
||||
@@ -181,7 +185,12 @@ onMounted(() => {
|
||||
|
||||
<template v-else>
|
||||
<a-button type="default" @click="fnEdit(true)"> 编辑 </a-button>
|
||||
<a-button type="text" danger style="margin-left: 10px" @click="fnRevert">
|
||||
<a-button
|
||||
type="text"
|
||||
danger
|
||||
style="margin-left: 10px"
|
||||
@click="fnRevert"
|
||||
>
|
||||
还原
|
||||
</a-button>
|
||||
</template>
|
||||
|
||||
@@ -9,6 +9,7 @@ import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import { uploadFile } from '@/api/tool/file';
|
||||
import { changeValue } from '@/api/system/config';
|
||||
import { computed } from 'vue';
|
||||
import { sessionGet } from '@/utils/cache-session-utils';
|
||||
const appStore = useAppStore();
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -64,13 +65,15 @@ function fnUpload(up: UploadRequestOption) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success('文件上传成功,提交保存生效', 3);
|
||||
state.filePath = res.data.fileName;
|
||||
// appStore.setLOGO(state.type, res.data.fileName);
|
||||
const baseApi = import.meta.env.VITE_API_BASE_URL;
|
||||
// 兼容旧前端可改配置文件
|
||||
const baseUrl = import.meta.env.PROD
|
||||
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
|
||||
: import.meta.env.VITE_API_BASE_URL;
|
||||
if (state.type === 'icon') {
|
||||
state.icon = `${baseApi}${res.data.fileName}`;
|
||||
state.icon = `${baseUrl}${res.data.fileName}`;
|
||||
}
|
||||
if (state.type === 'brand') {
|
||||
state.brand = `${baseApi}${res.data.fileName}`;
|
||||
state.brand = `${baseUrl}${res.data.fileName}`;
|
||||
}
|
||||
} else {
|
||||
message.error(res.msg, 3);
|
||||
|
||||
Reference in New Issue
Block a user