| | |
| | | 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'; |
| | |
| | | }, |
| | | }, |
| | | data() { |
| | | return {}; |
| | | return { |
| | | fileNames: {}, |
| | | }; |
| | | }, |
| | | computed: { |
| | | files() { |
| | |
| | | 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); |
| | | }, |
| | |
| | | }); |
| | | }, |
| | | $uploadImage(callback) { |
| | | const url = Fetcher.host + $fetchCommon.getUploadImgURL(); |
| | | let url = $fetchCommon.getUploadImgURL(); |
| | | if (url.indexOf('http') < 0) { |
| | | url = $hostBoot.getHost() + url; |
| | | } |
| | | const uploadTeam = []; |
| | | const imgs = []; |
| | | this.files.forEach(file => { |
| | |
| | | url, |
| | | header, |
| | | filePath: file.url, |
| | | fileName: this.fileNames[file.url], |
| | | name: 'file', |
| | | formData: {}, |
| | | success(res) { |
| | |
| | | resolve( |
| | | $fetchCommon.transImgPath( |
| | | 'fix', |
| | | res2.data.src |
| | | res2.data.src || |
| | | res2.data.file || |
| | | res2.data.url |
| | | ) |
| | | ); |
| | | } else { |