hbte-saas-ui 1.8.9 → 1.8.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -456,6 +456,13 @@ function getNative(object, key) {
456
456
  module.exports = getNative;
457
457
 
458
458
 
459
+ /***/ }),
460
+
461
+ /***/ "0c4f":
462
+ /***/ (function(module, exports, __webpack_require__) {
463
+
464
+ // extracted by mini-css-extract-plugin
465
+
459
466
  /***/ }),
460
467
 
461
468
  /***/ "0c82":
@@ -1247,17 +1254,6 @@ _src_main_vue__WEBPACK_IMPORTED_MODULE_0__["default"].config = function (params)
1247
1254
  };
1248
1255
  /* harmony default export */ __webpack_exports__["default"] = (_src_main_vue__WEBPACK_IMPORTED_MODULE_0__["default"]);
1249
1256
 
1250
- /***/ }),
1251
-
1252
- /***/ "2070":
1253
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1254
-
1255
- "use strict";
1256
- /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_main_vue_vue_type_style_index_0_id_2c521d9c_prod_lang_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("695d");
1257
- /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_main_vue_vue_type_style_index_0_id_2c521d9c_prod_lang_scss__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_main_vue_vue_type_style_index_0_id_2c521d9c_prod_lang_scss__WEBPACK_IMPORTED_MODULE_0__);
1258
- /* unused harmony reexport * */
1259
-
1260
-
1261
1257
  /***/ }),
1262
1258
 
1263
1259
  /***/ "2266":
@@ -24963,13 +24959,6 @@ module.exports = function isSubsetOf(other) {
24963
24959
  };
24964
24960
 
24965
24961
 
24966
- /***/ }),
24967
-
24968
- /***/ "695d":
24969
- /***/ (function(module, exports, __webpack_require__) {
24970
-
24971
- // extracted by mini-css-extract-plugin
24972
-
24973
24962
  /***/ }),
24974
24963
 
24975
24964
  /***/ "6964":
@@ -33854,7 +33843,7 @@ module.exports = overArg;
33854
33843
  // ESM COMPAT FLAG
33855
33844
  __webpack_require__.r(__webpack_exports__);
33856
33845
 
