xianniu-ui 0.8.33 → 0.8.34

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xianniu-ui",
3
- "version": "0.8.33",
3
+ "version": "0.8.34",
4
4
  "private": false,
5
5
  "main": "lib/xianniu-ui.umd.min.js",
6
6
  "scripts": {
@@ -114,6 +114,7 @@ export default {
114
114
  oss: null,
115
115
  client: null,
116
116
  successFiles: [],
117
+ count: 0,
117
118
  };
118
119
  },
119
120
  created() {
@@ -130,6 +131,7 @@ export default {
130
131
  this.abort();
131
132
  this.fileList = [];
132
133
  this.successFiles = [];
134
+ this.count = 0;
133
135
  }
134
136
  this.$emit("update:show", false);
135
137
  },
@@ -172,10 +174,9 @@ export default {
172
174
  .upload(file)
173
175
  .then((res) => {
174
176
  this.successFiles.push(res);
175
- this.$emit("on-success", this.successFiles);
177
+ this.$emit("on-success", res);
176
178
  })
177
- .catch(() => {
178
- });
179
+ .catch(() => {});
179
180
  }
180
181
  } catch (error) {
181
182
  file.onError();
@@ -211,13 +212,18 @@ export default {
211
212
  if (!this.fileList.length) {
212
213
  return this.$message.warning("请选择要上传的文件");
213
214
  }
214
- this.submit();
215
+ if (this.autoUpload) {
216
+ this.submit();
217
+ }
215
218
  });
216
219
  } else {
217
220
  if (!this.fileList.length) {
218
221
  return this.$message.warning("请选择要上传的文件");
219
222
  }
220
- this.submit();
223
+ if (this.autoUpload) {
224
+ this.submit();
225
+ }
226
+ this.$emit("on-confirm", this.successFiles);
221
227
  }
222
228
  },
223
229
  isPromise(obj) {
@@ -148,6 +148,13 @@
148
148
  width: 50%;
149
149
  }
150
150
  }
151
+ .el-upload--list{
152
+ width: 100%;
153
+ }
154
+ .el-upload-dragger{
155
+ width: 100%;
156
+ height: 100%;
157
+ }
151
158
  }
152
159
  .xn-idcard {
153
160
  position: relative;
@@ -18,6 +18,7 @@
18
18
  :style="{ ...styles,...idCardSizeData }"
19
19
  :on-exceed="onExceed"
20
20
  :on-change="onChange"
21
+ :on-preview="onPreviewFile"
21
22
  >
22
23
  <template v-if="listType === 'idcard'">
23
24
  <template slot="trigger">
@@ -297,18 +298,17 @@ export default {
297
298
  .then((res) => {
298
299
  this.successFiles.push(res);
299
300
  this.$emit("update:fileList", this.successFiles);
301
+ this.$emit("on-file", this.res);
300
302
  this.$emit("on-success", this.successFiles);
301
303
  this.$emit("on-uploaded", true);
302
304
  this.isUploading = false;
303
305
  })
304
- .catch((err) => {
305
- console.log(err);
306
+ .catch(() => {
306
307
  this.$emit("update:fileList", this.successFiles);
307
308
  });
308
309
  },
309
310
 
310
- onError(err) {
311
- console.log(err);
311
+ onError() {
312
312
  this.$message.error("上传失败,请重试");
313
313
  },
314
314
  onSubmitUpload() {
@@ -357,6 +357,15 @@ export default {
357
357
  abortUpload() {
358
358
  return this.oss.oss.cancel();
359
359
  },
360
+ onPreviewFile(file){
361
+ if(file.isAV === 1){
362
+ this.handleAVPreview(file)
363
+ }else if(file.imgFlag === 1){
364
+ this.handlePictureCardPreview(file)
365
+ }else{
366
+ this.handleDownload(file)
367
+ }
368
+ }
360
369
  },
361
370
  };
362
371
  </script>
File without changes