@10yun/cv-mobile-ui 0.5.62 → 0.5.63
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 +1 -1
- package/plugins/uni-extend.js +10 -10
- package/ui-fireui/components/u-action-sheet/u-action-sheet.vue +46 -16
- package/ui-fireui/components/u-alert/u-alert.vue +11 -5
- package/ui-fireui/components/u-badge/u-badge.vue +52 -69
- package/ui-fireui/components/u-bottom-navigation/u-bottom-navigation.vue +28 -20
- package/ui-fireui/components/u-bottom-popup/u-bottom-popup.vue +40 -11
- package/ui-fireui/components/u-bubble-popup/u-bubble-popup.vue +3 -6
- package/ui-fireui/components/u-button/u-button.vue +262 -259
- package/ui-fireui/components/u-calendar/u-calendar.vue +227 -44
- package/ui-fireui/components/u-calendar/u-calendar2.js +562 -0
- package/ui-fireui/components/u-card/u-card.vue +50 -32
- package/ui-fireui/components/u-cascade-selection/u-cascade-selection.vue +197 -74
- package/ui-fireui/components/u-circular-progress/u-circular-progress.vue +324 -0
- package/ui-fireui/components/u-clipboard2/tui-clipboard.js +53 -0
- package/ui-fireui/components/u-collapse/u-collapse.vue +8 -8
- package/ui-fireui/components/u-config/index.js +129 -0
- package/ui-fireui/components/u-count-down/u-count-down.vue +124 -19
- package/ui-fireui/components/u-datetime/u-datetime.vue +416 -176
- package/ui-fireui/components/u-divider/u-divider.vue +3 -3
- package/ui-fireui/components/u-drawer/u-drawer.vue +55 -12
- package/ui-fireui/components/u-dropdown-list/u-dropdown-list.vue +103 -0
- package/ui-fireui/components/u-fab/u-fab.vue +344 -0
- package/ui-fireui/components/u-footer/u-footer.vue +148 -0
- package/ui-fireui/components/u-grid/u-grid.vue +2 -8
- package/ui-fireui/components/u-grid-item/u-grid-item.vue +22 -5
- package/ui-fireui/components/u-icon/u-icon-new.js +190 -0
- package/ui-fireui/components/u-icon/u-icon-new.vue +100 -0
- package/ui-fireui/components/u-image-cropper/u-image-cropper.vue +1144 -0
- package/ui-fireui/components/u-image-group/u-image-group.vue +164 -0
- package/ui-fireui/components/u-keyboard/u-keyboard.vue +3 -2
- package/ui-fireui/components/u-keyboard-input/u-keyboard-input.vue +1 -1
- package/ui-fireui/components/u-list-cell/u-list-cell.vue +82 -72
- package/ui-fireui/components/u-list-view/u-list-view.vue +33 -8
- package/ui-fireui/components/u-loading/u-loading.vue +107 -27
- package/ui-fireui/components/u-loadmore/u-loadmore.vue +21 -3
- package/ui-fireui/components/u-modal/u-modal.vue +140 -176
- package/ui-fireui/components/u-navigation-bar/u-navigation-bar.vue +121 -28
- package/ui-fireui/components/u-no-data/u-no-data.vue +58 -20
- package/ui-fireui/components/u-nomore/u-nomore.vue +5 -4
- package/ui-fireui/components/u-numberbox/u-numberbox.vue +88 -45
- package/ui-fireui/components/u-picture-cropper/u-picture-cropper.vue +94 -36
- package/ui-fireui/components/u-picture-cropper/u-picture-cropper.wxs +27 -17
- package/ui-fireui/components/u-rate/u-rate.vue +197 -0
- package/ui-fireui/components/u-round-progress/u-round-progress.vue +62 -42
- package/ui-fireui/components/u-scroll-top/u-scroll-top.vue +4 -3
- package/ui-fireui/components/u-section/u-section.vue +149 -0
- package/ui-fireui/components/u-skeleton/u-skeleton.vue +37 -6
- package/ui-fireui/components/u-steps/u-steps.vue +110 -27
- package/ui-fireui/components/u-sticky/u-sticky.vue +35 -21
- package/ui-fireui/components/u-sticky-wxs/u-sticky-wxs.vue +7 -4
- package/ui-fireui/components/u-sticky-wxs/u-sticky.wxs +39 -36
- package/ui-fireui/components/u-swipe-action/u-swipe-action.vue +76 -19
- package/ui-fireui/components/u-tabbar/u-tabbar.vue +71 -38
- package/ui-fireui/components/u-tabs/u-tabs.vue +133 -51
- package/ui-fireui/components/u-tag/u-tag.vue +109 -226
- package/ui-fireui/components/u-time-axis/u-time-axis.vue +1 -1
- package/ui-fireui/components/u-timeaxis-item/u-timeaxis-item.vue +1 -1
- package/ui-fireui/components/u-tips/u-tips.vue +35 -15
- package/ui-fireui/components/u-toast/u-toast.vue +9 -5
- package/ui-fireui/components/u-top-dropdown/u-top-dropdown.vue +8 -6
- package/ui-fireui/components/u-upload/u-upload-old.vue +462 -0
- package/ui-fireui/components/u-upload/u-upload.vue +648 -446
- package/ui-fireui/components/u-white-space/u-white-space.vue +68 -0
- package/ui-fireui/components/u-wing-blank/u-wing-blank.vue +100 -0
- package/uview-plus/libs/ctocode/index.js +1 -0
- package/uview-plus/libs/ctocode/richText.js +0 -1
|
@@ -1,446 +1,648 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="up-
|
|
3
|
-
<view class="up-upload-box">
|
|
4
|
-
<view
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
</
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
this
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
.
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
.
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
.
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
.
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
.
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
.
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<view class="up-upload__container">
|
|
3
|
+
<view class="up-upload-box">
|
|
4
|
+
<view
|
|
5
|
+
class="up-image-item"
|
|
6
|
+
:style="{ width: width + 'rpx', height: height + 'rpx', borderRadius: radius + 'rpx' }"
|
|
7
|
+
v-for="(item, index) in imageList"
|
|
8
|
+
:key="index"
|
|
9
|
+
>
|
|
10
|
+
<image
|
|
11
|
+
:src="item"
|
|
12
|
+
class="up-item-img"
|
|
13
|
+
:style="{ width: width + 'rpx', height: height + 'rpx', borderRadius: radius + 'rpx' }"
|
|
14
|
+
@tap.stop="previewImage(index)"
|
|
15
|
+
mode="aspectFill"
|
|
16
|
+
></image>
|
|
17
|
+
<view v-if="!forbidDel" class="up-img-del" :style="{ background: getDelColor }" @tap.stop="delImage(index)"></view>
|
|
18
|
+
<view v-if="statusArr[index] != 1" class="up-upload-mask">
|
|
19
|
+
<view class="up-upload-loading" v-if="statusArr[index] == 2"></view>
|
|
20
|
+
<text class="up-tips">{{ statusArr[index] == 2 ? '上传中...' : '上传失败' }}</text>
|
|
21
|
+
<view
|
|
22
|
+
class="up-mask-btn"
|
|
23
|
+
v-if="statusArr[index] == 3"
|
|
24
|
+
@tap.stop="reUpLoad(index)"
|
|
25
|
+
hover-class="up-btn-hover"
|
|
26
|
+
:hover-stay-time="150"
|
|
27
|
+
>
|
|
28
|
+
重新上传
|
|
29
|
+
</view>
|
|
30
|
+
</view>
|
|
31
|
+
</view>
|
|
32
|
+
<view
|
|
33
|
+
v-if="isShowAdd"
|
|
34
|
+
class="up-upload-add"
|
|
35
|
+
:class="[borderColor !== 'transparent' ? 'up-upload__border' : 'up-upload__unborder']"
|
|
36
|
+
:style="{
|
|
37
|
+
width: width + 'rpx',
|
|
38
|
+
height: height + 'rpx',
|
|
39
|
+
background: background,
|
|
40
|
+
borderRadius: radius + 'rpx',
|
|
41
|
+
borderColor: borderColor,
|
|
42
|
+
borderStyle: borderSytle
|
|
43
|
+
}"
|
|
44
|
+
@tap="chooseImage"
|
|
45
|
+
>
|
|
46
|
+
<slot>
|
|
47
|
+
<view class="up-upload-icon up-icon-plus" :style="{ color: addColor, fontSize: addSize + 'rpx' }"></view>
|
|
48
|
+
</slot>
|
|
49
|
+
</view>
|
|
50
|
+
</view>
|
|
51
|
+
</view>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<script>
|
|
55
|
+
export default {
|
|
56
|
+
name: 'tuiUpload',
|
|
57
|
+
emits: ['remove', 'complete', 'reupload'],
|
|
58
|
+
props: {
|
|
59
|
+
//展示图片宽度
|
|
60
|
+
width: {
|
|
61
|
+
type: [Number, String],
|
|
62
|
+
default: 218
|
|
63
|
+
},
|
|
64
|
+
//展示图片高度
|
|
65
|
+
height: {
|
|
66
|
+
type: [Number, String],
|
|
67
|
+
default: 218
|
|
68
|
+
},
|
|
69
|
+
//初始化图片路径
|
|
70
|
+
value: {
|
|
71
|
+
type: Array,
|
|
72
|
+
default() {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
//2.3.0+
|
|
77
|
+
radius: {
|
|
78
|
+
type: [Number, String],
|
|
79
|
+
default: 0
|
|
80
|
+
},
|
|
81
|
+
//2.3.0+
|
|
82
|
+
background: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: '#F7F7F7'
|
|
85
|
+
},
|
|
86
|
+
//2.3.0+
|
|
87
|
+
borderColor: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: 'transparent'
|
|
90
|
+
},
|
|
91
|
+
//2.3.0+
|
|
92
|
+
//solid、dashed、dotted
|
|
93
|
+
borderSytle: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: 'dashed'
|
|
96
|
+
},
|
|
97
|
+
//2.3.0+
|
|
98
|
+
delColor: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: ''
|
|
101
|
+
},
|
|
102
|
+
//删除图片前是否弹框确认
|
|
103
|
+
delConfirm: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: false
|
|
106
|
+
},
|
|
107
|
+
//禁用删除
|
|
108
|
+
forbidDel: {
|
|
109
|
+
type: Boolean,
|
|
110
|
+
default: false
|
|
111
|
+
},
|
|
112
|
+
//V2.9.6+ 删除图片是否触发 @complete 事件
|
|
113
|
+
delTrigger: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
default: true
|
|
116
|
+
},
|
|
117
|
+
//2.3.0+
|
|
118
|
+
addColor: {
|
|
119
|
+
type: String,
|
|
120
|
+
default: '#888'
|
|
121
|
+
},
|
|
122
|
+
//2.3.0+
|
|
123
|
+
addSize: {
|
|
124
|
+
type: [Number, String],
|
|
125
|
+
default: 68
|
|
126
|
+
},
|
|
127
|
+
//禁用添加
|
|
128
|
+
forbidAdd: {
|
|
129
|
+
type: Boolean,
|
|
130
|
+
default: false
|
|
131
|
+
},
|
|
132
|
+
//服务器接口地址。当接口地址为空时,直接返回本地图片地址
|
|
133
|
+
serverUrl: {
|
|
134
|
+
type: String,
|
|
135
|
+
default: ''
|
|
136
|
+
},
|
|
137
|
+
//限制数
|
|
138
|
+
limit: {
|
|
139
|
+
type: Number,
|
|
140
|
+
default: 9
|
|
141
|
+
},
|
|
142
|
+
//original 原图,compressed 压缩图,默认二者都有
|
|
143
|
+
sizeType: {
|
|
144
|
+
type: Array,
|
|
145
|
+
default() {
|
|
146
|
+
return ['original', 'compressed'];
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
//album 从相册选图,camera 使用相机,默认二者都有。如需直接开相机或直接选相册,请只使用一个选项
|
|
150
|
+
sourceType: {
|
|
151
|
+
type: Array,
|
|
152
|
+
default() {
|
|
153
|
+
return ['album', 'camera'];
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
//可上传图片类型,默认为空,不限制 Array<String> ['jpg','png','gif']
|
|
157
|
+
imageFormat: {
|
|
158
|
+
type: Array,
|
|
159
|
+
default() {
|
|
160
|
+
return [];
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
//单张图片大小限制 MB
|
|
164
|
+
size: {
|
|
165
|
+
type: Number,
|
|
166
|
+
default: 4
|
|
167
|
+
},
|
|
168
|
+
//文件对应的key,默认为 file
|
|
169
|
+
fileKeyName: {
|
|
170
|
+
type: String,
|
|
171
|
+
default: 'file'
|
|
172
|
+
},
|
|
173
|
+
//HTTP 请求 Header, header 中不能设置 Referer。
|
|
174
|
+
header: {
|
|
175
|
+
type: Object,
|
|
176
|
+
default() {
|
|
177
|
+
return {};
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
//HTTP 请求中其他额外的 form data
|
|
181
|
+
formData: {
|
|
182
|
+
type: Object,
|
|
183
|
+
default() {
|
|
184
|
+
return {};
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
//自定义参数
|
|
188
|
+
params: {
|
|
189
|
+
type: [Number, String],
|
|
190
|
+
default: 0
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
data() {
|
|
194
|
+
return {
|
|
195
|
+
//图片地址
|
|
196
|
+
imageList: [],
|
|
197
|
+
tempFiles: [],
|
|
198
|
+
//上传状态:1-上传成功 2-上传中 3-上传失败
|
|
199
|
+
statusArr: [],
|
|
200
|
+
//传入回调函数上传
|
|
201
|
+
callUpload: false
|
|
202
|
+
};
|
|
203
|
+
},
|
|
204
|
+
created() {
|
|
205
|
+
this.initImages();
|
|
206
|
+
},
|
|
207
|
+
watch: {
|
|
208
|
+
value(val) {
|
|
209
|
+
if (val) {
|
|
210
|
+
this.initImages();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
computed: {
|
|
215
|
+
isShowAdd() {
|
|
216
|
+
let isShow = true;
|
|
217
|
+
if (this.forbidAdd || (this.limit && this.imageList.length >= this.limit)) {
|
|
218
|
+
isShow = false;
|
|
219
|
+
}
|
|
220
|
+
return isShow;
|
|
221
|
+
},
|
|
222
|
+
getDelColor() {
|
|
223
|
+
return this.delColor || (uni && uni.$tui && uni.$tui.color.danger) || '#EB0909';
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
methods: {
|
|
227
|
+
initImages() {
|
|
228
|
+
this.statusArr = [];
|
|
229
|
+
this.imageList = [...this.value];
|
|
230
|
+
let tempFiles = [];
|
|
231
|
+
for (let item of this.imageList) {
|
|
232
|
+
this.statusArr.push('1');
|
|
233
|
+
tempFiles.push({
|
|
234
|
+
path: item
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
this.tempFiles = tempFiles;
|
|
238
|
+
},
|
|
239
|
+
// 重新上传
|
|
240
|
+
reUpLoad(index) {
|
|
241
|
+
this.$set(this.statusArr, index, '2');
|
|
242
|
+
this.$emit('reupload', {
|
|
243
|
+
index
|
|
244
|
+
});
|
|
245
|
+
if (!this.callUpload) {
|
|
246
|
+
this.uploadImage(index, this.imageList[index])
|
|
247
|
+
.then(() => {
|
|
248
|
+
this.change();
|
|
249
|
+
})
|
|
250
|
+
.catch(() => {
|
|
251
|
+
this.change();
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
/**
|
|
256
|
+
* @param manual 是否手动上传
|
|
257
|
+
**/
|
|
258
|
+
change(manual = false) {
|
|
259
|
+
let status = ~this.statusArr.indexOf('2') ? 2 : 1;
|
|
260
|
+
if (status != 2 && ~this.statusArr.indexOf('3')) {
|
|
261
|
+
// 上传失败
|
|
262
|
+
status = 3;
|
|
263
|
+
}
|
|
264
|
+
this.$emit('complete', {
|
|
265
|
+
status: status,
|
|
266
|
+
imgArr: this.imageList,
|
|
267
|
+
params: this.params,
|
|
268
|
+
manual: manual
|
|
269
|
+
});
|
|
270
|
+
},
|
|
271
|
+
toast(text) {
|
|
272
|
+
text &&
|
|
273
|
+
uni.showToast({
|
|
274
|
+
title: text,
|
|
275
|
+
icon: 'none'
|
|
276
|
+
});
|
|
277
|
+
},
|
|
278
|
+
chooseImage: function () {
|
|
279
|
+
let _this = this;
|
|
280
|
+
uni.chooseImage({
|
|
281
|
+
count: _this.limit - _this.imageList.length,
|
|
282
|
+
sizeType: _this.sizeType,
|
|
283
|
+
sourceType: _this.sourceType,
|
|
284
|
+
success: function (e) {
|
|
285
|
+
let imageArr = [];
|
|
286
|
+
for (let i = 0; i < e.tempFiles.length; i++) {
|
|
287
|
+
let len = _this.imageList.length;
|
|
288
|
+
if (len >= _this.limit) {
|
|
289
|
+
_this.toast(`最多可上传${_this.limit}张图片`);
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
//过滤图片类型
|
|
293
|
+
let path = e.tempFiles[i].path;
|
|
294
|
+
|
|
295
|
+
if (_this.imageFormat.length > 0) {
|
|
296
|
+
let format = '';
|
|
297
|
+
// #ifdef H5
|
|
298
|
+
let type = e.tempFiles[i].type;
|
|
299
|
+
format = type.split('/')[1];
|
|
300
|
+
// #endif
|
|
301
|
+
|
|
302
|
+
// #ifndef H5
|
|
303
|
+
format = path.split('.')[path.split('.').length - 1];
|
|
304
|
+
// #endif
|
|
305
|
+
|
|
306
|
+
if (_this.imageFormat.indexOf(format) == -1) {
|
|
307
|
+
let text = `只能上传 ${_this.imageFormat.join(',')} 格式图片!`;
|
|
308
|
+
_this.toast(text);
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
//过滤超出大小限制图片
|
|
314
|
+
let size = e.tempFiles[i].size;
|
|
315
|
+
|
|
316
|
+
if (_this.size * 1024 * 1024 < size) {
|
|
317
|
+
let err = `单张图片大小不能超过:${_this.size}MB`;
|
|
318
|
+
_this.toast(err);
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
imageArr.push(path);
|
|
322
|
+
_this.imageList.push(path);
|
|
323
|
+
_this.tempFiles.push(e.tempFiles[i]);
|
|
324
|
+
_this.statusArr.push('2');
|
|
325
|
+
}
|
|
326
|
+
_this.change();
|
|
327
|
+
|
|
328
|
+
let start = _this.imageList.length - imageArr.length;
|
|
329
|
+
for (let j = 0; j < imageArr.length; j++) {
|
|
330
|
+
let index = start + j;
|
|
331
|
+
//服务器地址
|
|
332
|
+
if (_this.serverUrl) {
|
|
333
|
+
_this
|
|
334
|
+
.uploadImage(index, imageArr[j])
|
|
335
|
+
.then(() => {
|
|
336
|
+
_this.change();
|
|
337
|
+
})
|
|
338
|
+
.catch(() => {
|
|
339
|
+
_this.change();
|
|
340
|
+
});
|
|
341
|
+
} else {
|
|
342
|
+
//无服务器地址则直接返回成功
|
|
343
|
+
_this.$set(_this.statusArr, index, '1');
|
|
344
|
+
_this.change();
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
},
|
|
350
|
+
uploadImage: function (index, url, serverUrl) {
|
|
351
|
+
let _this = this;
|
|
352
|
+
return new Promise((resolve, reject) => {
|
|
353
|
+
uni.uploadFile({
|
|
354
|
+
url: this.serverUrl || serverUrl,
|
|
355
|
+
name: this.fileKeyName,
|
|
356
|
+
header: this.header,
|
|
357
|
+
formData: this.formData,
|
|
358
|
+
filePath: url,
|
|
359
|
+
success: function (res) {
|
|
360
|
+
if (res.statusCode == 200) {
|
|
361
|
+
//返回结果 此处需要按接口实际返回进行修改
|
|
362
|
+
let d = JSON.parse(res.data.replace(/\ufeff/g, '') || '{}');
|
|
363
|
+
//判断code,以实际接口规范判断
|
|
364
|
+
if (d.code % 100 === 0) {
|
|
365
|
+
// 上传成功 d.url 为上传后图片地址,以实际接口返回为准
|
|
366
|
+
d.url && (_this.imageList[index] = d.url);
|
|
367
|
+
_this.$set(_this.statusArr, index, d.url ? '1' : '3');
|
|
368
|
+
} else {
|
|
369
|
+
// 上传失败
|
|
370
|
+
_this.$set(_this.statusArr, index, '3');
|
|
371
|
+
}
|
|
372
|
+
resolve(index);
|
|
373
|
+
} else {
|
|
374
|
+
_this.$set(_this.statusArr, index, '3');
|
|
375
|
+
reject(index);
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
fail: function (res) {
|
|
379
|
+
_this.$set(_this.statusArr, index, '3');
|
|
380
|
+
reject(index);
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
},
|
|
385
|
+
delImage: function (index) {
|
|
386
|
+
let that = this;
|
|
387
|
+
if (this.delConfirm) {
|
|
388
|
+
uni.showModal({
|
|
389
|
+
title: '提示',
|
|
390
|
+
content: '确认删除该图片吗?',
|
|
391
|
+
showCancel: true,
|
|
392
|
+
cancelColor: '#555',
|
|
393
|
+
confirmColor: '#eb0909',
|
|
394
|
+
confirmText: '确定',
|
|
395
|
+
success(res) {
|
|
396
|
+
if (res.confirm) {
|
|
397
|
+
that.imageList.splice(index, 1);
|
|
398
|
+
that.tempFiles.splice(index, 1);
|
|
399
|
+
that.statusArr.splice(index, 1);
|
|
400
|
+
that.$emit('remove', {
|
|
401
|
+
index: index,
|
|
402
|
+
params: that.params
|
|
403
|
+
});
|
|
404
|
+
that.delTrigger && that.change();
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
} else {
|
|
409
|
+
that.imageList.splice(index, 1);
|
|
410
|
+
that.tempFiles.splice(index, 1);
|
|
411
|
+
that.statusArr.splice(index, 1);
|
|
412
|
+
that.$emit('remove', {
|
|
413
|
+
index: index,
|
|
414
|
+
params: that.params
|
|
415
|
+
});
|
|
416
|
+
that.delTrigger && that.change();
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
previewImage: function (index) {
|
|
420
|
+
if (!this.imageList.length) return;
|
|
421
|
+
uni.previewImage({
|
|
422
|
+
current: this.imageList[index],
|
|
423
|
+
loop: true,
|
|
424
|
+
urls: this.imageList
|
|
425
|
+
});
|
|
426
|
+
},
|
|
427
|
+
/**
|
|
428
|
+
* 当属性serverUrl传空时,父级调用该方法一次性上传所有图片
|
|
429
|
+
* @param serverUrl 服务器接口地址
|
|
430
|
+
**/
|
|
431
|
+
uploadAllImage(serverUrl) {
|
|
432
|
+
if (!serverUrl) {
|
|
433
|
+
this.toast('服务器接口地址不能为空!');
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
let imageArr = [...this.imageList];
|
|
437
|
+
const len = imageArr.length;
|
|
438
|
+
for (let i = 0; i < len; i++) {
|
|
439
|
+
//如果是服务器地址图片则无需再次上传
|
|
440
|
+
if (imageArr[i].startsWith('https')) {
|
|
441
|
+
continue;
|
|
442
|
+
} else {
|
|
443
|
+
this.$set(this.statusArr, i, '2');
|
|
444
|
+
this.uploadImage(i, imageArr[i], serverUrl)
|
|
445
|
+
.then(() => {
|
|
446
|
+
if (i === len - 1) {
|
|
447
|
+
this.change(true);
|
|
448
|
+
}
|
|
449
|
+
})
|
|
450
|
+
.catch(() => {
|
|
451
|
+
if (i === len - 1) {
|
|
452
|
+
this.change(true);
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
upload(callback, index) {
|
|
459
|
+
// 传入一个返回Promise的文件上传的函数
|
|
460
|
+
//上传状态:1-上传成功 2-上传中 3-上传失败
|
|
461
|
+
this.callUpload = true;
|
|
462
|
+
if (index === undefined || index === null) {
|
|
463
|
+
let urls = [...this.imageList];
|
|
464
|
+
const len = urls.length;
|
|
465
|
+
for (let i = 0; i < len; i++) {
|
|
466
|
+
if (urls[i].startsWith('https')) {
|
|
467
|
+
continue;
|
|
468
|
+
} else {
|
|
469
|
+
this.$set(this.statusArr, i, '2');
|
|
470
|
+
if (typeof callback === 'function') {
|
|
471
|
+
callback(this.tempFiles[i])
|
|
472
|
+
.then((res) => {
|
|
473
|
+
this.$set(this.statusArr, i, '1');
|
|
474
|
+
this.imageList[i] = res;
|
|
475
|
+
this.change(true);
|
|
476
|
+
})
|
|
477
|
+
.catch((err) => {
|
|
478
|
+
this.$set(this.statusArr, i, '3');
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
} else {
|
|
484
|
+
//如果传入index,则是重新上传时调用
|
|
485
|
+
this.$set(this.statusArr, index, '2');
|
|
486
|
+
if (typeof callback === 'function') {
|
|
487
|
+
callback(this.tempFiles[index])
|
|
488
|
+
.then((res) => {
|
|
489
|
+
this.$set(this.statusArr, index, '1');
|
|
490
|
+
this.imageList[index] = res;
|
|
491
|
+
this.change(true);
|
|
492
|
+
})
|
|
493
|
+
.catch((err) => {
|
|
494
|
+
this.$set(this.statusArr, index, '3');
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
</script>
|
|
502
|
+
|
|
503
|
+
<style scoped>
|
|
504
|
+
@font-face {
|
|
505
|
+
font-family: 'tuiUpload';
|
|
506
|
+
src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAATcAA0AAAAAByQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAEwAAAABoAAAAciR52BUdERUYAAASgAAAAHgAAAB4AKQALT1MvMgAAAaAAAABCAAAAVjxvR/tjbWFwAAAB+AAAAEUAAAFK5ibpuGdhc3AAAASYAAAACAAAAAj//wADZ2x5ZgAAAkwAAADXAAABAAmNjcZoZWFkAAABMAAAAC8AAAA2FpiS+WhoZWEAAAFgAAAAHQAAACQH3QOFaG10eAAAAeQAAAARAAAAEgwAACBsb2NhAAACQAAAAAwAAAAMAEoAgG1heHAAAAGAAAAAHwAAACABEgA2bmFtZQAAAyQAAAFJAAACiCnmEVVwb3N0AAAEcAAAACgAAAA6OMUs4HjaY2BkYGAAYo3boY/i+W2+MnCzMIDAzb3qdQj6fwPzf+YGIJeDgQkkCgA/KAtvAHjaY2BkYGBu+N/AEMPCAALM/xkYGVABCwBZ4wNrAAAAeNpjYGRgYGBl0GJgZgABJiDmAkIGhv9gPgMADTABSQB42mNgZGFgnMDAysDA1Ml0hoGBoR9CM75mMGLkAIoysDIzYAUBaa4pDA7PGJ9xMjf8b2CIYW5gaAAKM4LkANt9C+UAAHjaY2GAABYIVmBgAAAA+gAtAAAAeNpjYGBgZoBgGQZGBhBwAfIYwXwWBg0gzQakGRmYnjE+4/z/n4EBQksxSf6GqgcCRjYGOIeRCUgwMaACRoZhDwCiLwmoAAAAAAAAAAAAAAAASgCAeNpdjkFKw0AARf/vkIR0BkPayWRKQZtYY90ohJju2kOIbtz0KD1HVm50UfEmWXoAr9ADOHFARHHzeY//Fx8Ci+FJfIgdJFa4AhgiMshbrCuIsLxhFJZVs+Vl1bT1GddtbXTC3OhohN4dg4BJ3zMJAnccyfm468ZzHXddrH9ZKbHzdf9n/vkY/xv9sPQXgGEvBrHHwst5kTbXLE+YpYVPkxepPmW94W16UbdNJd6f3SAzo5W7m1jaKd+8ZZIvk5nlKw9SK6Wle7BLS3f/bTzQLmfAF2T1NsQAeNp9kD1OAzEQhZ/zByQSQiCoXVEA2vyUKRMp9Ailo0g23pBo1155nUg5AS0VB6DlGByAGyDRcgpelkmTImvt6PObmeexAZzjGwr/3yXuhBWO8ShcwREy4Sr1F+Ea+V24jhY+hRvUf4SbuFUD4RYu1BsdVO2Eu5vSbcsKZxgIV3CKJ+Eq9ZVwjfwqXMcVPoQb1L+EmxjjV7iFa2WpDOFhMEFgnEFjig3jAjEcLJIyBtahOfRmEsxMTzd6ETubOBso71dilwMeaDnngCntPbdmvkon/mDLgdSYbh4FS7YpjS4idCgbXyyc1d2oc7D9nu22tNi/a4E1x+xRDWzU/D3bM9JIbAyvkJI18jK3pBJTj2hrrPG7ZynW814IiU68y/SIx5o0dTr3bmniwOLn8owcfbS5kj33qBw+Y1kIeb/dTsQgil2GP5PYcRkAAAB42mNgYoAALjDJyIAOWMGiTIxMjMxsKak5qSWpbFmZiRmJ+QAmgAUIAAAAAf//AAIAAQAAAAwAAAAWAAAAAgABAAMABAABAAQAAAACAAAAAHjaY2BgYGQAgqtL1DlA9M296nUwGgA+8QYgAAA=)
|
|
507
|
+
format('woff');
|
|
508
|
+
font-weight: normal;
|
|
509
|
+
font-style: normal;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.up-upload-icon {
|
|
513
|
+
font-family: 'tuiUpload' !important;
|
|
514
|
+
font-style: normal;
|
|
515
|
+
-webkit-font-smoothing: antialiased;
|
|
516
|
+
-moz-osx-font-smoothing: grayscale;
|
|
517
|
+
padding: 10rpx;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
.up-icon-delete:before {
|
|
521
|
+
content: '\e601';
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.up-icon-plus:before {
|
|
525
|
+
content: '\e609';
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
.up-upload-box {
|
|
529
|
+
width: 100%;
|
|
530
|
+
display: flex;
|
|
531
|
+
flex-wrap: wrap;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.up-upload-add {
|
|
535
|
+
font-weight: 100;
|
|
536
|
+
display: flex;
|
|
537
|
+
align-items: center;
|
|
538
|
+
justify-content: center;
|
|
539
|
+
padding: 0;
|
|
540
|
+
overflow: hidden;
|
|
541
|
+
box-sizing: border-box;
|
|
542
|
+
/* #ifdef H5 */
|
|
543
|
+
cursor: pointer;
|
|
544
|
+
/* #endif */
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
.up-upload__unborder {
|
|
548
|
+
border-width: 0;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
.up-upload__border {
|
|
552
|
+
border-width: 1px;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.up-image-item {
|
|
556
|
+
position: relative;
|
|
557
|
+
margin-right: 20rpx;
|
|
558
|
+
margin-bottom: 20rpx;
|
|
559
|
+
flex-shrink: 0;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.up-item-img {
|
|
563
|
+
display: block;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.up-img-del {
|
|
567
|
+
width: 36rpx;
|
|
568
|
+
height: 36rpx;
|
|
569
|
+
position: absolute;
|
|
570
|
+
right: -12rpx;
|
|
571
|
+
top: -12rpx;
|
|
572
|
+
border-radius: 50%;
|
|
573
|
+
color: white;
|
|
574
|
+
font-size: 34rpx;
|
|
575
|
+
z-index: 5;
|
|
576
|
+
/* #ifdef H5 */
|
|
577
|
+
cursor: pointer;
|
|
578
|
+
/* #endif */
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.up-img-del::before {
|
|
582
|
+
content: '';
|
|
583
|
+
width: 16rpx;
|
|
584
|
+
height: 1px;
|
|
585
|
+
position: absolute;
|
|
586
|
+
left: 10rpx;
|
|
587
|
+
top: 18rpx;
|
|
588
|
+
background-color: #fff;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
.up-upload-mask {
|
|
592
|
+
width: 100%;
|
|
593
|
+
height: 100%;
|
|
594
|
+
position: absolute;
|
|
595
|
+
left: 0;
|
|
596
|
+
top: 0;
|
|
597
|
+
display: flex;
|
|
598
|
+
flex-direction: column;
|
|
599
|
+
align-items: center;
|
|
600
|
+
justify-content: center;
|
|
601
|
+
padding: 40rpx 0;
|
|
602
|
+
box-sizing: border-box;
|
|
603
|
+
background-color: rgba(0, 0, 0, 0.6);
|
|
604
|
+
z-index: 3;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.up-upload-loading {
|
|
608
|
+
width: 28rpx;
|
|
609
|
+
height: 28rpx;
|
|
610
|
+
border-radius: 50%;
|
|
611
|
+
border: 2px solid;
|
|
612
|
+
border-color: #b2b2b2 #b2b2b2 #b2b2b2 #fff;
|
|
613
|
+
animation: up-rotate 0.7s linear infinite;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
@keyframes up-rotate {
|
|
617
|
+
0% {
|
|
618
|
+
transform: rotate(0);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
100% {
|
|
622
|
+
transform: rotate(360deg);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
.up-tips {
|
|
627
|
+
font-size: 26rpx;
|
|
628
|
+
color: #fff;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
.up-mask-btn {
|
|
632
|
+
padding: 4rpx 16rpx;
|
|
633
|
+
border-radius: 40rpx;
|
|
634
|
+
text-align: center;
|
|
635
|
+
font-size: 24rpx;
|
|
636
|
+
color: #fff;
|
|
637
|
+
border: 1px solid #fff;
|
|
638
|
+
display: flex;
|
|
639
|
+
align-items: center;
|
|
640
|
+
justify-content: center;
|
|
641
|
+
flex-shrink: 0;
|
|
642
|
+
margin-top: 26rpx;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
.up-btn-hover {
|
|
646
|
+
opacity: 0.8;
|
|
647
|
+
}
|
|
648
|
+
</style>
|