33857
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"3c7c6be7-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/nav-menu/src/main.vue?vue&type=template&id=5927d4e0
33846
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"3c7c6be7-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/nav-menu/src/main.vue?vue&type=template&id=abd5359e
33858
33847
  var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"hb-navmenu",class:[
33859
33848
  _vm.isAbsolute ? (_vm.isCollapse ? 'hb-navmenu--open' : '') : '',
33860
33849
  _vm.isTransition ? 'hb-navmenu--transition' : '' ]},[_c('nav',{staticClass:"hb-navmenu-main"},[_vm._t("logo"),_vm._l((_vm.data),function(item,index){return _c('div',{key:index,class:_vm.isActive(index)
@@ -33869,7 +33858,7 @@ var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._sel
33869
33858
  var staticRenderFns = []
33870
33859
 
33871
33860
 
33872
- // CONCATENATED MODULE: ./packages/nav-menu/src/main.vue?vue&type=template&id=5927d4e0
33861
+ // CONCATENATED MODULE: ./packages/nav-menu/src/main.vue?vue&type=template&id=abd5359e
33873
33862
 
33874
33863
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
33875
33864
  var es_array_push = __webpack_require__("14d9");
@@ -34120,7 +34109,7 @@ var es_array_push = __webpack_require__("14d9");
34120
34109
  // 侧边导航栏路由跳转
34121
34110
  navigatToPath(item, flag = true) {
34122
34111
  if (item.event) {
34123
- this.$emit("customClick");
34112
+ this.$emit("customClick", item);
34124
34113
  return;
34125
34114
  } else {
34126
34115
  this.$emit("customClose");
@@ -39681,6 +39670,17 @@ module.exports = function (name) {
39681
39670
  };
39682
39671
 
39683
39672
 
39673
+ /***/ }),
39674
+
39675
+ /***/ "b639":
39676
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
39677
+
39678
+ "use strict";
39679
+ /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_main_vue_vue_type_style_index_0_id_0cc572b4_prod_lang_scss__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("0c4f");
39680
+ /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_main_vue_vue_type_style_index_0_id_0cc572b4_prod_lang_scss__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_9_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_9_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_9_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_9_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_main_vue_vue_type_style_index_0_id_0cc572b4_prod_lang_scss__WEBPACK_IMPORTED_MODULE_0__);
39681
+ /* unused harmony reexport * */
39682
+
39683
+
39684
39684
  /***/ }),
39685
39685
 
39686
39686
  /***/ "b64e":
@@ -43661,12 +43661,12 @@ module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
43661
43661
  // ESM COMPAT FLAG
43662
43662
  __webpack_require__.r(__webpack_exports__);
43663
43663
 
43664
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"3c7c6be7-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/main.vue?vue&type=template&id=2c521d9c
43665
- var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{key:_vm.key,staticClass:"hb-upload"},[_c('div',{directives:[{name:"layout-flex",rawName:"v-layout-flex",value:({ gutter: 20, maxWidth: 280 }),expression:"{ gutter: 20, maxWidth: 280 }"}],staticClass:"hb-upload-wrapper"},[_vm._l((_vm.list),function(item,index){return _c('div',{key:index,staticClass:"unit-item-wrapper"},[_c('div',{staticClass:"file unit-item",on:{"click":function($event){return _vm.viewFile(item)}}},[_c('HbSvg',{attrs:{"iconClass":_vm._f("fileIcon")(true,_vm.getSuffix(item.fileName)),"fontSize":"44px"}}),_c('div',{staticClass:"right"},[_c('div',{staticClass:"title"},[_vm._v(" "+_vm._s(item.fileName)+" ")]),_c('div',{staticClass:"info"},[_c('div',{staticClass:"time"},[_vm._v(_vm._s(item.createTime))]),_c('div',{staticClass:"icon"},[(_vm.showCover)?_c('i',{staticClass:"icon-main-huanyuan mr10",on:{"click":function($event){$event.stopPropagation();return _vm.openCover(index)}}}):_vm._e(),(_vm.showDownLoad(item))?_c('i',{staticClass:"icon-main-xiazai mr10",on:{"click":function($event){$event.stopPropagation();return _vm.downloadFile(item)}}}):_vm._e(),(_vm.showRemove)?_c('i',{staticClass:"icon-main-shanchu",on:{"click":function($event){$event.stopPropagation();return _vm.remove(index, item.fileName)}}}):_vm._e()])])])],1),_vm._t("default",null,{"fileData":item})],2)}),(_vm.editAble)?_c('div',{staticClass:"upload unit-item"},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.netDisc),expression:"netDisc"}],staticClass:"netdisc",on:{"click":_vm.openNetDisc}},[_vm._v("选择网盘地址")]),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.link),expression:"link"}],staticClass:"link",on:{"click":_vm.openLink}},[_vm._v("自定义链接")]),_c('div',{staticClass:"local-file",on:{"click":_vm.openFile}},[_c('i',{staticClass:"el-icon-plus"}),_vm._v(" 上传附件 "),_c('input',{ref:"input",staticClass:"hidden",attrs:{"type":"file","multiple":""},on:{"change":_vm.chooseFile}})]),(_vm.maxUpload)?_c('div',{staticClass:"maxUploadShow"},[_vm._v(_vm._s(_vm.list.length)+" / "+_vm._s(_vm.maxUpload))]):_vm._e()]):_vm._e(),_c('input',{ref:"coverInput",staticClass:"hidden",attrs:{"type":"file"},on:{"change":function (ev) { return _vm.coverFile(ev); }}})],2),_c('NetDisc',{ref:"netDisc",on:{"submit":_vm.addNet}}),_c('CustomLink',{ref:"customLink",on:{"submit":_vm.addLink}})],1)}
43664
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"3c7c6be7-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/main.vue?vue&type=template&id=0cc572b4
43665
+ var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{key:_vm.key,staticClass:"hb-upload"},[_c('div',{directives:[{name:"layout-flex",rawName:"v-layout-flex",value:({ gutter: 20, maxWidth: 280 }),expression:"{ gutter: 20, maxWidth: 280 }"}],staticClass:"hb-upload-wrapper"},[_vm._l((_vm.list),function(item,index){return _c('div',{key:item.fileUrl || item.id || index,staticClass:"unit-item-wrapper"},[_c('div',{staticClass:"file unit-item",on:{"click":function($event){return _vm.viewFile(item)}}},[_c('HbSvg',{attrs:{"iconClass":_vm._f("fileIcon")(true,_vm.getSuffix(item.fileName)),"fontSize":"44px"}}),_c('div',{staticClass:"right"},[_c('div',{staticClass:"title"},[_vm._v(" "+_vm._s(item.fileName)+" ")]),_c('div',{staticClass:"info"},[_c('div',{staticClass:"time"},[_vm._v(_vm._s(item.createTime))]),_c('div',{staticClass:"icon"},[(_vm.showCover)?_c('i',{staticClass:"icon-main-huanyuan mr10",on:{"click":function($event){$event.stopPropagation();return _vm.openCover(index)}}}):_vm._e(),(_vm.showDownLoad(item))?_c('i',{staticClass:"icon-main-xiazai mr10",on:{"click":function($event){$event.stopPropagation();return _vm.downloadFile(item)}}}):_vm._e(),(_vm.showRemove)?_c('i',{staticClass:"icon-main-shanchu",on:{"click":function($event){$event.stopPropagation();return _vm.remove(index, item.fileName)}}}):_vm._e()])])])],1),_vm._t("default",null,{"fileData":item})],2)}),_vm._l((_vm.uploadingList),function(item,index){return _c('div',{key:'uploading-' + index,staticClass:"unit-item-wrapper"},[_c('div',{staticClass:"file unit-item"},[_c('HbSvg',{attrs:{"iconClass":_vm._f("fileIcon")(true,_vm.getSuffix(item.fileName)),"fontSize":"44px"}}),_c('div',{staticClass:"right",staticStyle:{"flex-direction":"row","align-items":"center"}},[_c('div',{staticStyle:{"flex":"1","overflow":"hidden","margin-right":"10px"}},[_c('div',{staticClass:"title"},[_vm._v(_vm._s(item.fileName))]),_c('div',{staticClass:"info"},[_vm._v(" "+_vm._s(item.status === "transmitSuccess" ? "处理中..." : "上传中...")+" ")])]),_c('div',{staticClass:"progress-wrapper"},[_c('el-progress',{attrs:{"type":"circle","percentage":Math.floor(item.progress * 100),"width":50,"stroke-width":4}}),(item.status === 'padding' || item.status === 'inline')?_c('i',{staticClass:"el-icon-close cancel-btn",on:{"click":function($event){$event.stopPropagation();return _vm.cancelUpload(item)}}}):_vm._e()],1)])],1)])}),(_vm.editAble)?_c('div',{staticClass:"upload unit-item"},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.netDisc),expression:"netDisc"}],staticClass:"netdisc",on:{"click":_vm.openNetDisc}},[_vm._v(" 选择网盘地址 ")]),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.link),expression:"link"}],staticClass:"link",on:{"click":_vm.openLink}},[_vm._v("自定义链接")]),_c('div',{staticClass:"local-file",on:{"click":_vm.openFile}},[_c('i',{staticClass:"el-icon-plus"}),_vm._v(" 上传附件 "),_c('input',{ref:"input",staticClass:"hidden",attrs:{"type":"file","multiple":""},on:{"change":_vm.chooseFile}})]),(_vm.maxUpload)?_c('div',{staticClass:"maxUploadShow"},[_vm._v(" "+_vm._s(_vm.list.length)+" / "+_vm._s(_vm.maxUpload)+" ")]):_vm._e()]):_vm._e(),_c('input',{ref:"coverInput",staticClass:"hidden",attrs:{"type":"file"},on:{"change":function (ev) { return _vm.coverFile(ev); }}})],2),_c('NetDisc',{ref:"netDisc",on:{"submit":_vm.addNet}}),_c('CustomLink',{ref:"customLink",on:{"submit":_vm.addLink}})],1)}
43666
43666
  var staticRenderFns = []
