@cloudbase/weda-ui 2.0.26 → 3.1.0
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 +12 -13
- package/src/configs/actions/showModal.json +0 -48
- package/src/configs/actions/showToast.json +0 -41
- package/src/configs/components/auth.json +0 -16
- package/src/configs/components/button.json +0 -239
- package/src/configs/components/calendar.json +0 -81
- package/src/configs/components/carousel.json +0 -292
- package/src/configs/components/chart/bar.json +0 -721
- package/src/configs/components/chart/line.json +0 -674
- package/src/configs/components/chart/pie.json +0 -494
- package/src/configs/components/chart/statisticsCard.json +0 -376
- package/src/configs/components/container.json +0 -50
- package/src/configs/components/dataView.json +0 -151
- package/src/configs/components/drawer.json +0 -115
- package/src/configs/components/form/checkbox.json +0 -173
- package/src/configs/components/form/form.json +0 -45
- package/src/configs/components/form/input.json +0 -154
- package/src/configs/components/form/label.json +0 -22
- package/src/configs/components/form/location.json +0 -155
- package/src/configs/components/form/radio.json +0 -203
- package/src/configs/components/form/richText.json +0 -125
- package/src/configs/components/form/select.json +0 -411
- package/src/configs/components/form/switch.json +0 -58
- package/src/configs/components/form/textarea.json +0 -116
- package/src/configs/components/form/tips.json +0 -34
- package/src/configs/components/form/uploader.json +0 -169
- package/src/configs/components/form/uploaderFile.json +0 -158
- package/src/configs/components/graphicCard.json +0 -413
- package/src/configs/components/image.json +0 -179
- package/src/configs/components/link.json +0 -79
- package/src/configs/components/listView.json +0 -281
- package/src/configs/components/lottery.json +0 -157
- package/src/configs/components/modal.json +0 -83
- package/src/configs/components/navLayout.json +0 -368
- package/src/configs/components/navigationBar.json +0 -62
- package/src/configs/components/picker/datePicker.json +0 -33
- package/src/configs/components/picker/picker.json +0 -18
- package/src/configs/components/picker/timePicker.json +0 -23
- package/src/configs/components/richtextview.json +0 -26
- package/src/configs/components/scrollVeiw.json +0 -253
- package/src/configs/components/slot.json +0 -17
- package/src/configs/components/swiper.json +0 -90
- package/src/configs/components/tabs.json +0 -121
- package/src/configs/components/text.json +0 -95
- package/src/configs/components/wedaVideo.json +0 -89
- package/src/configs/components/wxOpenApi/phone.json +0 -127
- package/src/configs/components/wxOpenApi/phoneCode.json +0 -109
- package/src/configs/components/wxOpenApi/share.json +0 -157
- package/src/configs/components/wxOpenApi/userInfo.json +0 -156
- package/src/configs/index.js +0 -111
- package/src/index.js +0 -4
- package/src/mp/README.md +0 -1
- package/src/mp/actions/showModal/index.js +0 -3
- package/src/mp/actions/showToast/index.js +0 -3
- package/src/mp/components/button/index.js +0 -91
- package/src/mp/components/button/index.json +0 -4
- package/src/mp/components/button/index.wxml +0 -22
- package/src/mp/components/button/index.wxss +0 -13
- package/src/mp/components/calendar/arrowright--line.svg +0 -11
- package/src/mp/components/calendar/index.js +0 -268
- package/src/mp/components/calendar/index.json +0 -5
- package/src/mp/components/calendar/index.wxml +0 -35
- package/src/mp/components/calendar/index.wxss +0 -179
- package/src/mp/components/carousel/index.js +0 -88
- package/src/mp/components/carousel/index.json +0 -7
- package/src/mp/components/carousel/index.wxml +0 -6
- package/src/mp/components/chart/bar/index.js +0 -257
- package/src/mp/components/chart/bar/index.json +0 -6
- package/src/mp/components/chart/bar/index.wxml +0 -3
- package/src/mp/components/chart/bar/index.wxss +0 -9
- package/src/mp/components/chart/common/config/bar.js +0 -50
- package/src/mp/components/chart/common/config/global.js +0 -16
- package/src/mp/components/chart/common/config/line.js +0 -48
- package/src/mp/components/chart/common/config/pie.js +0 -36
- package/src/mp/components/chart/common/core/eChartBar.js +0 -258
- package/src/mp/components/chart/common/core/eChartBase.js +0 -389
- package/src/mp/components/chart/common/core/eChartLine.js +0 -223
- package/src/mp/components/chart/common/core/eChartPie.js +0 -169
- package/src/mp/components/chart/common/lib/echarts.min.js +0 -18
- package/src/mp/components/chart/ec-canvas/ec-canvas.js +0 -277
- package/src/mp/components/chart/ec-canvas/ec-canvas.json +0 -4
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +0 -4
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxss +0 -4
- package/src/mp/components/chart/ec-canvas/wx-canvas.js +0 -109
- package/src/mp/components/chart/line/index.js +0 -247
- package/src/mp/components/chart/line/index.json +0 -6
- package/src/mp/components/chart/line/index.wxml +0 -3
- package/src/mp/components/chart/line/index.wxss +0 -9
- package/src/mp/components/chart/pie/index.js +0 -182
- package/src/mp/components/chart/pie/index.json +0 -6
- package/src/mp/components/chart/pie/index.wxml +0 -3
- package/src/mp/components/chart/pie/index.wxss +0 -9
- package/src/mp/components/chart/statisticsCard/index.js +0 -253
- package/src/mp/components/chart/statisticsCard/index.json +0 -4
- package/src/mp/components/chart/statisticsCard/index.wxml +0 -9
- package/src/mp/components/chart/statisticsCard/index.wxss +0 -42
- package/src/mp/components/container/index.js +0 -20
- package/src/mp/components/container/index.json +0 -4
- package/src/mp/components/container/index.wxml +0 -3
- package/src/mp/components/dataView/index.js +0 -34
- package/src/mp/components/dataView/index.json +0 -7
- package/src/mp/components/dataView/index.wxml +0 -3
- package/src/mp/components/dataView/index.wxss +0 -0
- package/src/mp/components/form/checkbox/index.js +0 -124
- package/src/mp/components/form/checkbox/index.json +0 -7
- package/src/mp/components/form/checkbox/index.wxml +0 -13
- package/src/mp/components/form/checkbox/index.wxss +0 -1
- package/src/mp/components/form/form/index.js +0 -18
- package/src/mp/components/form/form/index.json +0 -4
- package/src/mp/components/form/form/index.wxml +0 -5
- package/src/mp/components/form/form/index.wxss +0 -1
- package/src/mp/components/form/formcell/index.js +0 -54
- package/src/mp/components/form/formcell/index.json +0 -4
- package/src/mp/components/form/formcell/index.wxml +0 -11
- package/src/mp/components/form/formcell/index.wxss +0 -31
- package/src/mp/components/form/input/index.js +0 -110
- package/src/mp/components/form/input/index.json +0 -7
- package/src/mp/components/form/input/index.wxml +0 -24
- package/src/mp/components/form/input/index.wxss +0 -22
- package/src/mp/components/form/location/components/mapChoose/index.js +0 -201
- package/src/mp/components/form/location/components/mapChoose/index.json +0 -4
- package/src/mp/components/form/location/components/mapChoose/index.wxml +0 -42
- package/src/mp/components/form/location/components/mapChoose/index.wxss +0 -188
- package/src/mp/components/form/location/index.js +0 -388
- package/src/mp/components/form/location/index.json +0 -6
- package/src/mp/components/form/location/index.wxml +0 -21
- package/src/mp/components/form/location/index.wxss +0 -89
- package/src/mp/components/form/radio/index.js +0 -124
- package/src/mp/components/form/radio/index.json +0 -7
- package/src/mp/components/form/radio/index.wxml +0 -13
- package/src/mp/components/form/radio/index.wxss +0 -1
- package/src/mp/components/form/select/index.js +0 -677
- package/src/mp/components/form/select/index.json +0 -7
- package/src/mp/components/form/select/index.wxml +0 -12
- package/src/mp/components/form/select/index.wxss +0 -16
- package/src/mp/components/form/select/region/index.js +0 -107
- package/src/mp/components/form/switch/index.js +0 -75
- package/src/mp/components/form/switch/index.json +0 -7
- package/src/mp/components/form/switch/index.wxml +0 -11
- package/src/mp/components/form/switch/index.wxss +0 -1
- package/src/mp/components/form/textarea/index.js +0 -90
- package/src/mp/components/form/textarea/index.json +0 -7
- package/src/mp/components/form/textarea/index.wxml +0 -8
- package/src/mp/components/form/textarea/index.wxss +0 -10
- package/src/mp/components/form/tips/index.js +0 -41
- package/src/mp/components/form/tips/index.json +0 -4
- package/src/mp/components/form/tips/index.wxml +0 -1
- package/src/mp/components/form/tips/index.wxss +0 -1
- package/src/mp/components/form/uploader/index.js +0 -158
- package/src/mp/components/form/uploader/index.json +0 -10
- package/src/mp/components/form/uploader/index.wxml +0 -14
- package/src/mp/components/form/uploader/index.wxss +0 -36
- package/src/mp/components/form/uploader/weui-uploader.js +0 -219
- package/src/mp/components/form/uploader/weui-uploader.json +0 -7
- package/src/mp/components/form/uploader/weui-uploader.wxml +0 -45
- package/src/mp/components/form/uploader/weui-uploader.wxss +0 -1
- package/src/mp/components/form/uploaderFile/index.js +0 -313
- package/src/mp/components/form/uploaderFile/index.json +0 -9
- package/src/mp/components/form/uploaderFile/index.wxml +0 -45
- package/src/mp/components/form/uploaderFile/index.wxss +0 -105
- package/src/mp/components/graphicCard/chevron-right.svg +0 -3
- package/src/mp/components/graphicCard/index.js +0 -203
- package/src/mp/components/graphicCard/index.json +0 -4
- package/src/mp/components/graphicCard/index.wxml +0 -25
- package/src/mp/components/graphicCard/index.wxss +0 -157
- package/src/mp/components/image/index.js +0 -182
- package/src/mp/components/image/index.json +0 -7
- package/src/mp/components/image/index.wxml +0 -9
- package/src/mp/components/image/index.wxss +0 -49
- package/src/mp/components/listView/arrow-right-line.svg +0 -3
- package/src/mp/components/listView/index.js +0 -274
- package/src/mp/components/listView/index.json +0 -4
- package/src/mp/components/listView/index.wxml +0 -38
- package/src/mp/components/listView/index.wxss +0 -155
- package/src/mp/components/listView/more-line.svg +0 -3
- package/src/mp/components/lottery/index.js +0 -270
- package/src/mp/components/lottery/index.json +0 -4
- package/src/mp/components/lottery/index.wxml +0 -41
- package/src/mp/components/lottery/index.wxss +0 -323
- package/src/mp/components/modal/index.js +0 -39
- package/src/mp/components/modal/index.json +0 -4
- package/src/mp/components/modal/index.wxml +0 -1
- package/src/mp/components/navLayout/index.js +0 -120
- package/src/mp/components/navLayout/index.json +0 -7
- package/src/mp/components/navLayout/index.wxml +0 -23
- package/src/mp/components/navLayout/index.wxss +0 -1193
- package/src/mp/components/navigationBar/index.js +0 -193
- package/src/mp/components/navigationBar/index.json +0 -5
- package/src/mp/components/navigationBar/index.wxml +0 -80
- package/src/mp/components/navigationBar/index.wxss +0 -1257
- package/src/mp/components/richText/index.js +0 -67
- package/src/mp/components/richText/index.json +0 -4
- package/src/mp/components/richText/index.wxml +0 -3
- package/src/mp/components/richText/index.wxss +0 -27
- package/src/mp/components/scrollView/index.js +0 -119
- package/src/mp/components/scrollView/index.json +0 -4
- package/src/mp/components/scrollView/index.wxml +0 -38
- package/src/mp/components/slot/index.js +0 -20
- package/src/mp/components/slot/index.json +0 -4
- package/src/mp/components/slot/index.wxml +0 -3
- package/src/mp/components/swiper/index.js +0 -65
- package/src/mp/components/swiper/index.json +0 -4
- package/src/mp/components/swiper/index.wxml +0 -3
- package/src/mp/components/tabs/index.js +0 -59
- package/src/mp/components/tabs/index.json +0 -4
- package/src/mp/components/tabs/index.wxml +0 -12
- package/src/mp/components/tabs/index.wxss +0 -57
- package/src/mp/components/text/index.js +0 -40
- package/src/mp/components/text/index.json +0 -4
- package/src/mp/components/text/index.wxml +0 -1
- package/src/mp/components/text/index.wxss +0 -26
- package/src/mp/components/wedaVideo/index.js +0 -86
- package/src/mp/components/wedaVideo/index.json +0 -4
- package/src/mp/components/wedaVideo/index.wxml +0 -4
- package/src/mp/components/wedaVideo/index.wxss +0 -20
- package/src/mp/components/wxOpenApi/phone/index.js +0 -109
- package/src/mp/components/wxOpenApi/phone/index.json +0 -4
- package/src/mp/components/wxOpenApi/phone/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/phone/index.wxss +0 -22
- package/src/mp/components/wxOpenApi/phoneCode/index.js +0 -89
- package/src/mp/components/wxOpenApi/phoneCode/index.json +0 -4
- package/src/mp/components/wxOpenApi/phoneCode/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/phoneCode/index.wxss +0 -22
- package/src/mp/components/wxOpenApi/share/index.js +0 -117
- package/src/mp/components/wxOpenApi/share/index.json +0 -4
- package/src/mp/components/wxOpenApi/share/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/share/index.wxss +0 -22
- package/src/mp/components/wxOpenApi/userInfo/index.js +0 -88
- package/src/mp/components/wxOpenApi/userInfo/index.json +0 -4
- package/src/mp/components/wxOpenApi/userInfo/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/userInfo/index.wxss +0 -22
- package/src/mp/index.json +0 -52
- package/src/mp/package.json +0 -6
- package/src/mp/style/weda-ui.wxss +0 -71
- package/src/mp/utils/classnames.js +0 -39
- package/src/mp/utils/constant.js +0 -20
- package/src/mp/utils/dayjs.min.js +0 -1
- package/src/mp/utils/debounce.js +0 -133
- package/src/mp/utils/deepEqual.js +0 -42
- package/src/mp/utils/destr.js +0 -49
- package/src/mp/utils/dr_square_point.js +0 -29
- package/src/mp/utils/handleEvents.js +0 -32
- package/src/mp/utils/lodash.js +0 -2
- package/src/mp/utils/platform.js +0 -45
- package/src/mp/utils/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js +0 -1336
- package/src/mp/utils/spark-md5.js +0 -776
- package/src/mp/utils/tcb.js +0 -76
- package/src/setupTests.js +0 -14
- package/src/web/actions/index.js +0 -2
- package/src/web/actions/showModal/index.tsx +0 -118
- package/src/web/actions/showToast/index.js +0 -3
- package/src/web/components/auth/index.css +0 -0
- package/src/web/components/auth/index.js +0 -66
- package/src/web/components/button/index.css +0 -27
- package/src/web/components/button/index.tsx +0 -119
- package/src/web/components/calendar/index.css +0 -416
- package/src/web/components/calendar/index.jsx +0 -312
- package/src/web/components/calendar/util.js +0 -90
- package/src/web/components/carousel/index.css +0 -119
- package/src/web/components/carousel/index.tsx +0 -417
- package/src/web/components/chart/bar/index.tsx +0 -140
- package/src/web/components/chart/common/config/bar.js +0 -49
- package/src/web/components/chart/common/config/global.js +0 -16
- package/src/web/components/chart/common/config/line.js +0 -50
- package/src/web/components/chart/common/config/pie.js +0 -37
- package/src/web/components/chart/common/core/eChartBar.js +0 -259
- package/src/web/components/chart/common/core/eChartBase.ts +0 -396
- package/src/web/components/chart/common/core/eChartLine.js +0 -225
- package/src/web/components/chart/common/core/eChartPie.js +0 -173
- package/src/web/components/chart/common/core/type.ts +0 -34
- package/src/web/components/chart/common/echart.css +0 -106
- package/src/web/components/chart/common/echarts.ts +0 -31
- package/src/web/components/chart/common/useChart.tsx +0 -87
- package/src/web/components/chart/line/index.tsx +0 -136
- package/src/web/components/chart/pie/index.tsx +0 -99
- package/src/web/components/chart/statisticsCard/index.css +0 -63
- package/src/web/components/chart/statisticsCard/index.tsx +0 -307
- package/src/web/components/chart/statisticsCard/interface.ts +0 -14
- package/src/web/components/container/index.tsx +0 -34
- package/src/web/components/dataView/index.tsx +0 -20
- package/src/web/components/dataView/interface.ts +0 -6
- package/src/web/components/drawer/index.tsx +0 -68
- package/src/web/components/form/checkbox/index.tsx +0 -210
- package/src/web/components/form/enumSelect/MultipleSelect.jsx +0 -89
- package/src/web/components/form/enumSelect/NormalSelect.tsx +0 -92
- package/src/web/components/form/enumSelect/SelectContainer.jsx +0 -43
- package/src/web/components/form/enumSelect/index.jsx +0 -9
- package/src/web/components/form/enumSelect/props/defaultProps.js +0 -39
- package/src/web/components/form/enumSelect/props/propsTypes.js +0 -50
- package/src/web/components/form/form/index.css +0 -9
- package/src/web/components/form/form/index.tsx +0 -51
- package/src/web/components/form/formcell/index.css +0 -85
- package/src/web/components/form/formcell/index.tsx +0 -85
- package/src/web/components/form/input/index.css +0 -40
- package/src/web/components/form/input/index.tsx +0 -166
- package/src/web/components/form/location/common/mapChoose.css +0 -180
- package/src/web/components/form/location/common/mapChoose.jsx +0 -343
- package/src/web/components/form/location/common/mapView.jsx +0 -190
- package/src/web/components/form/location/common/propsConfig.js +0 -54
- package/src/web/components/form/location/common/selectModal.css +0 -44
- package/src/web/components/form/location/common/selectModal.jsx +0 -73
- package/src/web/components/form/location/common/useLocationInfo.js +0 -104
- package/src/web/components/form/location/components/LocationH5/index.css +0 -239
- package/src/web/components/form/location/components/LocationH5/location.h5.jsx +0 -413
- package/src/web/components/form/location/components/LocationPC/Header.jsx +0 -96
- package/src/web/components/form/location/components/LocationPC/index.css +0 -44
- package/src/web/components/form/location/components/LocationPC/location.PC.jsx +0 -332
- package/src/web/components/form/location/constants.js +0 -4
- package/src/web/components/form/location/index.css +0 -0
- package/src/web/components/form/location/index.jsx +0 -25
- package/src/web/components/form/radio/index.css +0 -12
- package/src/web/components/form/radio/index.tsx +0 -179
- package/src/web/components/form/renderDecorator.tsx +0 -28
- package/src/web/components/form/select/h5.tsx +0 -602
- package/src/web/components/form/select/index.css +0 -27
- package/src/web/components/form/select/index.tsx +0 -510
- package/src/web/components/form/select/region/index.ts +0 -152
- package/src/web/components/form/select/time.jsx +0 -145
- package/src/web/components/form/select/year.tsx +0 -172
- package/src/web/components/form/switch/index.tsx +0 -100
- package/src/web/components/form/textarea/index.css +0 -11
- package/src/web/components/form/textarea/index.tsx +0 -127
- package/src/web/components/form/tips/index.css +0 -4
- package/src/web/components/form/tips/index.tsx +0 -34
- package/src/web/components/form/types.d.ts +0 -12
- package/src/web/components/form/uploader/index.css +0 -118
- package/src/web/components/form/uploader/index.tsx +0 -65
- package/src/web/components/form/uploader/uploader.h5.tsx +0 -290
- package/src/web/components/form/uploader/uploader.pc.tsx +0 -287
- package/src/web/components/form/uploaderFile/fail.svg +0 -12
- package/src/web/components/form/uploaderFile/index.css +0 -422
- package/src/web/components/form/uploaderFile/index.jsx +0 -25
- package/src/web/components/form/uploaderFile/pending.svg +0 -18
- package/src/web/components/form/uploaderFile/success.svg +0 -12
- package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +0 -606
- package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +0 -520
- package/src/web/components/graphicCard/index.css +0 -159
- package/src/web/components/graphicCard/index.tsx +0 -310
- package/src/web/components/image/image.tsx +0 -187
- package/src/web/components/image/index.css +0 -54
- package/src/web/components/image/index.tsx +0 -121
- package/src/web/components/index.js +0 -95
- package/src/web/components/link/index.css +0 -8
- package/src/web/components/link/index.tsx +0 -119
- package/src/web/components/listView/arrow-right-line.svg +0 -3
- package/src/web/components/listView/index.css +0 -143
- package/src/web/components/listView/index.tsx +0 -346
- package/src/web/components/listView/interface.ts +0 -98
- package/src/web/components/lottery/index.css +0 -333
- package/src/web/components/lottery/index.tsx +0 -567
- package/src/web/components/lottery/lotteryUtil.ts +0 -130
- package/src/web/components/modal/index.tsx +0 -60
- package/src/web/components/navLayout/index.css +0 -332
- package/src/web/components/navLayout/index.tsx +0 -247
- package/src/web/components/navigationBar/chevron-right--double.svg +0 -3
- package/src/web/components/navigationBar/common.tsx +0 -198
- package/src/web/components/navigationBar/h5Menu.tsx +0 -179
- package/src/web/components/navigationBar/horizontalMenu.tsx +0 -200
- package/src/web/components/navigationBar/index.css +0 -762
- package/src/web/components/navigationBar/index.tsx +0 -230
- package/src/web/components/navigationBar/type.d.ts +0 -111
- package/src/web/components/navigationBar/verticalMenu.tsx +0 -81
- package/src/web/components/phone/index.css +0 -0
- package/src/web/components/phone/index.tsx +0 -22
- package/src/web/components/phoneCode/index.css +0 -0
- package/src/web/components/phoneCode/index.tsx +0 -22
- package/src/web/components/picker/datePicker.tsx +0 -48
- package/src/web/components/picker/picker.tsx +0 -59
- package/src/web/components/picker/timePicker.tsx +0 -56
- package/src/web/components/richText/const.ts +0 -3
- package/src/web/components/richText/index.css +0 -93
- package/src/web/components/richText/index.jsx +0 -473
- package/src/web/components/richTextView/index.css +0 -63
- package/src/web/components/richTextView/index.tsx +0 -63
- package/src/web/components/scrollView/index.tsx +0 -148
- package/src/web/components/share/index.css +0 -0
- package/src/web/components/share/index.tsx +0 -38
- package/src/web/components/slot/index.tsx +0 -19
- package/src/web/components/swiper/index.css +0 -106
- package/src/web/components/swiper/index.tsx +0 -291
- package/src/web/components/tabs/index.css +0 -64
- package/src/web/components/tabs/index.tsx +0 -35
- package/src/web/components/tabs/tabs.h5.tsx +0 -84
- package/src/web/components/tabs/tabs.pc.tsx +0 -74
- package/src/web/components/text/index.css +0 -26
- package/src/web/components/text/index.tsx +0 -60
- package/src/web/components/uploaderFileView/index.css +0 -11
- package/src/web/components/uploaderFileView/index.jsx +0 -84
- package/src/web/components/uploaderView/index.css +0 -31
- package/src/web/components/uploaderView/index.tsx +0 -92
- package/src/web/components/userInfo/index.css +0 -0
- package/src/web/components/userInfo/index.tsx +0 -30
- package/src/web/components/wedaVideo/index.css +0 -42
- package/src/web/components/wedaVideo/index.tsx +0 -208
- package/src/web/index.js +0 -4
- package/src/web/types.d.ts +0 -21
- package/src/web/utils/classnames.js +0 -39
- package/src/web/utils/constant.ts +0 -23
- package/src/web/utils/debounce.js +0 -98
- package/src/web/utils/events.js +0 -2
- package/src/web/utils/getLocalCounter.js +0 -5
- package/src/web/utils/isObjectEqual.js +0 -15
- package/src/web/utils/loading-fallback.tsx +0 -2
- package/src/web/utils/lodash.ts +0 -2
- package/src/web/utils/platform.js +0 -156
- package/src/web/utils/tcb.js +0 -86
- package/src/web/utils/tmap.js +0 -4
- package/src/web/utils/useSetState.ts +0 -18
- package/src/web/utils/useSyncValue.ts +0 -17
- package/src/web/utils/weui.js +0 -3
- package/src/web/weda-ui.css +0 -86
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
Component({
|
|
2
|
-
options: {
|
|
3
|
-
addGlobalClass: true,
|
|
4
|
-
virtualHost: true,
|
|
5
|
-
},
|
|
6
|
-
properties: {
|
|
7
|
-
title: {
|
|
8
|
-
type: String,
|
|
9
|
-
value: '图片上传',
|
|
10
|
-
},
|
|
11
|
-
sizeType: {
|
|
12
|
-
type: Array,
|
|
13
|
-
value: ['original', 'compressed'],
|
|
14
|
-
},
|
|
15
|
-
sourceType: {
|
|
16
|
-
type: Array,
|
|
17
|
-
value: ['album', 'camera'],
|
|
18
|
-
},
|
|
19
|
-
maxSize: {
|
|
20
|
-
type: Number,
|
|
21
|
-
value: 5 * 1024 * 1024,
|
|
22
|
-
},
|
|
23
|
-
maxCount: {
|
|
24
|
-
// 最多上传多少个文件
|
|
25
|
-
type: Number,
|
|
26
|
-
value: 1,
|
|
27
|
-
},
|
|
28
|
-
files: {
|
|
29
|
-
// 当前的图片列表, {url, error, loading}
|
|
30
|
-
type: Array,
|
|
31
|
-
value: [],
|
|
32
|
-
observer(newVal) {
|
|
33
|
-
this.setData({
|
|
34
|
-
currentFiles: newVal,
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
select: {
|
|
39
|
-
// 过滤某个文件
|
|
40
|
-
type: null,
|
|
41
|
-
value: () => {},
|
|
42
|
-
},
|
|
43
|
-
upload: {
|
|
44
|
-
// 返回Promise的一个文件上传的函数
|
|
45
|
-
type: null,
|
|
46
|
-
value: null,
|
|
47
|
-
},
|
|
48
|
-
tips: {
|
|
49
|
-
type: String,
|
|
50
|
-
value: '',
|
|
51
|
-
},
|
|
52
|
-
layout: {
|
|
53
|
-
type: String,
|
|
54
|
-
value: 'horizontal',
|
|
55
|
-
},
|
|
56
|
-
extClass: {
|
|
57
|
-
type: String,
|
|
58
|
-
value: '',
|
|
59
|
-
},
|
|
60
|
-
showDelete: {
|
|
61
|
-
// 是否显示delete按钮
|
|
62
|
-
type: Boolean,
|
|
63
|
-
value: true,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
data: {
|
|
67
|
-
currentFiles: [],
|
|
68
|
-
showPreview: false,
|
|
69
|
-
previewImageUrls: [],
|
|
70
|
-
},
|
|
71
|
-
ready() {},
|
|
72
|
-
methods: {
|
|
73
|
-
previewImage(e) {
|
|
74
|
-
const { index } = e.currentTarget.dataset;
|
|
75
|
-
const previewImageUrls = [];
|
|
76
|
-
this.data.files.forEach((item) => {
|
|
77
|
-
previewImageUrls.push(item.url);
|
|
78
|
-
});
|
|
79
|
-
this.setData({
|
|
80
|
-
previewImageUrls,
|
|
81
|
-
previewCurrent: index,
|
|
82
|
-
showPreview: true,
|
|
83
|
-
});
|
|
84
|
-
},
|
|
85
|
-
chooseImage() {
|
|
86
|
-
if (this.uploading) return;
|
|
87
|
-
wx.chooseImage({
|
|
88
|
-
count: this.data.maxCount - this.data.files.length,
|
|
89
|
-
sizeType: this.data.sizeType,
|
|
90
|
-
sourceType: this.data.sourceType,
|
|
91
|
-
success: (res) => {
|
|
92
|
-
// console.log('chooseImage resp', res)
|
|
93
|
-
// 首先检查文件大小
|
|
94
|
-
let invalidIndex = -1;
|
|
95
|
-
// @ts-ignore
|
|
96
|
-
res.tempFiles.forEach((item, index) => {
|
|
97
|
-
if (item.size > this.data.maxSize) {
|
|
98
|
-
invalidIndex = index;
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
if (typeof this.data.select === 'function') {
|
|
102
|
-
const ret = this.data.select(res);
|
|
103
|
-
if (ret === false) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
if (invalidIndex >= 0) {
|
|
108
|
-
this.triggerEvent(
|
|
109
|
-
'fail',
|
|
110
|
-
{
|
|
111
|
-
type: 1,
|
|
112
|
-
errMsg: `chooseImage:fail size exceed ${this.data.maxSize}`,
|
|
113
|
-
total: res.tempFilePaths.length,
|
|
114
|
-
index: invalidIndex,
|
|
115
|
-
},
|
|
116
|
-
{}
|
|
117
|
-
);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
// 获取文件内容
|
|
121
|
-
const mgr = wx.getFileSystemManager();
|
|
122
|
-
const contents = res.tempFilePaths.map((item) => {
|
|
123
|
-
// @ts-ignore
|
|
124
|
-
const fileContent = mgr.readFileSync(item);
|
|
125
|
-
return fileContent;
|
|
126
|
-
});
|
|
127
|
-
const obj = {
|
|
128
|
-
tempFilePaths: res.tempFilePaths,
|
|
129
|
-
tempFiles: res.tempFiles,
|
|
130
|
-
contents,
|
|
131
|
-
};
|
|
132
|
-
// 触发选中的事件,开发者根据内容来上传文件,上传了把上传的结果反馈到files属性里面
|
|
133
|
-
this.triggerEvent('select', obj, {});
|
|
134
|
-
const files = res.tempFilePaths.map((item, i) => ({
|
|
135
|
-
loading: true,
|
|
136
|
-
url:
|
|
137
|
-
res.tempFilePaths[i] ||
|
|
138
|
-
`data:image/jpg;base64,${wx.arrayBufferToBase64(contents[i])}`,
|
|
139
|
-
}));
|
|
140
|
-
if (!files || !files.length) return;
|
|
141
|
-
if (typeof this.data.upload === 'function') {
|
|
142
|
-
const len = this.data.files.length;
|
|
143
|
-
const newFiles = this.data.files.concat(files);
|
|
144
|
-
this.setData({
|
|
145
|
-
files: newFiles,
|
|
146
|
-
currentFiles: newFiles,
|
|
147
|
-
});
|
|
148
|
-
this.loading = true;
|
|
149
|
-
this.data
|
|
150
|
-
.upload(obj)
|
|
151
|
-
.then((json) => {
|
|
152
|
-
this.loading = false;
|
|
153
|
-
if (json.urls) {
|
|
154
|
-
const oldFiles = this.data.files;
|
|
155
|
-
json.urls.forEach((url, index) => {
|
|
156
|
-
oldFiles[len + index].url = url;
|
|
157
|
-
oldFiles[len + index].loading = false;
|
|
158
|
-
});
|
|
159
|
-
this.setData({
|
|
160
|
-
files: oldFiles,
|
|
161
|
-
currentFiles: newFiles,
|
|
162
|
-
});
|
|
163
|
-
this.triggerEvent('success', json, {});
|
|
164
|
-
} else {
|
|
165
|
-
this.triggerEvent(
|
|
166
|
-
'fail',
|
|
167
|
-
{
|
|
168
|
-
type: 3,
|
|
169
|
-
errMsg: 'upload file fail, urls not found',
|
|
170
|
-
},
|
|
171
|
-
{}
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
})
|
|
175
|
-
.catch((err) => {
|
|
176
|
-
this.loading = false;
|
|
177
|
-
const oldFiles = this.data.files;
|
|
178
|
-
res.tempFilePaths.forEach((item, index) => {
|
|
179
|
-
oldFiles[len + index].error = true;
|
|
180
|
-
oldFiles[len + index].loading = false;
|
|
181
|
-
});
|
|
182
|
-
this.setData({
|
|
183
|
-
files: oldFiles,
|
|
184
|
-
currentFiles: newFiles,
|
|
185
|
-
});
|
|
186
|
-
this.triggerEvent(
|
|
187
|
-
'fail',
|
|
188
|
-
{
|
|
189
|
-
type: 3,
|
|
190
|
-
errMsg: 'upload file fail',
|
|
191
|
-
error: err,
|
|
192
|
-
},
|
|
193
|
-
{}
|
|
194
|
-
);
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
fail: (fail) => {
|
|
199
|
-
if (fail.errMsg.indexOf('chooseImage:fail cancel') >= 0) {
|
|
200
|
-
this.triggerEvent('cancel', {}, {});
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
fail.type = 2;
|
|
204
|
-
this.triggerEvent('fail', fail, {});
|
|
205
|
-
},
|
|
206
|
-
});
|
|
207
|
-
},
|
|
208
|
-
deletePic(e) {
|
|
209
|
-
const index = e.detail.index;
|
|
210
|
-
const files = this.data.files;
|
|
211
|
-
const file = files.splice(index, 1);
|
|
212
|
-
this.setData({
|
|
213
|
-
files,
|
|
214
|
-
currentFiles: files,
|
|
215
|
-
});
|
|
216
|
-
this.triggerEvent('delete', { index, item: file[0] });
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<view class="weui-uploader {{extClass}}">
|
|
2
|
-
<view class="weui-uploader__hd {{layout}}">
|
|
3
|
-
<view class="weda-formcells__label weui-cell">
|
|
4
|
-
<block wx:if="{{layout === 'horizontal'}}">
|
|
5
|
-
<view class="">
|
|
6
|
-
<view class="weui-uploader__title">{{title}}</view>
|
|
7
|
-
<view class="weui-uploader__info" wx:if="{{maxCount > 1}}">{{currentFiles.length}}/{{maxCount}}</view>
|
|
8
|
-
</view>
|
|
9
|
-
<label wx:if="{{true}}" class="weda-formcells__flag">*</label>
|
|
10
|
-
</block>
|
|
11
|
-
<block wx:if="{{layout === 'vertical'}}">
|
|
12
|
-
<view class="weui-uploader__label">
|
|
13
|
-
<view class="weui-uploader__title">{{title}}</view>
|
|
14
|
-
<label wx:if="{{true}}" class="weda-formcells__flag">*</label>
|
|
15
|
-
</view>
|
|
16
|
-
<view class="weui-uploader__info" wx:if="{{maxCount > 1}}">{{currentFiles.length}}/{{maxCount}}</view>
|
|
17
|
-
</block>
|
|
18
|
-
</view>
|
|
19
|
-
</view>
|
|
20
|
-
<view class="weui-uploader__bd">
|
|
21
|
-
<view class="weui-uploader__files">
|
|
22
|
-
<block wx:for="{{currentFiles}}" wx:key="*this">
|
|
23
|
-
<view wx:if="{{item.error}}" data-index="{{index}}" bindtap="previewImage" class="weui-uploader__file weui-uploader__file_status">
|
|
24
|
-
<image class="weui-uploader__img" src="{{item.url}}" mode="aspectFill" />
|
|
25
|
-
<view class="weui-uploader__file-content">
|
|
26
|
-
<icon type="warn" size="23" color="#F43530"></icon>
|
|
27
|
-
</view>
|
|
28
|
-
</view>
|
|
29
|
-
<view wx:elif="{{item.loading}}" data-index="{{index}}" bindtap="previewImage" class="weui-uploader__file weui-uploader__file_status">
|
|
30
|
-
<image class="weui-uploader__img" src="{{item.url}}" mode="aspectFill" />
|
|
31
|
-
<view class="weui-uploader__file-content">
|
|
32
|
-
<view class="weui-loading"></view>
|
|
33
|
-
</view>
|
|
34
|
-
</view>
|
|
35
|
-
<view wx:else class="weui-uploader__file" data-index="{{index}}" bindtap="previewImage">
|
|
36
|
-
<image class="weui-uploader__img" src="{{item.url}}" mode="aspectFill" />
|
|
37
|
-
</view>
|
|
38
|
-
</block>
|
|
39
|
-
</view>
|
|
40
|
-
<view wx:if="{{currentFiles.length < maxCount}}" class="weui-uploader__input-box" hover-class="weui-active">
|
|
41
|
-
<view class="weui-uploader__input" bindtap="chooseImage"></view>
|
|
42
|
-
</view>
|
|
43
|
-
</view>
|
|
44
|
-
<mp-gallery class="gallery" hide-on-click="{{true}}" show-delete="{{showDelete}}" show="{{showPreview}}" binddelete="deletePic" img-urls="{{previewImageUrls}}" current="{{previewCurrent}}"></mp-gallery>
|
|
45
|
-
</view>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/* materials/gsd-h5-react/components/form/uploader/weui-uploader.wxss */
|
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
import { getCloudInstance, getTempFileURL } from '../../../utils/tcb';
|
|
2
|
-
import SparkMD5 from '../../../utils/spark-md5';
|
|
3
|
-
import { transSize, uuid } from '../../../utils/platform';
|
|
4
|
-
Component({
|
|
5
|
-
options: {
|
|
6
|
-
virtualHost: true,
|
|
7
|
-
multipleSlots: true,
|
|
8
|
-
},
|
|
9
|
-
properties: {
|
|
10
|
-
label: {
|
|
11
|
-
type: String,
|
|
12
|
-
value: '文件上传',
|
|
13
|
-
},
|
|
14
|
-
//是否显示标题
|
|
15
|
-
labelVisible: {
|
|
16
|
-
type: Boolean,
|
|
17
|
-
value: true,
|
|
18
|
-
},
|
|
19
|
-
//单文件上传模式
|
|
20
|
-
single: {
|
|
21
|
-
type: Boolean,
|
|
22
|
-
value: false,
|
|
23
|
-
},
|
|
24
|
-
defaultValue: {
|
|
25
|
-
type: null,
|
|
26
|
-
},
|
|
27
|
-
maxUploadCount: {
|
|
28
|
-
type: Number,
|
|
29
|
-
value: 9,
|
|
30
|
-
},
|
|
31
|
-
//单个文件最大使用限制
|
|
32
|
-
maxSize: {
|
|
33
|
-
type: Number,
|
|
34
|
-
value: 10,
|
|
35
|
-
},
|
|
36
|
-
layout: {
|
|
37
|
-
type: String,
|
|
38
|
-
value: 'horizontal',
|
|
39
|
-
},
|
|
40
|
-
extClass: {
|
|
41
|
-
type: String,
|
|
42
|
-
value: '',
|
|
43
|
-
},
|
|
44
|
-
tips: {
|
|
45
|
-
type: Boolean,
|
|
46
|
-
value: false,
|
|
47
|
-
},
|
|
48
|
-
status: {
|
|
49
|
-
type: String,
|
|
50
|
-
valve: 'success',
|
|
51
|
-
},
|
|
52
|
-
downloadVisible: {
|
|
53
|
-
type: Boolean,
|
|
54
|
-
value: true,
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
data: {
|
|
58
|
-
maxCount: 0,
|
|
59
|
-
files: [],
|
|
60
|
-
urls: [],
|
|
61
|
-
cloudFile: [],
|
|
62
|
-
strogeUrls: [],
|
|
63
|
-
singleFlag: false,
|
|
64
|
-
},
|
|
65
|
-
methods: {
|
|
66
|
-
// 批量上传文件前置事件
|
|
67
|
-
handleBefore: function (files = []) {
|
|
68
|
-
if (this.data.files.length + files.length > this.data.maxCount) {
|
|
69
|
-
wx.showToast({
|
|
70
|
-
title: `上传文件总数不能超过${this.data.maxCount}个`,
|
|
71
|
-
icon: 'none',
|
|
72
|
-
duration: 2000,
|
|
73
|
-
});
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
if (
|
|
77
|
-
this.properties.maxSize &&
|
|
78
|
-
files.some((f) => f.size > this.properties.maxSize * 1024 * 1024)
|
|
79
|
-
) {
|
|
80
|
-
wx.showToast({
|
|
81
|
-
title: `上传文件大小不能超过${this.properties.maxSize}M`,
|
|
82
|
-
icon: 'none',
|
|
83
|
-
duration: 2000,
|
|
84
|
-
});
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
if (files.some((f) => f.size > 1024 * 1024 * 1024)) {
|
|
88
|
-
wx.showToast({
|
|
89
|
-
title: `上传文件大小不能超过1024M`,
|
|
90
|
-
icon: 'none',
|
|
91
|
-
duration: 2000,
|
|
92
|
-
});
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
return true;
|
|
96
|
-
},
|
|
97
|
-
//上传文件过程
|
|
98
|
-
uploadFile: async function () {
|
|
99
|
-
const wxClientApi = wx;
|
|
100
|
-
const apiName = [
|
|
101
|
-
'c',
|
|
102
|
-
'h',
|
|
103
|
-
'o',
|
|
104
|
-
'o',
|
|
105
|
-
's',
|
|
106
|
-
'e',
|
|
107
|
-
'M',
|
|
108
|
-
'e',
|
|
109
|
-
's',
|
|
110
|
-
's',
|
|
111
|
-
'a',
|
|
112
|
-
'g',
|
|
113
|
-
'e',
|
|
114
|
-
'F',
|
|
115
|
-
'i',
|
|
116
|
-
'l',
|
|
117
|
-
'e',
|
|
118
|
-
].join('');
|
|
119
|
-
|
|
120
|
-
//文件上传的函数,
|
|
121
|
-
wxClientApi[apiName]({
|
|
122
|
-
count: this.data.maxCount,
|
|
123
|
-
type: 'all',
|
|
124
|
-
success: async (files) => {
|
|
125
|
-
this.handleUpload(files);
|
|
126
|
-
},
|
|
127
|
-
fail(e) {
|
|
128
|
-
this.triggerEvent('error', e.detail);
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
},
|
|
132
|
-
handleUpload: async function (files) {
|
|
133
|
-
var _this = this;
|
|
134
|
-
if (!this.handleBefore(files?.tempFiles)) return;
|
|
135
|
-
const uploadPath = 'weda-uploader';
|
|
136
|
-
const uploadPromise = files.tempFiles.map(async (tempFile) => {
|
|
137
|
-
const cloudPath = `${uploadPath}/${uuid().replaceAll('-', '')}-${
|
|
138
|
-
tempFile.name
|
|
139
|
-
}`;
|
|
140
|
-
tempFile.percent = '0';
|
|
141
|
-
tempFile.cloudPath = null;
|
|
142
|
-
tempFile.filePath = tempFile?.path || null;
|
|
143
|
-
tempFile.size = transSize(tempFile?.size);
|
|
144
|
-
tempFile.status = 'uploading';
|
|
145
|
-
this.data.files.push(tempFile);
|
|
146
|
-
this.setData({
|
|
147
|
-
files: [...this.data.files],
|
|
148
|
-
});
|
|
149
|
-
//初始上传文件状态
|
|
150
|
-
let index = this.data.files.length - 1;
|
|
151
|
-
try {
|
|
152
|
-
const tcb = await getCloudInstance();
|
|
153
|
-
const uploadTask = await tcb.uploadFile({
|
|
154
|
-
cloudPath: cloudPath,
|
|
155
|
-
filePath: tempFile.path,
|
|
156
|
-
success(res) {
|
|
157
|
-
_this.data.files[index].cloudPath = res.fileID;
|
|
158
|
-
_this.data.files[index].percent = 100;
|
|
159
|
-
_this.data.files[index].status = 'success';
|
|
160
|
-
const arr = [];
|
|
161
|
-
arr.push(res.fileID);
|
|
162
|
-
let strogeUrls = [];
|
|
163
|
-
//为了避免死循环 在组件接到默认值后用cloudFile做暂存,造成urls跟cloudFile不同步,根据暂存状态来处理更新urls
|
|
164
|
-
if (_this.data.cloudFile.length > 0) {
|
|
165
|
-
strogeUrls = [..._this.data.cloudFile, ...arr];
|
|
166
|
-
} else {
|
|
167
|
-
strogeUrls = [..._this.data.urls, ...arr];
|
|
168
|
-
}
|
|
169
|
-
//同步urls cloudFile
|
|
170
|
-
_this.setData({
|
|
171
|
-
files: [..._this.data.files],
|
|
172
|
-
urls: [...strogeUrls],
|
|
173
|
-
cloudFile: [...strogeUrls],
|
|
174
|
-
});
|
|
175
|
-
if (_this.properties.single) {
|
|
176
|
-
_this.triggerEvent('success', {
|
|
177
|
-
value: _this.data.urls[0],
|
|
178
|
-
});
|
|
179
|
-
} else {
|
|
180
|
-
_this.triggerEvent('success', {
|
|
181
|
-
value: _this.data.urls,
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
fail() {
|
|
186
|
-
this.data.files[index].status = 'fail';
|
|
187
|
-
},
|
|
188
|
-
});
|
|
189
|
-
uploadTask.onProgressUpdate((res) => {
|
|
190
|
-
this.data.files[index].percent = String(res.progress);
|
|
191
|
-
res.progress == 100
|
|
192
|
-
? (this.data.files[index].status = 'success')
|
|
193
|
-
: (this.data.files[index].status = 'uploading');
|
|
194
|
-
this.data.files[index].uploaded = transSize(res.totalBytesSent);
|
|
195
|
-
this.setData({
|
|
196
|
-
files: this.data.files,
|
|
197
|
-
//cloudFile:this.data.cloudFile.concat(this.data.files)
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
return { fileID: uploadTask.fileID };
|
|
201
|
-
} catch (e) {
|
|
202
|
-
this.triggerEvent('error', e.detail);
|
|
203
|
-
this.data.files[index].status = 'fail';
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
this.setData({
|
|
207
|
-
files: this.data.files,
|
|
208
|
-
url: this.data.files,
|
|
209
|
-
});
|
|
210
|
-
return { urls: files.tempFiles };
|
|
211
|
-
},
|
|
212
|
-
|
|
213
|
-
onDelete: function (e) {
|
|
214
|
-
if (this.data.urls.length == 0) {
|
|
215
|
-
var storgeUrls = [];
|
|
216
|
-
this.data.cloudFile.forEach((v, index) => {
|
|
217
|
-
if (e.target.dataset.item.cloudPath != v) {
|
|
218
|
-
storgeUrls.push(v);
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
this.setData({
|
|
222
|
-
files: this.data.files.filter(
|
|
223
|
-
(v, index) => e.target.dataset.item.cloudPath !== v.cloudPath
|
|
224
|
-
),
|
|
225
|
-
urls: storgeUrls,
|
|
226
|
-
});
|
|
227
|
-
} else {
|
|
228
|
-
const filelist = this.data.files.filter(
|
|
229
|
-
(item) => e.target.dataset.item?.path != item?.path
|
|
230
|
-
);
|
|
231
|
-
this.setData({
|
|
232
|
-
files: filelist,
|
|
233
|
-
urls: this.data.urls.filter(
|
|
234
|
-
(v, index) => e.target.dataset.item?.cloudPath != v
|
|
235
|
-
),
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
reload: function (e) {
|
|
240
|
-
this.handleUpload(e.target.dataset.item);
|
|
241
|
-
},
|
|
242
|
-
downloadFile: async function (e) {
|
|
243
|
-
const fileSrc = await getTempFileURL(e.target.dataset.item?.cloudPath);
|
|
244
|
-
wx.downloadFile({
|
|
245
|
-
url: fileSrc,
|
|
246
|
-
success(res) {
|
|
247
|
-
// 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
|
|
248
|
-
if (res.statusCode === 200) {
|
|
249
|
-
wx.showToast({
|
|
250
|
-
title: `下载成功`,
|
|
251
|
-
icon: 'none',
|
|
252
|
-
duration: 2000,
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
});
|
|
257
|
-
},
|
|
258
|
-
},
|
|
259
|
-
observers: {
|
|
260
|
-
defaultValue: async function (value) {
|
|
261
|
-
//当单图片上传且默认值为空数组时,初次渲染更新value,以避免空串提交类型不匹配问题
|
|
262
|
-
if (Array.isArray(value) && !this.data.singleFlag) {
|
|
263
|
-
this.setData({
|
|
264
|
-
urls: value,
|
|
265
|
-
});
|
|
266
|
-
this.data.singleFlag = true;
|
|
267
|
-
}
|
|
268
|
-
let httpFiles = [];
|
|
269
|
-
if (value && JSON.stringify(value) != '[]') {
|
|
270
|
-
for (let f of value) {
|
|
271
|
-
const hf = await getTempFileURL(f);
|
|
272
|
-
const uuidReg = /[0-9a-f]{8}([0-9a-f]{4}){3}[0-9a-f]{12}-/;
|
|
273
|
-
const lastIndex = String(hf).lastIndexOf('/');
|
|
274
|
-
const name = String(hf).slice(lastIndex + 1);
|
|
275
|
-
const label = name.replace(uuidReg, '');
|
|
276
|
-
const httpFile = {
|
|
277
|
-
name: label,
|
|
278
|
-
cloudPath: f,
|
|
279
|
-
filePath: hf,
|
|
280
|
-
path: hf,
|
|
281
|
-
status: 'success',
|
|
282
|
-
};
|
|
283
|
-
httpFiles.push(httpFile);
|
|
284
|
-
}
|
|
285
|
-
this.setData({
|
|
286
|
-
files: httpFiles,
|
|
287
|
-
cloudFile:
|
|
288
|
-
JSON.stringify(value) != JSON.stringify(this.data.cloudFile)
|
|
289
|
-
? value
|
|
290
|
-
: [],
|
|
291
|
-
});
|
|
292
|
-
} else {
|
|
293
|
-
this.setData({
|
|
294
|
-
files: [],
|
|
295
|
-
cloudFile: [],
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
'maxUploadCount, single': function (maxUploadCount, single) {
|
|
300
|
-
const maxCount = single ? 1 : maxUploadCount;
|
|
301
|
-
this.setData({
|
|
302
|
-
maxCount,
|
|
303
|
-
});
|
|
304
|
-
},
|
|
305
|
-
urls: function (urls) {
|
|
306
|
-
let value = urls;
|
|
307
|
-
if (this.properties.single) {
|
|
308
|
-
value = urls[0] ?? '';
|
|
309
|
-
}
|
|
310
|
-
this.triggerEvent('change', { value });
|
|
311
|
-
},
|
|
312
|
-
},
|
|
313
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
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
|
-
</view>
|
|
35
|
-
</view>
|
|
36
|
-
<view class="weda-uploader-files__btn-group">
|
|
37
|
-
<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>
|
|
38
|
-
<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>
|
|
39
|
-
<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>
|
|
40
|
-
</view>
|
|
41
|
-
</view>
|
|
42
|
-
</block>
|
|
43
|
-
</view>
|
|
44
|
-
</view>
|
|
45
|
-
</view>
|