@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,567 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/jsx-key */
|
|
2
|
-
import React, { useState, useEffect } from 'react';
|
|
3
|
-
import { usePlatform } from '../../utils/platform';
|
|
4
|
-
import classNames from '../../utils/classnames';
|
|
5
|
-
import './index.css';
|
|
6
|
-
import type { CommonPropsType } from '../../types';
|
|
7
|
-
import { ConfigProvider } from 'tea-component';
|
|
8
|
-
import LotteryAction from './lotteryUtil';
|
|
9
|
-
|
|
10
|
-
const CLASS_PREFIX = 'weda-lottery';
|
|
11
|
-
const lotteryAction = new LotteryAction();
|
|
12
|
-
export default function Lottery({
|
|
13
|
-
className,
|
|
14
|
-
id,
|
|
15
|
-
style,
|
|
16
|
-
prizeList,
|
|
17
|
-
enablePrize,
|
|
18
|
-
prizeResult,
|
|
19
|
-
events,
|
|
20
|
-
}: PropsType) {
|
|
21
|
-
const platform = usePlatform();
|
|
22
|
-
const [activedId, setActivedId] = useState(-1);
|
|
23
|
-
const [isStartLottery, setIsStartLottery] = useState(false);
|
|
24
|
-
const [lotteryList, setLotteryList] = useState([]);
|
|
25
|
-
const [btnActived, setBtnActived] = useState(false);
|
|
26
|
-
|
|
27
|
-
//获取初始化默认数据,数据不足8条设置默认,超过8条获取前8条
|
|
28
|
-
const lotteryListDefault = () => {
|
|
29
|
-
let list = [];
|
|
30
|
-
if (prizeList == null) {
|
|
31
|
-
return list;
|
|
32
|
-
}
|
|
33
|
-
for (let i = 0; i < 8; i++) {
|
|
34
|
-
if (i < prizeList.length) {
|
|
35
|
-
let prize = prizeList[i];
|
|
36
|
-
list.push({
|
|
37
|
-
idx: i + 1,
|
|
38
|
-
selected: false,
|
|
39
|
-
desc: prize.title,
|
|
40
|
-
src: prize.image,
|
|
41
|
-
});
|
|
42
|
-
} else {
|
|
43
|
-
list.push({
|
|
44
|
-
idx: i + 1,
|
|
45
|
-
selected: false,
|
|
46
|
-
desc: '',
|
|
47
|
-
src: '',
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return list;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const startLottery = () => {
|
|
55
|
-
setLotteryList(lotteryListDefault());
|
|
56
|
-
setBtnActived(true);
|
|
57
|
-
if (lotteryAction.isStart) return;
|
|
58
|
-
events?.clickLotteryButton();
|
|
59
|
-
setIsStartLottery(true);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
useEffect(() => {
|
|
63
|
-
setLotteryList(lotteryListDefault());
|
|
64
|
-
}, [prizeList]);
|
|
65
|
-
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
lotteryAction.animationCallback = ({ idx, isEnd }) => {
|
|
68
|
-
setActivedId(idx == -1 ? 0 : idx);
|
|
69
|
-
if (isEnd) {
|
|
70
|
-
setBtnActived(false);
|
|
71
|
-
let list = lotteryList.map((item, index) => {
|
|
72
|
-
if (index === idx - 1) {
|
|
73
|
-
item.selected = true;
|
|
74
|
-
} else {
|
|
75
|
-
item.selected = false;
|
|
76
|
-
}
|
|
77
|
-
return item;
|
|
78
|
-
});
|
|
79
|
-
setLotteryList(list);
|
|
80
|
-
setActivedId(-1);
|
|
81
|
-
setTimeout(() => {
|
|
82
|
-
events.finishLottery({
|
|
83
|
-
prize: idx,
|
|
84
|
-
result: list[idx - 1],
|
|
85
|
-
});
|
|
86
|
-
//延迟700毫秒显示的视觉效果更好,否则看不清结果就弹出dialog盖住了
|
|
87
|
-
}, 700);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
}, [lotteryList]);
|
|
91
|
-
|
|
92
|
-
useEffect(() => {
|
|
93
|
-
// 当满足开启抽奖条件并且点击了开奖开关时,启用抽奖
|
|
94
|
-
if (enablePrize && isStartLottery) {
|
|
95
|
-
lotteryAction.start(prizeResult, () => {
|
|
96
|
-
window.app.showToast({
|
|
97
|
-
title: '网络异常',
|
|
98
|
-
icon: 'none',
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
// 当不选取变量作为结果的时候,按照设置给定结果
|
|
102
|
-
lotteryAction.end(prizeResult);
|
|
103
|
-
setIsStartLottery(false);
|
|
104
|
-
} else if (!enablePrize) {
|
|
105
|
-
//立马停止抽奖
|
|
106
|
-
lotteryAction.stop();
|
|
107
|
-
}
|
|
108
|
-
}, [isStartLottery, enablePrize]);
|
|
109
|
-
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
// 设置抽奖结果
|
|
112
|
-
lotteryAction.end(prizeResult);
|
|
113
|
-
}, [prizeResult]);
|
|
114
|
-
|
|
115
|
-
const [widthRatio, setWidthRatio] = useState(1);
|
|
116
|
-
const [heightRatio, setHeightRatio] = useState(1);
|
|
117
|
-
|
|
118
|
-
// 上下5个球的宽度
|
|
119
|
-
const [dotWidth, setDotWidth] = useState(217 / 14);
|
|
120
|
-
// 左右5个球的高度
|
|
121
|
-
const [dotHeight, setDotHeight] = useState(217 / 14);
|
|
122
|
-
|
|
123
|
-
const standardWidth = 326;
|
|
124
|
-
const standardHeight = 326;
|
|
125
|
-
|
|
126
|
-
const cls = classNames({
|
|
127
|
-
[CLASS_PREFIX]: true,
|
|
128
|
-
[className]: className,
|
|
129
|
-
[`${CLASS_PREFIX}-mobile`]: platform === 'h5',
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
// 将获取的style 转化为 px, 用户输入的单位可能有(纯数字,px, rem, %, rpx)
|
|
133
|
-
// 注: 前端输入宽高,不带单位和带rem单位,code 中获取的都是rem 单位,也就是输入1304,输出‘46.5714rem’; 输入‘1304rem’, 输出‘1304rem’, 所以rem目前不支持正常的比列
|
|
134
|
-
// 带上px单位和不带单位,输出的都是rem,且转化的值一样的,所以不需要特殊处理,也就是 输入 1304 和 1304px ,前端拿到的都是‘46.5714rem’
|
|
135
|
-
// rpx 是小程序的单位,并且在pc 上加病没作用,所以rpx 不处理
|
|
136
|
-
// % 暂时也不处理,因为不确定用户的百分比是以什么为标准的
|
|
137
|
-
const getStyleUnit = (targetValue: string | number) => {
|
|
138
|
-
if (!targetValue) return -1;
|
|
139
|
-
let value = targetValue.toString();
|
|
140
|
-
|
|
141
|
-
// 获取单位
|
|
142
|
-
const fotData = value.match(/^\d+(?:\.\d+)?([a-zA-Z%]+)?$/);
|
|
143
|
-
let unit = 'rem';
|
|
144
|
-
if (fotData && fotData[1]) {
|
|
145
|
-
unit = fotData[1];
|
|
146
|
-
}
|
|
147
|
-
return unit;
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const getRatio = (value: number, unit: string | number) => {
|
|
151
|
-
let actualValue;
|
|
152
|
-
if (unit.toString() === 'rem') {
|
|
153
|
-
actualValue = value * 14 * 2;
|
|
154
|
-
}
|
|
155
|
-
return actualValue;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
// 通过页面配置拿到用户设置的宽,高,直接获取的宽和高,会被转化为rem, 需要将rem 转为 px. 规则: e/2/14
|
|
159
|
-
// css 输出的px到页面rem, 转化规则为: e/14
|
|
160
|
-
useEffect(() => {
|
|
161
|
-
if (!style || style == undefined || platform === 'h5') {
|
|
162
|
-
setWidthRatio(1);
|
|
163
|
-
setDotWidth(217 / 14);
|
|
164
|
-
setHeightRatio(1);
|
|
165
|
-
setDotHeight(217 / 14);
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
if (style && style !== undefined) {
|
|
169
|
-
// 如果宽和高不存在,则还远吗比例为默认值-1,也就是保持视觉稿默认的宽和高
|
|
170
|
-
if (!style.width) {
|
|
171
|
-
setWidthRatio(1);
|
|
172
|
-
setDotWidth(217 / 14);
|
|
173
|
-
}
|
|
174
|
-
if (!style.height) {
|
|
175
|
-
setHeightRatio(1);
|
|
176
|
-
setDotHeight(217 / 14);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (style.width) {
|
|
180
|
-
// 现将获取的rem 转化为px
|
|
181
|
-
const actualValue = getRatio(
|
|
182
|
-
parseFloat(style.width.toString()),
|
|
183
|
-
getStyleUnit(style.width)
|
|
184
|
-
);
|
|
185
|
-
// setWidthRatio();
|
|
186
|
-
const setValue =
|
|
187
|
-
Math.floor((actualValue / (standardWidth * 2)) * 1000) / 1000;
|
|
188
|
-
setWidthRatio(setValue);
|
|
189
|
-
const dotWidth = (setValue * 43 * 4 + setValue * 9 * 5) / 14;
|
|
190
|
-
setDotWidth(dotWidth);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (style.height) {
|
|
194
|
-
// 现将获取的rem 转化为px
|
|
195
|
-
const actualValue = getRatio(
|
|
196
|
-
parseFloat(style.height.toString()),
|
|
197
|
-
getStyleUnit(style.height)
|
|
198
|
-
);
|
|
199
|
-
const setValue =
|
|
200
|
-
Math.floor((actualValue / (standardHeight * 2)) * 1000) / 1000;
|
|
201
|
-
setHeightRatio(setValue);
|
|
202
|
-
const dotHeight = (setValue * 43 * 4 + setValue * 9 * 5) / 14;
|
|
203
|
-
setDotHeight(dotHeight);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}, [style]);
|
|
207
|
-
|
|
208
|
-
const renderDot = (direction: string, list: string[]) => {
|
|
209
|
-
return (
|
|
210
|
-
<>
|
|
211
|
-
<div
|
|
212
|
-
className={classNames(
|
|
213
|
-
`${CLASS_PREFIX}__dot`,
|
|
214
|
-
`${CLASS_PREFIX}__dot-${direction}`
|
|
215
|
-
)}
|
|
216
|
-
>
|
|
217
|
-
{list.map((item, index) => {
|
|
218
|
-
return (
|
|
219
|
-
<div
|
|
220
|
-
key={index}
|
|
221
|
-
className={`${CLASS_PREFIX}__dot-item`}
|
|
222
|
-
style={{
|
|
223
|
-
width: `${(9 * widthRatio) / 14}rem`,
|
|
224
|
-
height: `${(9 * heightRatio) / 14}rem`,
|
|
225
|
-
marginBottom:
|
|
226
|
-
`${direction}` === 'vertical'
|
|
227
|
-
? `${(43 * heightRatio) / 14}rem`
|
|
228
|
-
: '0',
|
|
229
|
-
marginRight:
|
|
230
|
-
`${direction}` === 'horizontal'
|
|
231
|
-
? `${(43 * widthRatio) / 14}rem`
|
|
232
|
-
: '0',
|
|
233
|
-
}}
|
|
234
|
-
></div>
|
|
235
|
-
);
|
|
236
|
-
})}
|
|
237
|
-
</div>
|
|
238
|
-
</>
|
|
239
|
-
);
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
const dotList = [
|
|
243
|
-
{
|
|
244
|
-
single: true,
|
|
245
|
-
position: 'left-top',
|
|
246
|
-
direction: '',
|
|
247
|
-
list: [],
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
single: true,
|
|
251
|
-
position: 'left-bottom',
|
|
252
|
-
direction: '',
|
|
253
|
-
list: [],
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
single: true,
|
|
257
|
-
position: 'right-top',
|
|
258
|
-
direction: '',
|
|
259
|
-
list: [],
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
single: true,
|
|
263
|
-
position: 'right-bottom',
|
|
264
|
-
direction: '',
|
|
265
|
-
list: [],
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
single: false,
|
|
269
|
-
position: 'top',
|
|
270
|
-
direction: 'horizontal',
|
|
271
|
-
list: ['1', '2', '3', '4', '5'],
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
single: false,
|
|
275
|
-
position: 'bottom',
|
|
276
|
-
direction: 'horizontal',
|
|
277
|
-
list: ['1', '2', '3', '4', '5'],
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
single: false,
|
|
281
|
-
position: 'left',
|
|
282
|
-
direction: 'vertical',
|
|
283
|
-
list: ['1', '2', '3', '4', '5'],
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
single: false,
|
|
287
|
-
position: 'right',
|
|
288
|
-
direction: 'vertical',
|
|
289
|
-
list: ['1', '2', '3', '4', '5'],
|
|
290
|
-
},
|
|
291
|
-
];
|
|
292
|
-
|
|
293
|
-
return (
|
|
294
|
-
<ConfigProvider classPrefix="wedatea2td">
|
|
295
|
-
<div className="body" key="lottery" data-testid="lottery">
|
|
296
|
-
<div className={cls} id={id} style={style}>
|
|
297
|
-
<div className={`${CLASS_PREFIX}__wrap`}>
|
|
298
|
-
{dotList.map((dot, index) => {
|
|
299
|
-
return (
|
|
300
|
-
<div key={index}>
|
|
301
|
-
{dot.single && (
|
|
302
|
-
<div
|
|
303
|
-
key={`${dot.direction}-${index}`}
|
|
304
|
-
className={classNames(
|
|
305
|
-
`${CLASS_PREFIX}__dot-single`,
|
|
306
|
-
`${CLASS_PREFIX}__dot-${dot.position}`
|
|
307
|
-
)}
|
|
308
|
-
style={{
|
|
309
|
-
width: `${(9 * widthRatio) / 14}rem`,
|
|
310
|
-
height: `${(9 * heightRatio) / 14}rem`,
|
|
311
|
-
top:
|
|
312
|
-
`${dot.position}` === 'left-top' ||
|
|
313
|
-
`${dot.position}` === 'right-top'
|
|
314
|
-
? `${(9 * heightRatio) / 14}rem`
|
|
315
|
-
: '',
|
|
316
|
-
bottom:
|
|
317
|
-
`${dot.position}` === 'left-bottom' ||
|
|
318
|
-
`${dot.position}` === 'right-bottom'
|
|
319
|
-
? `${(9 * heightRatio) / 14}rem`
|
|
320
|
-
: '',
|
|
321
|
-
left:
|
|
322
|
-
`${dot.position}` === 'left-top' ||
|
|
323
|
-
`${dot.position}` === 'left-bottom'
|
|
324
|
-
? `${(6 * widthRatio) / 14}rem`
|
|
325
|
-
: '',
|
|
326
|
-
right:
|
|
327
|
-
`${dot.position}` === 'right-top' ||
|
|
328
|
-
`${dot.position}` === 'right-bottom'
|
|
329
|
-
? `${(6 * widthRatio) / 14}rem`
|
|
330
|
-
: '',
|
|
331
|
-
}}
|
|
332
|
-
></div>
|
|
333
|
-
)}
|
|
334
|
-
{!dot.single && (
|
|
335
|
-
<div
|
|
336
|
-
key={`${dot.direction}-${index}`}
|
|
337
|
-
className={`${CLASS_PREFIX}__dot-${dot.position}`}
|
|
338
|
-
style={{
|
|
339
|
-
left:
|
|
340
|
-
`${dot.position}` === 'top' ||
|
|
341
|
-
`${dot.position}` === 'bottom'
|
|
342
|
-
? `calc((${'100%'} - ${dotWidth}rem) / 2)`
|
|
343
|
-
: `${dot.position}` === 'left'
|
|
344
|
-
? `${
|
|
345
|
-
(widthRatio * 18 - widthRatio * 9) / 2 / 14
|
|
346
|
-
}rem`
|
|
347
|
-
: '',
|
|
348
|
-
top:
|
|
349
|
-
`${dot.position}` === 'left' ||
|
|
350
|
-
`${dot.position}` === 'right'
|
|
351
|
-
? `calc((100% - ${dotHeight}rem) / 2)`
|
|
352
|
-
: `${dot.position}` === 'top'
|
|
353
|
-
? `${
|
|
354
|
-
(heightRatio * 18 - heightRatio * 9) / 2 / 14
|
|
355
|
-
}rem`
|
|
356
|
-
: '',
|
|
357
|
-
bottom:
|
|
358
|
-
`${dot.position}` === 'bottom'
|
|
359
|
-
? `${
|
|
360
|
-
(heightRatio * 18 - heightRatio * 9) / 2 / 14
|
|
361
|
-
}rem`
|
|
362
|
-
: '',
|
|
363
|
-
right:
|
|
364
|
-
`${dot.position}` === 'right'
|
|
365
|
-
? `${
|
|
366
|
-
(widthRatio * 18 - widthRatio * 9) / 2 / 14
|
|
367
|
-
}rem`
|
|
368
|
-
: '',
|
|
369
|
-
}}
|
|
370
|
-
>
|
|
371
|
-
{true && renderDot(dot.direction, dot.list)}
|
|
372
|
-
</div>
|
|
373
|
-
)}
|
|
374
|
-
</div>
|
|
375
|
-
);
|
|
376
|
-
})}
|
|
377
|
-
<div
|
|
378
|
-
className={`${CLASS_PREFIX}__inner`}
|
|
379
|
-
style={{
|
|
380
|
-
paddingTop: `${(18 * heightRatio) / 14}rem`,
|
|
381
|
-
paddingBottom: `${(18 * heightRatio) / 14}rem`,
|
|
382
|
-
paddingLeft: `${(18 * widthRatio) / 14}rem`,
|
|
383
|
-
paddingRight: `${(18 * widthRatio) / 14}rem`,
|
|
384
|
-
}}
|
|
385
|
-
>
|
|
386
|
-
<div className={`${CLASS_PREFIX}__inner-wrap`}>
|
|
387
|
-
<ul className={`${CLASS_PREFIX}__list`}>
|
|
388
|
-
{lotteryList.map((item, index) => {
|
|
389
|
-
return (
|
|
390
|
-
<li
|
|
391
|
-
data-testid="lottery-item"
|
|
392
|
-
key={index}
|
|
393
|
-
className={classNames(
|
|
394
|
-
`${CLASS_PREFIX}__turntable-item`,
|
|
395
|
-
item.idx === activedId ? 'is-actived' : '',
|
|
396
|
-
item.selected ? 'is-selected' : ''
|
|
397
|
-
)}
|
|
398
|
-
style={{
|
|
399
|
-
width: `calc((${'100%'} - ${
|
|
400
|
-
(widthRatio * 8 * 4) / 14
|
|
401
|
-
}rem) / 3)`,
|
|
402
|
-
height: `calc((${'100%'} - ${
|
|
403
|
-
(heightRatio * 8 * 4) / 14
|
|
404
|
-
}rem) / 3)`,
|
|
405
|
-
top:
|
|
406
|
-
`${index}` == '0' ||
|
|
407
|
-
`${index}` == '1' ||
|
|
408
|
-
`${index}` == '2'
|
|
409
|
-
? `${(heightRatio * 8) / 14}rem`
|
|
410
|
-
: `${index}` == '3'
|
|
411
|
-
? `calc((${'100%'} - ${
|
|
412
|
-
(heightRatio * 8 * 4) / 14
|
|
413
|
-
}rem) / 3 + ${(heightRatio * 8 * 2) / 14}rem)`
|
|
414
|
-
: '',
|
|
415
|
-
bottom:
|
|
416
|
-
`${index}` == '4' ||
|
|
417
|
-
`${index}` == '5' ||
|
|
418
|
-
`${index}` == '6'
|
|
419
|
-
? `${(heightRatio * 8) / 14}rem`
|
|
420
|
-
: `${index}` == '7'
|
|
421
|
-
? `calc((${'100%'} - ${
|
|
422
|
-
(heightRatio * 8 * 4) / 14
|
|
423
|
-
}rem) / 3 + ${(heightRatio * 8 * 2) / 14}rem)`
|
|
424
|
-
: '',
|
|
425
|
-
right:
|
|
426
|
-
`${index}` == '2' ||
|
|
427
|
-
`${index}` == '3' ||
|
|
428
|
-
`${index}` == '4'
|
|
429
|
-
? `${(widthRatio * 8) / 14}rem`
|
|
430
|
-
: '',
|
|
431
|
-
left:
|
|
432
|
-
`${index}` == '0' ||
|
|
433
|
-
`${index}` == '6' ||
|
|
434
|
-
`${index}` == '7'
|
|
435
|
-
? `${(widthRatio * 8) / 14}rem`
|
|
436
|
-
: `${index}` == '1' || `${index}` == '5'
|
|
437
|
-
? `calc((${'100%'} - ${
|
|
438
|
-
(widthRatio * 8 * 4) / 14
|
|
439
|
-
}rem) / 3 + ${(widthRatio * 8 * 2) / 14}rem)`
|
|
440
|
-
: '',
|
|
441
|
-
}}
|
|
442
|
-
>
|
|
443
|
-
<div
|
|
444
|
-
className={`${CLASS_PREFIX}__turntable-cell`}
|
|
445
|
-
style={{
|
|
446
|
-
borderLeftWidth: `${(4 * widthRatio) / 14}rem`,
|
|
447
|
-
borderRightWidth: `${(4 * widthRatio) / 14}rem`,
|
|
448
|
-
borderTopWidth: `${(4 * heightRatio) / 14}rem`,
|
|
449
|
-
borderBottomWidth: `${(4 * heightRatio) / 14}rem`,
|
|
450
|
-
paddingTop: `${(8 * heightRatio) / 14}rem`,
|
|
451
|
-
paddingBottom: `${(8 * heightRatio) / 14}rem`,
|
|
452
|
-
paddingLeft: `${(2 * widthRatio) / 14}rem`,
|
|
453
|
-
paddingRight: `${(2 * widthRatio) / 14}rem`,
|
|
454
|
-
}}
|
|
455
|
-
>
|
|
456
|
-
{item.src && (
|
|
457
|
-
<div
|
|
458
|
-
className={`${CLASS_PREFIX}__turntable-cell-image`}
|
|
459
|
-
style={{
|
|
460
|
-
height: `${(heightRatio * 40) / 14}rem`,
|
|
461
|
-
}}
|
|
462
|
-
>
|
|
463
|
-
<img
|
|
464
|
-
src={item.src}
|
|
465
|
-
alt={item.desc}
|
|
466
|
-
className={`${CLASS_PREFIX}__turntable-cell-icon`}
|
|
467
|
-
style={{
|
|
468
|
-
width: `${(widthRatio * 40) / 14}rem`,
|
|
469
|
-
height: `${(heightRatio * 40) / 14}rem`,
|
|
470
|
-
}}
|
|
471
|
-
/>
|
|
472
|
-
</div>
|
|
473
|
-
)}
|
|
474
|
-
{item.desc && (
|
|
475
|
-
<div
|
|
476
|
-
className={`${CLASS_PREFIX}__turntable-cell-desc`}
|
|
477
|
-
style={{
|
|
478
|
-
marginTop: `${(heightRatio * 6) / 14}rem`,
|
|
479
|
-
fontSize: `${(widthRatio * 12) / 14}rem`,
|
|
480
|
-
lineHeight: `${(heightRatio * 17) / 14}rem`,
|
|
481
|
-
}}
|
|
482
|
-
>
|
|
483
|
-
{item.desc}
|
|
484
|
-
</div>
|
|
485
|
-
)}
|
|
486
|
-
</div>
|
|
487
|
-
</li>
|
|
488
|
-
);
|
|
489
|
-
})}
|
|
490
|
-
</ul>
|
|
491
|
-
<div
|
|
492
|
-
className={classNames(
|
|
493
|
-
`${CLASS_PREFIX}__turntable-btn`,
|
|
494
|
-
btnActived ? 'is-actived' : ''
|
|
495
|
-
)}
|
|
496
|
-
style={{
|
|
497
|
-
width: `calc((${'100%'} - ${
|
|
498
|
-
(widthRatio * 8 * 4) / 14
|
|
499
|
-
}rem) / 3)`,
|
|
500
|
-
height: `calc((${'100%'} - ${
|
|
501
|
-
(heightRatio * 8 * 4) / 14
|
|
502
|
-
}rem) / 3)`,
|
|
503
|
-
top: `calc((${'100%'} - ${
|
|
504
|
-
(heightRatio * 8 * 4) / 14
|
|
505
|
-
}rem) / 3 + ${(heightRatio * 8 * 2) / 14}rem)`,
|
|
506
|
-
left: `calc((${'100%'} - ${
|
|
507
|
-
(heightRatio * 8 * 4) / 14
|
|
508
|
-
}rem) / 3 + ${(heightRatio * 8 * 2) / 14}rem)`,
|
|
509
|
-
}}
|
|
510
|
-
>
|
|
511
|
-
<div
|
|
512
|
-
className={`${CLASS_PREFIX}__btn-inner`}
|
|
513
|
-
style={{
|
|
514
|
-
paddingTop: `${(9 * heightRatio) / 14}rem`,
|
|
515
|
-
paddingBottom: `${(9 * heightRatio) / 14}rem`,
|
|
516
|
-
paddingLeft: `${(9 * widthRatio) / 14}rem`,
|
|
517
|
-
paddingRight: `${(9 * widthRatio) / 14}rem`,
|
|
518
|
-
}}
|
|
519
|
-
>
|
|
520
|
-
<div className={`${CLASS_PREFIX}__btn`}>
|
|
521
|
-
<a
|
|
522
|
-
data-testid="start-lottery"
|
|
523
|
-
className={`${CLASS_PREFIX}__btn-image`}
|
|
524
|
-
style={{
|
|
525
|
-
paddingTop: `${(11 * heightRatio) / 14}rem`,
|
|
526
|
-
paddingBottom: `${(11 * heightRatio) / 14}rem`,
|
|
527
|
-
paddingLeft: `${(15 * widthRatio) / 14}rem`,
|
|
528
|
-
paddingRight: `${(15 * widthRatio) / 14}rem`,
|
|
529
|
-
}}
|
|
530
|
-
onClick={startLottery}
|
|
531
|
-
>
|
|
532
|
-
<p
|
|
533
|
-
className={`${CLASS_PREFIX}__btn-text`}
|
|
534
|
-
style={{
|
|
535
|
-
fontSize: `${(widthRatio * 18) / 14}rem`,
|
|
536
|
-
lineHeight: `${(widthRatio * 22) / 14}rem`,
|
|
537
|
-
}}
|
|
538
|
-
>
|
|
539
|
-
开始抽奖
|
|
540
|
-
</p>
|
|
541
|
-
</a>
|
|
542
|
-
</div>
|
|
543
|
-
</div>
|
|
544
|
-
</div>
|
|
545
|
-
</div>
|
|
546
|
-
</div>
|
|
547
|
-
</div>
|
|
548
|
-
</div>
|
|
549
|
-
</div>
|
|
550
|
-
</ConfigProvider>
|
|
551
|
-
);
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
export interface PropsType extends CommonPropsType {
|
|
555
|
-
/**
|
|
556
|
-
* 奖品列表
|
|
557
|
-
*/
|
|
558
|
-
prizeList: any;
|
|
559
|
-
/**
|
|
560
|
-
* 启动抽奖
|
|
561
|
-
*/
|
|
562
|
-
enablePrize: boolean;
|
|
563
|
-
/**
|
|
564
|
-
* 抽奖结果
|
|
565
|
-
*/
|
|
566
|
-
prizeResult: string;
|
|
567
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
export default class LotteryAction {
|
|
2
|
-
idx: number;
|
|
3
|
-
// 开始抽奖
|
|
4
|
-
isStart: boolean;
|
|
5
|
-
// 结束位置
|
|
6
|
-
endId: any;
|
|
7
|
-
// 抽奖速度
|
|
8
|
-
speed: number;
|
|
9
|
-
// 持续时长
|
|
10
|
-
duration: number;
|
|
11
|
-
maxIdx: number;
|
|
12
|
-
// 回调动作
|
|
13
|
-
animationCallback: ({ idx, isEnd }: { idx: any; isEnd: any }) => void;
|
|
14
|
-
// 是否异常
|
|
15
|
-
isError: boolean;
|
|
16
|
-
// 是否加速
|
|
17
|
-
isSpeedUp: boolean;
|
|
18
|
-
// 超时时间
|
|
19
|
-
timeout: number;
|
|
20
|
-
|
|
21
|
-
timer: any;
|
|
22
|
-
|
|
23
|
-
constructor() {
|
|
24
|
-
// 当前位置
|
|
25
|
-
this.idx = -1;
|
|
26
|
-
// 开始抽奖
|
|
27
|
-
this.isStart = false;
|
|
28
|
-
// 结束位置
|
|
29
|
-
this.endId = undefined;
|
|
30
|
-
// 抽奖速度
|
|
31
|
-
this.speed = 0;
|
|
32
|
-
// 持续时长
|
|
33
|
-
this.duration = 2000;
|
|
34
|
-
// 长度
|
|
35
|
-
this.maxIdx = 8;
|
|
36
|
-
// 回调动作
|
|
37
|
-
this.animationCallback = ({ idx, isEnd }) => {};
|
|
38
|
-
// 是否异常
|
|
39
|
-
this.isError = false;
|
|
40
|
-
// 是否加速
|
|
41
|
-
this.isSpeedUp = false;
|
|
42
|
-
//超时时间
|
|
43
|
-
this.timeout = 6000;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
start(prizeResult, errorCallback) {
|
|
47
|
-
setTimeout(() => {
|
|
48
|
-
this.isStart = false;
|
|
49
|
-
let reg = /^\+?[1-9]\d*$/;
|
|
50
|
-
if (!reg.test(prizeResult)) {
|
|
51
|
-
this.isError = true;
|
|
52
|
-
if (errorCallback) {
|
|
53
|
-
errorCallback();
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}, this.duration);
|
|
57
|
-
// 在转动时长的一半,开始减速转动
|
|
58
|
-
setTimeout(() => {
|
|
59
|
-
this.isSpeedUp = false;
|
|
60
|
-
}, this.duration / 2);
|
|
61
|
-
// 超时,当出现一些意外的情况终止动画
|
|
62
|
-
setTimeout(() => {
|
|
63
|
-
if (this.endId === undefined) {
|
|
64
|
-
this.end(prizeResult);
|
|
65
|
-
}
|
|
66
|
-
}, this.timeout);
|
|
67
|
-
this.isStart = true;
|
|
68
|
-
this.isError = false;
|
|
69
|
-
this.isSpeedUp = true;
|
|
70
|
-
this.loop();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
end(prizeResult) {
|
|
74
|
-
this.endId = prizeResult;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
error() {
|
|
78
|
-
this.isError = true;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
stop() {
|
|
82
|
-
this.isStart = false;
|
|
83
|
-
this.end(-1);
|
|
84
|
-
clearTimeout(this.timer);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
pointOnCubicBezier(cp, t) {
|
|
88
|
-
let x =
|
|
89
|
-
Math.pow(1 - t, 2) * cp[0] +
|
|
90
|
-
2 * t * (1 - t) * cp[1] +
|
|
91
|
-
Math.pow(t, 2) * cp[2];
|
|
92
|
-
return x;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
loop() {
|
|
96
|
-
const { animationCallback } = this;
|
|
97
|
-
this.timer = setTimeout(() => {
|
|
98
|
-
const over = !this.isStart && this.endId !== undefined;
|
|
99
|
-
// emit
|
|
100
|
-
animationCallback({ idx: this.idx, isEnd: false });
|
|
101
|
-
// compare
|
|
102
|
-
if (this.idx < this.maxIdx) {
|
|
103
|
-
this.idx++;
|
|
104
|
-
} else {
|
|
105
|
-
this.idx = 1;
|
|
106
|
-
}
|
|
107
|
-
// continue
|
|
108
|
-
if (!(over && String(this.idx) === String(this.endId)) && !this.isError) {
|
|
109
|
-
if (this.isSpeedUp) {
|
|
110
|
-
const point = this.pointOnCubicBezier([500, 50, 100], 1 / 10);
|
|
111
|
-
this.speed = point;
|
|
112
|
-
if (this.speed < 100) {
|
|
113
|
-
this.speed = 100;
|
|
114
|
-
}
|
|
115
|
-
} else {
|
|
116
|
-
const point = this.pointOnCubicBezier([100, 50, 500], 1 / 10);
|
|
117
|
-
this.speed = point;
|
|
118
|
-
if (this.speed > 1000) {
|
|
119
|
-
this.speed = 1000;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
this.loop();
|
|
123
|
-
} else {
|
|
124
|
-
if (this.isError) return;
|
|
125
|
-
animationCallback({ idx: this.idx, isEnd: true });
|
|
126
|
-
this.idx = -1;
|
|
127
|
-
}
|
|
128
|
-
}, this.speed);
|
|
129
|
-
}
|
|
130
|
-
}
|