@cloudbase/weda-ui 0.2.8 → 0.2.12

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.
Files changed (104) hide show
  1. package/package.json +62 -41
  2. package/src/configs/.DS_Store +0 -0
  3. package/src/configs/components/button.json +7 -3
  4. package/src/configs/components/form/richText.json +1 -1
  5. package/src/configs/components/form/uploader.json +29 -1
  6. package/src/configs/components/form/uploaderFile.json +158 -0
  7. package/src/configs/components/image.json +12 -3
  8. package/src/configs/components/link.json +3 -3
  9. package/src/configs/components/richtextview.json +2 -2
  10. package/src/configs/components/scrollVeiw.json +5 -5
  11. package/src/configs/components/swiper.json +6 -6
  12. package/src/configs/components/tabs.json +3 -3
  13. package/src/configs/components/text.json +39 -4
  14. package/src/configs/index.js +6 -5
  15. package/src/mp/components/button/index.js +1 -0
  16. package/src/mp/components/button/index.wxss +8 -0
  17. package/src/mp/components/form/select/index.js +18 -0
  18. package/src/mp/components/form/uploader/index.js +26 -29
  19. package/src/mp/components/form/uploaderFile/index.js +247 -0
  20. package/src/mp/components/form/uploaderFile/index.json +9 -0
  21. package/src/mp/components/form/uploaderFile/index.wxml +46 -0
  22. package/src/mp/components/form/uploaderFile/index.wxss +104 -0
  23. package/src/mp/components/text/index.js +33 -0
  24. package/src/mp/components/text/index.wxml +1 -1
  25. package/src/mp/components/text/index.wxss +18 -0
  26. package/src/mp/index.json +1 -0
  27. package/src/mp/utils/platform.js +20 -0
  28. package/src/mp/utils/tcb.js +11 -0
  29. package/src/web/actions/showModal/{index.jsx → index.tsx} +53 -3
  30. package/src/web/components/auth/index.js +2 -2
  31. package/src/web/components/button/index.css +9 -0
  32. package/src/web/components/button/{index.jsx → index.tsx} +27 -41
  33. package/src/web/components/container/{index.jsx → index.tsx} +6 -10
  34. package/src/web/components/drawer/index.tsx +57 -0
  35. package/src/web/components/form/checkbox/{index.jsx → index.tsx} +24 -48
  36. package/src/web/components/form/enumSelect/MultipleSelect.jsx +89 -0
  37. package/src/web/components/form/enumSelect/NormalSelect.tsx +94 -0
  38. package/src/web/components/form/enumSelect/SelectContainer.jsx +43 -0
  39. package/src/web/components/form/enumSelect/index.jsx +9 -0
  40. package/src/web/components/form/enumSelect/props/defaultProps.js +39 -0
  41. package/src/web/components/form/enumSelect/props/propsTypes.js +50 -0
  42. package/src/web/components/form/form/index.tsx +48 -0
  43. package/src/web/components/form/formcell/{index.jsx → index.tsx} +6 -13
  44. package/src/web/components/form/input/index.css +4 -0
  45. package/src/web/components/form/input/{index.jsx → index.tsx} +33 -67
  46. package/src/web/components/form/radio/{index.jsx → index.tsx} +19 -42
  47. package/src/web/components/form/{renderDecorator.jsx → renderDecorator.tsx} +1 -3
  48. package/src/web/components/form/select/{h5.jsx → h5.tsx} +18 -62
  49. package/src/web/components/form/select/{index.jsx → index.tsx} +51 -94
  50. package/src/web/components/form/select/region/{cities.js → cities.ts} +1 -1
  51. package/src/web/components/form/select/region/{index.js → index.ts} +3 -3
  52. package/src/web/components/form/select/region/{provinces.js → provinces.ts} +1 -1
  53. package/src/web/components/form/select/region/{regions.js → regions.ts} +1 -1
  54. package/src/web/components/form/select/time.jsx +2 -2
  55. package/src/web/components/form/switch/{index.jsx → index.tsx} +30 -47
  56. package/src/web/components/form/textarea/{index.jsx → index.tsx} +22 -55
  57. package/src/web/components/form/tips/{index.jsx → index.tsx} +8 -22
  58. package/src/web/components/form/types.d.ts +12 -0
  59. package/src/web/components/form/uploader/{index.jsx → index.tsx} +16 -14
  60. package/src/web/components/form/uploader/{uploader.h5.jsx → uploader.h5.tsx} +67 -57
  61. package/src/web/components/form/uploader/{uploader.pc.jsx → uploader.pc.tsx} +26 -43
  62. package/src/web/components/form/uploaderFile/fail.svg +12 -0
  63. package/src/web/components/form/uploaderFile/index.css +423 -0
  64. package/src/web/components/form/uploaderFile/index.jsx +30 -0
  65. package/src/web/components/form/uploaderFile/pending.svg +18 -0
  66. package/src/web/components/form/uploaderFile/success.svg +12 -0
  67. package/src/web/components/form/uploaderFile/uploadFile.h5.jsx +562 -0
  68. package/src/web/components/form/uploaderFile/uploadFile.pc.jsx +487 -0
  69. package/src/web/components/image/{image.jsx → image.tsx} +8 -21
  70. package/src/web/components/image/{index.jsx → index.tsx} +22 -37
  71. package/src/web/components/index.js +36 -1
  72. package/src/web/components/link/{index.jsx → index.tsx} +19 -36
  73. package/src/web/components/modal/{index.jsx → index.tsx} +24 -10
  74. package/src/web/components/picker/{datePicker.jsx → datePicker.tsx} +11 -12
  75. package/src/web/components/picker/{picker.jsx → picker.tsx} +7 -10
  76. package/src/web/components/picker/{timePicker.jsx → timePicker.tsx} +8 -16
  77. package/src/web/components/richText/{const.js → const.ts} +0 -0
  78. package/src/web/components/richText/index.jsx +5 -2
  79. package/src/web/components/richTextView/index.tsx +67 -0
  80. package/src/web/components/scrollView/{index.jsx → index.tsx} +18 -33
  81. package/src/web/components/slot/{index.jsx → index.tsx} +8 -9
  82. package/src/web/components/swiper/index.css +1 -1
  83. package/src/web/components/swiper/{index.jsx → index.tsx} +66 -73
  84. package/src/web/components/tabs/index.tsx +33 -0
  85. package/src/web/components/tabs/{tabs.h5.jsx → tabs.h5.tsx} +4 -33
  86. package/src/web/components/tabs/{tabs.pc.jsx → tabs.pc.tsx} +5 -39
  87. package/src/web/components/text/index.css +18 -0
  88. package/src/web/components/text/index.tsx +69 -0
  89. package/src/web/components/uploaderFileView/index.css +11 -0
  90. package/src/web/components/uploaderFileView/index.jsx +75 -0
  91. package/src/web/components/uploaderView/{index.jsx → index.tsx} +12 -15
  92. package/src/web/types.d.ts +20 -0
  93. package/src/web/utils/constant.js +2 -0
  94. package/src/web/utils/loading-fallback.tsx +2 -0
  95. package/src/web/utils/platform.js +77 -6
  96. package/src/web/utils/useSetState.ts +14 -0
  97. package/src/web/utils/useSyncValue.ts +17 -0
  98. package/src/configs/components/button.svg +0 -18
  99. package/src/web/components/drawer/index.jsx +0 -64
  100. package/src/web/components/form/form/index.jsx +0 -76
  101. package/src/web/components/richTextView/index.jsx +0 -89
  102. package/src/web/components/tabs/index.jsx +0 -10
  103. package/src/web/components/text/index.jsx +0 -71
  104. package/src/web/utils/useSyncValue.js +0 -14
