mali-applet-ui 1.1.91 → 1.1.94

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.
@@ -10,12 +10,12 @@
10
10
  </view>
11
11
  </view>
12
12
  <template v-if="!isFromReadonly && !isLimit">
13
- <view v-if="hasForm" class="ml-upload-image-form-add-btn" @tap="chooseEvent">
13
+ <view v-if="hasForm" class="ml-upload-image-form-add-btn" @tap="chooseImgEvent">
14
14
  <ml-icon v-if="loading" name="loading" roll />
15
15
  <ml-icon v-else name="add-circle" />
16
16
  </view>
17
17
  <view v-else class="ml-upload-image-add">
18
- <view class="ml-upload-image-add-btn" @tap="chooseEvent">
18
+ <view class="ml-upload-image-add-btn" @tap="chooseImgEvent">
19
19
  <view class="ml-upload-image-add-icon">
20
20
  <ml-icon v-if="loading" name="loading" roll />
21
21
  <ml-icon v-else name="add" />
@@ -29,12 +29,12 @@
29
29
  <!-- 上传文件 -->
30
30
  <view v-else class="ml-upload-file-list-warpper">
31
31
  <template v-if="!isFromReadonly && !isLimit">
32
- <view v-if="hasForm" class="ml-upload-file-form-add-btn" @tap="chooseEvent">
32
+ <view v-if="hasForm" class="ml-upload-file-form-add-btn" @tap="chooseFileEvent">
33
33
  <ml-icon v-if="loading" name="loading" roll />
34
34
  <ml-icon v-else name="add-circle" />
35
35
  </view>
36
36
  <view v-else class="ml-upload-file-add">
37
- <view class="ml-upload-file-add-btn" @tap="chooseEvent">
37
+ <view class="ml-upload-file-add-btn" @tap="chooseFileEvent">
38
38
  <text class="ml-upload-file-add-icon">
39
39
  <ml-icon v-if="loading" name="loading" roll />
40
40
  <ml-icon v-else name="add" />
@@ -219,8 +219,10 @@ export default {
219
219
  type: Boolean,
220
220
  default: false
221
221
  },
222
- limit: Number,
223
- limitCount: Number,
222
+ limitCount: {
223
+ type: Number,
224
+ default: 0
225
+ },
224
226
  limitSize: {
225
227
  type: Number,
226
228
  default: Number(globalStore.upload?.limitSize || 20480)
@@ -298,7 +300,13 @@ export default {
298
300
  return !!this.form
299
301
  },
300
302
  limitFileLen () {
301
- return this.limitCount || this.limit || 9
303
+ if (this.limitCount) {
304
+ return this.limitCount
305
+ }
306
+ if (this.mediatype === 'image') {
307
+ return 9
308
+ }
309
+ return 100
302
310
  },
303
311
  isLimit () {
304
312
  if (this.multiple) {
@@ -581,11 +589,11 @@ export default {
581
589
  })
582
590
  // #endif
583
591
  },
584
- choose () {
592
+ choose (type) {
585
593
  if (this.loading) {
586
594
  return
587
595
  }
588
- let chooseMethod = uploadAllFiles
596
+ let chooseMethod = type === 'image' ? uploadImageFiles : uploadAllFiles
589
597
  // 钉钉暂时只支持图片
590
598
  if (this.mediatype === 'image' || this.platformEnv.isDDMP || this.platformEnv.isQWMP) {
591
599
  chooseMethod = uploadImageFiles
@@ -639,8 +647,23 @@ export default {
639
647
  console.log(e)
640
648
  })
641
649
  },
642
- chooseEvent () {
643
- this.choose()
650
+ chooseImgEvent () {
651
+ this.choose('image')
652
+ },
653
+ chooseFileEvent () {
654
+ uni.showActionSheet({
655
+ itemList: ['选择图片', '选择文件'],
656
+ // #ifdef MP-DINGTALK
657
+ cancelButtonText: '取消',
658
+ // #endif
659
+ success: (res) => {
660
+ if (res.tapIndex === 1) {
661
+ this.choose()
662
+ } else {
663
+ this.choose('image')
664
+ }
665
+ }
666
+ })
644
667
  }
645
668
  }
646
669
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.1.91",
3
+ "version": "1.1.94",
4
4
  "description": "码里UI-小程序组件库(vue2)",
5
5
  "files": [
6
6
  "lib",