From f14ea940fb32105de8b592992e3f53c62f31d84d Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 22 一月 2026 16:42:51 +0800
Subject: [PATCH] 2026.1.22

---
 component/uploader/uploader.js |  868 +++++++++++++++++++++++++++++----------------------------
 1 files changed, 440 insertions(+), 428 deletions(-)

diff --git a/component/uploader/uploader.js b/component/uploader/uploader.js
index 0e1e484..3e71e26 100644
--- a/component/uploader/uploader.js
+++ b/component/uploader/uploader.js
@@ -1,13 +1,12 @@
 module.exports =
   /******/
-  (function (modules) { // webpackBootstrap
+  (function (modules) {
+    // webpackBootstrap
     /******/ // The module cache
     /******/
-    var installedModules = {};
+    var installedModules = {}; /******/ // The require function
     /******/
-    /******/ // The require function
-    /******/
-    function __webpack_require__(moduleId) {
+    /******/ function __webpack_require__(moduleId) {
       /******/
       /******/ // Check if module is in cache
       /******/
@@ -15,88 +14,72 @@
         /******/
         return installedModules[moduleId].exports;
         /******/
-      }
-      /******/ // Create a new module (and put it into the cache)
-      /******/
-      var module = installedModules[moduleId] = {
+      } /******/ // Create a new module (and put it into the cache)
+      /******/ var module = (installedModules[moduleId] = {
         /******/
         i: moduleId,
         /******/
         l: false,
         /******/
-        exports: {}
+        exports: {},
         /******/
-      };
+      }); /******/ // Execute the module function
       /******/
-      /******/ // Execute the module function
+      /******/ modules[moduleId].call(
+        module.exports,
+        module,
+        module.exports,
+        __webpack_require__,
+      ); /******/ // Flag the module as loaded
       /******/
-      modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+      /******/ module.l = true; /******/ // Return the exports of the module
       /******/
-      /******/ // Flag the module as loaded
+      /******/ return module.exports;
       /******/
-      module.l = true;
-      /******/
-      /******/ // Return the exports of the module
-      /******/
-      return module.exports;
-      /******/
-    }
+    } /******/ // expose the modules object (__webpack_modules__)
     /******/
     /******/
-    /******/ // expose the modules object (__webpack_modules__)
+    /******/ __webpack_require__.m = modules; /******/ // expose the module cache
     /******/
-    __webpack_require__.m = modules;
+    /******/ __webpack_require__.c = installedModules; /******/ // define getter function for harmony exports
     /******/
-    /******/ // expose the module cache
-    /******/
-    __webpack_require__.c = installedModules;
-    /******/
-    /******/ // define getter function for harmony exports
-    /******/
-    __webpack_require__.d = function (exports, name, getter) {
+    /******/ __webpack_require__.d = function (exports, name, getter) {
       /******/
       if (!__webpack_require__.o(exports, name)) {
         /******/
         Object.defineProperty(exports, name, {
           enumerable: true,
-          get: getter
+          get: getter,
         });
         /******/
       }
       /******/
-    };
+    }; /******/ // define __esModule on exports
     /******/
-    /******/ // define __esModule on exports
-    /******/
-    __webpack_require__.r = function (exports) {
+    /******/ __webpack_require__.r = function (exports) {
       /******/
       if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
         /******/
         Object.defineProperty(exports, Symbol.toStringTag, {
-          value: 'Module'
+          value: 'Module',
         });
         /******/
       }
       /******/
       Object.defineProperty(exports, '__esModule', {
-        value: true
+        value: true,
       });
       /******/
-    };
+    }; /******/ /******/ /******/ /******/ /******/ // create a fake namespace object // mode & 1: value is a module id, require it // mode & 2: merge all properties of value into the ns // mode & 4: return value when already ns object // mode & 8|1: behave like require
     /******/
-    /******/ // create a fake namespace object
-    /******/ // mode & 1: value is a module id, require it
-    /******/ // mode & 2: merge all properties of value into the ns
-    /******/ // mode & 4: return value when already ns object
-    /******/ // mode & 8|1: behave like require
-    /******/
-    __webpack_require__.t = function (value, mode) {
+    /******/ __webpack_require__.t = function (value, mode) {
       /******/
       if (mode & 1) value = __webpack_require__(value);
       /******/
       if (mode & 8) return value;
       /******/
-      if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
+      if (mode & 4 && typeof value === 'object' && value && value.__esModule)
+        return value;
       /******/
       var ns = Object.create(null);
       /******/
@@ -104,407 +87,436 @@
       /******/
       Object.defineProperty(ns, 'default', {
         enumerable: true,
-        value: value
+        value: value,
       });
       /******/
       if (mode & 2 && typeof value != 'string')
-        for (var key in value) __webpack_require__.d(ns, key, function (key) {
-          return value[key];
-        }.bind(null, key));
+        for (var key in value)
+          __webpack_require__.d(
+            ns,
+            key,
+            function (key) {
+              return value[key];
+            }.bind(null, key),
+          );
       /******/
       return ns;
       /******/
-    };
+    }; /******/ // getDefaultExport function for compatibility with non-harmony modules
     /******/
-    /******/ // getDefaultExport function for compatibility with non-harmony modules
-    /******/
-    __webpack_require__.n = function (module) {
+    /******/ __webpack_require__.n = function (module) {
       /******/
-      var getter = module && module.__esModule ?
-        /******/
-        function getDefault() {
-          return module['default'];
-        } :
-        /******/
-        function getModuleExports() {
-          return module;
-        };
+      var getter =
+        module && module.__esModule
+          ? /******/
+            function getDefault() {
+              return module['default'];
+            }
+          : /******/
+            function getModuleExports() {
+              return module;
+            };
       /******/
       __webpack_require__.d(getter, 'a', getter);
       /******/
       return getter;
       /******/
-    };
+    }; /******/ // Object.prototype.hasOwnProperty.call
     /******/
-    /******/ // Object.prototype.hasOwnProperty.call
-    /******/
-    __webpack_require__.o = function (object, property) {
+    /******/ __webpack_require__.o = function (object, property) {
       return Object.prototype.hasOwnProperty.call(object, property);
-    };
+    }; /******/ // __webpack_public_path__
     /******/
-    /******/ // __webpack_public_path__
-    /******/
-    __webpack_require__.p = "";
+    /******/ __webpack_require__.p = ''; /******/ // Load entry module and return exports
     /******/
     /******/
-    /******/ // Load entry module and return exports
+    /******/ return __webpack_require__((__webpack_require__.s = 22));
     /******/
-    return __webpack_require__(__webpack_require__.s = 22);
+  })(
+    /************************************************************************/
     /******/
-  })
-/************************************************************************/
-/******/
-({
-
-  /***/
-  22:
-    /***/
-    (function (module, exports, __webpack_require__) {
-
-      "use strict";
-
-
-      Component({
-        options: {
-          addGlobalClass: true
-        },
-        properties: {
-          title: {
-            type: String,
-            value: ''
-          },
-          titleClass: {
-            type: "String",
-            value: ""
-          },
-
-          sizeType: {
-            type: Array,
-            value: ['original', 'compressed']
-          },
-          sourceType: {
-            type: Array,
-            value: ['album', 'camera']
-          },
-          maxSize: {
-            type: Number,
-            value: 5 * 1024 * 1024
-          },
-          maxCount: {
-            // 鏈�澶氫笂浼犲灏戜釜鏂囦欢
-            type: Number,
-            value: 1
-          },
-          countInfo: {
-            type: String,
-            value: ""
-          },
-          files: {
-            // 褰撳墠鐨勫浘鐗囧垪琛�, {url, error, loading}
-            type: Array,
-            value: [],
-
-            observer(newVal) {
-              this.setData({
-                currentFiles: newVal
-              });
-            }
-
-          },
-          select: {
-            // 杩囨护鏌愪釜鏂囦欢
-            type: null,
-            value: null
-          },
-          upload: {
-            // 杩斿洖Promise鐨勪竴涓枃浠朵笂浼犵殑鍑芥暟
-            type: null,
-            value: () => {}
-          },
-          tips: {
-            type: String,
-            value: ''
-          },
-          extClass: {
-            type: String,
-            value: ''
-          },
-          showDelete: {
-            // 鏄惁鏄剧ずdelete鎸夐挳
-            type: Boolean,
-            value: true
-          }
-        },
-        data: {
-          currentFiles: [],
-          showPreview: false,
-          previewImageUrls: [],
-          groups: [{
-            text: '閫夋嫨鍥剧墖',
-            value: 0
-          }, {
-            text: '浠庤亰澶╄褰曢�夋嫨鏂囦欢',
-            value: 1
-          }],
-        },
-
-        ready() {},
-
-        methods: {
-          showActionSheet() {
-            this.setData({
-              showSheet: true
-            })
-          },
-          previewImage(e) {
-            const {
-              index
-            } = e.currentTarget.dataset;
-            const previewImageUrls = [];
-            this.data.files.forEach(item => {
-              previewImageUrls.push(item.url);
-            });
-            this.setData({
-              previewImageUrls,
-              previewCurrent: index,
-              showPreview: true
-            });
-          },
-          previewFile(e) {
-            const {
-              index
-            } = e.currentTarget.dataset;
-            const file = this.data.files[index]
-            wx.openDocument({
-              filePath: file.url,
-            });
-          },
-          actionClick(e) {
-            switch (e.detail.value) {
-              case 0:
-                this.chooseImage()
-                break;
-              case 1:
-                this.chooseMessageFile()
-                break;
-              default:
-                this.chooseImage()
-                break;
-            }
-            this.setData({
-              showSheet: false
-            })
-          },
-          chooseImage() {
-            if (this.uploading) return;
-            wx.chooseMedia({
-              count: this.data.maxCount - this.data.files.length,
-              sizeType: ['compressed'],
-              mediaType: ['image'],
-              success: res => {
-                console.log('chooseImage resp', res)
-                // 棣栧厛妫�鏌ユ枃浠跺ぇ灏�
-                let invalidIndex = -1; // @ts-ignore
-                res.tempFilePaths = res.tempFiles.map(item => item.tempFilePath)
-                res.tempFiles.forEach((item, index) => {
-                  if (item.size > this.data.maxSize) {
-                    invalidIndex = index;
-                  }
-                });
-                if (typeof this.data.select === 'function') {
-                  const ret = this.data.select(res);
-                  if (ret === false) {
-                    return;
-                  }
-                }
-                if (invalidIndex >= 0) {
-                  this.triggerEvent('fail', {
-                    type: 1,
-                    errMsg: `chooseImage:fail size exceed ${this.data.maxSize}`,
-                    total: res.tempFilePaths.length,
-                    index: invalidIndex
-                  }, {});
-                  return;
-                } // 鑾峰彇鏂囦欢鍐呭
-
-
-                const mgr = wx.getFileSystemManager();
-                const contents = res.tempFilePaths.map(item => {
-                  // @ts-ignore
-                  const fileContent = mgr.readFileSync(item);
-                  return fileContent;
-                });
-                const obj = {
-                  tempFilePaths: res.tempFilePaths,
-                  tempFiles: res.tempFiles,
-                  contents
-                }; // 瑙﹀彂閫変腑鐨勪簨浠讹紝寮�鍙戣�呮牴鎹唴瀹规潵涓婁紶鏂囦欢锛屼笂浼犱簡鎶婁笂浼犵殑缁撴灉鍙嶉鍒癴iles灞炴�ч噷闈�
-
-                this.triggerEvent('select', obj, {});
-
-                let files = res.tempFiles.map((item, i) => ({
-                  loading: true,
-                  url: item.tempFilePath,
-                  type: item.fileType,
-                }))
-                //鍘嬬缉鍥剧墖
-                wx.compressImage({
-                  src: files[0].url,
-                  quality: 20,
-                  success(data) {
-                    console.log('compressImage', data)
-                  },
-                  fail() {
-
-                  }
-                })
-
-                if (!files || !files.length) return;
-                const newFiles = this.data.files.concat(files);
-                this.setData({
-                  files: newFiles,
-                  currentFiles: newFiles
-                });
-                this.triggerEvent('uploadImg', {
-                  newFiles
-                }, {})
-              },
-              fail: fail => {
-                if (fail.errMsg.indexOf('chooseImage:fail cancel') >= 0) {
-                  this.triggerEvent('cancel', {}, {});
-                  return;
-                }
-                fail.type = 2;
-                this.triggerEvent('fail', fail, {});
-              }
-            });
-          },
-          chooseMessageFile() {
-            if (this.uploading) return;
-            wx.chooseMessageFile({
-              count: this.data.maxCount - this.data.files.length,
-              type: 'file',
-              extension: ['xls', 'xlsx', 'csv', 'doc', 'docx', 'pdf', 'ppt', 'pptx'],
-              success: res => {
-                console.log('chooseMessageFile', res)
-                // 棣栧厛妫�鏌ユ枃浠跺ぇ灏�
-                let invalidIndex = -1; // @ts-ignore
-                res.tempFilePaths = res.tempFiles.map(item => item.path)
-                res.tempFiles.forEach((item, index) => {
-                  if (item.size > this.data.maxSize) {
-                    invalidIndex = index;
-                  }
-                });
-                if (typeof this.data.select === 'function') {
-                  const ret = this.data.select(res);
-                  if (ret === false) {
-                    return;
-                  }
-                }
-                if (invalidIndex >= 0) {
-                  this.triggerEvent('fail', {
-                    type: 1,
-                    errMsg: `chooseMessageFile:fail size exceed ${this.data.maxSize}`,
-                    total: res.tempFilePaths.length,
-                    index: invalidIndex
-                  }, {});
-                  return;
-                } // 鑾峰彇鏂囦欢鍐呭
-
-
-                const mgr = wx.getFileSystemManager();
-                const contents = res.tempFilePaths.map(item => {
-                  // @ts-ignore
-                  const fileContent = mgr.readFileSync(item);
-                  return fileContent;
-                });
-                const obj = {
-                  tempFilePaths: res.tempFilePaths,
-                  tempFiles: res.tempFiles,
-                  contents
-                }; // 瑙﹀彂閫変腑鐨勪簨浠讹紝寮�鍙戣�呮牴鎹唴瀹规潵涓婁紶鏂囦欢锛屼笂浼犱簡鎶婁笂浼犵殑缁撴灉鍙嶉鍒癴iles灞炴�ч噷闈�
-
-                this.triggerEvent('select', obj, {});
-
-                let files = res.tempFiles.map((item, i) => {
-                  // 鍒ゆ柇鏂囦欢绫诲瀷锛屽搴斾笉鍚屾牱寮�
-                  let extensionClass = ''
-                  switch (item.name.split('.')[1]) {
-                    case 'xls':
-                    case 'xlsx':
-                    case 'csv':
-                      extensionClass = 'file_xlsx'
-                      break;
-                    case 'doc':
-                    case 'docx':
-                      extensionClass = 'file_word'
-                      break;
-                    case 'pdf':
-                      extensionClass = 'file_pdf'
-                      break;
-                    case 'ppt':
-                    case 'pptx':
-                      extensionClass = 'file_ppt'
-                      break;
-                    default:
-                      break;
-                  }
-                  // 鎷嗗垎鏂囦欢鍚嶇О锛屽疄鐜版枃鏈繃闀挎椂锛屼腑闂寸渷鐣�
-                  const ellipsisName = {
-                    start: item.name.slice(0, -5),
-                    // 鍙栨湯灏�5涓瓧绗﹀父鎬佹樉绀�
-                    end: item.name.substr(-5, 5)
-                  }
-                  // 鏂囦欢澶у皬鏍煎紡鍖�
-                  let size = parseInt(item.size / 1024)
-                  if (size > 1024) {
-                    size = parseInt(size / 1024) + ' MB'
-                  } else {
-                    size += ' KB'
-                  }
-                  return {
-                    loading: true,
-                    url: item.path,
-                    name: item.name,
-                    ellipsisName,
-                    styleClass: extensionClass,
-                    type: item.type,
-                    time: item.time,
-                    size
-                  }
-                })
-                if (!files || !files.length) return;
-                const newFiles = this.data.files.concat(files);
-                this.setData({
-                  files: newFiles,
-                  currentFiles: newFiles
-                });
-                this.triggerEvent('uploadImg', {
-                  newFiles
-                }, {})
-              }
-            })
-          },
-          deletePic(e) {
-            const index = e.detail.index;
-            const files = this.data.files;
-            const file = files.splice(index, 1);
-            this.setData({
-              files,
-              currentFiles: files
-            });
-            this.triggerEvent('delete', {
-              index,
-              item: file[0]
-            });
-          },
-
-
-        }
-      });
-
+    {
       /***/
-    })
+      22:
+        /***/
+        function (module, exports, __webpack_require__) {
+          'use strict';
 
-  /******/
-});
\ No newline at end of file
+          Component({
+            options: {
+              addGlobalClass: true,
+            },
+            properties: {
+              title: {
+                type: String,
+                value: '',
+              },
+              titleClass: {
+                type: 'String',
+                value: '',
+              },
+
+              sizeType: {
+                type: Array,
+                value: ['original', 'compressed'],
+              },
+              sourceType: {
+                type: Array,
+                value: ['album', 'camera'],
+              },
+              maxSize: {
+                type: Number,
+                value: 5 * 1024 * 1024,
+              },
+              maxCount: {
+                // 鏈�澶氫笂浼犲灏戜釜鏂囦欢
+                type: Number,
+                value: 1,
+              },
+              countInfo: {
+                type: String,
+                value: '',
+              },
+              files: {
+                // 褰撳墠鐨勫浘鐗囧垪琛�, {url, error, loading}
+                type: Array,
+                value: [],
+
+                observer(newVal) {
+                  this.setData({
+                    currentFiles: newVal,
+                  });
+                },
+              },
+              select: {
+                // 杩囨护鏌愪釜鏂囦欢
+                type: null,
+                value: null,
+              },
+              upload: {
+                // 杩斿洖Promise鐨勪竴涓枃浠朵笂浼犵殑鍑芥暟
+                type: null,
+                value: () => {},
+              },
+              tips: {
+                type: String,
+                value: '',
+              },
+              extClass: {
+                type: String,
+                value: '',
+              },
+              showDelete: {
+                // 鏄惁鏄剧ずdelete鎸夐挳
+                type: Boolean,
+                value: true,
+              },
+              allowFiles: {
+                // 鏄惁鍏佽閫夋嫨鍥剧墖涔嬪鐨勫叾浠栨牸寮忔枃浠�
+                type: Boolean,
+                value: false,
+              },
+            },
+            data: {
+              currentFiles: [],
+              showPreview: false,
+              previewImageUrls: [],
+              groups: [
+                {
+                  text: '閫夋嫨鍥剧墖',
+                  value: 0,
+                },
+                {
+                  text: '浠庤亰澶╄褰曢�夋嫨鏂囦欢',
+                  value: 1,
+                },
+              ],
+            },
+
+            ready() {},
+
+            methods: {
+              showActionSheet() {
+                if (this.data.allowFiles) {
+                  this.setData({
+                    showSheet: true,
+                  });
+                } else {
+                  this.chooseImage();
+                }
+              },
+              previewImage(e) {
+                const { index } = e.currentTarget.dataset;
+                const f = this.data.files[index];
+                const previewImageUrls = this.data.files
+                  .filter(f => f.type == 'image')
+                  .map(f => f.url);
+                const i = previewImageUrls.indexOf(f.url);
+                this.setData({
+                  previewImageUrls,
+                  previewCurrent: i,
+                  showPreview: true,
+                });
+              },
+              previewFile(e) {
+                const { index } = e.currentTarget.dataset;
+                const file = this.data.files[index];
+                wx.openDocument({
+                  filePath: file.url,
+                });
+              },
+              actionClick(e) {
+                switch (e.detail.value) {
+                  case 0:
+                    this.chooseImage();
+                    break;
+                  case 1:
+                    this.chooseMessageFile();
+                    break;
+                  default:
+                    this.chooseImage();
+                    break;
+                }
+                this.setData({
+                  showSheet: false,
+                });
+              },
+              chooseImage() {
+                if (this.uploading) return;
+                wx.chooseMedia({
+                  count: this.data.maxCount - this.data.files.length,
+                  sizeType: ['compressed'],
+                  mediaType: ['image'],
+                  success: res => {
+                    console.log('chooseImage resp', res);
+                    // 棣栧厛妫�鏌ユ枃浠跺ぇ灏�
+                    let invalidIndex = -1; // @ts-ignore
+                    res.tempFilePaths = res.tempFiles.map(
+                      item => item.tempFilePath,
+                    );
+                    res.tempFiles.forEach((item, index) => {
+                      if (item.size > this.data.maxSize) {
+                        invalidIndex = index;
+                      }
+                    });
+                    if (typeof this.data.select === 'function') {
+                      const ret = this.data.select(res);
+                      if (ret === false) {
+                        return;
+                      }
+                    }
+                    if (invalidIndex >= 0) {
+                      this.triggerEvent(
+                        'fail',
+                        {
+                          type: 1,
+                          errMsg: `chooseImage:fail size exceed ${this.data.maxSize}`,
+                          total: res.tempFilePaths.length,
+                          index: invalidIndex,
+                        },
+                        {},
+                      );
+                      return;
+                    } // 鑾峰彇鏂囦欢鍐呭
+
+                    const mgr = wx.getFileSystemManager();
+                    const contents = res.tempFilePaths.map(item => {
+                      // @ts-ignore
+                      const fileContent = mgr.readFileSync(item);
+                      return fileContent;
+                    });
+                    const obj = {
+                      tempFilePaths: res.tempFilePaths,
+                      tempFiles: res.tempFiles,
+                      contents,
+                    }; // 瑙﹀彂閫変腑鐨勪簨浠讹紝寮�鍙戣�呮牴鎹唴瀹规潵涓婁紶鏂囦欢锛屼笂浼犱簡鎶婁笂浼犵殑缁撴灉鍙嶉鍒癴iles灞炴�ч噷闈�
+
+                    this.triggerEvent('select', obj, {});
+
+                    let files = res.tempFiles.map((item, i) => ({
+                      loading: true,
+                      url: item.tempFilePath,
+                      type: item.fileType,
+                    }));
+                    //鍘嬬缉鍥剧墖
+                    wx.compressImage({
+                      src: files[0].url,
+                      quality: 20,
+                      success(data) {
+                        console.log('compressImage', data);
+                      },
+                      fail() {},
+                    });
+
+                    if (!files || !files.length) return;
+                    const newFiles = this.data.files.concat(files);
+                    this.setData({
+                      files: newFiles,
+                      currentFiles: newFiles,
+                    });
+                    this.triggerEvent(
+                      'uploadImg',
+                      {
+                        newFiles,
+                      },
+                      {},
+                    );
+                  },
+                  fail: fail => {
+                    if (fail.errMsg.indexOf('chooseImage:fail cancel') >= 0) {
+                      this.triggerEvent('cancel', {}, {});
+                      return;
+                    }
+                    fail.type = 2;
+                    this.triggerEvent('fail', fail, {});
+                  },
+                });
+              },
+              chooseMessageFile() {
+                if (this.uploading) return;
+                wx.chooseMessageFile({
+                  count: this.data.maxCount - this.data.files.length,
+                  type: 'file',
+                  extension: [
+                    'xls',
+                    'xlsx',
+                    'csv',
+                    'doc',
+                    'docx',
+                    'pdf',
+                    'ppt',
+                    'pptx',
+                  ],
+                  success: res => {
+                    console.log('chooseMessageFile', res);
+                    // 棣栧厛妫�鏌ユ枃浠跺ぇ灏�
+                    let invalidIndex = -1; // @ts-ignore
+                    res.tempFilePaths = res.tempFiles.map(item => item.path);
+                    res.tempFiles.forEach((item, index) => {
+                      if (item.size > this.data.maxSize) {
+                        invalidIndex = index;
+                      }
+                    });
+                    if (typeof this.data.select === 'function') {
+                      const ret = this.data.select(res);
+                      if (ret === false) {
+                        return;
+                      }
+                    }
+                    if (invalidIndex >= 0) {
+                      this.triggerEvent(
+                        'fail',
+                        {
+                          type: 1,
+                          errMsg: `chooseMessageFile:fail size exceed ${this.data.maxSize}`,
+                          total: res.tempFilePaths.length,
+                          index: invalidIndex,
+                        },
+                        {},
+                      );
+                      return;
+                    } // 鑾峰彇鏂囦欢鍐呭
+
+                    const mgr = wx.getFileSystemManager();
+                    const contents = res.tempFilePaths.map(item => {
+                      // @ts-ignore
+                      const fileContent = mgr.readFileSync(item);
+                      return fileContent;
+                    });
+                    const obj = {
+                      tempFilePaths: res.tempFilePaths,
+                      tempFiles: res.tempFiles,
+                      contents,
+                    }; // 瑙﹀彂閫変腑鐨勪簨浠讹紝寮�鍙戣�呮牴鎹唴瀹规潵涓婁紶鏂囦欢锛屼笂浼犱簡鎶婁笂浼犵殑缁撴灉鍙嶉鍒癴iles灞炴�ч噷闈�
+
+                    this.triggerEvent('select', obj, {});
+
+                    let files = res.tempFiles.map((item, i) => {
+                      // 鍒ゆ柇鏂囦欢绫诲瀷锛屽搴斾笉鍚屾牱寮�
+                      const list = item.name.split('.');
+                      const ext = list[list.length - 1];
+                      let extensionClass = '';
+                      switch (ext) {
+                        case 'xls':
+                        case 'xlsx':
+                        case 'csv':
+                          extensionClass = 'file_xlsx';
+                          break;
+                        case 'doc':
+                        case 'docx':
+                          extensionClass = 'file_word';
+                          break;
+                        case 'pdf':
+                          extensionClass = 'file_pdf';
+                          break;
+                        case 'ppt':
+                        case 'pptx':
+                          extensionClass = 'file_ppt';
+                          break;
+                        default:
+                          break;
+                      }
+
+                      // 鏂囦欢澶у皬鏍煎紡鍖�
+                      let size = parseInt(item.size / 1024);
+                      if (size > 1024) {
+                        size = (size / 1024).toFixed(1) + ' MB';
+                      } else {
+                        size += ' KB';
+                      }
+                      return {
+                        loading: true,
+                        url: item.path,
+                        name: item.name,
+                        ext: ext ?? '',
+                        styleClass: extensionClass,
+                        type: item.type,
+                        time: item.time,
+                        size,
+                      };
+                    });
+                    if (!files || !files.length) return;
+                    const newFiles = this.data.files.concat(files);
+                    this.setData({
+                      files: newFiles,
+                      currentFiles: newFiles,
+                    });
+                    this.triggerEvent(
+                      'uploadImg',
+                      {
+                        newFiles,
+                      },
+                      {},
+                    );
+                  },
+                });
+              },
+              deletePic(e) {
+                const index = e.detail.index;
+                this._delete(index);
+              },
+              deleteFile(e) {
+                const { index } = e.currentTarget.dataset;
+                this._delete(index);
+              },
+              _delete(index) {
+                const files = this.data.files;
+                const file = files.splice(index, 1);
+                this.setData({
+                  files,
+                  currentFiles: files,
+                });
+                this.triggerEvent('delete', {
+                  index,
+                  item: file[0],
+                });
+              },
+            },
+          });
+
+          /***/
+        },
+
+      /******/
+    },
+  );

--
Gitblit v1.9.3