WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2022-07-16 d5e466a233f8b402d67043c823045799c5bd0fbd
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,14 +175,16 @@
            });
        },
        $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 => {
                if (file.type === 'btn') {
                    return;
                }
                Tools.toast(file.url);
                // 临时文件才上传
                if (
                    file.url.indexOf('blob') >= 0 ||
@@ -200,6 +208,7 @@
                                url,
                                header,
                                filePath: file.url,
                                fileName: this.fileNames[file.url],
                                name: 'file',
                                formData: {},
                                success(res) {
@@ -211,7 +220,9 @@
                                        resolve(
                                            $fetchCommon.transImgPath(
                                                'fix',
                                                res2.data.src
                                                res2.data.src ||
                                                    res2.data.file ||
                                                    res2.data.url
                                            )
                                        );
                                    } else {