@cloudbase/weda-ui 0.2.15 → 0.2.16
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/package.json +10 -7
- package/src/configs/components/calendar.json +75 -0
- package/src/configs/components/carousel.json +273 -0
- package/src/configs/components/chart/statisticsCard.json +331 -0
- package/src/configs/components/dataView.json +139 -0
- package/src/configs/components/form/location.json +152 -0
- package/src/configs/components/form/uploaderFile.json +2 -1
- package/src/configs/components/graphicCard.json +399 -0
- package/src/configs/components/link.json +2 -2
- package/src/configs/components/listView.json +230 -0
- package/src/configs/components/navLayout.json +350 -0
- package/src/configs/components/swiper.json +3 -3
- package/src/configs/index.js +16 -0
- package/src/mp/components/button/index.js +12 -13
- package/src/mp/components/button/index.wxml +1 -1
- package/src/mp/components/calendar/arrowright--line.svg +11 -0
- package/src/mp/components/calendar/index.js +238 -0
- package/src/mp/components/calendar/index.json +4 -0
- package/src/mp/components/calendar/index.wxml +37 -0
- package/src/mp/components/calendar/index.wxss +178 -0
- package/src/mp/components/carousel/index.js +88 -0
- package/src/mp/components/carousel/index.json +7 -0
- package/src/mp/components/carousel/index.wxml +6 -0
- package/src/mp/components/chart/statisticsCard/index.js +226 -0
- package/src/mp/components/chart/statisticsCard/index.json +4 -0
- package/src/mp/components/chart/statisticsCard/index.wxml +9 -0
- package/src/mp/components/chart/statisticsCard/index.wxss +45 -0
- package/src/mp/components/dataView/index.js +34 -0
- package/src/mp/components/dataView/index.json +7 -0
- package/src/mp/components/dataView/index.wxml +15 -0
- package/src/mp/components/dataView/index.wxss +0 -0
- package/src/mp/components/form/location/components/mapChoose/index.js +201 -0
- package/src/mp/components/form/location/components/mapChoose/index.json +4 -0
- package/src/mp/components/form/location/components/mapChoose/index.wxml +42 -0
- package/src/mp/components/form/location/components/mapChoose/index.wxss +188 -0
- package/src/mp/components/form/location/index.js +341 -0
- package/src/mp/components/form/location/index.json +6 -0
- package/src/mp/components/form/location/index.wxml +25 -0
- package/src/mp/components/form/location/index.wxss +91 -0
- package/src/mp/components/form/uploader/index.js +39 -35
- package/src/mp/components/form/uploaderFile/index.js +61 -14
- package/src/mp/components/graphicCard/chevron-right.svg +3 -0
- package/src/mp/components/graphicCard/index.js +205 -0
- package/src/mp/components/graphicCard/index.json +4 -0
- package/src/mp/components/graphicCard/index.wxml +29 -0
- package/src/mp/components/graphicCard/index.wxss +157 -0
- package/src/mp/components/image/index.js +0 -1
- package/src/mp/components/listView/arrow-right-line.svg +3 -0
- package/src/mp/components/listView/index.js +286 -0
- package/src/mp/components/listView/index.json +4 -0
- package/src/mp/components/listView/index.wxml +40 -0
- package/src/mp/components/listView/index.wxss +150 -0
- package/src/mp/components/listView/more-line.svg +3 -0
- package/src/mp/components/navLayout/index.js +123 -0
- package/src/mp/components/navLayout/index.json +7 -0
- package/src/mp/components/navLayout/index.wxml +25 -0
- package/src/mp/components/navLayout/index.wxss +1193 -0
- package/src/mp/components/swiper/index.wxml +2 -0
- package/src/mp/index.json +9 -1
- package/src/mp/utils/debounce.js +133 -0
- package/src/mp/utils/dr_square_point.js +25 -0
- package/src/mp/utils/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js +1336 -0
- package/src/mp/utils/spark-md5.js +776 -0
- package/src/mp/utils/tcb.js +18 -0
- package/src/web/components/calendar/index.css +382 -0
- package/src/web/components/calendar/index.jsx +312 -0
- package/src/web/components/calendar/util.js +90 -0
- package/src/web/components/carousel/index.css +119 -0
- package/src/web/components/carousel/index.tsx +417 -0
- package/src/web/components/chart/statisticsCard/index.css +62 -0
- package/src/web/components/chart/statisticsCard/index.tsx +286 -0
- package/src/web/components/chart/statisticsCard/interface.ts +14 -0
- package/src/web/components/dataView/index.tsx +20 -0
- package/src/web/components/dataView/interface.ts +6 -0
- package/src/web/components/form/location/common/mapChoose.css +178 -0
- package/src/web/components/form/location/common/mapChoose.jsx +343 -0
- package/src/web/components/form/location/common/mapView.jsx +190 -0
- package/src/web/components/form/location/common/propsConfig.js +54 -0
- package/src/web/components/form/location/common/selectModal.css +44 -0
- package/src/web/components/form/location/common/selectModal.jsx +82 -0
- package/src/web/components/form/location/common/useLocationInfo.js +100 -0
- package/src/web/components/form/location/components/LocationH5/index.css +243 -0
- package/src/web/components/form/location/components/LocationH5/location.h5.jsx +403 -0
- package/src/web/components/form/location/components/LocationPC/Header.jsx +109 -0
- package/src/web/components/form/location/components/LocationPC/index.css +44 -0
- package/src/web/components/form/location/components/LocationPC/location.PC.jsx +323 -0
- package/src/web/components/form/location/constants.js +4 -0
- package/src/web/components/form/location/index.css +0 -0
- package/src/web/components/form/location/index.jsx +25 -0
- package/src/web/components/form/uploader/uploader.h5.tsx +16 -10
- package/src/web/components/form/uploader/uploader.pc.tsx +15 -11
- package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +122 -107
- package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +22 -19
- package/src/web/components/graphicCard/index.css +163 -0
- package/src/web/components/graphicCard/index.tsx +309 -0
- package/src/web/components/image/image.tsx +0 -1
- package/src/web/components/index.js +12 -0
- package/src/web/components/listView/arrow-right-line.svg +3 -0
- package/src/web/components/listView/index.css +139 -0
- package/src/web/components/listView/index.tsx +354 -0
- package/src/web/components/listView/interface.ts +98 -0
- package/src/web/components/navLayout/index.css +332 -0
- package/src/web/components/navLayout/index.tsx +247 -0
- package/src/web/components/tabs/index.tsx +2 -2
- package/src/web/components/tabs/tabs.h5.tsx +7 -4
- package/src/web/components/uploaderFileView/index.css +9 -9
- package/src/web/components/uploaderFileView/index.jsx +32 -23
- package/src/web/types.d.ts +15 -14
- package/src/web/utils/debounce.js +98 -0
- package/src/web/utils/platform.js +31 -0
- package/src/web/utils/tcb.js +35 -0
- package/src/web/utils/tmap.js +4 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as PropTypes from 'prop-types';
|
|
3
|
-
import { useSyncValue } from '../../../utils/useSyncValue';
|
|
4
|
-
import isObjectEqual from '../../../utils/isObjectEqual';
|
|
5
3
|
import weui from '../../../utils/weui';
|
|
6
4
|
import { CommonFormPropsType } from '../types';
|
|
5
|
+
import SparkMD5 from 'spark-md5';
|
|
7
6
|
|
|
8
7
|
import {
|
|
9
8
|
Upload,
|
|
@@ -23,6 +22,7 @@ import {
|
|
|
23
22
|
isHttpFileID,
|
|
24
23
|
transSize,
|
|
25
24
|
downloadFile,
|
|
25
|
+
transFileCloudidToName
|
|
26
26
|
} from '../../../utils/platform';
|
|
27
27
|
import { getCloudInstance, getTempFileURL } from '../../../utils/tcb';
|
|
28
28
|
import classNames from '../../../utils/classnames';
|
|
@@ -74,6 +74,7 @@ export function UploadFileH5({
|
|
|
74
74
|
uploadPath = 'weda-uploader',
|
|
75
75
|
single = true,
|
|
76
76
|
onChange = null,
|
|
77
|
+
isEdit = true,
|
|
77
78
|
}: IUploadFileH5) {
|
|
78
79
|
const [fileIDList, setfileIDList] = React.useState(
|
|
79
80
|
filterStrList([].concat(defaultValue, value))
|
|
@@ -141,74 +142,81 @@ export function UploadFileH5({
|
|
|
141
142
|
downloadVisible,
|
|
142
143
|
deleteVisible,
|
|
143
144
|
onChange: handleChange,
|
|
145
|
+
isEdit,
|
|
144
146
|
events,
|
|
145
147
|
fileSizeObj,
|
|
146
148
|
}}
|
|
147
149
|
>
|
|
148
150
|
<div data-testid="uploadFileH5" className={cls} id={id} style={style}>
|
|
149
151
|
<div className={classNames(`${CLASS_PREFIX}`)}>
|
|
150
|
-
|
|
151
|
-
<div>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
className={classNames(`${CLASS_PREFIX}__btn--weak`)}
|
|
156
|
-
disabled={btnDisabled}
|
|
157
|
-
>
|
|
158
|
-
{btnTitle}
|
|
159
|
-
</Button>
|
|
160
|
-
) : (
|
|
161
|
-
<div>
|
|
162
|
-
<input
|
|
163
|
-
id="uploaderInput"
|
|
164
|
-
type="file"
|
|
165
|
-
data-testid="button-up"
|
|
166
|
-
className="weui-uploader-mobile__input"
|
|
167
|
-
accept={accepts.join(',')}
|
|
168
|
-
multiple={!single}
|
|
169
|
-
onChange={(e) => {
|
|
170
|
-
const fileList = [...e.target.files];
|
|
171
|
-
if (single && fileList.length > 1) {
|
|
172
|
-
weui.alert(`上传文件总数不能超过1个`);
|
|
173
|
-
return false;
|
|
174
|
-
}
|
|
175
|
-
if (
|
|
176
|
-
fileList.length + fileIDList.length >
|
|
177
|
-
maxUploadCount
|
|
178
|
-
) {
|
|
179
|
-
weui.alert(`上传文件总数不能超过${maxUploadCount}个`);
|
|
180
|
-
return false;
|
|
181
|
-
}
|
|
182
|
-
if (
|
|
183
|
-
maxSize &&
|
|
184
|
-
fileList.some((f) => f.size > maxSize * 1024 * 1024)
|
|
185
|
-
) {
|
|
186
|
-
weui.alert(`请上传不超过${maxSize}M的文件`);
|
|
187
|
-
return false;
|
|
188
|
-
}
|
|
189
|
-
if (fileList.some((f) => f.size > 1024 * 1024 * 1024)) {
|
|
190
|
-
weui.alert(`请上传不超过1024M的文件`);
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
fileList.forEach((f) => (f['_uuid'] = v4()));
|
|
194
|
-
setFileList((list) => [...list, ...fileList]);
|
|
195
|
-
}}
|
|
196
|
-
/>
|
|
197
|
-
<a
|
|
152
|
+
{isEdit && (
|
|
153
|
+
<div className={classNames(`${CLASS_PREFIX}__hd`, layout)}>
|
|
154
|
+
<div>
|
|
155
|
+
{btnDisabled ? (
|
|
156
|
+
<Button
|
|
198
157
|
type="weak"
|
|
199
|
-
className=
|
|
158
|
+
className={classNames(`${CLASS_PREFIX}__btn--weak`)}
|
|
159
|
+
disabled={btnDisabled}
|
|
200
160
|
>
|
|
201
|
-
|
|
202
|
-
</
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
161
|
+
{btnTitle}
|
|
162
|
+
</Button>
|
|
163
|
+
) : (
|
|
164
|
+
<div>
|
|
165
|
+
<input
|
|
166
|
+
id="uploaderInput"
|
|
167
|
+
type="file"
|
|
168
|
+
data-testid="button-up"
|
|
169
|
+
className="weui-uploader-mobile__input"
|
|
170
|
+
accept={accepts.join(',')}
|
|
171
|
+
multiple={!single}
|
|
172
|
+
onChange={(e) => {
|
|
173
|
+
const fileList = [...e.target.files];
|
|
174
|
+
if (single && fileList.length > 1) {
|
|
175
|
+
weui.alert(`上传文件总数不能超过1个`);
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
if (
|
|
179
|
+
fileList.length + fileIDList.length >
|
|
180
|
+
maxUploadCount
|
|
181
|
+
) {
|
|
182
|
+
weui.alert(
|
|
183
|
+
`上传文件总数不能超过${maxUploadCount}个`
|
|
184
|
+
);
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
if (
|
|
188
|
+
maxSize &&
|
|
189
|
+
fileList.some((f) => f.size > maxSize * 1024 * 1024)
|
|
190
|
+
) {
|
|
191
|
+
weui.alert(`请上传不超过${maxSize}M的文件`);
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
if (
|
|
195
|
+
fileList.some((f) => f.size > 1024 * 1024 * 1024)
|
|
196
|
+
) {
|
|
197
|
+
weui.alert(`请上传不超过1024M的文件`);
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
fileList.forEach((f) => (f['_uuid'] = v4()));
|
|
201
|
+
setFileList((list) => [...list, ...fileList]);
|
|
202
|
+
}}
|
|
203
|
+
/>
|
|
204
|
+
<a
|
|
205
|
+
type="weak"
|
|
206
|
+
className="wedatea2td-btn wedatea2td-btn--weak"
|
|
207
|
+
>
|
|
208
|
+
点击上传
|
|
209
|
+
</a>
|
|
210
|
+
{!single && (
|
|
211
|
+
<Text className={`${CLASS_PREFIX}__tips`}>
|
|
212
|
+
支持批量上传
|
|
213
|
+
</Text>
|
|
214
|
+
)}
|
|
215
|
+
</div>
|
|
216
|
+
)}
|
|
217
|
+
</div>
|
|
210
218
|
</div>
|
|
211
|
-
|
|
219
|
+
)}
|
|
212
220
|
<div className={`${CLASS_PREFIX}__bd`}>
|
|
213
221
|
<List>
|
|
214
222
|
{fileIDList.map((d) => (
|
|
@@ -267,6 +275,7 @@ export interface IUploadFileH5 extends CommonFormPropsType {
|
|
|
267
275
|
uploadPath?: string; // 上传路径
|
|
268
276
|
single?: boolean; // 单张上传还是多张上传,对应 onChange 参数为字符串还是字符串数组,value 在处理过程统一转为字符串数组
|
|
269
277
|
onChange?: (v: any) => void; // 配合 fomily 受控使用
|
|
278
|
+
isEdit: boolean; // 当前是编辑态还是展示态,展示态会去掉删除等按钮
|
|
270
279
|
}
|
|
271
280
|
|
|
272
281
|
/**
|
|
@@ -298,11 +307,7 @@ const TcbFileEcho = ({
|
|
|
298
307
|
//上传文件名称
|
|
299
308
|
const label = React.useMemo(() => {
|
|
300
309
|
if (isCloudFileID(fileID)) {
|
|
301
|
-
|
|
302
|
-
const lastIndex = `${fileID}`.lastIndexOf('/');
|
|
303
|
-
const name = `${fileID}`.slice(lastIndex + 1);
|
|
304
|
-
const label = name.replace(uuidReg, '');
|
|
305
|
-
return label;
|
|
310
|
+
return transFileCloudidToName(fileID);
|
|
306
311
|
} else {
|
|
307
312
|
return fileID;
|
|
308
313
|
}
|
|
@@ -366,20 +371,25 @@ const TcbFileUpload = ({
|
|
|
366
371
|
const tcb = await getCloudInstance();
|
|
367
372
|
try {
|
|
368
373
|
setStatus('UPLOAD_STATUS_PENDING');
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
)
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
374
|
+
const fileReader = new FileReader();
|
|
375
|
+
fileReader.readAsBinaryString(file);
|
|
376
|
+
fileReader.onload = async function (e) {
|
|
377
|
+
const md5Path = SparkMD5.hashBinary(e.target.result);
|
|
378
|
+
const { fileID } = await tcb.uploadFile({
|
|
379
|
+
cloudPath: `${uploadPath}/${md5Path}-${file?.name}`,
|
|
380
|
+
filePath: file,
|
|
381
|
+
onUploadProgress: (progressEvent) => {
|
|
382
|
+
let percent = 0;
|
|
383
|
+
percent = Math.round(
|
|
384
|
+
(progressEvent.loaded * 100) / progressEvent.total
|
|
385
|
+
);
|
|
386
|
+
setStatus('UPLOAD_STATUS_LOADING');
|
|
387
|
+
setPercent(percent < 100 ? percent : 100);
|
|
388
|
+
},
|
|
389
|
+
});
|
|
390
|
+
!cancleRef.current && onChange?.({ fileID, type: 'add', uuid, size });
|
|
391
|
+
setStatus('UPLOAD_STATUS_SUCCESS');
|
|
392
|
+
};
|
|
383
393
|
} catch (err) {
|
|
384
394
|
setStatus('UPLOAD_STATUS_ERROR');
|
|
385
395
|
events?.error?.(err);
|
|
@@ -430,6 +440,7 @@ const UploadFileStatus = ({
|
|
|
430
440
|
title = null,
|
|
431
441
|
percentSize = 0,
|
|
432
442
|
}: IUploadFileStatus) => {
|
|
443
|
+
const { isEdit } = React.useContext(FileContext) || {};
|
|
433
444
|
//上传中、待上传状态
|
|
434
445
|
if (
|
|
435
446
|
status == 'UPLOAD_STATUS_LOADING' ||
|
|
@@ -470,6 +481,7 @@ const UploadFileStatus = ({
|
|
|
470
481
|
<Tooltip title={title}>
|
|
471
482
|
<Text className={`${CLASS_PREFIX}__file-name`}>{title}</Text>
|
|
472
483
|
</Tooltip>
|
|
484
|
+
{isEdit &&
|
|
473
485
|
<div className={`${CLASS_PREFIX}__file-status`}>
|
|
474
486
|
<Icon
|
|
475
487
|
type={
|
|
@@ -480,13 +492,13 @@ const UploadFileStatus = ({
|
|
|
480
492
|
{statusMap[status]?.title ||
|
|
481
493
|
statusMap['UPLOAD_STATUS_PENDING'].title}
|
|
482
494
|
</Text>
|
|
483
|
-
</div>
|
|
495
|
+
</div>}
|
|
484
496
|
</div>
|
|
485
|
-
<div className={`${CLASS_PREFIX}__file-foot`}>
|
|
497
|
+
{isEdit && <div className={`${CLASS_PREFIX}__file-foot`}>
|
|
486
498
|
<div>
|
|
487
499
|
<Text>{size}</Text>
|
|
488
500
|
</div>
|
|
489
|
-
</div>
|
|
501
|
+
</div>}
|
|
490
502
|
</>
|
|
491
503
|
);
|
|
492
504
|
};
|
|
@@ -514,36 +526,39 @@ const UploadFileAction = ({
|
|
|
514
526
|
onReLoad = null,
|
|
515
527
|
onCancel = null,
|
|
516
528
|
}: IUploadFileAction) => {
|
|
517
|
-
const { onChange, downloadVisible, deleteVisible } =
|
|
529
|
+
const { onChange, downloadVisible, deleteVisible, isEdit } =
|
|
518
530
|
React.useContext(FileContext) || {};
|
|
519
531
|
// 操作列按钮-删除
|
|
520
|
-
const renderDelete = () =>
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
532
|
+
const renderDelete = () =>
|
|
533
|
+
isEdit && (
|
|
534
|
+
<Icon
|
|
535
|
+
type="delete"
|
|
536
|
+
style={{ cursor: 'pointer' }}
|
|
537
|
+
onClick={() => onChange?.({ fileID, uuid, type: 'delete' })}
|
|
538
|
+
/>
|
|
539
|
+
);
|
|
527
540
|
|
|
528
541
|
// 操作列按钮-取消
|
|
529
|
-
const renderCancel = () =>
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
542
|
+
const renderCancel = () =>
|
|
543
|
+
isEdit && (
|
|
544
|
+
<Icon
|
|
545
|
+
type="dismiss"
|
|
546
|
+
style={{ cursor: 'pointer' }}
|
|
547
|
+
onClick={() => onCancel?.(uuid)}
|
|
548
|
+
/>
|
|
549
|
+
);
|
|
536
550
|
|
|
537
551
|
// 操作列按钮-重新上传
|
|
538
|
-
const renderReLoad = () =>
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
552
|
+
const renderReLoad = () =>
|
|
553
|
+
isEdit && (
|
|
554
|
+
<Icon
|
|
555
|
+
type="refresh"
|
|
556
|
+
style={{ cursor: 'pointer' }}
|
|
557
|
+
onClick={() => {
|
|
558
|
+
onReLoad?.(file);
|
|
559
|
+
}}
|
|
560
|
+
/>
|
|
561
|
+
);
|
|
547
562
|
|
|
548
563
|
// 操作列按钮-下载
|
|
549
564
|
const renderDownLoad = () => (
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
Text,
|
|
9
9
|
List,
|
|
10
10
|
} from 'tea-component';
|
|
11
|
+
import SparkMD5 from 'spark-md5';
|
|
11
12
|
import { v4 } from 'uuid';
|
|
12
13
|
import {
|
|
13
14
|
filterStrList,
|
|
@@ -16,6 +17,7 @@ import {
|
|
|
16
17
|
transSize,
|
|
17
18
|
downloadFile,
|
|
18
19
|
cutFileTitle,
|
|
20
|
+
transFileCloudidToName
|
|
19
21
|
} from '../../../utils/platform';
|
|
20
22
|
import { getCloudInstance, getTempFileURL } from '../../../utils/tcb';
|
|
21
23
|
import classNames from '../../../utils/classnames';
|
|
@@ -283,11 +285,7 @@ const TcbFileEcho = ({ fileID }: ITcbFileEcho) => {
|
|
|
283
285
|
|
|
284
286
|
const title = React.useMemo(() => {
|
|
285
287
|
if (isCloudFileID(fileID)) {
|
|
286
|
-
|
|
287
|
-
const lastIndex = `${fileID}`.lastIndexOf('/');
|
|
288
|
-
const name = `${fileID}`.slice(lastIndex + 1);
|
|
289
|
-
const title = name.replace(uuidReg, '');
|
|
290
|
-
return title;
|
|
288
|
+
return transFileCloudidToName(fileID);
|
|
291
289
|
} else {
|
|
292
290
|
return fileID;
|
|
293
291
|
}
|
|
@@ -341,20 +339,25 @@ const TcbFileUpload = ({ file }: ITcbFileUpload) => {
|
|
|
341
339
|
const tcb = await getCloudInstance();
|
|
342
340
|
try {
|
|
343
341
|
setStatus('0');
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
)
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
342
|
+
const fileReader = new FileReader();
|
|
343
|
+
fileReader.readAsBinaryString(file);
|
|
344
|
+
fileReader.onload = async function (e) {
|
|
345
|
+
const md5Path = SparkMD5.hashBinary(e.target.result);
|
|
346
|
+
const { fileID } = await tcb.uploadFile({
|
|
347
|
+
cloudPath: `${uploadPath}/${md5Path}-${file?.name}`,
|
|
348
|
+
filePath: file,
|
|
349
|
+
onUploadProgress: (progressEvent) => {
|
|
350
|
+
let percent = 0;
|
|
351
|
+
percent = Math.round(
|
|
352
|
+
(progressEvent.loaded * 100) / progressEvent.total
|
|
353
|
+
);
|
|
354
|
+
setStatus('1');
|
|
355
|
+
setPercent(percent < 100 ? percent : 100);
|
|
356
|
+
},
|
|
357
|
+
});
|
|
358
|
+
!cancleRef.current && onChange?.({ fileID, type: 'add', uuid, size });
|
|
359
|
+
setStatus('2');
|
|
360
|
+
};
|
|
358
361
|
} catch (e) {
|
|
359
362
|
setStatus('3');
|
|
360
363
|
events.error && events.error(e);
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/* pc style */
|
|
2
|
+
.weda-graphic-card {
|
|
3
|
+
width: 100%;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.weda-graphic-card .weda-graphic-card__wrapper {
|
|
7
|
+
width: 100%;
|
|
8
|
+
padding: 0 24px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.weda-graphic-card .weda-graphic-card__row {
|
|
12
|
+
margin: 0;
|
|
13
|
+
padding: 20px 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.weda-graphic-card .weda-graphic-card__col {
|
|
17
|
+
padding: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__col-body {
|
|
21
|
+
width: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.weda-graphic-card .weda-graphic-card__col .wedatea2td-grid__box,
|
|
25
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__col-body {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
align-items: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.weda-graphic-card
|
|
33
|
+
.weda-graphic-card__col.weda-graphic-card__col--left
|
|
34
|
+
.wedatea2td-grid__box,
|
|
35
|
+
.weda-graphic-card
|
|
36
|
+
.weda-graphic-card__col.weda-graphic-card__col--left
|
|
37
|
+
.weda-graphic-card__col-body {
|
|
38
|
+
align-items: flex-start;
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.weda-graphic-card
|
|
43
|
+
.weda-graphic-card__col.weda-graphic-card__col--right
|
|
44
|
+
.wedatea2td-grid__box,
|
|
45
|
+
.weda-graphic-card
|
|
46
|
+
.weda-graphic-card__col.weda-graphic-card__col--right
|
|
47
|
+
.weda-graphic-card__col-body {
|
|
48
|
+
align-items: flex-end;
|
|
49
|
+
width: 100%;
|
|
50
|
+
}
|
|
51
|
+
.weda-graphic-card
|
|
52
|
+
.weda-graphic-card__col.weda-graphic-card__col--center
|
|
53
|
+
.wedatea2td-grid__box,
|
|
54
|
+
.weda-graphic-card
|
|
55
|
+
.weda-graphic-card__col.weda-graphic-card__col--center
|
|
56
|
+
.weda-graphic-card__col-body {
|
|
57
|
+
align-items: center;
|
|
58
|
+
width: 100%;
|
|
59
|
+
}
|
|
60
|
+
.weda-graphic-card
|
|
61
|
+
.weda-graphic-card__col.weda-graphic-card__col--justify
|
|
62
|
+
.wedatea2td-grid__box,
|
|
63
|
+
.weda-graphic-card
|
|
64
|
+
.weda-graphic-card__col.weda-graphic-card__col--justify
|
|
65
|
+
.weda-graphic-card__col-body {
|
|
66
|
+
width: 100%;
|
|
67
|
+
}
|
|
68
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__icon {
|
|
69
|
+
width: 100%;
|
|
70
|
+
height: 200px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.weda-graphic-card .weda-graphic-card__icon .weda-graphic-card__img {
|
|
74
|
+
width: 100%;
|
|
75
|
+
height: 100%;
|
|
76
|
+
object-fit: cover;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__detail {
|
|
80
|
+
width: 100%;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__title {
|
|
84
|
+
font-size: 16px;
|
|
85
|
+
line-height: 24px;
|
|
86
|
+
text-align: center;
|
|
87
|
+
color: rgba(0, 0, 0, 0.9);
|
|
88
|
+
display: -webkit-box;
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
text-overflow: ellipsis;
|
|
91
|
+
-webkit-box-orient: vertical;
|
|
92
|
+
-webkit-line-clamp: 2;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__desc {
|
|
96
|
+
font-size: 14px;
|
|
97
|
+
line-height: 22px;
|
|
98
|
+
color: rgba(0, 0, 0, 0.4);
|
|
99
|
+
text-align: center;
|
|
100
|
+
display: -webkit-box;
|
|
101
|
+
overflow: hidden;
|
|
102
|
+
text-overflow: ellipsis;
|
|
103
|
+
-webkit-box-orient: vertical;
|
|
104
|
+
-webkit-line-clamp: 2;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__btn--text {
|
|
108
|
+
font-size: 14px;
|
|
109
|
+
line-height: 22px;
|
|
110
|
+
color: #0052d9;
|
|
111
|
+
margin-right: 8px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.weda-graphic-card
|
|
115
|
+
.weda-graphic-card__col
|
|
116
|
+
.weda-graphic-card__btn
|
|
117
|
+
.weda-graphic-card__btn--icon {
|
|
118
|
+
transform: rotate(180deg);
|
|
119
|
+
margin-bottom: 2px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__title {
|
|
123
|
+
margin-top: 20px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__desc {
|
|
127
|
+
margin-top: 8px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.weda-graphic-card .weda-graphic-card__col .weda-graphic-card__btn {
|
|
131
|
+
margin-top: 20px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* h5 style */
|
|
135
|
+
.weda-graphic-card-mobile .weda-graphic-card__wrapper {
|
|
136
|
+
width: 100%;
|
|
137
|
+
padding: 0 16px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.weda-graphic-card-mobile .weda-graphic-card__row {
|
|
141
|
+
padding: 18px 0;
|
|
142
|
+
margin: 0 -5.5px;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.weda-graphic-card-mobile .weda-graphic-card__col {
|
|
146
|
+
padding: 0 5.5px !important;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.weda-graphic-card-mobile .weda-graphic-card__col .weda-graphic-card__detail {
|
|
150
|
+
padding: 0 !important;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.weda-graphic-card-mobile .weda-graphic-card__col .weda-graphic-card__title {
|
|
154
|
+
margin-top: 16px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.weda-graphic-card-mobile .weda-graphic-card__col .weda-graphic-card__desc {
|
|
158
|
+
margin-top: 6px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.weda-graphic-card-mobile .weda-graphic-card__col .weda-graphic-card__btn {
|
|
162
|
+
margin-top: 16px;
|
|
163
|
+
}
|