uview-plus 3.3.36 → 3.3.38
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/changelog.md +10 -0
- package/components/u-album/album.js +2 -1
- package/components/u-album/props.js +5 -0
- package/components/u-album/u-album.vue +2 -0
- package/components/u-datetime-picker/u-datetime-picker.vue +8 -6
- package/components/u-upload/u-upload.vue +45 -28
- package/libs/function/index.js +1 -0
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -335,11 +335,12 @@
|
|
|
335
335
|
if (this.filter) {
|
|
336
336
|
values = this.filter(type, values)
|
|
337
337
|
if (!values || (values && values.length == 0)) {
|
|
338
|
-
uni.showToast({
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
})
|
|
338
|
+
// uni.showToast({
|
|
339
|
+
// title: '日期filter结果不能为空',
|
|
340
|
+
// icon: 'error',
|
|
341
|
+
// mask: true
|
|
342
|
+
// })
|
|
343
|
+
console.log('日期filter结果不能为空')
|
|
343
344
|
}
|
|
344
345
|
}
|
|
345
346
|
return { type, values }
|
|
@@ -353,7 +354,8 @@
|
|
|
353
354
|
// 得出合法的时间
|
|
354
355
|
correctValue(value) {
|
|
355
356
|
const isDateMode = this.mode !== 'time'
|
|
356
|
-
if (isDateMode && !test.date(value)) {
|
|
357
|
+
// if (isDateMode && !test.date(value)) {
|
|
358
|
+
if (isDateMode && !dayjs.unix(value).isValid()) {
|
|
357
359
|
// 如果是日期类型,但是又没有设置合法的当前时间的话,使用最小时间为当前时间
|
|
358
360
|
value = this.minDate
|
|
359
361
|
} else if (!isDateMode && !value) {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
:src="item.thumb || item.url"
|
|
13
13
|
:mode="imageMode"
|
|
14
14
|
class="u-upload__wrap__preview__image"
|
|
15
|
-
@tap="onPreviewImage(item)"
|
|
15
|
+
@tap="onPreviewImage(item, index)"
|
|
16
16
|
:style="[{
|
|
17
17
|
width: addUnit(width),
|
|
18
18
|
height: addUnit(height)
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<view
|
|
22
22
|
v-else
|
|
23
23
|
class="u-upload__wrap__preview__other"
|
|
24
|
-
@tap="onClickPreview(
|
|
24
|
+
@tap="onClickPreview(item, index)"
|
|
25
25
|
>
|
|
26
26
|
<u-icon
|
|
27
27
|
color="#80CBF9"
|
|
@@ -334,50 +334,67 @@
|
|
|
334
334
|
);
|
|
335
335
|
},
|
|
336
336
|
// 预览图片
|
|
337
|
-
onPreviewImage(
|
|
338
|
-
if (!
|
|
337
|
+
onPreviewImage(previewItem, index) {
|
|
338
|
+
if (!previewItem.isImage || !this.previewFullImage) return
|
|
339
|
+
let current = 0;
|
|
340
|
+
const urls = [];
|
|
341
|
+
let imageIndex = 0;
|
|
342
|
+
for (var i = 0; i < this.lists.length; i++) {
|
|
343
|
+
const item = this.lists[i];
|
|
344
|
+
if (item.isImage || (item.type && item.type === 'image')) {
|
|
345
|
+
urls.push(item.url || item.thumb);
|
|
346
|
+
if (i === index) {
|
|
347
|
+
current = imageIndex;
|
|
348
|
+
}
|
|
349
|
+
imageIndex += 1;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
if (urls.length < 1) {
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
339
355
|
uni.previewImage({
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
current: item.url || item.thumb,
|
|
356
|
+
urls: urls,
|
|
357
|
+
current: current,
|
|
343
358
|
fail() {
|
|
344
359
|
toast('预览图片失败')
|
|
345
360
|
},
|
|
346
361
|
});
|
|
347
362
|
},
|
|
348
|
-
onPreviewVideo(
|
|
363
|
+
onPreviewVideo(index) {
|
|
349
364
|
if (!this.previewFullImage) return;
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
365
|
+
let current = 0;
|
|
366
|
+
const sources = [];
|
|
367
|
+
let videoIndex = 0;
|
|
368
|
+
for (var i = 0; i < this.lists.length; i++) {
|
|
369
|
+
const item = this.lists[i];
|
|
370
|
+
if (item.isVideo || (item.type && item.type === 'video')) {
|
|
371
|
+
sources.push(Object.assign(Object.assign({}, item), {
|
|
372
|
+
type: 'video'
|
|
373
|
+
}));
|
|
374
|
+
if (i === index) {
|
|
375
|
+
current = videoIndex;
|
|
376
|
+
}
|
|
377
|
+
videoIndex += 1;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
if (sources.length < 1) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
356
383
|
// #ifdef MP-WEIXIN
|
|
357
384
|
wx.previewMedia({
|
|
358
|
-
sources:
|
|
359
|
-
|
|
360
|
-
.map((item) =>
|
|
361
|
-
Object.assign(Object.assign({}, item), {
|
|
362
|
-
type: 'video'
|
|
363
|
-
})
|
|
364
|
-
),
|
|
365
|
-
current: index,
|
|
385
|
+
sources: sources,
|
|
386
|
+
current: current,
|
|
366
387
|
fail() {
|
|
367
388
|
toast('预览视频失败')
|
|
368
389
|
},
|
|
369
390
|
});
|
|
370
391
|
// #endif
|
|
371
392
|
},
|
|
372
|
-
onClickPreview(
|
|
373
|
-
const {
|
|
374
|
-
index
|
|
375
|
-
} = event.currentTarget.dataset;
|
|
376
|
-
const item = this.data.lists[index];
|
|
393
|
+
onClickPreview(item, index) {
|
|
377
394
|
if (!this.previewFullImage) return;
|
|
378
395
|
switch (item.type) {
|
|
379
396
|
case 'video':
|
|
380
|
-
this.onPreviewVideo(
|
|
397
|
+
this.onPreviewVideo(index);
|
|
381
398
|
break;
|
|
382
399
|
default:
|
|
383
400
|
break;
|
package/libs/function/index.js
CHANGED
|
@@ -119,6 +119,7 @@ export function $parent(name = undefined) {
|
|
|
119
119
|
// 通过while历遍,这里主要是为了H5需要多层解析的问题
|
|
120
120
|
while (parent) {
|
|
121
121
|
// 父组件
|
|
122
|
+
name = name.replace(/up-([a-zA-Z0-9-_]+)/g, 'u-$1')
|
|
122
123
|
if (parent.$options && parent.$options.name !== name) {
|
|
123
124
|
// 如果组件的name不相等,继续上一级寻找
|
|
124
125
|
parent = parent.$parent
|