43667
43667
 
43668
43668
 
43669
- // CONCATENATED MODULE: ./packages/upload/src/main.vue?vue&type=template&id=2c521d9c
43669
+ // CONCATENATED MODULE: ./packages/upload/src/main.vue?vue&type=template&id=0cc572b4
43670
43670
 
43671
43671
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
43672
43672
  var es_array_push = __webpack_require__("14d9");
@@ -43674,6 +43674,9 @@ var es_array_push = __webpack_require__("14d9");
43674
43674
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.constructor.js
43675
43675
  var es_iterator_constructor = __webpack_require__("e9f5");
43676
43676
 
43677
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.find.js
43678
+ var es_iterator_find = __webpack_require__("f665");
43679
+
43677
43680
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.for-each.js
43678
43681
  var es_iterator_for_each = __webpack_require__("7d54");
43679
43682
 
@@ -44016,6 +44019,55 @@ var CustomLink_component = Object(componentNormalizer["a" /* default */])(
44016
44019
 
44017
44020
 
44018
44021
 
44022
+
44023
+ //
44024
+ //
44025
+ //
44026
+ //
44027
+ //
44028
+ //
44029
+ //
44030
+ //
44031
+ //
44032
+ //
44033
+ //
44034
+ //
44035
+ //
44036
+ //
44037
+ //
44038
+ //
44039
+ //
44040
+ //
44041
+ //
44042
+ //
44043
+ //
44044
+ //
44045
+ //
44046
+ //
44047
+ //
44048
+ //
44049
+ //
44050
+ //
44051
+ //
44052
+ //
44053
+ //
44054
+ //
44055
+ //
44056
+ //
44057
+ //
44058
+ //
44059
+ //
44060
+ //
44061
+ //
44062
+ //
44063
+ //
44064
+ //
44065
+ //
44066
+ //
44067
+ //
44068
+ //
44069
+ //
44070
+ //
44019
44071
  //
44020
44072
  //
44021
44073
  //
@@ -44066,16 +44118,48 @@ var CustomLink_component = Object(componentNormalizer["a" /* default */])(
44066
44118
  //
44067
44119
  //
44068
44120
  //
44121
+ //
44122
+ //
44123
+ //
44124
+ //
44125
+ //
44126
+ //
44127
+ //
44128
+ //
44129
+ //
44130
+ //
44131
+ //
44132
+ //
44133
+
44069
44134
 
44070
44135
 
44071
44136
 
44137
+ // 提取文件图标映射配置,避免在过滤器中重复创建,提升性能
44138
+ const FILE_ICON_MAP = [{
44139
+ suffix: [".jpg", ".jpeg", ".png", ".gif"],
44140
+ icon: "icon-color-JPG"
44141
+ }, {
44142
+ suffix: [".doc", ".docx"],
44143
+ icon: "icon-color-wendang"
44144
+ }, {
44145
+ suffix: [".xls", ".xlsx"],
44146
+ icon: "icon-color-excel"
44147
+ }, {
44148
+ suffix: ".pdf",
44149
+ icon: "icon-color-pdf"
44150
+ }, {
44151
+ suffix: ".txt",
44152
+ icon: "icon-color-txt"
44153
+ }];
44072
44154
  /* harmony default export */ var mainvue_type_script_lang_js = ({
44073
44155
  name: "HbUpload",
44074
44156
  componentName: "HbUpload",
44075
44157
  data() {
44076
44158
  return {
44077
44159
  key: Math.random(),
44078
- coverIndex: 0 // 要覆盖的文件索引
44160
+ coverIndex: 0,
44161
+ // 要覆盖的文件索引
44162
+ uploadingList: [] // 正在上传的文件列表
44079
44163
  };
44080
44164
  },
44081
44165
  props: {
@@ -44102,8 +44186,34 @@ var CustomLink_component = Object(componentNormalizer["a" /* default */])(
44102
44186
  maxUpload: {
44103
44187
  type: Number,
44104
44188
  default: 0
44189
+ },
44190
+ _simpleUploadThreshold: {
44191
+ type: Number,
44192
+ default: 50 * 1024 * 1024 // 50MB
44105
44193
  }
44106
44194
  },
44195
+ created() {
44196
+ // 监听阿里OSS的上传进度和状态变化
44197
+ // 注意:这里使用的是 window 全局事件,可能会影响页面上其他相同组件实例
44198
+ // 建议:如果可能有多个实例,应确保事件携带唯一标识符
44199
+ window.addEventListener("netdiscItemProgress", this.onUploadProgress);
44200
+ window.addEventListener("netdiscItemStatusChange", this.onUploadStatusChange);
44201
+ },
44202
+ beforeDestroy() {
44203
+ // 取消上传 : 传输中或排队中的文件
44204
+ this.uploadingList.forEach(item => {
44205
+ if (item.status === "padding" || item.status === "inline") {
44206
+ window.dispatchEvent(new CustomEvent("netdiscCancelUpload", {
44207
+ bubbles: false,
44208
+ detail: {
44209
+ file: item.file
44210
+ }
44211
+ }));
44212
+ }
44213
+ });
44214
+ window.removeEventListener("netdiscItemProgress", this.onUploadProgress);
44215
+ window.removeEventListener("netdiscItemStatusChange", this.onUploadStatusChange);
44216
+ },
44107
44217
  methods: {
44108
44218
  viewFile(item) {
44109
44219
  if (!item.onlineUrl) {
@@ -44130,27 +44240,62 @@ var CustomLink_component = Object(componentNormalizer["a" /* default */])(
44130
44240
  this.$refs.coverInput.click();
44131
44241
  },
44132
44242
  coverFile(ev) {
44133
- console.log(ev.target.files[0]);
44134
- let files = new FormData();
44135
- files.append("files[0]", ev.target.files[0]);
44136
- this.$http.post("/sysFiles/uploads", files).then(res => {
44137
- this.$message.success("上传成功");
44138
- //处理返回的数据
44139
- let coverList = res.map(item => ({
44140
- fileName: item.fileName,
44141
- fileType: "1",
44142
- fileUrl: item.fileUrl,
44143
- downUrl: item.downUrl,
44144
- onlineUrl: item.onlineUrl,
44145
- fileSize: item.fileSize
44146
- }));
44147
- const coverOriginData = this.$lodash.cloneDeep(this.list[this.coverIndex]);
44148
- this.list.splice(this.coverIndex, 1, coverList[0]);
44149
- this.$emit("coverSuccess", {
44150
- index: this.coverIndex,
44151
- fileList: this.list,
44152
- coverOriginData
44243
+ const file = ev.target.files[0];
44244
+ if (!file) return;
44245
+
44246
+ // Check if there's already an active cover upload for this index
44247
+ const existingCover = this.uploadingList.find(item => item.isCover && item.coverIndex === this.coverIndex && (item.status === "padding" || item.status === "inline"));
44248
+ if (existingCover) {
44249
+ this.$confirm("当前正在覆盖该文件,是否取消之前的上传并开始新的覆盖?", "提示", {
44250
+ confirmButtonText: "确定",
44251
+ cancelButtonText: "取消",
44252
+ type: "warning"
44253
+ }).then(() => {
44254
+ // Cancel the previous upload
44255
+ this.cancelUpload(existingCover, false); // Pass false to skip confirm dialog inside cancelUpload
44256
+ this.startCoverUpload(file);
44257
+ }).catch(() => {
44258
+ // Do nothing, keep the old upload
44259
+ ev.target.value = "";
44153
44260
  });
44261
+ } else {
44262
+ this.startCoverUpload(file);
44263
+ }
44264
+ ev.target.value = "";
44265
+ },
44266
+ // 点击覆盖按钮 执行阿里OSS上传操作
44267
+ startCoverUpload(file) {
44268
+ const uploadItem = {
44269
+ fileName: file.name,
44270
+ fileSize: file.size,
44271
+ progress: 0,
44272
+ status: "padding",
44273
+ file: file,
44274
+ // Keep reference
44275
+ isCover: true,
44276
+ // Mark as cover operation
44277
+ coverIndex: this.coverIndex // Store the index
44278
+ };
44279
+ this.uploadingList.push(uploadItem);
44280
+ // 通过后端接口获取到上传阿里所需token
44281
+ this.getSTSToken().then(res => {
44282
+ window.dispatchEvent(new CustomEvent("netdiscUpload", {
44283
+ bubbles: false,
44284
+ detail: {
44285
+ type: "file",
44286
+ fileList: [file],
44287
+ path: [],
44288
+ token: res,
44289
+ _unUploadByNetdisc: true,
44290
+ // 不是在网盘上传的文件
44291
+ _doNotOpenUploader: true,
44292
+ // 不需要打开上传进度
44293
+ _simpleUploadThreshold: this._simpleUploadThreshold // 简单上传与分片上传的阈值
44294
+ }
44295
+ }));
44296
+ }).catch(() => {
44297
+ this.$message.error("ali-oss token获取失败");
44298
+ this.removeFromUploading(uploadItem);
44154
44299
  });
44155
44300
  },
44156
44301
  openNetDisc() {
@@ -44174,16 +44319,102 @@ var CustomLink_component = Object(componentNormalizer["a" /* default */])(
44174
44319
  }
44175
44320
  this.$refs.input.click();
44176
44321
  },
44322
+ // 选择文件 执行上传阿里OSS操作
44177
44323
  chooseFile(ev) {
44178
44324
  let fileList = Array.from(ev.target.files);
44179
- console.log(ev);
44180
- let files = new FormData();
44181
- fileList.forEach((item, index) => {
44182
- files.append(`files[${index}]`, item);
44325
+ fileList.forEach(file => {
44326
+ this.uploadingList.push({
44327
+ fileName: file.name,
44328
+ fileSize: file.size,
44329
+ progress: 0,
44330
+ status: "padding",
44331
+ file: file // Keep reference
44332
+ });
44183
44333
  });
44184
- this.$http.post("/sysFiles/uploads", files).then(res => {
44185
- this.$message.success("上传成功");
44186
- //处理返回的数据
44334
+ // 通过后端接口获取到上传阿里所需token
44335
+ this.getSTSToken().then(res => {
44336
+ window.dispatchEvent(new CustomEvent("netdiscUpload", {
44337
+ bubbles: false,
44338
+ detail: {
44339
+ type: "file",
44340
+ fileList: fileList,
44341
+ path: [],
44342
+ token: res,
44343
+ _unUploadByNetdisc: true,
44344
+ // 不是在网盘上传的文件
44345
+ _doNotOpenUploader: true,
44346
+ // 不需要打开上传进度
44347
+ _simpleUploadThreshold: this._simpleUploadThreshold // 简单上传与分片上传的阈值
44348
+ }
44349
+ }));
44350
+ }).catch(() => {
44351
+ this.$message.error("ali-oss token获取失败");
44352
+ // Remove from uploading list if token fails
44353
+ fileList.forEach(file => {
44354
+ const index = this.uploadingList.findIndex(i => i.file === file);
44355
+ if (index > -1) this.uploadingList.splice(index, 1);
44356
+ });
44357
+ });
44358
+ ev.target.value = "";
44359
+ },
44360
+ getSTSToken() {
44361
+ return this.$http.get("/ndRecord/getStsToken", {
44362
+ baseURL: "/platform"
44363
+ }).then(res => {
44364
+ let token = {
44365
+ region: "oss-cn-hangzhou",
44366
+ accessKeyId: res.credentials.accessKeyId,
44367
+ accessKeySecret: res.credentials.accessKeySecret,
44368
+ stsToken: res.credentials.securityToken,
44369
+ bucket: res.bucket
44370
+ };
44371
+ return Promise.resolve(token);
44372
+ }).catch(error => {
44373
+ return Promise.reject(error);
44374
+ });
44375
+ },
44376
+ // 监听阿里上传进度
44377
+ onUploadProgress(e) {
44378
+ const {
44379
+ file,
44380
+ progress
44381
+ } = e.detail;
44382
+ const item = this.uploadingList.find(i => i.file === file);
44383
+ if (item) {
44384
+ item.progress = progress;
44385
+ }
44386
+ },
44387
+ // 监听阿里上传状态变化
44388
+ onUploadStatusChange(e) {
44389
+ const {
44390
+ file,
44391
+ status
44392
+ } = e.detail;
44393
+ const item = this.uploadingList.find(i => i.file === file);
44394
+ if (item) {
44395
+ item.status = status;
44396
+ if (status === "transmitSuccess") {
44397
+ this.handleUploadSuccess(item); // 上传阿里成功
44398
+ } else if (status === "failed") {
44399
+ this.$message.error(`${item.fileName} 上传失败`);
44400
+ this.removeFromUploading(item); // 上传阿里失败
44401
+ } else if (status === "cancel") {
44402
+ this.removeFromUploading(item); // 上传阿里取消
44403
+ }
44404
+ }
44405
+ },
44406
+ // 上传阿里成功 执行保存文件信息操作
44407
+ handleUploadSuccess(item) {
44408
+ const payload = [{
44409
+ fileName: item.fileName,
44410
+ fileSize: item.fileSize,
44411
+ fileSuffix: this.getSuffix(item.fileName),
44412
+ fileType: "1",
44413
+ fileUrl: item.file.path
44414
+ }];
44415
+ // 经过后端拿到上传到阿里的文件的信息
44416
+ this.$http.post("/sysFiles/getSysFilesVo", payload).then(res => {
44417
+ // 处理返回的数据
44187
44418
  let addList = res.map(item => ({
44188
44419
  fileName: item.fileName,
44189
44420
  fileType: "1",
@@ -44192,15 +44423,36 @@ var CustomLink_component = Object(componentNormalizer["a" /* default */])(
44192
44423
  onlineUrl: item.onlineUrl,
44193
44424
  fileSize: item.fileSize
44194
44425
  }));
44195
- addList.forEach(item => {
44196
- this.list.push(item);
44197
- });
44198
- this.$emit("uploadSuccess", {
44199
- fileList: this.list,
44200
- addData: this.$lodash.cloneDeep(addList)
44201
- });
44426
+ if (item.isCover) {
44427
+ const coverOriginData = this.$lodash.cloneDeep(this.list[item.coverIndex]);
44428
+ this.list.splice(item.coverIndex, 1, addList[0]);
44429
+ this.$emit("coverSuccess", {
44430
+ index: item.coverIndex,
44431
+ fileList: this.list,
44432
+ coverOriginData
44433
+ });
44434
+ } else {
44435
+ addList.forEach(item => {
44436
+ this.list.push(item);
44437
+ });
44438
+ this.$emit("uploadSuccess", {
44439
+ fileList: this.list,
44440
+ addData: this.$lodash.cloneDeep(addList)
44441
+ });
44442
+ }
44443
+ this.removeFromUploading(item);
44444
+ }).catch(() => {
44445
+ this.$message.error("保存文件信息失败");
44446
+ this.removeFromUploading(item);
44202
44447
  });
44203
44448
  },
44449
+ // 移除正在进行阿里上传的文件项
44450
+ removeFromUploading(item) {
44451
+ const index = this.uploadingList.indexOf(item);
44452
+ if (index > -1) {
44453
+ this.uploadingList.splice(index, 1);
44454
+ }
44455
+ },
44204
44456
  addLink(data) {
44205
44457
  if (this.maxUpload && this.list.length + 1 > this.maxUpload) {
44206
44458
  this.$message.error("最多上传" + this.maxUpload + "个文件");
@@ -44233,6 +44485,29 @@ var CustomLink_component = Object(componentNormalizer["a" /* default */])(
44233
44485
  });
44234
44486
  }).catch(() => {});
44235
44487
  },
44488
+ // 取消上传阿里
44489
+ cancelUpload(item, confirm = true) {
44490
+ const doCancel = () => {
44491
+ window.dispatchEvent(new CustomEvent("netdiscCancelUpload", {
44492
+ bubbles: false,
44493
+ detail: {
44494
+ file: item.file
44495
+ }
44496
+ }));
44497
+ this.removeFromUploading(item);
44498
+ };
44499
+ if (confirm) {
44500
+ this.$confirm(`确定要取消上传 ${item.fileName} 吗?`, "提示", {
44501
+ confirmButtonText: "确定",
44502
+ cancelButtonText: "取消",
44503
+ type: "warning"
44504
+ }).then(() => {
44505
+ doCancel();
44506
+ }).catch(() => {});
44507
+ } else {
44508
+ doCancel();
44509
+ }
44510
+ },
44236
44511
  rerendering() {
44237
44512
  this.key = Math.random();
44238
44513
  }
@@ -44266,30 +44541,14 @@ var CustomLink_component = Object(componentNormalizer["a" /* default */])(
44266
44541
  },
44267
44542
  filters: {
44268
44543
  fileIcon(isFile, fileType) {
44269
- var _fileMap$find;
44544
+ var _FILE_ICON_MAP$find;
44270
44545
  if (!isFile) {
44271
44546
  return "icon-color-wenjianjia";
44272
44547
  }
44273
44548
  const lowerFileType = fileType.toLowerCase();
44274
- const fileMap = [{
44275
- suffix: [".jpg", ".jpeg", ".png", ".gif"],
44276
- icon: "icon-color-JPG"
44277
- }, {
44278
- suffix: [".doc", ".docx"],
44279
- icon: "icon-color-wendang"
44280
- }, {
44281
- suffix: [".xls", ".xlsx"],
44282
- icon: "icon-color-excel"
44283
- }, {
44284
- suffix: ".pdf",
44285
- icon: "icon-color-pdf"
44286
- }, {
44287
- suffix: ".txt",
44288
- icon: "icon-color-txt"
44289
- }];
44290
- const iconClass = (_fileMap$find = fileMap.find(item => {
44549
+ const iconClass = (_FILE_ICON_MAP$find = FILE_ICON_MAP.find(item => {
44291
44550
  return typeof item.suffix === "string" ? item.suffix === lowerFileType : item.suffix.includes(lowerFileType);
44292
- })) === null || _fileMap$find === void 0 ? void 0 : _fileMap$find.icon;
44551
+ })) === null || _FILE_ICON_MAP$find === void 0 ? void 0 : _FILE_ICON_MAP$find.icon;
44293
44552
  return iconClass || "icon-color-qita1";
44294
44553
  }
44295
44554
  },
@@ -44300,8 +44559,8 @@ var CustomLink_component = Object(componentNormalizer["a" /* default */])(
44300
44559
  });
44301
44560
  // CONCATENATED MODULE: ./packages/upload/src/main.vue?vue&type=script&lang=js
44302
44561
  /* harmony default export */ var src_mainvue_type_script_lang_js = (mainvue_type_script_lang_js);
44303
- // EXTERNAL MODULE: ./packages/upload/src/main.vue?vue&type=style&index=0&id=2c521d9c&prod&lang=scss
44304
- var mainvue_type_style_index_0_id_2c521d9c_prod_lang_scss = __webpack_require__("2070");
44562
+ // EXTERNAL MODULE: ./packages/upload/src/main.vue?vue&type=style&index=0&id=0cc572b4&prod&lang=scss
44563
+ var mainvue_type_style_index_0_id_0cc572b4_prod_lang_scss = __webpack_require__("b639");
44305
44564
 
44306
44565
  // CONCATENATED MODULE: ./packages/upload/src/main.vue
44307
44566