zartui 2.1.20 → 2.1.22
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/es/index.js +1 -1
- package/es/media-picker/index.js +157 -95
- package/lib/index.js +1 -1
- package/lib/media-picker/index.js +157 -95
- package/lib/zart.js +3569 -127
- package/lib/zart.min.js +9 -2
- package/package.json +4 -2
package/es/index.js
CHANGED
|
@@ -76,7 +76,7 @@ import TextEllipsis from './text-ellipsis';
|
|
|
76
76
|
import Timeline from './timeline';
|
|
77
77
|
import Toast from './toast';
|
|
78
78
|
import Uploader from './uploader';
|
|
79
|
-
var version = '2.1.
|
|
79
|
+
var version = '2.1.22';
|
|
80
80
|
function install(Vue) {
|
|
81
81
|
var components = [ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, SpeechRecognizer, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, TextEllipsis, Timeline, Toast, Uploader];
|
|
82
82
|
components.forEach(function (item) {
|
package/es/media-picker/index.js
CHANGED
|
@@ -38,6 +38,7 @@ import { FRAME_CONTAINER, CERTIFICATE_BACKGROUND, CERTIFICATE_BUTTON } from './i
|
|
|
38
38
|
import { getFileUniqueCode, getUniqueFileName, isAudioType, isImageType, isVideoType, isPdfType, isDocType, isTextType, isPptType, isExcelType } from "./media-util";
|
|
39
39
|
import { isWeixin } from '../utils/device';
|
|
40
40
|
import { wxUploadImage } from './wx-util';
|
|
41
|
+
import Sortable from "sortablejs";
|
|
41
42
|
|
|
42
43
|
// 单个文件最大限制,单位为M(目前限制是100M)
|
|
43
44
|
var FILE_SIZE_LIMIT = 100;
|
|
@@ -182,6 +183,10 @@ export default createComponent({
|
|
|
182
183
|
default: function _default() {
|
|
183
184
|
return {};
|
|
184
185
|
}
|
|
186
|
+
},
|
|
187
|
+
sortable: {
|
|
188
|
+
type: Boolean,
|
|
189
|
+
default: false
|
|
185
190
|
}
|
|
186
191
|
},
|
|
187
192
|
model: {
|
|
@@ -195,7 +200,8 @@ export default createComponent({
|
|
|
195
200
|
actionVisible: false,
|
|
196
201
|
mediaPlayerVisible: false,
|
|
197
202
|
mediaTypeToPlay: '',
|
|
198
|
-
mediaUrlToPlay: ''
|
|
203
|
+
mediaUrlToPlay: '',
|
|
204
|
+
sort: undefined
|
|
199
205
|
};
|
|
200
206
|
},
|
|
201
207
|
computed: {
|
|
@@ -243,11 +249,36 @@ export default createComponent({
|
|
|
243
249
|
}
|
|
244
250
|
}];
|
|
245
251
|
}
|
|
252
|
+
},
|
|
253
|
+
showPreview: function showPreview() {
|
|
254
|
+
return this.mediaList.length > 0 && this.pickerMode !== "certificate";
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
watch: {
|
|
258
|
+
showPreview: function showPreview() {
|
|
259
|
+
var _this$$refs$grid,
|
|
260
|
+
_this2 = this;
|
|
261
|
+
if (this.sort || !this.sortable) return;
|
|
262
|
+
this.sort = Sortable.create((_this$$refs$grid = this.$refs.grid) == null ? void 0 : _this$$refs$grid.$el, {
|
|
263
|
+
animation: 200,
|
|
264
|
+
handle: ".zt2-grid-item",
|
|
265
|
+
onEnd: function onEnd(evt) {
|
|
266
|
+
var raws = _this2.exchangeArrayIndex(_this2.mediaList, evt.oldIndex, evt.newIndex);
|
|
267
|
+
_this2.$emit('input', raws);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
246
270
|
}
|
|
247
271
|
},
|
|
248
272
|
methods: {
|
|
273
|
+
exchangeArrayIndex: function exchangeArrayIndex(list, index, newIndex) {
|
|
274
|
+
var raws = [].concat(list);
|
|
275
|
+
var raw = raws[index];
|
|
276
|
+
raws.splice(index, 1);
|
|
277
|
+
raws.splice(newIndex, 0, raw);
|
|
278
|
+
return [].concat(raws);
|
|
279
|
+
},
|
|
249
280
|
mediaPick: function mediaPick(mediaType, mediaAddType) {
|
|
250
|
-
var
|
|
281
|
+
var _this3 = this;
|
|
251
282
|
if (this.disabled) {
|
|
252
283
|
return;
|
|
253
284
|
}
|
|
@@ -269,7 +300,7 @@ export default createComponent({
|
|
|
269
300
|
if (this.useWx && isWeixin() && window.wx) {
|
|
270
301
|
var type = mediaAddType === MediaAddType.TAKE ? 'camera' : 'album';
|
|
271
302
|
wxUploadImage(type).then(function (newMedias) {
|
|
272
|
-
|
|
303
|
+
_this3.$emit('input', [].concat(_this3.mediaList, newMedias));
|
|
273
304
|
});
|
|
274
305
|
} else {
|
|
275
306
|
if (mediaAddType === MediaAddType.TAKE) {
|
|
@@ -344,7 +375,7 @@ export default createComponent({
|
|
|
344
375
|
}
|
|
345
376
|
},
|
|
346
377
|
handleInputFiles: function handleInputFiles(event) {
|
|
347
|
-
var
|
|
378
|
+
var _this4 = this;
|
|
348
379
|
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
349
380
|
var files, response, data;
|
|
350
381
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -357,29 +388,29 @@ export default createComponent({
|
|
|
357
388
|
}
|
|
358
389
|
return _context.abrupt("return");
|
|
359
390
|
case 3:
|
|
360
|
-
if (
|
|
391
|
+
if (_this4.pickerMode === "certificate") {
|
|
361
392
|
files = [files[0]];
|
|
362
393
|
}
|
|
363
|
-
files =
|
|
394
|
+
files = _this4.filterValidFiles(files);
|
|
364
395
|
if (!(files.length === 0)) {
|
|
365
396
|
_context.next = 7;
|
|
366
397
|
break;
|
|
367
398
|
}
|
|
368
399
|
return _context.abrupt("return");
|
|
369
400
|
case 7:
|
|
370
|
-
if (
|
|
401
|
+
if (_this4.checkFileCountAfterAdd(files)) {
|
|
371
402
|
_context.next = 9;
|
|
372
403
|
break;
|
|
373
404
|
}
|
|
374
405
|
return _context.abrupt("return");
|
|
375
406
|
case 9:
|
|
376
|
-
if (!
|
|
407
|
+
if (!_this4.beforeRead) {
|
|
377
408
|
_context.next = 24;
|
|
378
409
|
break;
|
|
379
410
|
}
|
|
380
411
|
_context.prev = 10;
|
|
381
412
|
_context.next = 13;
|
|
382
|
-
return
|
|
413
|
+
return _this4.beforeRead(files);
|
|
383
414
|
case 13:
|
|
384
415
|
response = _context.sent;
|
|
385
416
|
if (response) {
|
|
@@ -392,9 +423,9 @@ export default createComponent({
|
|
|
392
423
|
data = response.filter(function (item) {
|
|
393
424
|
return !!item;
|
|
394
425
|
});
|
|
395
|
-
|
|
426
|
+
_this4.readFiles(data);
|
|
396
427
|
} else {
|
|
397
|
-
|
|
428
|
+
_this4.readFiles(files);
|
|
398
429
|
}
|
|
399
430
|
_context.next = 22;
|
|
400
431
|
break;
|
|
@@ -406,7 +437,7 @@ export default createComponent({
|
|
|
406
437
|
_context.next = 25;
|
|
407
438
|
break;
|
|
408
439
|
case 24:
|
|
409
|
-
|
|
440
|
+
_this4.readFiles(files);
|
|
410
441
|
case 25:
|
|
411
442
|
case "end":
|
|
412
443
|
return _context.stop();
|
|
@@ -415,12 +446,12 @@ export default createComponent({
|
|
|
415
446
|
}))();
|
|
416
447
|
},
|
|
417
448
|
readFiles: function readFiles(files) {
|
|
418
|
-
var
|
|
449
|
+
var _this5 = this;
|
|
419
450
|
// 处理非图片
|
|
420
451
|
var notImages = files.filter(function (f) {
|
|
421
452
|
return !isImageType(f);
|
|
422
453
|
}).map(function (f) {
|
|
423
|
-
return
|
|
454
|
+
return _this5.transformNotImageFile(f);
|
|
424
455
|
});
|
|
425
456
|
var newMedias = [];
|
|
426
457
|
if (notImages.length > 0) {
|
|
@@ -441,13 +472,13 @@ export default createComponent({
|
|
|
441
472
|
newMedias = newMedias.concat(medias);
|
|
442
473
|
}
|
|
443
474
|
}).finally(function () {
|
|
444
|
-
if (
|
|
445
|
-
|
|
475
|
+
if (_this5.pickerMode === "certificate") {
|
|
476
|
+
_this5.$emit('input', [].concat(newMedias));
|
|
446
477
|
} else {
|
|
447
|
-
|
|
478
|
+
_this5.$emit('input', [].concat(_this5.mediaList, newMedias));
|
|
448
479
|
}
|
|
449
|
-
if (
|
|
450
|
-
|
|
480
|
+
if (_this5.afterRead) {
|
|
481
|
+
_this5.afterRead(newMedias);
|
|
451
482
|
}
|
|
452
483
|
});
|
|
453
484
|
},
|
|
@@ -535,24 +566,24 @@ export default createComponent({
|
|
|
535
566
|
* @return {Promise<[Media]>}
|
|
536
567
|
*/
|
|
537
568
|
transformImageFiles: function transformImageFiles(files) {
|
|
538
|
-
var
|
|
569
|
+
var _this6 = this;
|
|
539
570
|
var promisesTodo = [];
|
|
540
571
|
var resizeOptions = new ResizeOptions(this.maxImageSideLength);
|
|
541
572
|
var compressOptions = new CompressOptions(this.maxImageFileSize);
|
|
542
573
|
var _loop = function _loop() {
|
|
543
574
|
var inputFile = files[i];
|
|
544
|
-
var watermarkEnabled =
|
|
575
|
+
var watermarkEnabled = _this6.watermarkOptions && _this6.watermarkOptions.watermarkConfigString && checkWatermarkConfigSupported(_this6.watermarkOptions.watermarkConfigString);
|
|
545
576
|
var watermarkOpt;
|
|
546
577
|
if (watermarkEnabled) {
|
|
547
578
|
watermarkOpt = new WatermarkOptions({
|
|
548
579
|
enabled: true,
|
|
549
|
-
watermarkConfigString: watermarkEnabled ?
|
|
580
|
+
watermarkConfigString: watermarkEnabled ? _this6.watermarkOptions.watermarkConfigString : '',
|
|
550
581
|
context: {
|
|
551
|
-
address:
|
|
552
|
-
humanName:
|
|
553
|
-
projectName:
|
|
554
|
-
logo:
|
|
555
|
-
applicationName:
|
|
582
|
+
address: _this6.watermarkOptions.address || "",
|
|
583
|
+
humanName: _this6.watermarkOptions.humanName || _this6.watermarkOptions.humanname || "",
|
|
584
|
+
projectName: _this6.watermarkOptions.projectName || "",
|
|
585
|
+
logo: _this6.watermarkOptions.logo || "",
|
|
586
|
+
applicationName: _this6.watermarkOptions.applicationName || "",
|
|
556
587
|
watermarkTime: new Date()
|
|
557
588
|
}
|
|
558
589
|
});
|
|
@@ -664,62 +695,87 @@ export default createComponent({
|
|
|
664
695
|
* 点击预览
|
|
665
696
|
*/
|
|
666
697
|
previewMedia: function previewMedia(media, index) {
|
|
667
|
-
|
|
668
|
-
return;
|
|
669
|
-
}
|
|
670
|
-
if (media.type === MediaType.PHOTO) {
|
|
671
|
-
var imageIndex = this.imageList.indexOf(media);
|
|
672
|
-
ImagePreview({
|
|
673
|
-
images: this.imageList.map(function (image) {
|
|
674
|
-
return {
|
|
675
|
-
url: image.showSrc
|
|
676
|
-
};
|
|
677
|
-
}),
|
|
678
|
-
startPosition: imageIndex,
|
|
679
|
-
closeable: true
|
|
680
|
-
});
|
|
681
|
-
} else if (media.type === MediaType.AUDIO || media.type === MediaType.VIDEO) {
|
|
682
|
-
if (!media.file && !media.url) {
|
|
683
|
-
Toast('文件参数缺失');
|
|
684
|
-
} else {
|
|
685
|
-
this.mediaTypeToPlay = media.type;
|
|
686
|
-
this.mediaUrlToPlay = media.url || (URL || webkitURL).createObjectURL(media.file);
|
|
687
|
-
// this.mediaUrlToPlay = 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
|
|
688
|
-
this.mediaPlayerVisible = true;
|
|
689
|
-
}
|
|
690
|
-
} else {
|
|
691
|
-
Toast('暂不支持此类文件的预览');
|
|
692
|
-
}
|
|
693
|
-
},
|
|
694
|
-
onDelete: function onDelete(media, index) {
|
|
695
|
-
var _this6 = this;
|
|
698
|
+
var _this7 = this;
|
|
696
699
|
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
697
|
-
var
|
|
700
|
+
var imageIndex;
|
|
698
701
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
699
702
|
while (1) switch (_context2.prev = _context2.next) {
|
|
700
703
|
case 0:
|
|
701
|
-
|
|
702
|
-
|
|
704
|
+
_context2.t0 = _this7.preview;
|
|
705
|
+
if (!_context2.t0) {
|
|
706
|
+
_context2.next = 5;
|
|
703
707
|
break;
|
|
704
708
|
}
|
|
705
|
-
_context2.next =
|
|
706
|
-
return
|
|
707
|
-
case
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
709
|
+
_context2.next = 4;
|
|
710
|
+
return _this7.preview(media, index);
|
|
711
|
+
case 4:
|
|
712
|
+
_context2.t0 = _context2.sent;
|
|
713
|
+
case 5:
|
|
714
|
+
if (!_context2.t0) {
|
|
715
|
+
_context2.next = 7;
|
|
711
716
|
break;
|
|
712
717
|
}
|
|
713
718
|
return _context2.abrupt("return");
|
|
714
|
-
case 6:
|
|
715
|
-
_this6.deleteMedia(media, index);
|
|
716
719
|
case 7:
|
|
720
|
+
if (media.type === MediaType.PHOTO) {
|
|
721
|
+
imageIndex = _this7.imageList.indexOf(media);
|
|
722
|
+
ImagePreview({
|
|
723
|
+
images: _this7.imageList.map(function (image) {
|
|
724
|
+
return {
|
|
725
|
+
url: image.showSrc
|
|
726
|
+
};
|
|
727
|
+
}),
|
|
728
|
+
startPosition: imageIndex,
|
|
729
|
+
closeable: true
|
|
730
|
+
});
|
|
731
|
+
} else if (media.type === MediaType.AUDIO || media.type === MediaType.VIDEO) {
|
|
732
|
+
if (!media.file && !media.url) {
|
|
733
|
+
Toast('文件参数缺失');
|
|
734
|
+
} else {
|
|
735
|
+
_this7.mediaTypeToPlay = media.type;
|
|
736
|
+
_this7.mediaUrlToPlay = media.url || (URL || webkitURL).createObjectURL(media.file);
|
|
737
|
+
// this.mediaUrlToPlay = 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
|
|
738
|
+
_this7.mediaPlayerVisible = true;
|
|
739
|
+
}
|
|
740
|
+
} else {
|
|
741
|
+
Toast('暂不支持此类文件的预览');
|
|
742
|
+
}
|
|
743
|
+
case 8:
|
|
717
744
|
case "end":
|
|
718
745
|
return _context2.stop();
|
|
719
746
|
}
|
|
720
747
|
}, _callee2);
|
|
721
748
|
}))();
|
|
722
749
|
},
|
|
750
|
+
onDelete: function onDelete(media, index) {
|
|
751
|
+
var _this8 = this;
|
|
752
|
+
return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
753
|
+
var response;
|
|
754
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
755
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
756
|
+
case 0:
|
|
757
|
+
if (!_this8.beforeDelete) {
|
|
758
|
+
_context3.next = 6;
|
|
759
|
+
break;
|
|
760
|
+
}
|
|
761
|
+
_context3.next = 3;
|
|
762
|
+
return _this8.beforeDelete(media);
|
|
763
|
+
case 3:
|
|
764
|
+
response = _context3.sent;
|
|
765
|
+
if (response) {
|
|
766
|
+
_context3.next = 6;
|
|
767
|
+
break;
|
|
768
|
+
}
|
|
769
|
+
return _context3.abrupt("return");
|
|
770
|
+
case 6:
|
|
771
|
+
_this8.deleteMedia(media, index);
|
|
772
|
+
case 7:
|
|
773
|
+
case "end":
|
|
774
|
+
return _context3.stop();
|
|
775
|
+
}
|
|
776
|
+
}, _callee3);
|
|
777
|
+
}))();
|
|
778
|
+
},
|
|
723
779
|
deleteMedia: function deleteMedia(media, index) {
|
|
724
780
|
var list = this.mediaList.slice(0);
|
|
725
781
|
list.splice(index, 1);
|
|
@@ -727,7 +783,7 @@ export default createComponent({
|
|
|
727
783
|
this.$emit('delete', media, index);
|
|
728
784
|
},
|
|
729
785
|
hiddenInput: function hiddenInput() {
|
|
730
|
-
var
|
|
786
|
+
var _this9 = this;
|
|
731
787
|
var h = this.$createElement;
|
|
732
788
|
return [h("input", {
|
|
733
789
|
"attrs": {
|
|
@@ -740,7 +796,7 @@ export default createComponent({
|
|
|
740
796
|
"on": {
|
|
741
797
|
"change": this.handleInputFiles,
|
|
742
798
|
"click": function click() {
|
|
743
|
-
return
|
|
799
|
+
return _this9.resetInput(MediaType.PHOTO, MediaAddType.TAKE);
|
|
744
800
|
}
|
|
745
801
|
},
|
|
746
802
|
"class": bem('hidden')
|
|
@@ -754,7 +810,7 @@ export default createComponent({
|
|
|
754
810
|
"on": {
|
|
755
811
|
"change": this.handleInputFiles,
|
|
756
812
|
"click": function click() {
|
|
757
|
-
return
|
|
813
|
+
return _this9.resetInput(MediaType.PHOTO, MediaAddType.PICK);
|
|
758
814
|
}
|
|
759
815
|
},
|
|
760
816
|
"class": bem('hidden')
|
|
@@ -768,7 +824,7 @@ export default createComponent({
|
|
|
768
824
|
"on": {
|
|
769
825
|
"change": this.handleInputFiles,
|
|
770
826
|
"click": function click() {
|
|
771
|
-
return
|
|
827
|
+
return _this9.resetInput(MediaType.VIDEO, MediaAddType.TAKE);
|
|
772
828
|
}
|
|
773
829
|
},
|
|
774
830
|
"class": bem('hidden')
|
|
@@ -781,7 +837,7 @@ export default createComponent({
|
|
|
781
837
|
"on": {
|
|
782
838
|
"change": this.handleInputFiles,
|
|
783
839
|
"click": function click() {
|
|
784
|
-
return
|
|
840
|
+
return _this9.resetInput(MediaType.VIDEO, MediaAddType.PICK);
|
|
785
841
|
}
|
|
786
842
|
},
|
|
787
843
|
"class": bem('hidden')
|
|
@@ -795,7 +851,7 @@ export default createComponent({
|
|
|
795
851
|
"on": {
|
|
796
852
|
"change": this.handleInputFiles,
|
|
797
853
|
"click": function click() {
|
|
798
|
-
return
|
|
854
|
+
return _this9.resetInput(MediaType.AUDIO, MediaAddType.TAKE);
|
|
799
855
|
}
|
|
800
856
|
},
|
|
801
857
|
"class": bem('hidden')
|
|
@@ -808,7 +864,7 @@ export default createComponent({
|
|
|
808
864
|
"on": {
|
|
809
865
|
"change": this.handleInputFiles,
|
|
810
866
|
"click": function click() {
|
|
811
|
-
return
|
|
867
|
+
return _this9.resetInput(MediaType.AUDIO, MediaAddType.PICK);
|
|
812
868
|
}
|
|
813
869
|
},
|
|
814
870
|
"class": bem('hidden')
|
|
@@ -821,14 +877,14 @@ export default createComponent({
|
|
|
821
877
|
"on": {
|
|
822
878
|
"change": this.handleInputFiles,
|
|
823
879
|
"click": function click() {
|
|
824
|
-
return
|
|
880
|
+
return _this9.resetInput(MediaType.FILE, MediaAddType.PICK);
|
|
825
881
|
}
|
|
826
882
|
},
|
|
827
883
|
"class": bem('hidden')
|
|
828
884
|
})];
|
|
829
885
|
},
|
|
830
886
|
renderIcon: function renderIcon(mediaType, mediaAddType) {
|
|
831
|
-
var
|
|
887
|
+
var _this10 = this;
|
|
832
888
|
var h = this.$createElement;
|
|
833
889
|
if (mediaType === MediaType.PHOTO) {
|
|
834
890
|
if (mediaAddType === MediaAddType.TAKE) {
|
|
@@ -836,7 +892,7 @@ export default createComponent({
|
|
|
836
892
|
"class": bem('button'),
|
|
837
893
|
"on": {
|
|
838
894
|
"click": function click() {
|
|
839
|
-
return
|
|
895
|
+
return _this10.mediaPick(mediaType, mediaAddType);
|
|
840
896
|
}
|
|
841
897
|
}
|
|
842
898
|
});
|
|
@@ -845,7 +901,7 @@ export default createComponent({
|
|
|
845
901
|
"class": bem('button'),
|
|
846
902
|
"on": {
|
|
847
903
|
"click": function click() {
|
|
848
|
-
return
|
|
904
|
+
return _this10.mediaPick(mediaType, mediaAddType);
|
|
849
905
|
}
|
|
850
906
|
}
|
|
851
907
|
});
|
|
@@ -855,7 +911,7 @@ export default createComponent({
|
|
|
855
911
|
"class": bem('button'),
|
|
856
912
|
"on": {
|
|
857
913
|
"click": function click() {
|
|
858
|
-
return
|
|
914
|
+
return _this10.mediaPick(mediaType, mediaAddType);
|
|
859
915
|
}
|
|
860
916
|
}
|
|
861
917
|
});
|
|
@@ -864,7 +920,7 @@ export default createComponent({
|
|
|
864
920
|
"class": bem('button'),
|
|
865
921
|
"on": {
|
|
866
922
|
"click": function click() {
|
|
867
|
-
return
|
|
923
|
+
return _this10.mediaPick(mediaType, mediaAddType);
|
|
868
924
|
}
|
|
869
925
|
}
|
|
870
926
|
});
|
|
@@ -873,7 +929,7 @@ export default createComponent({
|
|
|
873
929
|
"class": bem('button'),
|
|
874
930
|
"on": {
|
|
875
931
|
"click": function click() {
|
|
876
|
-
return
|
|
932
|
+
return _this10.mediaPick(mediaType, mediaAddType);
|
|
877
933
|
}
|
|
878
934
|
}
|
|
879
935
|
});
|
|
@@ -914,7 +970,7 @@ export default createComponent({
|
|
|
914
970
|
}
|
|
915
971
|
},
|
|
916
972
|
renderCertificates: function renderCertificates() {
|
|
917
|
-
var
|
|
973
|
+
var _this11 = this;
|
|
918
974
|
var h = this.$createElement;
|
|
919
975
|
if (this.mediaList && this.mediaList.length) {
|
|
920
976
|
var media = this.mediaList[0];
|
|
@@ -924,8 +980,8 @@ export default createComponent({
|
|
|
924
980
|
"on": {
|
|
925
981
|
"click": function click(event) {
|
|
926
982
|
event.stopPropagation();
|
|
927
|
-
|
|
928
|
-
|
|
983
|
+
_this11.onDelete(media, 0);
|
|
984
|
+
_this11.mediaPick(MediaType.PHOTO, MediaAddType.PICK);
|
|
929
985
|
}
|
|
930
986
|
}
|
|
931
987
|
}, [h(ReUploadIcon, {
|
|
@@ -943,7 +999,7 @@ export default createComponent({
|
|
|
943
999
|
"click": function click(event) {
|
|
944
1000
|
event.stopPropagation();
|
|
945
1001
|
// 证件照模式只有一张图片
|
|
946
|
-
|
|
1002
|
+
_this11.previewMedia(media, 0);
|
|
947
1003
|
}
|
|
948
1004
|
}
|
|
949
1005
|
}, [reUpload]);
|
|
@@ -1035,6 +1091,11 @@ export default createComponent({
|
|
|
1035
1091
|
*/
|
|
1036
1092
|
renderMediaThumbnail: function renderMediaThumbnail(media) {
|
|
1037
1093
|
var h = this.$createElement;
|
|
1094
|
+
if (this.$scopedSlots['preview-media']) {
|
|
1095
|
+
return this.slots('preview-media', {
|
|
1096
|
+
file: media
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1038
1099
|
if (media.showSrc) {
|
|
1039
1100
|
return h(ZtImage, {
|
|
1040
1101
|
"attrs": {
|
|
@@ -1078,7 +1139,7 @@ export default createComponent({
|
|
|
1078
1139
|
}
|
|
1079
1140
|
},
|
|
1080
1141
|
renderMediaList: function renderMediaList() {
|
|
1081
|
-
var
|
|
1142
|
+
var _this12 = this;
|
|
1082
1143
|
var h = this.$createElement;
|
|
1083
1144
|
return this.mediaList.map(function (media, index) {
|
|
1084
1145
|
var showDelete = media.deletable && media.status !== MediaUploadStatus.UPLOADING;
|
|
@@ -1087,7 +1148,7 @@ export default createComponent({
|
|
|
1087
1148
|
"on": {
|
|
1088
1149
|
"click": function click(event) {
|
|
1089
1150
|
event.stopPropagation();
|
|
1090
|
-
|
|
1151
|
+
_this12.onDelete(media, index);
|
|
1091
1152
|
}
|
|
1092
1153
|
}
|
|
1093
1154
|
});
|
|
@@ -1096,10 +1157,10 @@ export default createComponent({
|
|
|
1096
1157
|
"on": {
|
|
1097
1158
|
"click": function click(event) {
|
|
1098
1159
|
event.stopPropagation();
|
|
1099
|
-
|
|
1160
|
+
_this12.previewMedia(media, index);
|
|
1100
1161
|
}
|
|
1101
1162
|
}
|
|
1102
|
-
}, [
|
|
1163
|
+
}, [_this12.renderMediaBox(media), _this12.genThumbnailMask(media), deleteIcon]);
|
|
1103
1164
|
});
|
|
1104
1165
|
},
|
|
1105
1166
|
selectAction: function selectAction(action) {
|
|
@@ -1108,7 +1169,7 @@ export default createComponent({
|
|
|
1108
1169
|
}
|
|
1109
1170
|
},
|
|
1110
1171
|
render: function render() {
|
|
1111
|
-
var
|
|
1172
|
+
var _this13 = this;
|
|
1112
1173
|
var h = arguments[0];
|
|
1113
1174
|
var title = this.showTitle && h("div", {
|
|
1114
1175
|
"class": bem('title')
|
|
@@ -1121,9 +1182,9 @@ export default createComponent({
|
|
|
1121
1182
|
"mediaUrl": this.mediaUrlToPlay
|
|
1122
1183
|
}, this.mediaPlayerProps),
|
|
1123
1184
|
"model": {
|
|
1124
|
-
value:
|
|
1185
|
+
value: _this13.mediaPlayerVisible,
|
|
1125
1186
|
callback: function callback($$v) {
|
|
1126
|
-
|
|
1187
|
+
_this13.mediaPlayerVisible = $$v;
|
|
1127
1188
|
}
|
|
1128
1189
|
}
|
|
1129
1190
|
}), h(ZtActionSheet, {
|
|
@@ -1137,9 +1198,9 @@ export default createComponent({
|
|
|
1137
1198
|
"select": this.selectAction
|
|
1138
1199
|
},
|
|
1139
1200
|
"model": {
|
|
1140
|
-
value:
|
|
1201
|
+
value: _this13.actionVisible,
|
|
1141
1202
|
callback: function callback($$v) {
|
|
1142
|
-
|
|
1203
|
+
_this13.actionVisible = $$v;
|
|
1143
1204
|
}
|
|
1144
1205
|
}
|
|
1145
1206
|
}), this.pickerMode === "certificate" ? h("div", {
|
|
@@ -1150,9 +1211,10 @@ export default createComponent({
|
|
|
1150
1211
|
}, [this.renderCertificates()]) : h("div", {
|
|
1151
1212
|
"class": bem('line')
|
|
1152
1213
|
}, [this.renderButtons(), this.slots('extend')]), h(ZtGrid, {
|
|
1214
|
+
"ref": "grid",
|
|
1153
1215
|
"directives": [{
|
|
1154
1216
|
name: "show",
|
|
1155
|
-
value: this.
|
|
1217
|
+
value: this.showPreview
|
|
1156
1218
|
}],
|
|
1157
1219
|
"attrs": {
|
|
1158
1220
|
"column-num": '3',
|
package/lib/index.js
CHANGED
|
@@ -161,7 +161,7 @@ var _toast = _interopRequireDefault(require("./toast"));
|
|
|
161
161
|
exports.Toast = _toast.default;
|
|
162
162
|
var _uploader = _interopRequireDefault(require("./uploader"));
|
|
163
163
|
exports.Uploader = _uploader.default;
|
|
164
|
-
var version = exports.version = '2.1.
|
|
164
|
+
var version = exports.version = '2.1.22';
|
|
165
165
|
function install(Vue) {
|
|
166
166
|
var components = [_actionSheet.default, _area.default, _avatar.default, _backTop.default, _badge.default, _button.default, _calendar.default, _cascader.default, _cell.default, _cellGroup.default, _checkbox.default, _checkboxGroup.default, _col.default, _collapse.default, _collapseItem.default, _countDown.default, _datetimePicker.default, _dialog.default, _divider.default, _dropdownItem.default, _dropdownMenu.default, _empty.default, _field.default, _foldDialog.default, _form.default, _grid.default, _gridItem.default, _hierarchySelect.default, _icon.default, _image.default, _imagePreview.default, _indexAnchor.default, _indexBar.default, _info.default, _lazyload.default, _list.default, _loading.default, _locale.default, _mediaPicker.default, _mediaPlayer.default, _multiplePicker.default, _navBar.default, _noticeBar.default, _numberKeyboard.default, _overlay.default, _passwordInput.default, _picker.default, _popover.default, _popup.default, _pullRefresh.default, _radio.default, _radioGroup.default, _rate.default, _row.default, _search.default, _signature.default, _skeleton.default, _slider.default, _speechRecognizer.default, _step.default, _stepper.default, _steps.default, _sticky.default, _swipe.default, _swipeCell.default, _swipeItem.default, _switch.default, _switchCell.default, _tab.default, _tabbar.default, _tabbarItem.default, _table.default, _tabs.default, _tag.default, _textEllipsis.default, _timeline.default, _toast.default, _uploader.default];
|
|
167
167
|
components.forEach(function (item) {
|