@@ -16,6 +16,7 @@ import Select from './components/form/select.json';
16
16
  import Auth from './components/auth.json';
17
17
  import Slot from './components/slot.json';
18
18
  import Uploader from './components/form/uploader.json';
19
+ import UploaderFile from './components/form/uploaderFile.json';
19
20
  import ScrollView from './components/scrollVeiw.json';
20
21
  import Swiper from './components/swiper.json';
21
22
  // import Label from './components/form/label.json';
@@ -24,10 +25,10 @@ import Modal from './components/modal.json';
24
25
  import Drawer from './components/drawer.json';
25
26
  import RichText from './components/form/richText.json';
26
27
  import RichTextView from './components/richtextview.json';
27
- import Tabs from './components/tabs';
28
+ import Tabs from './components/tabs.json';
28
29
 
29
- import showToast from './actions/showToast';
30
- import showModal from './actions/showModal';
30
+ import showToast from './actions/showToast.json';
31
+ import showModal from './actions/showModal.json';
31
32
 
32
33
  export const components = {
33
34
  Button,
@@ -48,6 +49,7 @@ export const components = {
48
49
  Auth,
49
50
  Slot,
50
51
  Uploader,
52
+ UploaderFile,
51
53
  ScrollView,
52
54
  Swiper,
53
55
  // Label,
@@ -57,8 +59,7 @@ export const components = {
57
59
  RichTextView,
58
60
  Link,
59
61
  Drawer,
60
- Tabs
61
-
62
+ Tabs,
62
63
  };
63
64
 
64
65
  export const actions = {
@@ -52,6 +52,7 @@ Component({
52
52
  'weda-button': true,
53
53
  'weui-btn': true,
54
54
  'weui-btn_mini': size === 'mini',
55
+ 'weui-btn_large': size === 'large',
55
56
  'weui-btn_primary': type === 'primary',
56
57
  'weui-btn_default': type === 'default',
57
58
  'weui-btn_warn': type === 'warn',
@@ -3,3 +3,11 @@
3
3
  .weui-btn.weui-btn_primary:not(.weui-btn_disabled):active {
4
4
  background-color: var(--weui-TAG-TEXT-BLUE);
5
5
  }
6
+ .weda-ui.weui-btn.weui-btn_large {
7
+ font-size: large;
8
+ display: block;
9
+ padding-left: 14rpx;
10
+ padding-right: 14rpx;
11
+ text-align: center;
12
+ width: 100%;
13
+ }
@@ -212,6 +212,24 @@ Component({
212
212
  displayCls: displayValue ? '' : 'weui-input__placeholder',
213
213
  });
214
214
  },
215
+ range: function (range) {
216
+ const { mode } = this.properties;
217
+ let selectRange = '';
218
+ switch (mode) {
219
+ case 'selector': {
220
+ selectRange = range.map((item) => item.label);
221
+ break;
222
+ }
223
+ default: {
224
+ break;
225
+ }
226
+ }
227
+ if (selectRange != '') {
228
+ this.setData({
229
+ selectRange,
230
+ });
231
+ }
232
+ },
215
233
  },
216
234
  methods: {
217
235
  onChange(e) {
@@ -1,5 +1,5 @@
1
1
  import { getCloudInstance } from '../../../utils/tcb';
2
- import deepEqual from '../../../utils/deepEqual';
2
+ // import deepEqual from '../../../utils/deepEqual';
3
3
 
4
4
  Component({
5
5
  options: {
@@ -9,9 +9,9 @@ Component({
9
9
  attached() {
10
10
  this.setData({
11
11
  urls: this.properties.defaultValue,
12
- files: this.properties.defaultValue.map(url => ({url}))
12
+ files: this.properties.defaultValue.map((url) => ({ url })),
13
13
  });
14
- }
14
+ },
15
15
  },
16
16
  properties: {
17
17
  maxUploadCount: {
@@ -28,20 +28,20 @@ Component({
28
28
  },
29
29
  layout: {
30
30
  type: String,
31
- value: 'horizontal'
31
+ value: 'horizontal',
32
32
  },
33
33
  defaultValue: {
34
34
  type: Array,
35
- value: []
35
+ value: [],
36
36
  },
37
37
  single: {
38
38
  type: Boolean,
39
- value: false
39
+ value: false,
40
40
  },
41
41
  maxSize: {
42
42
  type: Number,
43
- value: 10
44
- }
43
+ value: 10,
44
+ },
45
45
  },
46
46
  data: {
47
47
  maxCount: 0,
@@ -67,7 +67,7 @@ Component({
67
67
  // https://github.com/wechat-miniprogram/weui-miniprogram/blob/a3630575910302e3b94e69fcef266d2b509de650/src/components/uploader/uploader.ts#L149
68
68
  // 写死的从返回值的 .urls 获取展示用的url来用。一定要将tempFilePaths透传下去,否则会重新加载然后出现闪白
69
69
  return { urls: files.tempFilePaths, cloudUrls };
70
- }
70
+ },
71
71
  },
72
72
  methods: {
73
73
  uploadError: function (e) {
@@ -77,24 +77,20 @@ Component({
77
77
  uploadSuccess: async function (e) {
78
78
  const urls = e.detail.cloudUrls; // uploadFile 获取返回值
79
79
  // 小程序自带tempURL 不需要调用 tcb.getTempFileURL 获取
80
- this.triggerEvent(
81
- 'success',
82
- {
83
- value: urls[0]
84
- }
85
- );
80
+ this.triggerEvent('success', {
81
+ value: urls[0],
82
+ });
86
83
  this.setData({
87
- files: this.data.files.concat(e.detail.urls.map(url => ({url}))),
88
- urls: [...this.data.urls, ...urls]
84
+ files: this.data.files.concat(e.detail.urls.map((url) => ({ url }))),
85
+ urls: [...this.data.urls, ...urls],
89
86
  });
90
-
91
87
  },
92
- onDelete: function(e) {
88
+ onDelete: function (e) {
93
89
  this.setData({
94
90
  files: this.data.files.filter((v, index) => e.detail.index !== index),
95
- urls: this.data.urls.filter((v, index) => e.detail.index !== index)
91
+ urls: this.data.urls.filter((v, index) => e.detail.index !== index),
96
92
  });
97
- }
93
+ },
98
94
  },
99
95
  observers: {
100
96
  // 'defaultValue': function(value) {
@@ -108,18 +104,19 @@ Component({
108
104
  // });
109
105
  // }
110
106
  // },
111
- 'maxUploadCount, single': function(maxUploadCount, single) {
107
+
108
+ 'maxUploadCount, single': function (maxUploadCount, single) {
112
109
  const maxCount = single ? 1 : maxUploadCount;
113
110
  this.setData({
114
- maxCount
111
+ maxCount,
115
112
  });
116
113
  },
117
- 'urls': function (urls) {
114
+ urls: function (urls) {
118
115
  let value = urls;
119
- if(this.properties.single) {
116
+ if (this.properties.single) {
120
117
  value = urls[0] ?? '';
121
118
  }
122
- this.triggerEvent('change', {value});
123
- }
124
- }
125
- });
119
+ this.triggerEvent('change', { value });
120
+ },
121
+ },
122
+ });
@@ -0,0 +1,247 @@
1
+ import { getCloudInstance, getTempFileURL } from '../../../utils/tcb';
2
+ import deepEqual from '../../../utils/deepEqual';
3
+ import { transSize } from '../../../utils/platform';
4
+
5
+ Component({
6
+ options: {
7
+ virtualHost: true,
8
+ multipleSlots: true,
9
+ },
10
+ lifetimes: {
11
+ attached() {
12
+ this.setData({
13
+ urls: this.properties.defaultValue,
14
+ files: this.properties.defaultValue.map((url) => ({ url })),
15
+ });
16
+ },
17
+ },
18
+ properties: {
19
+ label: {
20
+ type: String,
21
+ value: '文件上传',
22
+ },
23
+ //是否显示标题
24
+ labelVisible: {
25
+ type: Boolean,
26
+ value: true,
27
+ },
28
+ //单文件上传模式
29
+ single: {
30
+ type: Boolean,
31
+ value: false,
32
+ },
33
+ defaultValue: {
34
+ type: Array,
35
+ value: [],
36
+ },
37
+ maxUploadCount: {
38
+ type: Number,
39
+ value: 9,
40
+ },
41
+ //单个文件最大使用限制
42
+ maxSize: {
43
+ type: Number,
44
+ value: 10,
45
+ },
46
+ layout: {
47
+ type: String,
48
+ value: 'horizontal',
49
+ },
50
+ extClass: {
51
+ type: String,
52
+ value: '',
53
+ },
54
+ tips: {
55
+ type: Boolean,
56
+ value: false,
57
+ },
58
+ status: {
59
+ type: String,
60
+ valve: 'success',
61
+ },
62
+ downloadVisible: {
63
+ type: Boolean,
64
+ value: true,
65
+ },
66
+ },
67
+ data: {
68
+ maxCount: 0,
69
+ files: [],
70
+ urls: [],
71
+ },
72
+ methods: {
73
+ // 批量上传文件前置事件
74
+ handleBefore: function (files = []) {
75
+ if (this.data.files.length + files.length > this.data.maxCount) {
76
+ wx.showToast({
77
+ title: `上传文件总数不能超过${this.data.maxCount}个`,
78
+ icon: 'none',
79
+ duration: 2000,
80
+ });
81
+ return false;
82
+ }
83
+ if (
84
+ this.properties.maxSize &&
85
+ files.some((f) => f.size > this.properties.maxSize * 1024 * 1024)
86
+ ) {
87
+ wx.showToast({
88
+ title: `上传文件大小不能超过${this.properties.maxSize}M`,
89
+ icon: 'none',
90
+ duration: 2000,
91
+ });
92
+ return false;
93
+ }
94
+ if (files.some((f) => f.size > 1024 * 1024 * 1024)) {
95
+ wx.showToast({
96
+ title: `上传文件大小不能超过1024M`,
97
+ icon: 'none',
98
+ duration: 2000,
99
+ });
100
+ return false;
101
+ }
102
+ return true;
103
+ },
104
+ //上传文件过程
105
+ uploadFile: async function () {
106
+ //文件上传的函数,
107
+ wx.chooseMessageFile({
108
+ count: this.data.maxCount,
109
+ type: 'all',
110
+ success: async (files) => {
111
+ this.handleUpload(files);
112
+ },
113
+ fail(e) {
114
+ this.triggerEvent('error', e.detail);
115
+ },
116
+ });
117
+ },
118
+ handleUpload: async function (files) {
119
+ var _this = this;
120
+ if (!this.handleBefore(files?.tempFiles)) return;
121
+ const uploadPath = 'weda-uploader';
122
+ const uploadPromise = files.tempFiles.map(async (tempFile) => {
123
+ const fileType = tempFile.path.split('.')?.[1];
124
+ const cloudPath = `${uploadPath}/uploader-${Date.now()}.${fileType}`;
125
+ tempFile.percent = '0';
126
+ tempFile.cloudPath = null;
127
+ tempFile.filePath = tempFile?.path || null;
128
+ tempFile.size = transSize(tempFile?.size);
129
+ tempFile.status = 'uploading';
130
+ this.data.files.push(tempFile);
131
+ this.setData({
132
+ files: [...this.data.files],
133
+ });
134
+ //初始上传文件状态
135
+ let index = this.data.files.length - 1;
136
+ try {
137
+ const tcb = await getCloudInstance();
138
+ const uploadTask = await tcb.uploadFile({
139
+ cloudPath: cloudPath,
140
+ filePath: tempFile.path,
141
+ success(res) {
142
+ _this.data.files[index].cloudPath = res.fileID;
143
+ _this.data.files[index].percent = 100;
144
+ _this.data.files[index].status = 'success';
145
+ const arr = [];
146
+ arr.push(res.fileID);
147
+ _this.setData({
148
+ files: _this.data.files,
149
+ urls: [..._this.data.urls, ...arr],
150
+ });
151
+ if (_this.properties.single) {
152
+ _this.triggerEvent('success', {
153
+ value: _this.data.urls[0],
154
+ });
155
+ } else {
156
+ _this.triggerEvent('success', {
157
+ value: _this.data.urls,
158
+ });
159
+ }
160
+ },
161
+ fail() {
162
+ this.data.files[index].status = 'fail';
163
+ },
164
+ });
165
+ uploadTask.onProgressUpdate((res) => {
166
+ this.data.files[index].percent = String(res.progress);
167
+ res.progress == 100
168
+ ? (this.data.files[index].status = 'success')
169
+ : (this.data.files[index].status = 'uploading');
170
+ this.data.files[index].uploaded = transSize(res.totalBytesSent);
171
+ this.setData({
172
+ files: this.data.files,
173
+ });
174
+ });
175
+ return { fileID: uploadTask.fileID };
176
+ } catch (e) {
177
+ this.triggerEvent('error', e.detail);
178
+ this.data.files[index].status = 'fail';
179
+ }
180
+ });
181
+ const uploadFileList = await Promise.all(uploadPromise);
182
+ const cloudUrls = uploadFileList.map((file) => file.fileID);
183
+ this.setData({
184
+ files: this.data.files,
185
+ //urls: [...this.data.urls, ...cloudUrls],
186
+ });
187
+ return { urls: files.tempFiles, cloudUrls };
188
+ },
189
+
190
+ onDelete: function (e) {
191
+ const filelist = this.data.files.filter(
192
+ (item) => e.target.dataset.item?.path != item?.path
193
+ );
194
+ this.setData({
195
+ files: filelist,
196
+ urls: this.data.urls.filter(
197
+ (v, index) => e.target.dataset.item?.cloudPath !== index
198
+ ),
199
+ });
200
+ },
201
+ reload: function (e) {
202
+ this.handleUpload(e.target.dataset.item);
203
+ },
204
+ downloadFile: async function (e) {
205
+ const fileSrc = await getTempFileURL(e.target.dataset.item?.cloudPath);
206
+ wx.downloadFile({
207
+ url: fileSrc,
208
+ success(res) {
209
+ // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
210
+ if (res.statusCode === 200) {
211
+ wx.showToast({
212
+ title: `下载成功`,
213
+ icon: 'none',
214
+ duration: 2000,
215
+ });
216
+ }
217
+ },
218
+ });
219
+ },
220
+ },
221
+ observers: {
222
+ 'maxUploadCount, single': function (maxUploadCount, single) {
223
+ const maxCount = single ? 1 : maxUploadCount;
224
+ this.setData({
225
+ maxCount,
226
+ });
227
+ },
228
+ defaultValue: function (value) {
229
+ if (!deepEqual(value, this.data.urls)) {
230
+ if (!Array.isArray(value)) {
231
+ value = [value];
232
+ }
233
+ this.setData({
234
+ files: value.map((f) => ({ url: f })),
235
+ urls: value,
236
+ });
237
+ }
238
+ },
239
+ urls: function (urls) {
240
+ let value = urls;
241
+ if (this.properties.single) {
242
+ value = urls[0] ?? '';
243
+ }
244
+ this.triggerEvent('change', { value });
245
+ },
246
+ },
247
+ });
@@ -0,0 +1,9 @@
1
+ {
2
+ "component": true,
3
+ "styleIsolation": "shared",
4
+ "usingComponents": {
5
+ "mp-icon": "weui-miniprogram/icon/icon",
6
+ "mp-cells": "weui-miniprogram/cells/cells",
7
+ "mp-cell": "weui-miniprogram/cell/cell"
8
+ }
9
+ }
@@ -0,0 +1,46 @@
1
+ <view class="weda-uploader-files {{extClass}}">
2
+ <view class="weda-uploader-files__hd">
3
+ <view class="weda-uploader-files__title" wx:if="{{labelVisible}}">{{label}}</view>
4
+ <view>
5
+ <button class="weui-btn weda-uploader-files__btn" bindtap="uploadFile">上传文件</button>
6
+ <view wx:if="{{maxCount!=1}}" class="weda-uploader-files__tips">支持批量上传</view>
7
+ <view wx:else><slot name="tips"></slot></view>
8
+ </view>
9
+ </view>
10
+ <view class="weda-uploader-files__bd">
11
+ <view class="weda-uploader-files__files" wx-if="{{files.length > 0}}">
12
+ <block wx:for="{{files}}" wx:key="index">
13
+ <view class="weda-uploader-files__item">
14
+ <view class="weda-uploader-files__item-left">
15
+ <view class="weda-uploader-files__file-detail">
16
+ <text class="weda-uploader-files__file-name">{{item.name}}</text>
17
+ <view wx:if="{{item.status === 'success' || item.status === 'fail'}}" class="weda-uploader-files__file-status">
18
+ <mp-icon wx:if="{{item.status === 'success' }}" icon="done2" size="{{16}}" color="#00A870" type="field"></mp-icon>
19
+ <mp-icon wx:if="{{item.status === 'fail' }}" icon="close2" size="{{16}}" color="#E34D59" type="field"></mp-icon>
20
+ <text class="weda-uploader-files__file-status--msg">{{item.status === 'success' ? '上传成功' : '上传失败'}}</text>
21
+ </view>
22
+ </view>
23
+ <view class="weda-uploader-files__progress weui-progress" wx-if="{{item.status === 'pending' || item.status === 'uploading'}}">
24
+ <view class="weui-progress__bar">
25
+ <progress percent="{{item.percent}}" stroke-width="3" activeColor="#0052D9" backgroundColor="#E7E7E7" stroke-width="3"/>
26
+ </view>
27
+ </view>
28
+ <view class="weda-uploader-files__file-foot">
29
+ <div>
30
+ <text wx-if="{{item.status === 'uploading' || item.status === 'pending'}}">{{item.status === 'uploading' ? item.uploaded : '0K' }}/</text>
31
+ <text>{{item.size}}</text>
32
+ </div>
33
+ <div wx-if="{{item.status === 'uploading' || item.status === 'pending'}}">{{item.status === 'pending' ? '等待上传' : '上传中'}}</div>
34
+
35
+ </view>
36
+ </view>
37
+ <view class="weda-uploader-files__btn-group">
38
+ <image wx-if="{{item.status === 'success'&&downloadVisible}}" data-item="{{item}}" bindtap="downloadFile" class="weda-uploader-files__icon" src="https://imgcache.qq.com/qcloud/tcloud_dtc/static/static_source_business/4cba5da1-cde4-40c6-a075-86eff22858a4.svg"></image>
39
+ <image wx-if="{{item.status === 'fail'}}" data-item="{{item}}" bindtap="reload" class="weda-uploader-files__icon" src="https://imgcache.qq.com/qcloud/tcloud_dtc/static/static_source_business/af5486eb-65e0-4536-8e51-6c68a17b71ac.svg"></image>
40
+ <image class="weda-uploader-files__icon" data-item="{{item}}" bindtap="onDelete" src="https://imgcache.qq.com/qcloud/tcloud_dtc/static/static_source_business/2372f6a8-2f6a-4f30-92bf-73c62a5c0ae7.svg"></image>
41
+ </view>
42
+ </view>
43
+ </block>
44
+ </view>
45
+ </view>
46
+ </view>
@@ -0,0 +1,104 @@
1
+ @import '../../../style/weda-ui.wxss';
2
+ .weda-uploader-files {
3
+ width: 100%;
4
+ background-color: #f6f6f6;
5
+ }
6
+ .weda-uploader-files__hd {
7
+ width: 100%;
8
+ padding: 24px 20px 8px 20px;
9
+ display: flex;
10
+ background-color: #ffffff;
11
+ }
12
+
13
+ .weda-uploader-files__btn::after {
14
+ border: 1px solid #dcdcdc;
15
+ border-radius: 3px;
16
+ width: 100%;
17
+ height: 100%;
18
+ transform: none;
19
+ }
20
+ .weda-uploader-files__title {
21
+ font-size: 14px;
22
+ line-height: 20px;
23
+ color: #000;
24
+ margin-right: 20px;
25
+ padding-top: 6px;
26
+ }
27
+ .weda-uploader-files__btn {
28
+ margin: 0;
29
+ width: 88px;
30
+ height: 32px;
31
+ padding: 0;
32
+ display: flex;
33
+ align-items: center;
34
+ justify-content: center;
35
+ font-size: 14px;
36
+ line-height: 22px;
37
+ color: #000;
38
+ border: 1px solid #dcdcdc;
39
+ border-radius: 3px;
40
+ font-weight: normal;
41
+ background-color: transparent;
42
+ }
43
+ .weda-uploader-files__tips {
44
+ margin-top: 8px;
45
+ font-size: 12px;
46
+ line-height: 20px;
47
+ color: rgba(0, 0, 0, 0.4);
48
+ }
49
+ .weda-uploader-files__item {
50
+ width: 100%;
51
+ margin-top: 8px;
52
+ padding: 16px;
53
+ background-color: #fff;
54
+ display: flex;
55
+ justify-content: space-between;
56
+ align-items: center;
57
+ }
58
+ .weda-uploader-files__item-left {
59
+ flex: 1;
60
+ margin-right: 16px;
61
+ }
62
+ .weda-uploader-files__file-detail {
63
+ display: flex;
64
+ align-items: center;
65
+ }
66
+ .weda-uploader-files__file-name {
67
+ font-size: 14px;
68
+ line-height: 22px;
69
+ color: rgba(0, 0, 0, 0.9);
70
+ overflow: hidden;
71
+ text-overflow: ellipsis;
72
+ white-space: nowrap;
73
+ }
74
+ .weda-uploader-files__file-status {
75
+ margin-left: 24px;
76
+ width: 28%;
77
+ }
78
+ .weda-uploader-files__file-status--msg {
79
+ margin-left: 4px;
80
+ font-size: 12px;
81
+ line-height: 20px;
82
+ color: rgba(0, 0, 0, 0.9);
83
+ }
84
+ .weda-uploader-files__file-foot {
85
+ font-size: 12px;
86
+ line-height: 20px;
87
+ color: rgba(0, 0, 0, 0.4);
88
+ margin-top: 8px;
89
+ display: flex;
90
+ justify-content: space-between;
91
+ }
92
+ .weda-uploader-files__btn-group {
93
+ display: flex;
94
+ }
95
+ .weda-uploader-files__icon {
96
+ width: 24px;
97
+ height: 24px;
98
+ }
99
+ .weda-uploader-files__icon + .weda-uploader-files__icon {
100
+ margin-left: 16px;
101
+ }
102
+ .weda-uploader-files__progress {
103
+ margin-top: 4px;
104
+ }
@@ -7,6 +7,10 @@ Component({
7
7
  type: String,
8
8
  value: '',
9
9
  },
10
+ level: {
11
+ type: String,
12
+ value: '0',
13
+ },
10
14
  maxLines: {
11
15
  type: Number,
12
16
  value: 2,
@@ -23,10 +27,39 @@ Component({
23
27
  type: String,
24
28
  value: '',
25
29
  },
30
+ textAlign: {
31
+ type: String,
32
+ value: '',
33
+ },
34
+ textColor: {
35
+ type: String,
36
+ value: '',
37
+ },
26
38
  style: {
27
39
  type: String,
28
40
  value: '',
29
41
  },
30
42
  },
31
43
  methods: {},
44
+ observers: {
45
+ level: function (level) {
46
+ const levelName = `level_${level}`;
47
+ if (level !== '0') {
48
+ this.setData({ levelName });
49
+ }
50
+ },
51
+ 'textAlign,textColor': function (textAlign, textColor) {
52
+ let style = this.properties.style;
53
+ // 添加文本颜色属性
54
+ if (textColor !== '') {
55
+ style = `${style};color:${textColor}`;
56
+ }
57
+
58
+ // 添加对齐属性
59
+ if (textAlign !== '') {
60
+ style = `${style};text-align: ${textAlign}`;
61
+ }
62
+ this.setData({ style });
63
+ },
64
+ },
32
65
  });
@@ -1,5 +1,5 @@
1
1
  <text
2
- class="weda-text weda-ui {{className}}"
2
+ class="weda-text weda-ui {{className}} {{levelName}}"
3
3
  id="{{id}}"
4
4
  user-select="{{userSelect}}"
5
5
  style="-webkit-line-clamp:{{maxLines}}; white-space: {{ space ? 'pre-warp' : 'pre-line'}}; {{style}}"
@@ -6,3 +6,21 @@
6
6
  /* -webkit-line-clamp: 1; */
7
7
  /* white-space: pre-line; */
8
8
  }
9
+ .weda-text.level_1 {
10
+ font-size: 64rpx !important;
11
+ }
12
+ .weda-text.level_2 {
13
+ font-size: 56rpx !important;
14
+ }
15
+ .weda-text.level_3 {
16
+ font-size: 48rpx !important;
17
+ }
18
+ .weda-text.level_4 {
19
+ font-size: 40rpx !important;
20
+ }
21
+ .weda-text.level_5 {
22
+ font-size: 32rpx !important;
23
+ }
24
+ .weda-text.level_6 {
25
+ font-size: 24rpx !important;
26
+ }