@cloudbase/weda-ui 0.2.17 → 2.0.8

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 (269) hide show
  1. package/README.md +3 -0
  2. package/package.json +10 -5
  3. package/src/configs/components/button.json +0 -2
  4. package/src/configs/components/calendar.json +9 -3
  5. package/src/configs/components/carousel.json +18 -9
  6. package/src/configs/components/chart/bar.json +31 -12
  7. package/src/configs/components/chart/line.json +27 -10
  8. package/src/configs/components/chart/pie.json +22 -8
  9. package/src/configs/components/chart/statisticsCard.json +61 -13
  10. package/src/configs/components/container.json +7 -2
  11. package/src/configs/components/dataView.json +31 -11
  12. package/src/configs/components/form/checkbox.json +97 -5
  13. package/src/configs/components/form/radio.json +123 -4
  14. package/src/configs/components/form/select.json +247 -13
  15. package/src/configs/components/graphicCard.json +90 -75
  16. package/src/configs/components/image.json +19 -8
  17. package/src/configs/components/link.json +25 -6
  18. package/src/configs/components/listView.json +83 -27
  19. package/src/configs/components/lottery.json +153 -0
  20. package/src/configs/components/modal.json +37 -5
  21. package/src/configs/components/navLayout.json +97 -79
  22. package/src/configs/components/navigationBar.json +59 -0
  23. package/src/configs/components/richtextview.json +6 -2
  24. package/src/configs/components/scrollVeiw.json +98 -34
  25. package/src/configs/components/swiper.json +22 -10
  26. package/src/configs/components/tabs.json +54 -9
  27. package/src/configs/components/text.json +43 -30
  28. package/src/configs/components/wxOpenApi/phone.json +141 -0
  29. package/src/configs/components/wxOpenApi/phoneCode.json +121 -0
  30. package/src/configs/components/wxOpenApi/share.json +167 -0
  31. package/src/configs/components/wxOpenApi/userInfo.json +174 -0
  32. package/src/configs/index.js +13 -0
  33. package/src/docs/common/format.tsx +112 -0
  34. package/src/docs/common/tableView.css +164 -0
  35. package/src/docs/common/tableView.tsx +273 -0
  36. package/src/docs/compsdocs/chart/Bar.mdx +159 -0
  37. package/src/docs/compsdocs/chart/Line.mdx +100 -0
  38. package/src/docs/compsdocs/chart/Pie.mdx +83 -0
  39. package/src/docs/compsdocs/chart/_category_.json +1 -0
  40. package/src/docs/compsdocs/chart/statisticsCard.mdx +51 -0
  41. package/src/docs/compsdocs/database/DataView.mdx +33 -0
  42. package/src/docs/compsdocs/database/ListView.mdx +33 -0
  43. package/src/docs/compsdocs/database/_category_.json +1 -0
  44. package/src/docs/compsdocs/form/Form.mdx +35 -0
  45. package/src/docs/compsdocs/form/FormCheckbox.mdx +35 -0
  46. package/src/docs/compsdocs/form/FormDate.mdx +30 -0
  47. package/src/docs/compsdocs/form/FormEmail.mdx +30 -0
  48. package/src/docs/compsdocs/form/FormImageUploader.mdx +31 -0
  49. package/src/docs/compsdocs/form/FormInput.mdx +30 -0
  50. package/src/docs/compsdocs/form/FormLocation.mdx +64 -0
  51. package/src/docs/compsdocs/form/FormPhone.mdx +30 -0
  52. package/src/docs/compsdocs/form/FormRadio.mdx +35 -0
  53. package/src/docs/compsdocs/form/FormRegion.mdx +30 -0
  54. package/src/docs/compsdocs/form/FormSelect.mdx +36 -0
  55. package/src/docs/compsdocs/form/FormSwitch.mdx +30 -0
  56. package/src/docs/compsdocs/form/FormTextarea.mdx +30 -0
  57. package/src/docs/compsdocs/form/FormTime.mdx +30 -0
  58. package/src/docs/compsdocs/form/FormUploadFile.mdx +30 -0
  59. package/src/docs/compsdocs/form/FormUrl.mdx +30 -0
  60. package/src/docs/compsdocs/form/_category_.json +1 -0
  61. package/src/docs/compsdocs/grid/Card.mdx +32 -0
  62. package/src/docs/compsdocs/grid/Container.mdx +42 -0
  63. package/src/docs/compsdocs/grid/Footer.mdx +31 -0
  64. package/src/docs/compsdocs/grid/GridLayout.mdx +32 -0
  65. package/src/docs/compsdocs/grid/Header.mdx +31 -0
  66. package/src/docs/compsdocs/grid/Layout.mdx +25 -0
  67. package/src/docs/compsdocs/grid/List.mdx +31 -0
  68. package/src/docs/compsdocs/grid/ScrollView.mdx +37 -0
  69. package/src/docs/compsdocs/grid/Swiper.mdx +58 -0
  70. package/src/docs/compsdocs/grid/_category_.json +1 -0
  71. package/src/docs/compsdocs/media/Icon.mdx +31 -0
  72. package/src/docs/compsdocs/media/Image.mdx +55 -0
  73. package/src/docs/compsdocs/media/_category_.json +1 -0
  74. package/src/docs/compsdocs/model/ModelCreate.mdx +20 -0
  75. package/src/docs/compsdocs/model/ModelDetail.mdx +20 -0
  76. package/src/docs/compsdocs/model/ModelTable.mdx +24 -0
  77. package/src/docs/compsdocs/model/ModelUpdate.mdx +21 -0
  78. package/src/docs/compsdocs/model/PageLayout.mdx +21 -0
  79. package/src/docs/compsdocs/model/_category_.json +1 -0
  80. package/src/docs/compsdocs/navmenu/Classification.mdx +38 -0
  81. package/src/docs/compsdocs/navmenu/NavBar.mdx +43 -0
  82. package/src/docs/compsdocs/navmenu/NavLayout.mdx +30 -0
  83. package/src/docs/compsdocs/navmenu/TabBar.mdx +43 -0
  84. package/src/docs/compsdocs/navmenu/TabBarItem.mdx +29 -0
  85. package/src/docs/compsdocs/navmenu/_category_.json +1 -0
  86. package/src/docs/compsdocs/senior/Lottery.mdx +48 -0
  87. package/src/docs/compsdocs/senior/Modal.mdx +58 -0
  88. package/src/docs/compsdocs/senior/SlotMachine.mdx +52 -0
  89. package/src/docs/compsdocs/senior/_category_.json +1 -0
  90. package/src/docs/compsdocs/show/Calendar.mdx +29 -0
  91. package/src/docs/compsdocs/show/Divider.mdx +31 -0
  92. package/src/docs/compsdocs/show/GraphicCard.mdx +30 -0
  93. package/src/docs/compsdocs/show/Item.mdx +32 -0
  94. package/src/docs/compsdocs/show/ItemList.mdx +47 -0
  95. package/src/docs/compsdocs/show/Media.mdx +25 -0
  96. package/src/docs/compsdocs/show/StatusTip.mdx +25 -0
  97. package/src/docs/compsdocs/show/Swiper.mdx +33 -0
  98. package/src/docs/compsdocs/show/Tabs.mdx +38 -0
  99. package/src/docs/compsdocs/show/_category_.json +1 -0
  100. package/src/docs/compsdocs/show/button.mdx +25 -0
  101. package/src/docs/compsdocs/text/Link.mdx +43 -0
  102. package/src/docs/compsdocs/text/RichTextView.mdx +36 -0
  103. package/src/docs/compsdocs/text/Text.mdx +31 -0
  104. package/src/docs/compsdocs/text/Title.mdx +32 -0
  105. package/src/docs/compsdocs/text/_category_.json +1 -0
  106. package/src/docs/compsdocs/wxOpen/Phone.mdx +60 -0
  107. package/src/docs/compsdocs/wxOpen/Share.mdx +46 -0
  108. package/src/docs/compsdocs/wxOpen/UserInfo.mdx +60 -0
  109. package/src/docs/compsdocs/wxOpen/_category_.json +4 -0
  110. package/src/index.js +2 -0
  111. package/src/mp/components/button/index.js +18 -2
  112. package/src/mp/components/button/index.wxml +7 -4
  113. package/src/mp/components/chart/bar/index.js +6 -2
  114. package/src/mp/components/chart/common/core/eChartBar.js +9 -8
  115. package/src/mp/components/chart/common/core/eChartBase.js +20 -16
  116. package/src/mp/components/chart/common/core/eChartLine.js +6 -5
  117. package/src/mp/components/chart/line/index.js +10 -6
  118. package/src/mp/components/chart/pie/index.js +6 -2
  119. package/src/mp/components/chart/statisticsCard/index.js +33 -6
  120. package/src/mp/components/dataView/index.json +1 -1
  121. package/src/mp/components/form/checkbox/index.js +41 -2
  122. package/src/mp/components/form/checkbox/index.wxml +1 -1
  123. package/src/mp/components/form/form/index.wxml +1 -2
  124. package/src/mp/components/form/formcell/index.wxml +1 -1
  125. package/src/mp/components/form/formcell/index.wxss +17 -0
  126. package/src/mp/components/form/input/index.js +1 -1
  127. package/src/mp/components/form/input/index.wxss +15 -0
  128. package/src/mp/components/form/location/index.js +43 -2
  129. package/src/mp/components/form/location/index.wxss +4 -6
  130. package/src/mp/components/form/radio/index.js +34 -1
  131. package/src/mp/components/form/select/index.js +351 -41
  132. package/src/mp/components/form/select/index.wxml +17 -2
  133. package/src/mp/components/form/select/index.wxss +4 -0
  134. package/src/mp/components/form/select/region/index.js +101 -0
  135. package/src/mp/components/form/textarea/index.js +1 -1
  136. package/src/mp/components/form/textarea/index.wxss +4 -0
  137. package/src/mp/components/form/uploader/index.js +39 -27
  138. package/src/mp/components/form/uploader/index.json +3 -2
  139. package/src/mp/components/form/uploader/index.wxml +11 -7
  140. package/src/mp/components/form/uploader/index.wxss +20 -2
  141. package/src/mp/components/form/uploader/weui-uploader.js +209 -0
  142. package/src/mp/components/form/uploader/weui-uploader.json +7 -0
  143. package/src/mp/components/form/uploader/weui-uploader.wxml +45 -0
  144. package/src/mp/components/form/uploader/weui-uploader.wxss +1 -0
  145. package/src/mp/components/form/uploaderFile/index.js +10 -6
  146. package/src/mp/components/form/uploaderFile/index.wxss +4 -4
  147. package/src/mp/components/image/index.wxss +3 -2
  148. package/src/mp/components/listView/index.js +38 -43
  149. package/src/mp/components/listView/index.wxml +1 -1
  150. package/src/mp/components/listView/index.wxss +5 -0
  151. package/src/mp/components/lottery/index.js +270 -0
  152. package/src/mp/components/{internals/listView → lottery}/index.json +0 -0
  153. package/src/mp/components/lottery/index.wxml +43 -0
  154. package/src/mp/components/lottery/index.wxss +317 -0
  155. package/src/mp/components/navigationBar/index.js +193 -0
  156. package/src/mp/components/navigationBar/index.json +6 -0
  157. package/src/mp/components/navigationBar/index.wxml +88 -0
  158. package/src/mp/components/navigationBar/index.wxss +1257 -0
  159. package/src/mp/components/tabs/index.js +7 -2
  160. package/src/mp/components/tabs/index.wxml +2 -1
  161. package/src/mp/components/text/index.js +0 -25
  162. package/src/mp/components/text/index.wxml +3 -3
  163. package/src/mp/components/wxOpenApi/phone/index.js +117 -0
  164. package/src/mp/components/wxOpenApi/phone/index.json +4 -0
  165. package/src/mp/components/wxOpenApi/phone/index.wxml +15 -0
  166. package/src/mp/components/wxOpenApi/phone/index.wxss +22 -0
  167. package/src/mp/components/wxOpenApi/phoneCode/index.js +89 -0
  168. package/src/mp/components/wxOpenApi/phoneCode/index.json +4 -0
  169. package/src/mp/components/wxOpenApi/phoneCode/index.wxml +15 -0
  170. package/src/mp/components/wxOpenApi/phoneCode/index.wxss +22 -0
  171. package/src/mp/components/wxOpenApi/share/index.js +117 -0
  172. package/src/mp/components/wxOpenApi/share/index.json +4 -0
  173. package/src/mp/components/wxOpenApi/share/index.wxml +15 -0
  174. package/src/mp/components/wxOpenApi/share/index.wxss +22 -0
  175. package/src/mp/components/wxOpenApi/userInfo/index.js +88 -0
  176. package/src/mp/components/wxOpenApi/userInfo/index.json +4 -0
  177. package/src/mp/components/wxOpenApi/userInfo/index.wxml +14 -0
  178. package/src/mp/components/wxOpenApi/userInfo/index.wxss +22 -0
  179. package/src/mp/index.json +7 -1
  180. package/src/mp/style/weda-ui.wxss +16 -0
  181. package/src/mp/utils/constant.js +15 -0
  182. package/src/mp/utils/destr.js +48 -0
  183. package/src/mp/utils/lodash.js +2 -0
  184. package/src/mp/utils/platform.js +10 -0
  185. package/src/mp/utils/tcb.js +44 -0
  186. package/src/web/components/button/index.css +8 -1
  187. package/src/web/components/button/index.tsx +10 -9
  188. package/src/web/components/calendar/index.jsx +1 -1
  189. package/src/web/components/carousel/index.tsx +8 -8
  190. package/src/web/components/chart/bar/index.tsx +40 -39
  191. package/src/web/components/chart/common/config/line.js +1 -1
  192. package/src/web/components/chart/common/core/eChartBar.js +7 -6
  193. package/src/web/components/chart/common/core/eChartBase.ts +20 -16
  194. package/src/web/components/chart/common/core/eChartLine.js +8 -6
  195. package/src/web/components/chart/line/index.tsx +40 -39
  196. package/src/web/components/chart/statisticsCard/index.tsx +29 -8
  197. package/src/web/components/form/checkbox/index.tsx +61 -23
  198. package/src/web/components/form/form/index.css +5 -1
  199. package/src/web/components/form/form/index.tsx +3 -1
  200. package/src/web/components/form/formcell/index.css +22 -1
  201. package/src/web/components/form/formcell/index.tsx +11 -6
  202. package/src/web/components/form/input/index.css +7 -12
  203. package/src/web/components/form/location/components/LocationH5/index.css +4 -7
  204. package/src/web/components/form/location/components/LocationH5/location.h5.jsx +1 -1
  205. package/src/web/components/form/radio/index.tsx +90 -53
  206. package/src/web/components/form/select/h5.tsx +370 -73
  207. package/src/web/components/form/select/index.css +15 -0
  208. package/src/web/components/form/select/index.tsx +392 -145
  209. package/src/web/components/form/select/region/index.ts +122 -31
  210. package/src/web/components/form/select/time.jsx +89 -0
  211. package/src/web/components/form/select/year.tsx +170 -0
  212. package/src/web/components/form/textarea/index.css +4 -0
  213. package/src/web/components/form/textarea/index.tsx +2 -2
  214. package/src/web/components/form/tips/index.css +4 -0
  215. package/src/web/components/form/tips/index.tsx +4 -3
  216. package/src/web/components/form/uploader/index.css +26 -2
  217. package/src/web/components/form/uploader/uploader.h5.tsx +89 -57
  218. package/src/web/components/form/uploader/uploader.pc.tsx +4 -4
  219. package/src/web/components/form/uploaderFile/index.css +2 -4
  220. package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +13 -7
  221. package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +13 -5
  222. package/src/web/components/image/image.tsx +1 -1
  223. package/src/web/components/image/index.css +3 -3
  224. package/src/web/components/image/index.tsx +6 -7
  225. package/src/web/components/index.js +8 -0
  226. package/src/web/components/link/index.tsx +7 -4
  227. package/src/web/components/listView/index.css +4 -0
  228. package/src/web/components/listView/index.tsx +12 -20
  229. package/src/web/components/lottery/index.css +327 -0
  230. package/src/web/components/lottery/index.tsx +567 -0
  231. package/src/web/components/lottery/lotteryUtil.ts +130 -0
  232. package/src/web/components/modal/index.tsx +3 -1
  233. package/src/web/components/navLayout/index.tsx +2 -2
  234. package/src/web/components/navigationBar/chevron-right--double.svg +3 -0
  235. package/src/web/components/navigationBar/common.tsx +198 -0
  236. package/src/web/components/navigationBar/h5Menu.tsx +179 -0
  237. package/src/web/components/navigationBar/horizontalMenu.tsx +200 -0
  238. package/src/web/components/navigationBar/index.css +762 -0
  239. package/src/web/components/navigationBar/index.tsx +230 -0
  240. package/src/web/components/navigationBar/type.d.ts +111 -0
  241. package/src/web/components/navigationBar/verticalMenu.tsx +81 -0
  242. package/src/web/components/phone/index.css +0 -0
  243. package/src/web/components/phone/index.tsx +22 -0
  244. package/src/web/components/phoneCode/index.css +0 -0
  245. package/src/web/components/phoneCode/index.tsx +22 -0
  246. package/src/web/components/picker/timePicker.tsx +2 -2
  247. package/src/web/components/richTextView/index.tsx +3 -5
  248. package/src/web/components/share/index.css +0 -0
  249. package/src/web/components/share/index.tsx +38 -0
  250. package/src/web/components/slot/index.tsx +1 -1
  251. package/src/web/components/tabs/index.tsx +2 -0
  252. package/src/web/components/tabs/tabs.h5.tsx +43 -33
  253. package/src/web/components/tabs/tabs.pc.tsx +23 -10
  254. package/src/web/components/text/index.tsx +12 -20
  255. package/src/web/components/userInfo/index.css +0 -0
  256. package/src/web/components/userInfo/index.tsx +30 -0
  257. package/src/web/utils/{constant.js → constant.ts} +17 -2
  258. package/src/web/utils/lodash.ts +2 -0
  259. package/src/web/utils/platform.js +9 -0
  260. package/src/web/utils/tcb.js +26 -0
  261. package/src/web/weda-ui.css +7 -1
  262. package/src/mp/components/internals/listView/arrow-right-line.svg +0 -3
  263. package/src/mp/components/internals/listView/index.js +0 -286
  264. package/src/mp/components/internals/listView/index.wxml +0 -40
  265. package/src/mp/components/internals/listView/index.wxss +0 -150
  266. package/src/mp/components/internals/listView/more-line.svg +0 -3
  267. package/src/web/components/form/select/region/cities.ts +0 -2410
  268. package/src/web/components/form/select/region/provinces.ts +0 -240
  269. package/src/web/components/form/select/region/regions.ts +0 -20645
