WebApp【公共组件库】@前端(For Git Submodule)
‘chensiAb’
2025-03-25 08c9d23e86b545a34e00a5fb5dae81ebabe50dea
forms/imagePicker/CImagePicker.vue
@@ -73,6 +73,11 @@
            type: Boolean,
            default: false,
        },
        // 上传地址来源
        uploadUrlSource: {
            type: String,
            default: '',
        },
    },
    data() {
        return {
@@ -138,8 +143,13 @@
                const needs = nextFiles
                    .map((file, needIndex) => {
                        const fileInfo = file.file;
                        // 没有 file 信息对象,或者不是 blob 类型
                        if (!fileInfo || fileInfo.path.indexOf('blob') < 0) {
                        // 没有 file 信息对象,或者不是 blob、wxfile、tmp 类型
                        if (
                            !fileInfo ||
                            (fileInfo.path.indexOf('blob') < 0 &&
                                fileInfo.path.indexOf('wxfile') < 0 &&
                                fileInfo.path.indexOf('http://tmp/') < 0)
                        ) {
                            return false;
                        }
                        // 尺寸小于 1M 的图片
@@ -218,7 +228,11 @@
                        callback(state, res);
                    }
                },
                this.params,
                $fetchCommon.transKeyName('underline', {
                    ...this.params,
                    needThumb: this.needThumb ? 1 : 0,
                }),
                this.uploadUrlSource,
            );
        },
    },
@@ -238,12 +252,17 @@
// 图片上传节流
const _readyUpload = {};
export const uploadImage = (files, callback, params) => {
export const uploadImage = (files, callback, formData = {}, uploadUrlSource) => {
    if (!files || files.length === 0) {
        callback('success', []);
        return;
    }
    let url = $fetchCommon.getUploadImgURL();
    let url = '';
    if (uploadUrlSource === 'LPG') {
        url = $fetchCommon.getLPGUploadImgURL();
    } else {
        url = $fetchCommon.getUploadImgURL();
    }
    if (url.indexOf('http') < 0) {
        url = $hostBoot.getHost() + url;
    }
@@ -282,10 +301,7 @@
                        ...requestFile,
                        header,
                        name: 'file',
                        formData: $fetchCommon.transKeyName('underline', {
                            ...params,
                            needThumb: this.needThumb ? 1 : 0,
                        }),
                        formData,
                        timeout: 30 * 1000,
                        success(res) {
                            let res2;