@xtdev/xt-miniprogram-ui 1.2.72 → 1.2.74

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.
@@ -30,39 +30,39 @@ Component({
30
30
  properties: {
31
31
  value: {
32
32
  type: [Number, String],
33
- default: 1
33
+ value: 1
34
34
  },
35
35
  min: {
36
36
  type: Number,
37
- default: 0
37
+ value: 0
38
38
  },
39
39
  max: {
40
40
  type: Number,
41
- default: 100
41
+ value: 100
42
42
  },
43
43
  step: {
44
44
  type: Number,
45
- default: 1
45
+ value: 1
46
46
  },
47
47
  background: {
48
48
  type: String,
49
- default: '#fff'
49
+ value: '#fff'
50
50
  },
51
51
  color: {
52
52
  type: String,
53
- default: '#000'
53
+ value: '#000'
54
54
  },
55
55
  disabled: {
56
56
  type: Boolean,
57
- default: false
57
+ value: false
58
58
  },
59
59
  stepTips: {
60
60
  type: String,
61
- default: ''
61
+ value: ''
62
62
  },
63
63
  disableInput: {
64
64
  type: Boolean,
65
- default: false
65
+ value: false
66
66
  }
67
67
  },
68
68
 
@@ -151,8 +151,7 @@ Component({
151
151
  },
152
152
  observers: {
153
153
  value(val) {
154
- const inputValue = this.data.inputValue + val;
155
- this.setData({inputValue});
154
+ this.setData({inputValue: val});
156
155
  }
157
156
  }
158
157
  });
@@ -26,6 +26,10 @@ Component({
26
26
  type: String,
27
27
  value: "",
28
28
  },
29
+ icon: {
30
+ type: String,
31
+ value: "https://img.tanjiu.cn/home/DDDsrH7PpNhneQsXGFmGGPcSM3QYXG8N.png",
32
+ },
29
33
  fileList: {
30
34
  type: Array,
31
35
  value: [],
@@ -43,6 +47,10 @@ Component({
43
47
  type: Array,
44
48
  value: ["album", "camera"],
45
49
  },
50
+ fileType: {
51
+ type: String,
52
+ value: "image",
53
+ },
46
54
  customUpload: {
47
55
  type: Boolean,
48
56
  value: false,
@@ -104,6 +112,7 @@ Component({
104
112
  max,
105
113
  sourceType,
106
114
  fileList,
115
+ fileType,
107
116
  } = this.properties;
108
117
  if (customUpload) {
109
118
  this.triggerEvent("upload", {});
@@ -119,14 +128,20 @@ Component({
119
128
  // ios企微环境下不支持该API
120
129
  const { platform, environment } = this.getSystemInfo();
121
130
  console.log(platform, environment);
122
- let chooseImgApi = (environment !== "wxwork" || platform !== "ios") ? wx.chooseMedia : wx.chooseImage;
131
+ let chooseImgApi = (environment !== "wxwork" || platform !== "ios") ? wx.chooseMedia : fileType == 'video' ? wx.chooseVideo : wx.chooseImage;
123
132
  chooseImgApi({
124
133
  count: max - fileList.length,
125
134
  mediaType: ["image"],
135
+ mediaType: fileType == "video" ? ["video"] : ["image"],
126
136
  sizeType: ["compressed"],
127
137
  sourceType,
128
138
  success(res) {
129
139
  console.log(res, "0000");
140
+ if (fileType == "video" && res.tempFiles[0].size / 1024 / 1024 > 100) {
141
+ // 视频上传不允许超过100M
142
+ wx.showToast({title: '视频大小不可超过100M', icon: "none"});
143
+ return;
144
+ }
130
145
  // tempFilePath可以作为img标签的src属性显示图片
131
146
  const tempFilePaths = res.tempFiles;
132
147
  if (Array.isArray(tempFilePaths) && tempFilePaths.length) {
@@ -3,12 +3,19 @@
3
3
  <view class="title_text" wx:if="{{title}}">{{title}}</view>
4
4
  <view class="file_box">
5
5
  <view wx:for="{{fileList}}" wx:key="index" class="file_item">
6
- <image class="file_img" src="{{item}}" mode="aspectFit" bindtap="onPreviewImage" data-url="{{item}}" data-index="{{index}}" />
7
- <!-- 删除 -->
8
- <xt-icon icon="shanchu" size="48" class="close_box" bindtap="onDelete" data-url="{{item}}" data-index="{{index}}" wx:if="{{!disabled}}"></xt-icon>
6
+ <block wx:if="{{fileType == 'video'}}">
7
+ <video class="file_img" src="{{item}}" mode="aspectFill" data-url="{{item}}" data-index="{{index}}" />
8
+ <!-- 删除 -->
9
+ <image src="https://img.tanjiu.cn/home/idzQXfttSiQryeX3jYEfc5xjWhZPdwY4.png" class="close_box" mode="aspectFill" bindtap="onDelete" data-url="{{item}}" data-index="{{index}}" wx:if="{{!disabled}}"></image>
10
+ </block>
11
+ <block wx:else>
12
+ <image class="file_img" src="{{item}}" mode="aspectFit" bindtap="onPreviewImage" data-url="{{item}}" data-index="{{index}}" />
13
+ <!-- 删除 -->
14
+ <xt-icon icon="shanchu" size="48" class="close_box" bindtap="onDelete" data-url="{{item}}" data-index="{{index}}" wx:if="{{!disabled}}"></xt-icon>
15
+ </block>
9
16
  </view>
10
17
  <view class="file_item" wx:if="{{!disabled && fileList.length<max}}" bindtap="startTakePhoto">
11
- <image src="https://img.tanjiu.cn/home/DDDsrH7PpNhneQsXGFmGGPcSM3QYXG8N.png" class="camera_icon" />
18
+ <image src="{{icon}}" class="camera_icon" />
12
19
  <view wx:if="{{uploadDesc}}" class="upload_desc">{{uploadDesc}}</view>
13
20
  </view>
14
21
  </view>
@@ -52,6 +52,8 @@
52
52
  .close_box {
53
53
  position : absolute;
54
54
  line-height: 48rpx;
55
+ width : 48rpx;
56
+ height : 48rpx;
55
57
  top : 0;
56
58
  right : 0;
57
59
  color : rgba(0, 0, 0, 0.5);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtdev/xt-miniprogram-ui",
3
- "version": "1.2.72",
3
+ "version": "1.2.74",
4
4
  "description": "",
5
5
  "miniprogram": "libs",
6
6
  "publishConfig": {