@@ -7,6 +7,10 @@ Component({
7
7
  },
8
8
 
9
9
  properties: {
10
+ isMultipleSlot: {
11
+ type: Boolean,
12
+ value: true
13
+ },
10
14
  tabs: { type: Array, value: [] },
11
15
  scrollCellId: {
12
16
  type: String,
@@ -22,7 +26,6 @@ Component({
22
26
  currentIndex: 0,
23
27
  stickyStyle: null,
24
28
  },
25
-
26
29
  methods: {
27
30
  toggle(e) {
28
31
  const { tabs } = this.data;
@@ -30,7 +33,6 @@ Component({
30
33
  this.setData({
31
34
  currentIndex: index,
32
35
  });
33
- this.triggerEvent('change', {id: index, label: tabs[index].title});
34
36
  if (tabs.length > 5) {
35
37
  this.setData({
36
38
  scrollCellId: `cell-${Math.max(index - 2, 0)}`,
@@ -45,6 +47,9 @@ Component({
45
47
  currentIndex: selectedIndex
46
48
  });
47
49
  }
50
+ },
51
+ 'currentIndex, tabs': function(currentIndex, tabs) {
52
+ this.triggerEvent('change', {id: currentIndex, label: tabs[currentIndex].title, value: tabs[currentIndex].value});
48
53
  }
49
54
  }
50
55
  });
@@ -24,6 +24,7 @@
24
24
  </scroll-view>
25
25
 
26
26
  <view class="weda-tabs__panel">
27
- <slot name="panel{{currentIndex + 1}}"></slot>
27
+ <slot wx:if="{{isMultipleSlot}}" name="panel{{currentIndex + 1}}"></slot>
28
+ <slot wx:else name="panel1"></slot>
28
29
  </view>
29
30
  </view>
@@ -11,10 +11,6 @@ Component({
11
11
  type: String,
12
12
  value: '0',
13
13
  },
14
- maxLines: {
15
- type: Number,
16
- value: 2,
17
- },
18
14
  userSelect: {
19
15
  type: Boolean,
20
16
  value: true,
@@ -27,14 +23,6 @@ Component({
27
23
  type: String,
28
24
  value: '',
29
25
  },
30
- textAlign: {
31
- type: String,
32
- value: '',
33
- },
34
- textColor: {
35
- type: String,
36
- value: '',
37
- },
38
26
  style: {
39
27
  type: String,
40
28
  value: '',
@@ -48,18 +36,5 @@ Component({
48
36
  this.setData({ levelName });
49
37
  }
50
38
  },
51
- 'textAlign,textColor': function (textAlign, textColor) {
52
- let style = this.properties.style;
53
- // 添加文本颜色属性
54
- if (textColor !== '') {
55
- style = `${style};color:${textColor}`;
56
- }
57
-
58
- // 添加对齐属性
59
- if (textAlign !== '') {
60
- style = `${style};text-align: ${textAlign}`;
61
- }
62
- this.setData({ style });
63
- },
64
39
  },
65
40
  });
@@ -1,6 +1,6 @@
1
- <text
2
- class="weda-text weda-ui {{className}} {{levelName}}"
1
+ <text
2
+ class="weda-text weda-ui {{className}} {{levelName}}"
3
3
  id="{{id}}"
4
4
  user-select="{{userSelect}}"
5
- style="-webkit-line-clamp:{{maxLines}}; white-space: {{ space ? 'pre-warp' : 'pre-line'}}; {{style}}"
5
+ style="white-space: {{ space ? 'pre-warp' : 'pre-line'}}; {{style}}"
6
6
  >{{text}}</text>
@@ -0,0 +1,117 @@
1
+ import classNames from '../../../utils/classnames';
2
+ import destr from '../../../utils/destr';
3
+
4
+ Component({
5
+ options: {
6
+ virtualHost: true,
7
+ multipleSlots: true,
8
+ },
9
+ properties: {
10
+ className: {
11
+ type: String,
12
+ value: '',
13
+ },
14
+ style: {
15
+ type: String,
16
+ value: '',
17
+ },
18
+ id: {
19
+ type: String,
20
+ value: '',
21
+ },
22
+ text: {
23
+ type: String,
24
+ value: '按钮标题',
25
+ },
26
+ size: {
27
+ type: String,
28
+ value: 'default',
29
+ },
30
+ type: {
31
+ type: String,
32
+ value: 'wechat',
33
+ },
34
+ loading: {
35
+ type: Boolean,
36
+ value: false,
37
+ },
38
+ disabled: {
39
+ type: Boolean,
40
+ value: false,
41
+ },
42
+ formType: {
43
+ type: String,
44
+ },
45
+ openType: {
46
+ type: String,
47
+ value: 'getPhoneNumber',
48
+ },
49
+ },
50
+ data: {
51
+ cls: '',
52
+ },
53
+ methods: {
54
+ async getPhoneNumber(e) {
55
+ if (e?.detail?.errMsg?.includes('fail')) {
56
+ this.triggerEvent('phonefail', e.detail);
57
+ return;
58
+ }
59
+ if (!e?.detail?.code) {
60
+ console.warn(`基础库版本过低,获取手机号失败`);
61
+ this.triggerEvent('phonefail', {
62
+ errMsg: '基础库版本过低,获取手机号失败',
63
+ });
64
+ return;
65
+ }
66
+ const { app } = getApp();
67
+ const callWedaApi = app?.cloud?.callWedaApi;
68
+ if (!callWedaApi) {
69
+ console.warn(`当前环境缺少方法 app.cloud.callWedaApi`);
70
+ this.triggerEvent('phonefail', {
71
+ errMsg: '当前环境缺少方法 app.cloud.callWedaApi,获取手机号失败',
72
+ });
73
+ return;
74
+ }
75
+ const res = await callWedaApi({
76
+ action: 'InvokeComponentWxModule',
77
+ data: {
78
+ WxRemoteMethod: 'GetPhoneNumber',
79
+ Method: 'InvokeComponentWxData',
80
+ ReqBody: JSON.stringify({ code: e?.detail?.code }),
81
+ },
82
+ });
83
+ if (!res?.Data) {
84
+ this.triggerEvent('phonefail', { errMsg: '获取手机号失败' });
85
+ return;
86
+ }
87
+ const parseData = destr(res?.Data) || {};
88
+ const { phone_info } = parseData;
89
+ if (!phone_info) {
90
+ this.triggerEvent('phonefail', { errMsg: '获取手机号失败' });
91
+ return;
92
+ }
93
+ this.triggerEvent('phonesuccess', {
94
+ ...phone_info,
95
+ timestamp: phone_info?.watermark?.timestamp || '',
96
+ });
97
+ },
98
+ },
99
+ observers: {
100
+ 'className,size,type,disabled': function (className, size, type, disabled) {
101
+ const cls = classNames('weda-ui', {
102
+ 'weda-button': true,
103
+ 'weui-btn': true,
104
+ 'weui-btn_mini': size === 'mini',
105
+ 'weui-btn_large': size === 'large',
106
+ 'weui-btn_primary': type === 'primary' || type === 'wechat',
107
+ 'weui-btn_default': type === 'default',
108
+ 'weui-btn_warn': type === 'warn',
109
+ 'weui-btn_wechat': type === 'wechat',
110
+ 'weui-btn_disabled': disabled,
111
+ [className]: className,
112
+ });
113
+
114
+ this.setData({ cls });
115
+ },
116
+ },
117
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "styleIsolation": "shared"
4
+ }
@@ -0,0 +1,15 @@
1
+ <button
2
+ id="{{id}}"
3
+ class="{{cls}}"
4
+ style="{{style}}"
5
+ size="{{size}}"
6
+ loading="{{loading}}"
7
+ disabled="{{disabled}}"
8
+ form-type="{{formType}}"
9
+ open-type="{{openType}}"
10
+ bindgetphonenumber="getPhoneNumber"
11
+ >
12
+ {{text ? text : ''}}
13
+ <slot name="contentSlot" wx:if="{{!text}}" />
14
+ </button>
15
+
@@ -0,0 +1,22 @@
1
+ @import '../../../style/weda-ui.wxss';
2
+
3
+ .weui-btn.weui-btn_primary:not(.weui-btn_disabled):active {
4
+ background-color: var(--weui-TAG-TEXT-BLUE);
5
+ }
6
+
7
+ .weui-btn.weui-btn_primary.weui-btn_wechat:not(.weui-btn_disabled):active {
8
+ background-color: var(--weui-TAG-TEXT-GREEN);
9
+ }
10
+
11
+ .weui-btn.weui-btn_primary.weui-btn_wechat {
12
+ background-color: var(--weui-WECHAT);
13
+ }
14
+
15
+ .weda-ui.weui-btn.weui-btn_large {
16
+ font-size: large;
17
+ display: block;
18
+ padding-left: 14rpx;
19
+ padding-right: 14rpx;
20
+ text-align: center;
21
+ width: 100%;
22
+ }
@@ -0,0 +1,89 @@
1
+ import classNames from '../../../utils/classnames';
2
+
3
+ Component({
4
+ options: {
5
+ virtualHost: true,
6
+ multipleSlots: true,
7
+ },
8
+ properties: {
9
+ className: {
10
+ type: String,
11
+ value: '',
12
+ },
13
+ style: {
14
+ type: String,
15
+ value: '',
16
+ },
17
+ id: {
18
+ type: String,
19
+ value: '',
20
+ },
21
+ text: {
22
+ type: String,
23
+ value: '按钮标题',
24
+ },
25
+ size: {
26
+ type: String,
27
+ value: 'default',
28
+ },
29
+ type: {
30
+ type: String,
31
+ value: 'wechat',
32
+ },
33
+ loading: {
34
+ type: Boolean,
35
+ value: false,
36
+ },
37
+ disabled: {
38
+ type: Boolean,
39
+ value: false,
40
+ },
41
+ formType: {
42
+ type: String,
43
+ },
44
+ openType: {
45
+ type: String,
46
+ value: 'getPhoneNumber',
47
+ },
48
+ },
49
+ data: {
50
+ cls: '',
51
+ },
52
+ methods: {
53
+ async getPhoneCodeNumber(e) {
54
+ if (e?.detail?.errMsg?.includes('fail')) {
55
+ this.triggerEvent('phoneCodeFail', e.detail);
56
+ return;
57
+ }
58
+ if (!e?.detail?.code) {
59
+ console.warn(`基础库版本过低,获取手机号授权令牌失败`);
60
+ this.triggerEvent('phoneCodeFail', {
61
+ errMsg: '基础库版本过低,获取手机号授权令牌失败',
62
+ });
63
+ return;
64
+ }
65
+ const { code } = e.detail;
66
+ this.triggerEvent('phoneCodeSuccess', {
67
+ code,
68
+ });
69
+ },
70
+ },
71
+ observers: {
72
+ 'className,size,type,disabled': function (className, size, type, disabled) {
73
+ const cls = classNames('weda-ui', {
74
+ 'weda-button': true,
75
+ 'weui-btn': true,
76
+ 'weui-btn_mini': size === 'mini',
77
+ 'weui-btn_large': size === 'large',
78
+ 'weui-btn_primary': type === 'primary' || type === 'wechat',
79
+ 'weui-btn_default': type === 'default',
80
+ 'weui-btn_warn': type === 'warn',
81
+ 'weui-btn_wechat': type === 'wechat',
82
+ 'weui-btn_disabled': disabled,
83
+ [className]: className,
84
+ });
85
+
86
+ this.setData({ cls });
87
+ },
88
+ },
89
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "styleIsolation": "shared"
4
+ }
@@ -0,0 +1,15 @@
1
+ <button
2
+ id="{{id}}"
3
+ class="{{cls}}"
4
+ style="{{style}}"
5
+ size="{{size}}"
6
+ loading="{{loading}}"
7
+ disabled="{{disabled}}"
8
+ form-type="{{formType}}"
9
+ open-type="{{openType}}"
10
+ bindgetphonenumber="getPhoneCodeNumber"
11
+ >
12
+ {{text ? text : ''}}
13
+ <slot name="contentSlot" wx:if="{{!text}}" />
14
+ </button>
15
+
@@ -0,0 +1,22 @@
1
+ @import '../../../style/weda-ui.wxss';
2
+
3
+ .weui-btn.weui-btn_primary:not(.weui-btn_disabled):active {
4
+ background-color: var(--weui-TAG-TEXT-BLUE);
5
+ }
6
+
7
+ .weui-btn.weui-btn_primary.weui-btn_wechat:not(.weui-btn_disabled):active {
8
+ background-color: var(--weui-TAG-TEXT-GREEN);
9
+ }
10
+
11
+ .weui-btn.weui-btn_primary.weui-btn_wechat {
12
+ background-color: var(--weui-WECHAT);
13
+ }
14
+
15
+ .weda-ui.weui-btn.weui-btn_large {
16
+ font-size: large;
17
+ display: block;
18
+ padding-left: 14rpx;
19
+ padding-right: 14rpx;
20
+ text-align: center;
21
+ width: 100%;
22
+ }
@@ -0,0 +1,117 @@
1
+ import classNames from '../../../utils/classnames';
2
+ import { getTempFileURL } from '../../../utils/tcb';
3
+
4
+ Component({
5
+ options: {
6
+ virtualHost: true,
7
+ multipleSlots: true,
8
+ },
9
+ properties: {
10
+ className: {
11
+ type: String,
12
+ value: '',
13
+ },
14
+ style: {
15
+ type: String,
16
+ value: '',
17
+ },
18
+ id: {
19
+ type: String,
20
+ value: '',
21
+ },
22
+ text: {
23
+ type: String,
24
+ value: '按钮标题',
25
+ },
26
+ size: {
27
+ type: String,
28
+ value: 'default',
29
+ },
30
+ type: {
31
+ type: String,
32
+ value: 'wechat',
33
+ },
34
+ loading: {
35
+ type: Boolean,
36
+ value: false,
37
+ },
38
+ disabled: {
39
+ type: Boolean,
40
+ value: false,
41
+ },
42
+ formType: {
43
+ type: String,
44
+ },
45
+ openType: {
46
+ type: String,
47
+ value: 'share',
48
+ },
49
+ title: {
50
+ type: String,
51
+ },
52
+ image: {
53
+ type: String,
54
+ },
55
+ path: {
56
+ type: String,
57
+ },
58
+ withParams: {
59
+ type: Boolean,
60
+ value: false,
61
+ },
62
+ params: {
63
+ type: Array,
64
+ value: [],
65
+ },
66
+ },
67
+ data: {
68
+ cls: '',
69
+ shareInfo: {},
70
+ },
71
+ observers: {
72
+ 'className,size,type,disabled': function (className, size, type, disabled) {
73
+ const cls = classNames('weda-ui', {
74
+ 'weda-button': true,
75
+ 'weui-btn': true,
76
+ 'weui-btn_mini': size === 'mini',
77
+ 'weui-btn_large': size === 'large',
78
+ 'weui-btn_primary': type === 'primary' || type === 'wechat',
79
+ 'weui-btn_default': type === 'default',
80
+ 'weui-btn_warn': type === 'warn',
81
+ 'weui-btn_wechat': type === 'wechat',
82
+ 'weui-btn_disabled': disabled,
83
+ [className]: className,
84
+ });
85
+
86
+ this.setData({ cls });
87
+ },
88
+ 'title,image,path,withParams,params': async function (
89
+ title,
90
+ image,
91
+ path,
92
+ withParams,
93
+ params
94
+ ) {
95
+ let urlParams = '';
96
+ if (params && params.length > 0) {
97
+ urlParams = '?';
98
+ params.forEach(function ({ key, value }, index) {
99
+ urlParams += `${key}=${value}`;
100
+ if (params.length != index + 1) {
101
+ urlParams += '&';
102
+ }
103
+ });
104
+ }
105
+ let newImage = '';
106
+ if (/^cloud:\/\//.test(image)) {
107
+ newImage = await getTempFileURL(image);
108
+ }
109
+ const shareInfo = {
110
+ title,
111
+ path: `/pages/${path}/index${withParams ? urlParams : ''}`,
112
+ imageUrl: newImage || image,
113
+ };
114
+ this.setData({ shareInfo });
115
+ },
116
+ },
117
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "styleIsolation": "shared"
4
+ }
@@ -0,0 +1,15 @@
1
+ <button
2
+ id="{{id}}"
3
+ class="{{cls}}"
4
+ style="{{style}}"
5
+ size="{{size}}"
6
+ loading="{{loading}}"
7
+ disabled="{{disabled}}"
8
+ form-type="{{formType}}"
9
+ open-type="{{openType}}"
10
+ data-weda_share_info="{{shareInfo}}"
11
+ >
12
+ {{text ? text : ''}}
13
+ <slot name="contentSlot" wx:if="{{!text}}" />
14
+ </button>
15
+
@@ -0,0 +1,22 @@
1
+ @import '../../../style/weda-ui.wxss';
2
+
3
+ .weui-btn.weui-btn_primary:not(.weui-btn_disabled):active {
4
+ background-color: var(--weui-TAG-TEXT-BLUE);
5
+ }
6
+
7
+ .weui-btn.weui-btn_primary.weui-btn_wechat:not(.weui-btn_disabled):active {
8
+ background-color: var(--weui-TAG-TEXT-GREEN);
9
+ }
10
+
11
+ .weui-btn.weui-btn_primary.weui-btn_wechat {
12
+ background-color: var(--weui-WECHAT);
13
+ }
14
+
15
+ .weda-ui.weui-btn.weui-btn_large {
16
+ font-size: large;
17
+ display: block;
18
+ padding-left: 14rpx;
19
+ padding-right: 14rpx;
20
+ text-align: center;
21
+ width: 100%;
22
+ }
@@ -0,0 +1,88 @@
1
+ import classNames from '../../../utils/classnames';
2
+
3
+ Component({
4
+ options: {
5
+ virtualHost: true,
6
+ multipleSlots: true,
7
+ },
8
+ properties: {
9
+ className: {
10
+ type: String,
11
+ value: '',
12
+ },
13
+ style: {
14
+ type: String,
15
+ value: '',
16
+ },
17
+ id: {
18
+ type: String,
19
+ value: '',
20
+ },
21
+ text: {
22
+ type: String,
23
+ value: '按钮标题',
24
+ },
25
+ size: {
26
+ type: String,
27
+ value: 'default',
28
+ },
29
+ type: {
30
+ type: String,
31
+ value: 'wechat',
32
+ },
33
+ loading: {
34
+ type: Boolean,
35
+ value: false,
36
+ },
37
+ disabled: {
38
+ type: Boolean,
39
+ value: false,
40
+ },
41
+ formType: {
42
+ type: String,
43
+ },
44
+ usage: {
45
+ type: String,
46
+ },
47
+ language: {
48
+ type: String,
49
+ value: 'zh_CN',
50
+ },
51
+ },
52
+ data: {
53
+ cls: '',
54
+ },
55
+ methods: {
56
+ getUserProfile(e) {
57
+ wx.getUserProfile({
58
+ desc: this.properties.usage,
59
+ lang: this.properties.language,
60
+ success: (userRes) => {
61
+ const { userInfo } = userRes;
62
+ this.triggerEvent('userinfosuccess', userInfo || {});
63
+ },
64
+ fail: (err) => {
65
+ this.triggerEvent('userinfofail', err);
66
+ },
67
+ });
68
+ },
69
+ },
70
+ observers: {
71
+ 'className,size,type,disabled': function (className, size, type, disabled) {
72
+ const cls = classNames('weda-ui', {
73
+ 'weda-button': true,
74
+ 'weui-btn': true,
75
+ 'weui-btn_mini': size === 'mini',
76
+ 'weui-btn_large': size === 'large',
77
+ 'weui-btn_primary': type === 'primary' || type === 'wechat',
78
+ 'weui-btn_default': type === 'default',
79
+ 'weui-btn_warn': type === 'warn',
80
+ 'weui-btn_wechat': type === 'wechat',
81
+ 'weui-btn_disabled': disabled,
82
+ [className]: className,
83
+ });
84
+
85
+ this.setData({ cls });
86
+ },
87
+ },
88
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "styleIsolation": "shared"
4
+ }
@@ -0,0 +1,14 @@
1
+ <button
2
+ id="{{id}}"
3
+ class="{{cls}}"
4
+ style="{{style}}"
5
+ size="{{size}}"
6
+ loading="{{loading}}"
7
+ disabled="{{disabled}}"
8
+ form-type="{{formType}}"
9
+ bindtap="getUserProfile"
10
+ >
11
+ {{text ? text : ''}}
12
+ <slot name="contentSlot" wx:if="{{!text}}" />
13
+ </button>
14
+
@@ -0,0 +1,22 @@
1
+ @import '../../../style/weda-ui.wxss';
2
+
3
+ .weui-btn.weui-btn_primary:not(.weui-btn_disabled):active {
4
+ background-color: var(--weui-TAG-TEXT-BLUE);
5
+ }
6
+
7
+ .weui-btn.weui-btn_primary.weui-btn_wechat:not(.weui-btn_disabled):active {
8
+ background-color: var(--weui-TAG-TEXT-GREEN);
9
+ }
10
+
11
+ .weui-btn.weui-btn_primary.weui-btn_wechat {
12
+ background-color: var(--weui-WECHAT);
13
+ }
14
+
15
+ .weda-ui.weui-btn.weui-btn_large {
16
+ font-size: large;
17
+ display: block;
18
+ padding-left: 14rpx;
19
+ padding-right: 14rpx;
20
+ text-align: center;
21
+ width: 100%;
22
+ }