WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2024-03-19 a250b6216753cfd0c0622a1fbc0f3254fc8e0a4f
forms/imagePicker/CImagePicker.vue
@@ -15,14 +15,15 @@
        <AtImagePicker
            ref="picker"
            mode="aspectFit"
            :sourceType="sourceType"
            :multiple="count > 1"
            :count="count"
            :showAddBtn="!selectedFull"
            :length="3"
            :files="files"
            :onChange="(files,operationType,index)=>handleChange(files,operationType,index)"
            :onFail="evt=>handleFail(evt)"
            :onImageClick="(index, file)=>handleImgView(index,file)"
            :onChange="(files,operationType,index) => handleChange(files,operationType,index)"
            :onFail="evt => handleFail(evt)"
            :onImageClick="(index, file) => handleImgView(index,file)"
        />
        <CImageCompressor ref="compressor" />
        <CImagePreview ref="imgPreview" />
@@ -56,6 +57,11 @@
        count: {
            type: Number,
            default: 1,
        },
        // 图片来源
        sourceType: {
            type: Array,
            default: () => ['album', 'camera'],
        },
        // 上传图片参数
        params: {
@@ -274,10 +280,20 @@
                        formData: { ...params },
                        timeout: 30 * 1000,
                        success(res) {
                            const res2 =
                                typeof res.data === 'string'
                                    ? JSON.parse(res.data)
                                    : res.data;
                            let res2;
                            try {
                                res2 =
                                    typeof res.data === 'string'
                                        ? JSON.parse(res.data)
                                        : res.data;
                            } catch (err) {
                                reject({
                                    ...requestFile,
                                    response: res,
                                    message: '上传图片异常!',
                                });
                                return;
                            }
                            // 上传成功
                            if (res2.state.code === 2000) {
                                const imgUrl = $fetchCommon.transImgPath(