fix: 修复协议管理、远程升级上传文件获取base-path方式
This commit is contained in:
parent
4b84614f82
commit
0671e2d357
|
@ -31,10 +31,11 @@
|
|||
<script setup lang="ts" name="FileUpload">
|
||||
import { LocalStore } from '@/utils/comm';
|
||||
import { TOKEN_KEY } from '@/utils/variable';
|
||||
import { FIRMWARE_UPLOAD, querySystemApi } from '@/api/device/firmware';
|
||||
import { FIRMWARE_UPLOAD } from '@/api/device/firmware';
|
||||
import { onlyMessage } from '@/utils/comm';
|
||||
import type { UploadChangeParam } from 'ant-design-vue';
|
||||
import { notification as Notification } from 'ant-design-vue';
|
||||
import { useSystem } from '@/store/system';
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'update:extraValue', 'change']);
|
||||
|
||||
|
@ -45,6 +46,10 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const paths: string = useSystem().$state.configInfo.paths?.[
|
||||
'base-path'
|
||||
] as string;
|
||||
|
||||
const fileValue = ref(props.modelValue);
|
||||
const loading = ref(false);
|
||||
|
||||
|
@ -53,11 +58,9 @@ const handleChange = async (info: UploadChangeParam) => {
|
|||
if (info.file.status === 'done') {
|
||||
loading.value = false;
|
||||
const result = info.file.response?.result;
|
||||
const api: any = await querySystemApi(['paths']); // todo base-path在pinia获取系统配置的
|
||||
const path = api.result[0]?.properties
|
||||
? api.result[0]?.properties['base-path']
|
||||
: '';
|
||||
const f = `${path}/file/${result.id}?accessKey=${result.others.accessKey}`;
|
||||
const f = `${paths || ''}/file/${result.id}?accessKey=${
|
||||
result.others.accessKey
|
||||
}`;
|
||||
onlyMessage('上传成功!', 'success');
|
||||
fileValue.value = f;
|
||||
emit('update:modelValue', f);
|
||||
|
|
|
@ -27,10 +27,11 @@
|
|||
<script setup lang="ts" name="FileUpload">
|
||||
import { LocalStore } from '@/utils/comm';
|
||||
import { TOKEN_KEY } from '@/utils/variable';
|
||||
import { PROTOCOL_UPLOAD, querySystemApi } from '@/api/link/protocol';
|
||||
import { PROTOCOL_UPLOAD } from '@/api/link/protocol';
|
||||
import { onlyMessage } from '@/utils/comm';
|
||||
import type { UploadChangeParam, UploadProps } from 'ant-design-vue';
|
||||
import { notification as Notification } from 'ant-design-vue';
|
||||
import { useSystem } from '@/store/system';
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'change']);
|
||||
|
||||
|
@ -41,6 +42,10 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const paths: string = useSystem().$state.configInfo.paths?.[
|
||||
'base-path'
|
||||
] as string;
|
||||
|
||||
const value = ref(props.modelValue);
|
||||
const loading = ref(false);
|
||||
|
||||
|
@ -58,11 +63,9 @@ const handleChange = async (info: UploadChangeParam) => {
|
|||
if (info.file.status === 'done') {
|
||||
loading.value = false;
|
||||
const result = info.file.response?.result;
|
||||
const api: any = await querySystemApi(['paths']); // todo base-path在pinia获取系统配置的
|
||||
const path = api.result[0]?.properties
|
||||
? api.result[0]?.properties['base-path']
|
||||
: '';
|
||||
const f = `${path}/file/${result.id}?accessKey=${result.others.accessKey}`;
|
||||
const f = `${paths || ''}/file/${result.id}?accessKey=${
|
||||
result.others.accessKey
|
||||
}`;
|
||||
onlyMessage('上传成功!', 'success');
|
||||
value.value = f;
|
||||
emit('update:modelValue', f);
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
:disabled="!!id"
|
||||
v-model:value="formData.type"
|
||||
:options="options"
|
||||
:column="2"
|
||||
@change="changeType"
|
||||
/>
|
||||
</j-form-item>
|
||||
|
|
Loading…
Reference in New Issue