From 99b052dca1da7d2723e6f7aa638c1a5883ff1845 Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Thu, 09 Jun 2022 11:19:48 +0800 Subject: [PATCH] 完善主机地址管理工具 --- forms/imagePicker/CImagePicker.vue | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/forms/imagePicker/CImagePicker.vue b/forms/imagePicker/CImagePicker.vue index 8ab735c..c6914a6 100644 --- a/forms/imagePicker/CImagePicker.vue +++ b/forms/imagePicker/CImagePicker.vue @@ -32,7 +32,7 @@ import Taro from '@tarojs/taro'; import { $ } from '@tarojs/extend'; import { AtInput, AtImagePicker, AtCurtain } from 'taro-ui-vue'; -import { Fetcher } from '@components/bases/Fetcher'; +import { $hostBoot } from '@components/bases/HostBoot'; import { $fetchCommon } from '@fetchers/FCommon'; import { Tools } from '@components/common/Tools'; import CImageCompressor from './CImageCompressor.vue'; @@ -56,7 +56,9 @@ }, }, data() { - return {}; + return { + fileNames: {}, + }; }, computed: { files() { @@ -78,6 +80,10 @@ const value = []; files.forEach(file => { value.push(file.url); + // 记录原文件名 + if (file.file && file.file.originalFileObj) { + this.fileNames[file.url] = file.file.originalFileObj.name; + } }); this.itemRes.onChange(value); }, @@ -169,7 +175,7 @@ }); }, $uploadImage(callback) { - const url = Fetcher.host + $fetchCommon.getUploadImgURL(); + const url = $hostBoot.getHost() + $fetchCommon.getUploadImgURL(); const uploadTeam = []; const imgs = []; this.files.forEach(file => { @@ -199,6 +205,7 @@ url, header, filePath: file.url, + fileName: this.fileNames[file.url], name: 'file', formData: {}, success(res) { @@ -210,7 +217,9 @@ resolve( $fetchCommon.transImgPath( 'fix', - res2.data.src + res2.data.src || + res2.data.file || + res2.data.url ) ); } else { -- Gitblit v1.9.1