xianniu-ui 0.8.35 → 0.8.37

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.35",
3
+ "version": "0.8.37",
4
4
  "private": false,
5
5
  "main": "lib/xianniu-ui.umd.min.js",
6
6
  "scripts": {
@@ -1,4 +1,13 @@
1
1
  .xn-upload {
2
+ .el-upload-list__item{
3
+ &.is-success{
4
+ &:hover{
5
+ .el-upload-list__item-status-label{
6
+ display: none !important;
7
+ }
8
+ }
9
+ }
10
+ }
2
11
  &.is-hidden {
3
12
  .el-upload {
4
13
  &.el-upload--picture-card {
@@ -56,6 +65,7 @@
56
65
  -webkit-box-orient: vertical;
57
66
  }
58
67
  }
68
+
59
69
  }
60
70
  &.is-disabled {
61
71
  .el-upload.el-upload--picture-card {
@@ -15,7 +15,7 @@
15
15
  :http-request="onHttpUpload"
16
16
  :on-error="onError"
17
17
  :before-upload="onBeforeUpload"
18
- :style="{ ...styles,...idCardSizeData }"
18
+ :style="{ ...styles, ...idCardSizeData }"
19
19
  :on-exceed="onExceed"
20
20
  :on-change="onChange"
21
21
  :on-preview="onPreviewFile"
@@ -38,11 +38,61 @@
38
38
  </slot>
39
39
  </template>
40
40
 
41
+ <template
42
+ slot="file"
43
+ slot-scope="{ file }"
44
+ v-if="['list'].includes(listType)"
45
+ >
46
+ <a
47
+ class="el-upload-list__item-name"
48
+ @click="handlePictureCardPreview(file)"
49
+ v-if="$utils.isImg(file)"
50
+ ><i class="el-icon-document"></i>{{ file.name }}
51
+ </a>
52
+ <a
53
+ class="el-upload-list__item-name"
54
+ @click="handleAVPreview(file)"
55
+ v-else-if="$utils.isAV(file)"
56
+ ><i class="el-icon-document"></i>{{ file.name }}
57
+ </a>
58
+ <a
59
+ class="el-upload-list__item-name"
60
+ @click="handleDownload(file)"
61
+ v-else
62
+ ><i class="el-icon-document"></i>{{ file.name }}
63
+ </a>
64
+ <a class="el-upload-list__item-name" v-if="file.status === 'uploading'"
65
+ ><i class="el-icon-document"></i>{{ file.name }}
66
+ </a>
67
+ <el-progress
68
+ v-if="file.status === 'uploading'"
69
+ type="line"
70
+ :stroke-width="2"
71
+ :percentage="process(file.percentage || 0)"
72
+ >
73
+ </el-progress>
74
+ <label
75
+ v-if="file.status === 'success'"
76
+ class="el-upload-list__item-status-label"
77
+ >
78
+ <i
79
+ :class="{
80
+ 'el-icon-upload-success': true,
81
+ 'el-icon-circle-check': true
82
+ }"
83
+ ></i>
84
+ </label>
85
+ <i
86
+ class="el-icon-close"
87
+ @click="handleRemove(file, fileList)"
88
+ v-if="allowDelete || ($attrs.disabled==null && !preview) || hideUpload"
89
+ ></i>
90
+ </template>
41
91
  <div
42
92
  slot="file"
43
93
  slot-scope="{ file }"
44
94
  class="xn-upload--slot"
45
- v-if="['picture-card', 'idcard'].includes(listType)"
95
+ v-else-if="['picture-card', 'idcard'].includes(listType)"
46
96
  >
47
97
  <uploadPop :file="file" @on-download="handleDownload(file)"></uploadPop>
48
98
  <template v-if="$utils.isImg(file)">
@@ -55,7 +105,10 @@
55
105
  <template v-else-if="$utils.isAV(file)">
56
106
  <el-image
57
107
  class="el-upload-list__item-thumbnail"
58
- :src="file.url + '?x-oss-process=video/snapshot,t_0,f_jpg,w_0,h_0,m_fast,ar_auto'"
108
+ :src="
109
+ file.url +
110
+ '?x-oss-process=video/snapshot,t_0,f_jpg,w_0,h_0,m_fast,ar_auto'
111
+ "
59
112
  fit="cover"
60
113
  />
61
114
  </template>
@@ -84,7 +137,7 @@
84
137
  >
85
138
  <i class="fz-16 el-icon-zoom-in" />
86
139
  </span>
87
- <span
140
+ <span
88
141
  v-if="$utils.isAV(file)"
89
142
  class="el-upload-list__item-preview"
90
143
  @click="handleAVPreview(file)"
@@ -122,7 +175,7 @@ import ElImageViewer from "element-ui/packages/image/src/image-viewer";
122
175
  import Client from "@/oss";
123
176
  import uploadPop from "./upload-pop.vue";
124
177
  import idCard from "./idCard.vue";
125
- import AV from './AV'
178
+ import AV from "./AV";
126
179
  // const MAX_WARNING = 1024 * 10 * 1024;
127
180
  export default {
128
181
  name: "XnUpload",
@@ -131,14 +184,14 @@ export default {
131
184
  uploadPop,
132
185
  ElImageViewer,
133
186
  idCard,
134
- AV
187
+ AV,
135
188
  },
136
189
  props: {
137
190
  listType: {
138
191
  type: String,
139
192
  default: "picture-card",
140
193
  },
141
- allowDelete:{
194
+ allowDelete: {
142
195
  type: Boolean,
143
196
  default: false,
144
197
  },
@@ -196,8 +249,8 @@ export default {
196
249
  oss: null,
197
250
  client: null,
198
251
  idCardSizeData: {},
199
- isShowAV:false,
200
- avUrl:''
252
+ isShowAV: false,
253
+ avUrl: "",
201
254
  };
202
255
  },
203
256
  computed: {
@@ -224,7 +277,7 @@ export default {
224
277
  stsUrl: this.$XN.stsUrl || "",
225
278
  setFileIdUrl: this.$XN.setFileIdUrl || "",
226
279
  });
227
- this.idCardSize()
280
+ this.idCardSize();
228
281
  },
229
282
  beforeDestroy() {
230
283
  // this.$emit("update:fileList", []);
@@ -326,8 +379,8 @@ export default {
326
379
  this.imageView = file.url;
327
380
  });
328
381
  },
329
- handleAVPreview(file){
330
- this.isShowAV = true
382
+ handleAVPreview(file) {
383
+ this.isShowAV = true;
331
384
  this.$nextTick(() => {
332
385
  this.avUrl = file.url;
333
386
  });
@@ -357,15 +410,15 @@ export default {
357
410
  abortUpload() {
358
411
  return this.oss.oss.cancel();
359
412
  },
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)
413
+ onPreviewFile(file) {
414
+ if (file.isAV === 1) {
415
+ this.handleAVPreview(file);
416
+ } else if (file.imgFlag === 1) {
417
+ this.handlePictureCardPreview(file);
418
+ } else {
419
+ this.handleDownload(file);
367
420
  }
368
- }
421
+ },
369
422
  },
370
423
  };
371
424
  </script>