@cloudbase/weda-ui 3.1.0 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/dist/asset-manifest.json +17 -0
  2. package/dist/configs/actions/showModal.json +48 -0
  3. package/dist/configs/actions/showToast.json +41 -0
  4. package/dist/configs/components/auth.json +16 -0
  5. package/dist/configs/components/button.json +239 -0
  6. package/dist/configs/components/calendar.json +81 -0
  7. package/dist/configs/components/carousel.json +292 -0
  8. package/dist/configs/components/chart/bar.json +721 -0
  9. package/dist/configs/components/chart/line.json +674 -0
  10. package/dist/configs/components/chart/pie.json +494 -0
  11. package/dist/configs/components/chart/statisticsCard.json +376 -0
  12. package/dist/configs/components/container.json +50 -0
  13. package/dist/configs/components/dataView.json +239 -0
  14. package/dist/configs/components/drawer.json +115 -0
  15. package/dist/configs/components/form/checkbox.json +178 -0
  16. package/dist/configs/components/form/form.json +45 -0
  17. package/dist/configs/components/form/input.json +154 -0
  18. package/dist/configs/components/form/location.json +216 -0
  19. package/dist/configs/components/form/radio.json +203 -0
  20. package/dist/configs/components/form/richText.json +125 -0
  21. package/dist/configs/components/form/select.json +430 -0
  22. package/dist/configs/components/form/switch.json +58 -0
  23. package/dist/configs/components/form/textarea.json +116 -0
  24. package/dist/configs/components/form/tips.json +34 -0
  25. package/dist/configs/components/form/uploader.json +171 -0
  26. package/dist/configs/components/form/uploaderFile.json +158 -0
  27. package/dist/configs/components/graphicCard.json +413 -0
  28. package/dist/configs/components/image.json +187 -0
  29. package/dist/configs/components/link.json +79 -0
  30. package/dist/configs/components/listView.json +370 -0
  31. package/dist/configs/components/lottery.json +163 -0
  32. package/dist/configs/components/modal.json +72 -0
  33. package/dist/configs/components/navLayout.json +368 -0
  34. package/dist/configs/components/navigationBar.json +62 -0
  35. package/dist/configs/components/richtextview.json +26 -0
  36. package/dist/configs/components/scrollVeiw.json +253 -0
  37. package/dist/configs/components/slot.json +17 -0
  38. package/dist/configs/components/swiper.json +90 -0
  39. package/dist/configs/components/tabs.json +121 -0
  40. package/dist/configs/components/text.json +95 -0
  41. package/dist/configs/components/wedaVideo.json +89 -0
  42. package/dist/configs/components/wxOpenApi/phone.json +127 -0
  43. package/dist/configs/components/wxOpenApi/phoneCode.json +109 -0
  44. package/dist/configs/components/wxOpenApi/share.json +157 -0
  45. package/dist/configs/components/wxOpenApi/userInfo.json +156 -0
  46. package/dist/configs/index.d.ts +97 -0
  47. package/dist/configs/index.js +105 -0
  48. package/dist/docs/common/format.d.ts +13 -0
  49. package/dist/docs/common/format.js +103 -0
  50. package/dist/docs/common/tableView.d.ts +30 -0
  51. package/dist/docs/common/tableView.js +159 -0
  52. package/dist/index.d.ts +2 -0
  53. package/dist/index.html +88 -0
  54. package/dist/index.js +3 -0
  55. package/dist/setupTests.d.ts +1 -0
  56. package/dist/setupTests.js +14 -0
  57. package/dist/static/js/bundle.js +963 -0
  58. package/dist/static/js/bundle.js.map +1 -0
  59. package/dist/static/js/main.chunk.js +8841 -0
  60. package/dist/static/js/main.chunk.js.map +1 -0
  61. package/dist/static/js/vendors~main.chunk.js +247885 -0
  62. package/dist/static/js/vendors~main.chunk.js.map +1 -0
  63. package/dist/static/media/ef6fa527e24e354765d806b826b41391.fa67580a.svg +627 -0
  64. package/dist/web/actions/index.d.ts +2 -0
  65. package/dist/web/actions/index.js +2 -0
  66. package/dist/web/actions/showModal/index.d.ts +3 -0
  67. package/dist/web/actions/showModal/index.js +66 -0
  68. package/dist/web/actions/showToast/index.d.ts +1 -0
  69. package/dist/web/actions/showToast/index.js +3 -0
  70. package/dist/web/components/auth/index.d.ts +10 -0
  71. package/dist/web/components/auth/index.js +37 -0
  72. package/dist/web/components/button/index.css +27 -0
  73. package/dist/web/components/button/index.d.ts +32 -0
  74. package/dist/web/components/button/index.js +48 -0
  75. package/dist/web/components/calendar/index.css +416 -0
  76. package/dist/web/components/calendar/index.d.ts +19 -0
  77. package/dist/web/components/calendar/index.js +181 -0
  78. package/dist/web/components/calendar/util.d.ts +13 -0
  79. package/dist/web/components/calendar/util.js +74 -0
  80. package/dist/web/components/carousel/index.css +119 -0
  81. package/dist/web/components/carousel/index.d.ts +41 -0
  82. package/dist/web/components/carousel/index.js +240 -0
  83. package/dist/web/components/chart/bar/index.d.ts +41 -0
  84. package/dist/web/components/chart/bar/index.js +56 -0
  85. package/dist/web/components/chart/common/config/bar.d.ts +48 -0
  86. package/dist/web/components/chart/common/config/bar.js +49 -0
  87. package/dist/web/components/chart/common/config/global.d.ts +13 -0
  88. package/dist/web/components/chart/common/config/global.js +16 -0
  89. package/dist/web/components/chart/common/config/line.d.ts +46 -0
  90. package/dist/web/components/chart/common/config/line.js +49 -0
  91. package/dist/web/components/chart/common/config/pie.d.ts +29 -0
  92. package/dist/web/components/chart/common/config/pie.js +36 -0
  93. package/dist/web/components/chart/common/core/eChartBar.d.ts +68 -0
  94. package/dist/web/components/chart/common/core/eChartBar.js +196 -0
  95. package/dist/web/components/chart/common/core/eChartBase.d.ts +128 -0
  96. package/dist/web/components/chart/common/core/eChartBase.js +346 -0
  97. package/dist/web/components/chart/common/core/eChartLine.d.ts +62 -0
  98. package/dist/web/components/chart/common/core/eChartLine.js +168 -0
  99. package/dist/web/components/chart/common/core/eChartPie.d.ts +50 -0
  100. package/dist/web/components/chart/common/core/eChartPie.js +132 -0
  101. package/dist/web/components/chart/common/core/type.d.ts +35 -0
  102. package/dist/web/components/chart/common/core/type.js +9 -0
  103. package/dist/web/components/chart/common/echarts.d.ts +2 -0
  104. package/dist/web/components/chart/common/echarts.js +24 -0
  105. package/dist/web/components/chart/common/useChart.d.ts +8 -0
  106. package/dist/web/components/chart/common/useChart.js +60 -0
  107. package/dist/web/components/chart/line/index.d.ts +39 -0
  108. package/dist/web/components/chart/line/index.js +53 -0
  109. package/dist/web/components/chart/pie/index.d.ts +27 -0
  110. package/dist/web/components/chart/pie/index.js +40 -0
  111. package/dist/web/components/chart/statisticsCard/index.css +63 -0
  112. package/dist/web/components/chart/statisticsCard/index.d.ts +85 -0
  113. package/dist/web/components/chart/statisticsCard/index.js +203 -0
  114. package/dist/web/components/chart/statisticsCard/interface.d.ts +13 -0
  115. package/dist/web/components/chart/statisticsCard/interface.js +1 -0
  116. package/dist/web/components/container/index.d.ts +6 -0
  117. package/dist/web/components/container/index.js +6 -0
  118. package/dist/web/components/dataView/index.d.ts +6 -0
  119. package/dist/web/components/dataView/index.js +8 -0
  120. package/dist/web/components/dataView/interface.d.ts +5 -0
  121. package/dist/web/components/dataView/interface.js +1 -0
  122. package/dist/web/components/drawer/index.d.ts +13 -0
  123. package/dist/web/components/drawer/index.js +12 -0
  124. package/dist/web/components/form/checkbox/index.d.ts +13 -0
  125. package/dist/web/components/form/checkbox/index.js +167 -0
  126. package/dist/web/components/form/enumSelect/MultipleSelect.d.ts +78 -0
  127. package/dist/web/components/form/enumSelect/MultipleSelect.js +52 -0
  128. package/dist/web/components/form/enumSelect/NormalSelect.d.ts +83 -0
  129. package/dist/web/components/form/enumSelect/NormalSelect.js +52 -0
  130. package/dist/web/components/form/enumSelect/SelectContainer.d.ts +16 -0
  131. package/dist/web/components/form/enumSelect/SelectContainer.js +30 -0
  132. package/dist/web/components/form/enumSelect/index.d.ts +82 -0
  133. package/dist/web/components/form/enumSelect/index.js +6 -0
  134. package/dist/web/components/form/enumSelect/props/defaultProps.d.ts +34 -0
  135. package/dist/web/components/form/enumSelect/props/defaultProps.js +40 -0
  136. package/dist/web/components/form/enumSelect/props/propsTypes.d.ts +39 -0
  137. package/dist/web/components/form/enumSelect/props/propsTypes.js +47 -0
  138. package/dist/web/components/form/form/index.css +9 -0
  139. package/dist/web/components/form/form/index.d.ts +13 -0
  140. package/dist/web/components/form/form/index.js +31 -0
  141. package/dist/web/components/form/formcell/index.css +85 -0
  142. package/dist/web/components/form/formcell/index.d.ts +8 -0
  143. package/dist/web/components/form/formcell/index.js +40 -0
  144. package/dist/web/components/form/input/index.css +40 -0
  145. package/dist/web/components/form/input/index.d.ts +14 -0
  146. package/dist/web/components/form/input/index.js +86 -0
  147. package/dist/web/components/form/location/common/mapChoose.css +477 -0
  148. package/dist/web/components/form/location/common/mapChoose.d.ts +15 -0
  149. package/dist/web/components/form/location/common/mapChoose.js +435 -0
  150. package/dist/web/components/form/location/common/mapView.d.ts +19 -0
  151. package/dist/web/components/form/location/common/mapView.js +170 -0
  152. package/dist/web/components/form/location/common/propsConfig.d.ts +59 -0
  153. package/dist/web/components/form/location/common/propsConfig.js +50 -0
  154. package/dist/web/components/form/location/common/selectModal.css +45 -0
  155. package/dist/web/components/form/location/common/selectModal.d.ts +21 -0
  156. package/dist/web/components/form/location/common/selectModal.js +44 -0
  157. package/dist/web/components/form/location/common/useLocationInfo.d.ts +36 -0
  158. package/dist/web/components/form/location/common/useLocationInfo.js +104 -0
  159. package/dist/web/components/form/location/components/LocationH5/index.css +100 -0
  160. package/dist/web/components/form/location/components/LocationH5/location.h5.d.ts +8 -0
  161. package/dist/web/components/form/location/components/LocationH5/location.h5.js +323 -0
  162. package/dist/web/components/form/location/components/LocationPC/Header.d.ts +12 -0
  163. package/dist/web/components/form/location/components/LocationPC/Header.js +43 -0
  164. package/dist/web/components/form/location/components/LocationPC/index.css +40 -0
  165. package/dist/web/components/form/location/components/LocationPC/location.PC.d.ts +8 -0
  166. package/dist/web/components/form/location/components/LocationPC/location.PC.js +224 -0
  167. package/dist/web/components/form/location/constants.d.ts +2 -0
  168. package/dist/web/components/form/location/constants.js +3 -0
  169. package/dist/web/components/form/location/index.css +13 -0
  170. package/dist/web/components/form/location/index.d.ts +1 -0
  171. package/dist/web/components/form/location/index.js +17 -0
  172. package/dist/web/components/form/radio/index.css +12 -0
  173. package/dist/web/components/form/radio/index.d.ts +11 -0
  174. package/dist/web/components/form/radio/index.js +115 -0
  175. package/dist/web/components/form/renderDecorator.d.ts +6 -0
  176. package/dist/web/components/form/renderDecorator.js +20 -0
  177. package/dist/web/components/form/select/h5.d.ts +16 -0
  178. package/dist/web/components/form/select/h5.js +504 -0
  179. package/dist/web/components/form/select/index.css +27 -0
  180. package/dist/web/components/form/select/index.d.ts +65 -0
  181. package/dist/web/components/form/select/index.js +301 -0
  182. package/dist/web/components/form/select/region/index.d.ts +6 -0
  183. package/dist/web/components/form/select/region/index.js +147 -0
  184. package/dist/web/components/form/select/time.d.ts +9 -0
  185. package/dist/web/components/form/select/time.js +146 -0
  186. package/dist/web/components/form/select/year.d.ts +7 -0
  187. package/dist/web/components/form/select/year.js +72 -0
  188. package/dist/web/components/form/switch/index.d.ts +6 -0
  189. package/dist/web/components/form/switch/index.js +57 -0
  190. package/dist/web/components/form/textarea/index.css +11 -0
  191. package/dist/web/components/form/textarea/index.d.ts +12 -0
  192. package/dist/web/components/form/textarea/index.js +66 -0
  193. package/dist/web/components/form/tips/index.css +4 -0
  194. package/dist/web/components/form/tips/index.d.ts +8 -0
  195. package/dist/web/components/form/tips/index.js +17 -0
  196. package/dist/web/components/form/uploader/index.css +118 -0
  197. package/dist/web/components/form/uploader/index.d.ts +3 -0
  198. package/dist/web/components/form/uploader/index.js +42 -0
  199. package/dist/web/components/form/uploader/uploader.h5.d.ts +19 -0
  200. package/dist/web/components/form/uploader/uploader.h5.js +201 -0
  201. package/dist/web/components/form/uploader/uploader.pc.d.ts +29 -0
  202. package/dist/web/components/form/uploader/uploader.pc.js +182 -0
  203. package/dist/web/components/form/uploaderFile/index.css +422 -0
  204. package/dist/web/components/form/uploaderFile/index.d.ts +4 -0
  205. package/dist/web/components/form/uploaderFile/index.js +19 -0
  206. package/dist/web/components/form/uploaderFile/uploadFile.h5.d.ts +23 -0
  207. package/dist/web/components/form/uploaderFile/uploadFile.h5.js +315 -0
  208. package/dist/web/components/form/uploaderFile/uploadFile.pc.d.ts +24 -0
  209. package/dist/web/components/form/uploaderFile/uploadFile.pc.js +290 -0
  210. package/dist/web/components/graphicCard/index.css +159 -0
  211. package/dist/web/components/graphicCard/index.d.ts +31 -0
  212. package/dist/web/components/graphicCard/index.js +166 -0
  213. package/dist/web/components/image/image.d.ts +9 -0
  214. package/dist/web/components/image/image.js +119 -0
  215. package/dist/web/components/image/index.css +54 -0
  216. package/dist/web/components/image/index.d.ts +13 -0
  217. package/dist/web/components/image/index.js +91 -0
  218. package/dist/web/components/index.d.ts +47 -0
  219. package/dist/web/components/index.js +94 -0
  220. package/dist/web/components/link/index.css +8 -0
  221. package/dist/web/components/link/index.d.ts +24 -0
  222. package/dist/web/components/link/index.js +71 -0
  223. package/dist/web/components/listView/index.css +143 -0
  224. package/dist/web/components/listView/index.d.ts +7 -0
  225. package/dist/web/components/listView/index.js +262 -0
  226. package/dist/web/components/listView/interface.d.ts +122 -0
  227. package/dist/web/components/listView/interface.js +1 -0
  228. package/dist/web/components/lottery/index.css +359 -0
  229. package/dist/web/components/lottery/index.d.ts +22 -0
  230. package/dist/web/components/lottery/index.js +390 -0
  231. package/dist/web/components/lottery/lotteryUtil.d.ts +23 -0
  232. package/dist/web/components/lottery/lotteryUtil.js +180 -0
  233. package/dist/web/components/modal/h5.css +53 -0
  234. package/dist/web/components/modal/index.d.ts +17 -0
  235. package/dist/web/components/modal/index.js +11 -0
  236. package/dist/web/components/modal/modal.h5.d.ts +4 -0
  237. package/dist/web/components/modal/modal.h5.js +46 -0
  238. package/dist/web/components/modal/modal.pc.d.ts +3 -0
  239. package/dist/web/components/modal/modal.pc.js +31 -0
  240. package/dist/web/components/navLayout/index.css +332 -0
  241. package/dist/web/components/navLayout/index.d.ts +46 -0
  242. package/dist/web/components/navLayout/index.js +116 -0
  243. package/dist/web/components/navigationBar/common.d.ts +15 -0
  244. package/dist/web/components/navigationBar/common.js +127 -0
  245. package/dist/web/components/navigationBar/h5Menu.d.ts +14 -0
  246. package/dist/web/components/navigationBar/h5Menu.js +72 -0
  247. package/dist/web/components/navigationBar/horizontalMenu.d.ts +12 -0
  248. package/dist/web/components/navigationBar/horizontalMenu.js +99 -0
  249. package/dist/web/components/navigationBar/index.css +762 -0
  250. package/dist/web/components/navigationBar/index.d.ts +13 -0
  251. package/dist/web/components/navigationBar/index.js +157 -0
  252. package/dist/web/components/navigationBar/verticalMenu.d.ts +13 -0
  253. package/dist/web/components/navigationBar/verticalMenu.js +38 -0
  254. package/dist/web/components/phone/index.d.ts +18 -0
  255. package/dist/web/components/phone/index.js +4 -0
  256. package/dist/web/components/phoneCode/index.d.ts +18 -0
  257. package/dist/web/components/phoneCode/index.js +4 -0
  258. package/dist/web/components/picker/datePicker.d.ts +10 -0
  259. package/dist/web/components/picker/datePicker.js +31 -0
  260. package/dist/web/components/picker/picker.d.ts +6 -0
  261. package/dist/web/components/picker/picker.js +45 -0
  262. package/dist/web/components/picker/timePicker.d.ts +7 -0
  263. package/dist/web/components/picker/timePicker.js +42 -0
  264. package/dist/web/components/richText/const.d.ts +1 -0
  265. package/dist/web/components/richText/const.js +2 -0
  266. package/dist/web/components/richText/index.css +93 -0
  267. package/dist/web/components/richText/index.d.ts +51 -0
  268. package/dist/web/components/richText/index.js +298 -0
  269. package/dist/web/components/richTextView/index.css +63 -0
  270. package/dist/web/components/richTextView/index.d.ts +7 -0
  271. package/dist/web/components/richTextView/index.js +44 -0
  272. package/dist/web/components/scrollView/index.d.ts +27 -0
  273. package/dist/web/components/scrollView/index.js +95 -0
  274. package/dist/web/components/share/index.d.ts +34 -0
  275. package/dist/web/components/share/index.js +4 -0
  276. package/dist/web/components/slot/index.d.ts +6 -0
  277. package/dist/web/components/slot/index.js +9 -0
  278. package/dist/web/components/swiper/index.css +106 -0
  279. package/dist/web/components/swiper/index.d.ts +24 -0
  280. package/dist/web/components/swiper/index.js +149 -0
  281. package/dist/web/components/tabs/index.css +64 -0
  282. package/dist/web/components/tabs/index.d.ts +13 -0
  283. package/dist/web/components/tabs/index.js +15 -0
  284. package/dist/web/components/tabs/tabs.h5.d.ts +4 -0
  285. package/dist/web/components/tabs/tabs.h5.js +42 -0
  286. package/dist/web/components/tabs/tabs.pc.d.ts +3 -0
  287. package/dist/web/components/tabs/tabs.pc.js +40 -0
  288. package/dist/web/components/text/index.css +26 -0
  289. package/dist/web/components/text/index.d.ts +14 -0
  290. package/dist/web/components/text/index.js +17 -0
  291. package/dist/web/components/uploaderFileView/index.css +11 -0
  292. package/dist/web/components/uploaderFileView/index.d.ts +10 -0
  293. package/dist/web/components/uploaderFileView/index.js +61 -0
  294. package/dist/web/components/uploaderView/index.css +31 -0
  295. package/dist/web/components/uploaderView/index.d.ts +17 -0
  296. package/dist/web/components/uploaderView/index.js +48 -0
  297. package/dist/web/components/userInfo/index.d.ts +26 -0
  298. package/dist/web/components/userInfo/index.js +4 -0
  299. package/dist/web/components/wedaVideo/index.css +42 -0
  300. package/dist/web/components/wedaVideo/index.d.ts +17 -0
  301. package/dist/web/components/wedaVideo/index.js +159 -0
  302. package/dist/web/index.d.ts +8 -0
  303. package/dist/web/index.js +4 -0
  304. package/dist/web/utils/classnames.d.ts +2 -0
  305. package/dist/web/utils/classnames.js +37 -0
  306. package/dist/web/utils/constant.d.ts +23 -0
  307. package/dist/web/utils/constant.js +24 -0
  308. package/dist/web/utils/debounce.d.ts +2 -0
  309. package/dist/web/utils/debounce.js +92 -0
  310. package/dist/web/utils/events.d.ts +1 -0
  311. package/dist/web/utils/events.js +2 -0
  312. package/dist/web/utils/getLocalCounter.d.ts +1 -0
  313. package/dist/web/utils/getLocalCounter.js +4 -0
  314. package/dist/web/utils/isObjectEqual.d.ts +2 -0
  315. package/dist/web/utils/isObjectEqual.js +12 -0
  316. package/dist/web/utils/loading-fallback.d.ts +2 -0
  317. package/dist/web/utils/loading-fallback.js +2 -0
  318. package/dist/web/utils/lodash.d.ts +1 -0
  319. package/dist/web/utils/lodash.js +2 -0
  320. package/dist/web/utils/platform.d.ts +18 -0
  321. package/dist/web/utils/platform.js +191 -0
  322. package/dist/web/utils/tcb.d.ts +23 -0
  323. package/dist/web/utils/tcb.js +82 -0
  324. package/dist/web/utils/tmap.d.ts +3 -0
  325. package/dist/web/utils/tmap.js +21 -0
  326. package/dist/web/utils/useSetState.d.ts +1 -0
  327. package/dist/web/utils/useSetState.js +8 -0
  328. package/dist/web/utils/useSyncValue.d.ts +4 -0
  329. package/dist/web/utils/useSyncValue.js +15 -0
  330. package/dist/web/utils/weui.d.ts +1 -0
  331. package/dist/web/utils/weui.js +2 -0
  332. package/dist/web/weda-ui.css +90 -0
  333. package/package.json +12 -12
