sadais-piui 1.2.7-beta163 → 1.2.7-beta165
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/components/pi-upload-img/index.vue +44 -12
- package/package.json +1 -1
- package/scss/common.scss +7 -7
|
@@ -479,10 +479,19 @@ export default {
|
|
|
479
479
|
return this.disabled || (parent && parent.getDisabled)
|
|
480
480
|
},
|
|
481
481
|
actionSheetItems() {
|
|
482
|
+
const hasImage = this.fileTypes.includes('image');
|
|
483
|
+
const hasVideo = this.fileTypes.includes('video');
|
|
484
|
+
const mediaTypesTitle = hasImage && hasVideo
|
|
485
|
+
? '图片/视频'
|
|
486
|
+
: hasImage
|
|
487
|
+
? '图片'
|
|
488
|
+
: hasVideo
|
|
489
|
+
? '视频'
|
|
490
|
+
: '';
|
|
482
491
|
return [
|
|
483
492
|
{
|
|
484
493
|
id: 1,
|
|
485
|
-
text:
|
|
494
|
+
text: `选择媒体${mediaTypesTitle}`
|
|
486
495
|
},
|
|
487
496
|
{
|
|
488
497
|
id: 2,
|
|
@@ -676,7 +685,17 @@ export default {
|
|
|
676
685
|
isRightType
|
|
677
686
|
)
|
|
678
687
|
if (!isRightType) {
|
|
679
|
-
|
|
688
|
+
uni.showModal({
|
|
689
|
+
title: '文件类型错误',
|
|
690
|
+
content: `请选择${this.getExtension.join('、')}类型的文件上传`,
|
|
691
|
+
showCancel: false,
|
|
692
|
+
confirmText: '好的',
|
|
693
|
+
success: (res) => {
|
|
694
|
+
if (res.confirm) {
|
|
695
|
+
this.handleChoose()
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
})
|
|
680
699
|
}
|
|
681
700
|
return isRightType
|
|
682
701
|
},
|
|
@@ -978,13 +997,17 @@ export default {
|
|
|
978
997
|
this.showCustomTakePhoto = true
|
|
979
998
|
},
|
|
980
999
|
async handleChooseFile() {
|
|
981
|
-
const { sizeType, sourceType, crop } = this.getChooseFileOpts
|
|
1000
|
+
const { sizeType, sourceType, crop, extension } = this.getChooseFileOpts
|
|
982
1001
|
try {
|
|
1002
|
+
const hasImage = this.fileTypes.includes('image');
|
|
1003
|
+
const hasVideo = this.fileTypes.includes('video');
|
|
1004
|
+
const type = hasImage && hasVideo ? 'all' : hasImage ? 'image' : 'video';
|
|
1005
|
+
|
|
983
1006
|
const [cancel, result] = await uni.chooseFile({
|
|
984
1007
|
count: this.getUploadMaxCount,
|
|
985
|
-
|
|
1008
|
+
type,
|
|
986
1009
|
sourceType,
|
|
987
|
-
|
|
1010
|
+
extension
|
|
988
1011
|
})
|
|
989
1012
|
|
|
990
1013
|
if (cancel && cancel?.errMsg === 'chooseFile:fail cancel') {
|
|
@@ -1149,13 +1172,22 @@ export default {
|
|
|
1149
1172
|
}
|
|
1150
1173
|
},
|
|
1151
1174
|
async handleChooseMedia() {
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1175
|
+
if(this.type === 'all') {
|
|
1176
|
+
// 选择图片/视频
|
|
1177
|
+
const hasImage = this.fileTypes.includes('image');
|
|
1178
|
+
const hasVideo = this.fileTypes.includes('video');
|
|
1179
|
+
const sourceType = this.getChooseFileOpts.sourceType;
|
|
1180
|
+
if(hasImage && hasVideo) {
|
|
1181
|
+
this.handleUniChooseMedia(['mix'], sourceType);
|
|
1182
|
+
} else if(hasImage) {
|
|
1183
|
+
this.handleUniChooseMedia(['image'], sourceType);
|
|
1184
|
+
} else if(hasVideo) {
|
|
1185
|
+
this.handleUniChooseMedia(['video'], sourceType);
|
|
1186
|
+
}
|
|
1187
|
+
} else {
|
|
1188
|
+
// 选择视频
|
|
1189
|
+
this.handleUniChooseMedia(['video'], this.getChooseVideoOpts.sourceType);
|
|
1190
|
+
}
|
|
1159
1191
|
},
|
|
1160
1192
|
async handleUniChooseMedia(mediaType, sourceType) {
|
|
1161
1193
|
const { maxDuration, camera } =
|
package/package.json
CHANGED
package/scss/common.scss
CHANGED
|
@@ -552,13 +552,13 @@ pi-input {
|
|
|
552
552
|
width: 100%;
|
|
553
553
|
}
|
|
554
554
|
|
|
555
|
-
//
|
|
556
|
-
::-webkit-scrollbar {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
}
|
|
555
|
+
// 不显示滚动条(可按需定义,不在框架定义)
|
|
556
|
+
// ::-webkit-scrollbar {
|
|
557
|
+
// width: 0;
|
|
558
|
+
// height: 0;
|
|
559
|
+
// color: transparent;
|
|
560
|
+
// background: transparent;
|
|
561
|
+
// }
|
|
562
562
|
|
|
563
563
|
// 解决image加载闪烁的问题
|
|
564
564
|
image {
|