@@ -0,0 +1,390 @@
1
+ /* eslint-disable react/jsx-key */
2
+ import React, { useState, useEffect, useCallback, useImperativeHandle, } from 'react';
3
+ import { usePlatform } from '../../utils/platform';
4
+ import classNames from '../../utils/classnames';
5
+ import './index.css';
6
+ import { ConfigProvider } from 'tea-component';
7
+ import LotteryAction from './lotteryUtil';
8
+ const CLASS_PREFIX = 'weda-lottery';
9
+ const lotteryAction = new LotteryAction();
10
+ export default React.forwardRef(function Lottery({ className, id, style, prizeList, enablePrize, prizeResult, events }, ref) {
11
+ const platform = usePlatform();
12
+ const [activedId, setActivedId] = useState(-1);
13
+ const [isStartLottery, setIsStartLottery] = useState(false);
14
+ const [lotteryList, setLotteryList] = useState([]);
15
+ const [btnActived, setBtnActived] = useState(false);
16
+ //获取初始化默认数据,数据不足8条设置默认,超过8条获取前8条
17
+ const lotteryListDefault = () => {
18
+ const list = [];
19
+ if (prizeList == null) {
20
+ return list;
21
+ }
22
+ for (let i = 0; i < 8; i++) {
23
+ if (i < prizeList.length) {
24
+ const prize = prizeList[i];
25
+ list.push({
26
+ idx: i + 1,
27
+ selected: false,
28
+ desc: prize.title,
29
+ src: prize.image,
30
+ });
31
+ }
32
+ else {
33
+ list.push({
34
+ idx: i + 1,
35
+ selected: false,
36
+ desc: '',
37
+ src: '',
38
+ });
39
+ }
40
+ }
41
+ return list;
42
+ };
43
+ const startLottery = useCallback(() => {
44
+ setLotteryList(lotteryListDefault());
45
+ setBtnActived(true);
46
+ if (lotteryAction.isStart)
47
+ return;
48
+ events === null || events === void 0 ? void 0 : events.clickLotteryButton();
49
+ setIsStartLottery(true);
50
+ }, [
51
+ lotteryAction.isStart,
52
+ setIsStartLottery,
53
+ setBtnActived,
54
+ lotteryListDefault,
55
+ setLotteryList,
56
+ ]);
57
+ useImperativeHandle(ref, () => {
58
+ return {
59
+ methods: {
60
+ start: startLottery,
61
+ },
62
+ };
63
+ }, [startLottery]);
64
+ useEffect(() => {
65
+ setLotteryList(lotteryListDefault());
66
+ }, [prizeList]);
67
+ useEffect(() => {
68
+ lotteryAction.animationCallback = ({ idx, isEnd }) => {
69
+ setActivedId(idx == -1 ? 0 : idx);
70
+ if (isEnd) {
71
+ setBtnActived(false);
72
+ const list = lotteryList.map((item, index) => {
73
+ if (index === idx - 1) {
74
+ item.selected = true;
75
+ }
76
+ else {
77
+ item.selected = false;
78
+ }
79
+ return item;
80
+ });
81
+ setLotteryList(list);
82
+ setActivedId(-1);
83
+ setTimeout(() => {
84
+ events.finishLottery({
85
+ prize: idx,
86
+ result: list[idx - 1],
87
+ });
88
+ //延迟700毫秒显示的视觉效果更好,否则看不清结果就弹出dialog盖住了
89
+ }, 700);
90
+ }
91
+ };
92
+ }, [lotteryList]);
93
+ useEffect(() => {
94
+ // 当满足开启抽奖条件并且点击了开奖开关时,启用抽奖
95
+ if (enablePrize && isStartLottery) {
96
+ lotteryAction.start(prizeResult, () => {
97
+ window.app.showToast({
98
+ title: '网络异常',
99
+ icon: 'none',
100
+ });
101
+ });
102
+ // 当不选取变量作为结果的时候,按照设置给定结果
103
+ lotteryAction.end(prizeResult);
104
+ setIsStartLottery(false);
105
+ }
106
+ else if (!enablePrize) {
107
+ //立马停止抽奖
108
+ lotteryAction.stop();
109
+ }
110
+ }, [isStartLottery, enablePrize]);
111
+ useEffect(() => {
112
+ // 设置抽奖结果
113
+ lotteryAction.end(prizeResult);
114
+ }, [prizeResult]);
115
+ const [widthRatio, setWidthRatio] = useState(1);
116
+ const [heightRatio, setHeightRatio] = useState(1);
117
+ // 上下5个球的宽度
118
+ const [dotWidth, setDotWidth] = useState(217 / 14);
119
+ // 左右5个球的高度
120
+ const [dotHeight, setDotHeight] = useState(217 / 14);
121
+ const standardWidth = 326;
122
+ const standardHeight = 326;
123
+ const cls = classNames({
124
+ [CLASS_PREFIX]: true,
125
+ [className]: className,
126
+ [`${CLASS_PREFIX}-mobile`]: platform === 'h5',
127
+ });
128
+ // 将获取的style 转化为 px, 用户输入的单位可能有(纯数字,px, rem, %, rpx)
129
+ // 注: 前端输入宽高,不带单位和带rem单位,code 中获取的都是rem 单位,也就是输入1304,输出‘46.5714rem’; 输入‘1304rem’, 输出‘1304rem’, 所以rem目前不支持正常的比列
130
+ // 带上px单位和不带单位,输出的都是rem,且转化的值一样的,所以不需要特殊处理,也就是 输入 1304 和 1304px ,前端拿到的都是‘46.5714rem’
131
+ // rpx 是小程序的单位,并且在pc 上加病没作用,所以rpx 不处理
132
+ // % 暂时也不处理,因为不确定用户的百分比是以什么为标准的
133
+ const getStyleUnit = (targetValue) => {
134
+ if (!targetValue)
135
+ return -1;
136
+ const value = targetValue.toString();
137
+ // 获取单位
138
+ const fotData = value.match(/^\d+(?:\.\d+)?([a-zA-Z%]+)?$/);
139
+ let unit = 'rem';
140
+ if (fotData && fotData[1]) {
141
+ unit = fotData[1];
142
+ }
143
+ return unit;
144
+ };
145
+ const getRatio = (value, unit) => {
146
+ let actualValue;
147
+ if (unit.toString() === 'rem') {
148
+ actualValue = value * 14 * 2;
149
+ }
150
+ return actualValue;
151
+ };
152
+ // 通过页面配置拿到用户设置的宽,高,直接获取的宽和高,会被转化为rem, 需要将rem 转为 px. 规则: e/2/14
153
+ // css 输出的px到页面rem, 转化规则为: e/14
154
+ useEffect(() => {
155
+ if (!style || style == undefined || platform === 'h5') {
156
+ setWidthRatio(1);
157
+ setDotWidth(217 / 14);
158
+ setHeightRatio(1);
159
+ setDotHeight(217 / 14);
160
+ return;
161
+ }
162
+ if (style && style !== undefined) {
163
+ // 如果宽和高不存在,则还远吗比例为默认值-1,也就是保持视觉稿默认的宽和高
164
+ if (!style.width) {
165
+ setWidthRatio(1);
166
+ setDotWidth(217 / 14);
167
+ }
168
+ if (!style.height) {
169
+ setHeightRatio(1);
170
+ setDotHeight(217 / 14);
171
+ }
172
+ if (style.width) {
173
+ // 现将获取的rem 转化为px
174
+ const actualValue = getRatio(parseFloat(style.width.toString()), getStyleUnit(style.width));
175
+ // setWidthRatio();
176
+ const setValue = Math.floor((actualValue / (standardWidth * 2)) * 1000) / 1000;
177
+ setWidthRatio(setValue);
178
+ const dotWidth = (setValue * 43 * 4 + setValue * 9 * 5) / 14;
179
+ setDotWidth(dotWidth);
180
+ }
181
+ if (style.height) {
182
+ // 现将获取的rem 转化为px
183
+ const actualValue = getRatio(parseFloat(style.height.toString()), getStyleUnit(style.height));
184
+ const setValue = Math.floor((actualValue / (standardHeight * 2)) * 1000) / 1000;
185
+ setHeightRatio(setValue);
186
+ const dotHeight = (setValue * 43 * 4 + setValue * 9 * 5) / 14;
187
+ setDotHeight(dotHeight);
188
+ }
189
+ }
190
+ }, [style]);
191
+ const renderDot = (direction, list) => {
192
+ return (React.createElement(React.Fragment, null,
193
+ React.createElement("div", { className: classNames(`${CLASS_PREFIX}__dot`, `${CLASS_PREFIX}__dot-${direction}`) }, list.map((item, index) => {
194
+ return (React.createElement("div", { key: index, className: `${CLASS_PREFIX}__dot-item`, style: {
195
+ width: `${(9 * widthRatio) / 14}rem`,
196
+ height: `${(9 * heightRatio) / 14}rem`,
197
+ marginBottom: `${direction}` === 'vertical'
198
+ ? `${(43 * heightRatio) / 14}rem`
199
+ : '0',
200
+ marginRight: `${direction}` === 'horizontal'
201
+ ? `${(43 * widthRatio) / 14}rem`
202
+ : '0',
203
+ } }));
204
+ }))));
205
+ };
206
+ const dotList = [
207
+ {
208
+ single: true,
209
+ position: 'left-top',
210
+ direction: '',
211
+ list: [],
212
+ },
213
+ {
214
+ single: true,
215
+ position: 'left-bottom',
216
+ direction: '',
217
+ list: [],
218
+ },
219
+ {
220
+ single: true,
221
+ position: 'right-top',
222
+ direction: '',
223
+ list: [],
224
+ },
225
+ {
226
+ single: true,
227
+ position: 'right-bottom',
228
+ direction: '',
229
+ list: [],
230
+ },
231
+ {
232
+ single: false,
233
+ position: 'top',
234
+ direction: 'horizontal',
235
+ list: ['1', '2', '3', '4', '5'],
236
+ },
237
+ {
238
+ single: false,
239
+ position: 'bottom',
240
+ direction: 'horizontal',
241
+ list: ['1', '2', '3', '4', '5'],
242
+ },
243
+ {
244
+ single: false,
245
+ position: 'left',
246
+ direction: 'vertical',
247
+ list: ['1', '2', '3', '4', '5'],
248
+ },
249
+ {
250
+ single: false,
251
+ position: 'right',
252
+ direction: 'vertical',
253
+ list: ['1', '2', '3', '4', '5'],
254
+ },
255
+ ];
256
+ return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
257
+ React.createElement("div", { className: "body", key: "lottery", "data-testid": "lottery" },
258
+ React.createElement("div", { className: cls, id: id, style: style },
259
+ React.createElement("div", { className: `${CLASS_PREFIX}__wrap` },
260
+ dotList.map((dot, index) => {
261
+ return (React.createElement("div", { key: index },
262
+ dot.single && (React.createElement("div", { key: `${dot.direction}-${index}`, className: classNames(`${CLASS_PREFIX}__dot-single`, `${CLASS_PREFIX}__dot-${dot.position}`), style: {
263
+ width: `${(9 * widthRatio) / 14}rem`,
264
+ height: `${(9 * heightRatio) / 14}rem`,
265
+ top: `${dot.position}` === 'left-top' ||
266
+ `${dot.position}` === 'right-top'
267
+ ? `${(9 * heightRatio) / 14}rem`
268
+ : '',
269
+ bottom: `${dot.position}` === 'left-bottom' ||
270
+ `${dot.position}` === 'right-bottom'
271
+ ? `${(9 * heightRatio) / 14}rem`
272
+ : '',
273
+ left: `${dot.position}` === 'left-top' ||
274
+ `${dot.position}` === 'left-bottom'
275
+ ? `${(6 * widthRatio) / 14}rem`
276
+ : '',
277
+ right: `${dot.position}` === 'right-top' ||
278
+ `${dot.position}` === 'right-bottom'
279
+ ? `${(6 * widthRatio) / 14}rem`
280
+ : '',
281
+ } })),
282
+ !dot.single && (React.createElement("div", { key: `${dot.direction}-${index}`, className: `${CLASS_PREFIX}__dot-${dot.position}`, style: {
283
+ left: `${dot.position}` === 'top' ||
284
+ `${dot.position}` === 'bottom'
285
+ ? `calc((${'100%'} - ${dotWidth}rem) / 2)`
286
+ : `${dot.position}` === 'left'
287
+ ? `${(widthRatio * 18 - widthRatio * 9) / 2 / 14}rem`
288
+ : '',
289
+ top: `${dot.position}` === 'left' ||
290
+ `${dot.position}` === 'right'
291
+ ? `calc((100% - ${dotHeight}rem) / 2)`
292
+ : `${dot.position}` === 'top'
293
+ ? `${(heightRatio * 18 - heightRatio * 9) / 2 / 14}rem`
294
+ : '',
295
+ bottom: `${dot.position}` === 'bottom'
296
+ ? `${(heightRatio * 18 - heightRatio * 9) / 2 / 14}rem`
297
+ : '',
298
+ right: `${dot.position}` === 'right'
299
+ ? `${(widthRatio * 18 - widthRatio * 9) / 2 / 14}rem`
300
+ : '',
301
+ } }, true && renderDot(dot.direction, dot.list)))));
302
+ }),
303
+ React.createElement("div", { className: `${CLASS_PREFIX}__inner`, style: {
304
+ paddingTop: `${(18 * heightRatio) / 14}rem`,
305
+ paddingBottom: `${(18 * heightRatio) / 14}rem`,
306
+ paddingLeft: `${(18 * widthRatio) / 14}rem`,
307
+ paddingRight: `${(18 * widthRatio) / 14}rem`,
308
+ } },
309
+ React.createElement("div", { className: `${CLASS_PREFIX}__inner-wrap` },
310
+ React.createElement("ul", { className: `${CLASS_PREFIX}__list` }, lotteryList.map((item, index) => {
311
+ return (React.createElement("li", { "data-testid": "lottery-item", key: index, className: classNames(`${CLASS_PREFIX}__turntable-item`, item.idx === activedId ? 'is-actived' : '', item.selected ? 'is-selected' : ''), style: {
312
+ width: `calc((${'100%'} - ${(widthRatio * 8 * 4) / 14}rem) / 3)`,
313
+ height: `calc((${'100%'} - ${(heightRatio * 8 * 4) / 14}rem) / 3)`,
314
+ top: `${index}` == '0' ||
315
+ `${index}` == '1' ||
316
+ `${index}` == '2'
317
+ ? `${(heightRatio * 8) / 14}rem`
318
+ : `${index}` == '3'
319
+ ? `calc((${'100%'} - ${(heightRatio * 8 * 4) / 14}rem) / 3 + ${(heightRatio * 8 * 2) / 14}rem)`
320
+ : '',
321
+ bottom: `${index}` == '4' ||
322
+ `${index}` == '5' ||
323
+ `${index}` == '6'
324
+ ? `${(heightRatio * 8) / 14}rem`
325
+ : `${index}` == '7'
326
+ ? `calc((${'100%'} - ${(heightRatio * 8 * 4) / 14}rem) / 3 + ${(heightRatio * 8 * 2) / 14}rem)`
327
+ : '',
328
+ right: `${index}` == '2' ||
329
+ `${index}` == '3' ||
330
+ `${index}` == '4'
331
+ ? `${(widthRatio * 8) / 14}rem`
332
+ : '',
333
+ left: `${index}` == '0' ||
334
+ `${index}` == '6' ||
335
+ `${index}` == '7'
336
+ ? `${(widthRatio * 8) / 14}rem`
337
+ : `${index}` == '1' || `${index}` == '5'
338
+ ? `calc((${'100%'} - ${(widthRatio * 8 * 4) / 14}rem) / 3 + ${(widthRatio * 8 * 2) / 14}rem)`
339
+ : '',
340
+ } },
341
+ React.createElement("div", { className: `${CLASS_PREFIX}__turntable-cell`, style: {
342
+ borderLeftWidth: `${(4 * widthRatio) / 14}rem`,
343
+ borderRightWidth: `${(4 * widthRatio) / 14}rem`,
344
+ borderTopWidth: `${(4 * heightRatio) / 14}rem`,
345
+ borderBottomWidth: `${(4 * heightRatio) / 14}rem`,
346
+ paddingTop: `${(8 * heightRatio) / 14}rem`,
347
+ paddingBottom: `${(8 * heightRatio) / 14}rem`,
348
+ paddingLeft: `${(2 * widthRatio) / 14}rem`,
349
+ paddingRight: `${(2 * widthRatio) / 14}rem`,
350
+ } },
351
+ item.src && (React.createElement("div", { className: `${CLASS_PREFIX}__turntable-cell-image`, style: {
352
+ height: `${(heightRatio * 40) / 14}rem`,
353
+ } },
354
+ React.createElement("img", { src: item.src, alt: item.desc, className: `${CLASS_PREFIX}__turntable-cell-icon`, style: {
355
+ width: `${(widthRatio * 40) / 14}rem`,
356
+ height: `${(heightRatio * 40) / 14}rem`,
357
+ } }))),
358
+ item.desc && (React.createElement("div", { className: `${CLASS_PREFIX}__turntable-cell-desc`, style: {
359
+ marginTop: `${(heightRatio * 6) / 14}rem`,
360
+ fontSize: `${(widthRatio * 12) / 14}rem`,
361
+ lineHeight: `${(heightRatio * 17) / 14}rem`,
362
+ } }, item.desc)))));
363
+ })),
364
+ React.createElement("div", { className: classNames(`${CLASS_PREFIX}__turntable-btn`, btnActived ? 'is-actived' : ''), style: {
365
+ width: `calc((${'100%'} - ${(widthRatio * 8 * 4) / 14}rem) / 3)`,
366
+ height: `calc((${'100%'} - ${(heightRatio * 8 * 4) / 14}rem) / 3)`,
367
+ top: `calc((${'100%'} - ${(heightRatio * 8 * 4) / 14}rem) / 3 + ${(heightRatio * 8 * 2) / 14}rem)`,
368
+ left: `calc((${'100%'} - ${(heightRatio * 8 * 4) / 14}rem) / 3 + ${(heightRatio * 8 * 2) / 14}rem)`,
369
+ } },
370
+ React.createElement("div", { className: `${CLASS_PREFIX}__btn-inner`, style: {
371
+ paddingTop: `${(9 * heightRatio) / 14}rem`,
372
+ paddingBottom: `${(9 * heightRatio) / 14}rem`,
373
+ paddingLeft: `${(9 * widthRatio) / 14}rem`,
374
+ paddingRight: `${(9 * widthRatio) / 14}rem`,
375
+ } },
376
+ React.createElement("div", { className: `${CLASS_PREFIX}__btn` },
377
+ React.createElement("a", { "data-testid": "start-lottery", className: `${CLASS_PREFIX}__btn-image`, style: {
378
+ paddingTop: `${(11 * heightRatio) / 14}rem`,
379
+ paddingBottom: `${(11 * heightRatio) / 14}rem`,
380
+ paddingLeft: `${(15 * widthRatio) / 14}rem`,
381
+ paddingRight: `${(15 * widthRatio) / 14}rem`,
382
+ }, onClick: startLottery },
383
+ React.createElement("p", { className: `${CLASS_PREFIX}__btn-text`, style: {
384
+ fontSize: `${(widthRatio * 18) / 14}rem`,
385
+ lineHeight: `${(widthRatio * 22) / 14}rem`,
386
+ } },
387
+ "\u5F00\u59CB",
388
+ React.createElement("br", null),
389
+ "\u62BD\u5956"))))))))))));
390
+ });
@@ -0,0 +1,23 @@
1
+ export default class LotteryAction {
2
+ idx: number;
3
+ isStart: boolean;
4
+ endId: any;
5
+ speed: number;
6
+ duration: number;
7
+ maxIdx: number;
8
+ animationCallback: ({ idx, isEnd }: {
9
+ idx: any;
10
+ isEnd: any;
11
+ }) => void;
12
+ isError: boolean;
13
+ isSpeedUp: boolean;
14
+ timeout: number;
15
+ timer: any;
16
+ constructor();
17
+ start(prizeResult: any, errorCallback: any): void;
18
+ end(prizeResult: any): void;
19
+ error(): void;
20
+ stop(): void;
21
+ pointOnCubicBezier(cp: any, t: any): number;
22
+ loop(): void;
23
+ }
@@ -0,0 +1,180 @@
1
+ export default class LotteryAction {
2
+ constructor() {
3
+ Object.defineProperty(this, "idx", {
4
+ enumerable: true,
5
+ configurable: true,
6
+ writable: true,
7
+ value: void 0
8
+ });
9
+ // 开始抽奖
10
+ Object.defineProperty(this, "isStart", {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value: void 0
15
+ });
16
+ // 结束位置
17
+ Object.defineProperty(this, "endId", {
18
+ enumerable: true,
19
+ configurable: true,
20
+ writable: true,
21
+ value: void 0
22
+ });
23
+ // 抽奖速度
24
+ Object.defineProperty(this, "speed", {
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true,
28
+ value: void 0
29
+ });
30
+ // 持续时长
31
+ Object.defineProperty(this, "duration", {
32
+ enumerable: true,
33
+ configurable: true,
34
+ writable: true,
35
+ value: void 0
36
+ });
37
+ Object.defineProperty(this, "maxIdx", {
38
+ enumerable: true,
39
+ configurable: true,
40
+ writable: true,
41
+ value: void 0
42
+ });
43
+ // 回调动作
44
+ Object.defineProperty(this, "animationCallback", {
45
+ enumerable: true,
46
+ configurable: true,
47
+ writable: true,
48
+ value: void 0
49
+ });
50
+ // 是否异常
51
+ Object.defineProperty(this, "isError", {
52
+ enumerable: true,
53
+ configurable: true,
54
+ writable: true,
55
+ value: void 0
56
+ });
57
+ // 是否加速
58
+ Object.defineProperty(this, "isSpeedUp", {
59
+ enumerable: true,
60
+ configurable: true,
61
+ writable: true,
62
+ value: void 0
63
+ });
64
+ // 超时时间
65
+ Object.defineProperty(this, "timeout", {
66
+ enumerable: true,
67
+ configurable: true,
68
+ writable: true,
69
+ value: void 0
70
+ });
71
+ Object.defineProperty(this, "timer", {
72
+ enumerable: true,
73
+ configurable: true,
74
+ writable: true,
75
+ value: void 0
76
+ });
77
+ // 当前位置
78
+ this.idx = -1;
79
+ // 开始抽奖
80
+ this.isStart = false;
81
+ // 结束位置
82
+ this.endId = undefined;
83
+ // 抽奖速度
84
+ this.speed = 0;
85
+ // 持续时长
86
+ this.duration = 2000;
87
+ // 长度
88
+ this.maxIdx = 8;
89
+ // 回调动作
90
+ this.animationCallback = ({ idx, isEnd }) => { };
91
+ // 是否异常
92
+ this.isError = false;
93
+ // 是否加速
94
+ this.isSpeedUp = false;
95
+ //超时时间
96
+ this.timeout = 6000;
97
+ }
98
+ start(prizeResult, errorCallback) {
99
+ setTimeout(() => {
100
+ this.isStart = false;
101
+ const reg = /^\+?[1-9]\d*$/;
102
+ if (!reg.test(prizeResult)) {
103
+ this.isError = true;
104
+ if (errorCallback) {
105
+ errorCallback();
106
+ }
107
+ }
108
+ }, this.duration);
109
+ // 在转动时长的一半,开始减速转动
110
+ setTimeout(() => {
111
+ this.isSpeedUp = false;
112
+ }, this.duration / 2);
113
+ // 超时,当出现一些意外的情况终止动画
114
+ setTimeout(() => {
115
+ if (this.endId === undefined) {
116
+ this.end(prizeResult);
117
+ }
118
+ }, this.timeout);
119
+ this.isStart = true;
120
+ this.isError = false;
121
+ this.isSpeedUp = true;
122
+ this.loop();
123
+ }
124
+ end(prizeResult) {
125
+ this.endId = prizeResult;
126
+ }
127
+ error() {
128
+ this.isError = true;
129
+ }
130
+ stop() {
131
+ this.isStart = false;
132
+ this.end(-1);
133
+ clearTimeout(this.timer);
134
+ }
135
+ pointOnCubicBezier(cp, t) {
136
+ const x = Math.pow(1 - t, 2) * cp[0] +
137
+ 2 * t * (1 - t) * cp[1] +
138
+ Math.pow(t, 2) * cp[2];
139
+ return x;
140
+ }
141
+ loop() {
142
+ const { animationCallback } = this;
143
+ this.timer = setTimeout(() => {
144
+ const over = !this.isStart && this.endId !== undefined;
145
+ // emit
146
+ animationCallback({ idx: this.idx, isEnd: false });
147
+ // compare
148
+ if (this.idx < this.maxIdx) {
149
+ this.idx++;
150
+ }
151
+ else {
152
+ this.idx = 1;
153
+ }
154
+ // continue
155
+ if (!(over && String(this.idx) === String(this.endId)) && !this.isError) {
156
+ if (this.isSpeedUp) {
157
+ const point = this.pointOnCubicBezier([500, 50, 100], 1 / 10);
158
+ this.speed = point;
159
+ if (this.speed < 100) {
160
+ this.speed = 100;
161
+ }
162
+ }
163
+ else {
164
+ const point = this.pointOnCubicBezier([100, 50, 500], 1 / 10);
165
+ this.speed = point;
166
+ if (this.speed > 1000) {
167
+ this.speed = 1000;
168
+ }
169
+ }
170
+ this.loop();
171
+ }
172
+ else {
173
+ if (this.isError)
174
+ return;
175
+ animationCallback({ idx: this.idx, isEnd: true });
176
+ this.idx = -1;
177
+ }
178
+ }, this.speed);
179
+ }
180
+ }
@@ -0,0 +1,53 @@
1
+ .lcap-modal .lcap-modal__mask {
2
+ top: 0;
3
+ left: 0;
4
+ width: 100%;
5
+ height: 100%;
6
+ z-index: 1000;
7
+ position: fixed;
8
+ background: rgba(0, 0, 0, 0.5);
9
+ transition: all 300ms ease-out;
10
+ }
11
+ .lcap-modal .lcap-modal__dialog {
12
+ transform: translateY(100%);
13
+ transition: all 300ms ease-out;
14
+ width: 100%;
15
+ max-height: 90%;
16
+ min-height: 16.78571rem;
17
+ padding: 0.53571rem 0.53571rem 1.78571rem;
18
+ z-index: 2000;
19
+ border-top-left-radius: 0.53571rem;
20
+ border-top-right-radius: 0.53571rem;
21
+ background: white;
22
+ position: fixed;
23
+ left: 0;
24
+ right: 0;
25
+ bottom: 0;
26
+ }
27
+ .lcap-modal .lcap-modal__dialog.enter {
28
+ transform: translateY(0);
29
+ }
30
+ .lcap-modal .lcap-modal__close_btn {
31
+ top: 0.35714rem;
32
+ right: 0.71429rem;
33
+ position: absolute;
34
+ cursor: pointer;
35
+ }
36
+ .lcap-modal .lcap-modal__confirm_btn {
37
+ padding-bottom: constant(safe-area-inset-bottom);
38
+ /* 兼容 iOS < 11.2 */
39
+ padding-bottom: env(safe-area-inset-bottom);
40
+ /* 兼容 iOS >= 11.2 */
41
+ }
42
+
43
+ .lcap-modal .lcap-modal__confirm_btn .lcap-modal__default_btn {
44
+ left: 0;
45
+ color: rgb(255, 255, 255);
46
+ right: 0;
47
+ width: 100%;
48
+ bottom: 0;
49
+ position: fixed;
50
+ background: rgb(50, 129, 248);
51
+ border-width: 0;
52
+ border-radius: 0;
53
+ }
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import { ModalProps } from 'tea-component';
3
+ import type { CommonPropsType, ICompRef } from '../../types';
4
+ export interface PropTypes extends ModalProps, CommonPropsType {
5
+ content: string;
6
+ customButton: React.ReactNode;
7
+ customContent: React.ReactNode;
8
+ isDefaultButton: boolean;
9
+ outerRef: React.Ref<TCompRef>;
10
+ }
11
+ declare type TCompRef = ICompRef<{
12
+ close: () => void;
13
+ open: () => void;
14
+ toggle: () => void;
15
+ }>;
16
+ declare const _default: React.ForwardRefExoticComponent<PropTypes & React.RefAttributes<TCompRef>>;
17
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import { usePlatform } from '../../utils/platform';
3
+ import { ModalPc } from './modal.pc';
4
+ import { ModalH5 } from './modal.h5';
5
+ export default React.forwardRef(function WeDaModal(props, ref) {
6
+ const platform = usePlatform();
7
+ if (platform === 'h5') {
8
+ return React.createElement(ModalH5, { ...props, outerRef: ref });
9
+ }
10
+ return React.createElement(ModalPc, { ...props, outerRef: ref });
11
+ });
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { PropTypes } from '../modal';
3
+ import './h5.css';
4
+ export declare function ModalH5(props: PropTypes): JSX.Element;