@cloudbase/weda-ui 0.2.15 → 1.0.21

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 (250) hide show
  1. package/README.md +41 -169
  2. package/package.json +28 -15
  3. package/src/configs/components/calendar.json +78 -0
  4. package/src/configs/components/carousel.json +273 -0
  5. package/src/configs/components/chart/bar.json +724 -0
  6. package/src/configs/components/chart/line.json +679 -0
  7. package/src/configs/components/chart/pie.json +497 -0
  8. package/src/configs/components/chart/statisticsCard.json +379 -0
  9. package/src/configs/components/container.json +7 -2
  10. package/src/configs/components/dataView.json +154 -0
  11. package/src/configs/components/form/checkbox.json +97 -5
  12. package/src/configs/components/form/location.json +152 -0
  13. package/src/configs/components/form/radio.json +96 -4
  14. package/src/configs/components/form/select.json +245 -11
  15. package/src/configs/components/form/uploaderFile.json +2 -1
  16. package/src/configs/components/graphicCard.json +410 -0
  17. package/src/configs/components/image.json +7 -2
  18. package/src/configs/components/link.json +20 -4
  19. package/src/configs/components/listView.json +277 -0
  20. package/src/configs/components/modal.json +37 -5
  21. package/src/configs/components/navLayout.json +362 -0
  22. package/src/configs/components/navigationBar.json +59 -0
  23. package/src/configs/components/richtextview.json +4 -1
  24. package/src/configs/components/scrollVeiw.json +74 -22
  25. package/src/configs/components/swiper.json +6 -3
  26. package/src/configs/components/tabs.json +51 -8
  27. package/src/configs/components/text.json +33 -25
  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 +34 -0
  33. package/src/mp/components/button/index.js +12 -13
  34. package/src/mp/components/button/index.wxml +1 -1
  35. package/src/mp/components/calendar/arrowright--line.svg +11 -0
  36. package/src/mp/components/calendar/index.js +238 -0
  37. package/src/mp/components/calendar/index.json +4 -0
  38. package/src/mp/components/calendar/index.wxml +37 -0
  39. package/src/mp/components/calendar/index.wxss +178 -0
  40. package/src/mp/components/carousel/index.js +88 -0
  41. package/src/mp/components/carousel/index.json +7 -0
  42. package/src/mp/components/carousel/index.wxml +6 -0
  43. package/src/mp/components/chart/bar/index.js +258 -0
  44. package/src/mp/components/chart/bar/index.json +6 -0
  45. package/src/mp/components/chart/bar/index.wxml +3 -0
  46. package/src/mp/components/chart/bar/index.wxss +9 -0
  47. package/src/mp/components/chart/common/config/bar.js +50 -0
  48. package/src/mp/components/chart/common/config/global.js +16 -0
  49. package/src/mp/components/chart/common/config/line.js +48 -0
  50. package/src/mp/components/chart/common/config/pie.js +36 -0
  51. package/src/mp/components/chart/common/core/eChartBar.js +263 -0
  52. package/src/mp/components/chart/common/core/eChartBase.js +375 -0
  53. package/src/mp/components/chart/common/core/eChartLine.js +229 -0
  54. package/src/mp/components/chart/common/core/eChartPie.js +166 -0
  55. package/src/mp/components/chart/common/lib/echarts.min.js +18 -0
  56. package/src/mp/components/chart/ec-canvas/ec-canvas.js +277 -0
  57. package/src/mp/components/chart/ec-canvas/ec-canvas.json +4 -0
  58. package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +4 -0
  59. package/src/mp/components/chart/ec-canvas/ec-canvas.wxss +4 -0
  60. package/src/mp/components/chart/ec-canvas/wx-canvas.js +107 -0
  61. package/src/mp/components/chart/line/index.js +247 -0
  62. package/src/mp/components/chart/line/index.json +6 -0
  63. package/src/mp/components/chart/line/index.wxml +3 -0
  64. package/src/mp/components/chart/line/index.wxss +9 -0
  65. package/src/mp/components/chart/pie/index.js +182 -0
  66. package/src/mp/components/chart/pie/index.json +6 -0
  67. package/src/mp/components/chart/pie/index.wxml +4 -0
  68. package/src/mp/components/chart/pie/index.wxss +9 -0
  69. package/src/mp/components/chart/statisticsCard/index.js +253 -0
  70. package/src/mp/components/chart/statisticsCard/index.json +4 -0
  71. package/src/mp/components/chart/statisticsCard/index.wxml +9 -0
  72. package/src/mp/components/chart/statisticsCard/index.wxss +45 -0
  73. package/src/mp/components/dataView/index.js +34 -0
  74. package/src/mp/components/dataView/index.json +7 -0
  75. package/src/mp/components/dataView/index.wxml +15 -0
  76. package/src/mp/components/dataView/index.wxss +0 -0
  77. package/src/mp/components/form/checkbox/index.js +41 -2
  78. package/src/mp/components/form/checkbox/index.wxml +1 -1
  79. package/src/mp/components/form/input/index.js +1 -1
  80. package/src/mp/components/form/location/components/mapChoose/index.js +201 -0
  81. package/src/mp/components/form/location/components/mapChoose/index.json +4 -0
  82. package/src/mp/components/form/location/components/mapChoose/index.wxml +42 -0
  83. package/src/mp/components/form/location/components/mapChoose/index.wxss +188 -0
  84. package/src/mp/components/form/location/index.js +382 -0
  85. package/src/mp/components/form/location/index.json +6 -0
  86. package/src/mp/components/form/location/index.wxml +25 -0
  87. package/src/mp/components/form/location/index.wxss +91 -0
  88. package/src/mp/components/form/radio/index.js +38 -0
  89. package/src/mp/components/form/select/index.js +360 -40
  90. package/src/mp/components/form/select/index.wxml +21 -6
  91. package/src/mp/components/form/select/region/index.js +98 -0
  92. package/src/mp/components/form/textarea/index.wxml +6 -5
  93. package/src/mp/components/form/uploader/index.js +84 -48
  94. package/src/mp/components/form/uploader/index.wxml +15 -3
  95. package/src/mp/components/form/uploaderFile/index.js +106 -27
  96. package/src/mp/components/graphicCard/chevron-right.svg +3 -0
  97. package/src/mp/components/graphicCard/index.js +203 -0
  98. package/src/mp/components/graphicCard/index.json +4 -0
  99. package/src/mp/components/graphicCard/index.wxml +29 -0
  100. package/src/mp/components/graphicCard/index.wxss +157 -0
  101. package/src/mp/components/image/index.js +0 -1
  102. package/src/mp/components/listView/arrow-right-line.svg +3 -0
  103. package/src/mp/components/listView/index.js +285 -0
  104. package/src/mp/components/listView/index.json +4 -0
  105. package/src/mp/components/listView/index.wxml +40 -0
  106. package/src/mp/components/listView/index.wxss +155 -0
  107. package/src/mp/components/listView/more-line.svg +3 -0
  108. package/src/mp/components/navLayout/index.js +123 -0
  109. package/src/mp/components/navLayout/index.json +7 -0
  110. package/src/mp/components/navLayout/index.wxml +25 -0
  111. package/src/mp/components/navLayout/index.wxss +1193 -0
  112. package/src/mp/components/navigationBar/index.js +193 -0
  113. package/src/mp/components/navigationBar/index.json +6 -0
  114. package/src/mp/components/navigationBar/index.wxml +88 -0
  115. package/src/mp/components/navigationBar/index.wxss +1257 -0
  116. package/src/mp/components/swiper/index.wxml +2 -0
  117. package/src/mp/components/tabs/index.js +7 -2
  118. package/src/mp/components/tabs/index.wxml +2 -1
  119. package/src/mp/components/text/index.js +0 -25
  120. package/src/mp/components/text/index.wxml +3 -3
  121. package/src/mp/components/wxOpenApi/phone/index.js +117 -0
  122. package/src/mp/components/wxOpenApi/phone/index.json +4 -0
  123. package/src/mp/components/wxOpenApi/phone/index.wxml +15 -0
  124. package/src/mp/components/wxOpenApi/phone/index.wxss +22 -0
  125. package/src/mp/components/wxOpenApi/phoneCode/index.js +89 -0
  126. package/src/mp/components/wxOpenApi/phoneCode/index.json +4 -0
  127. package/src/mp/components/wxOpenApi/phoneCode/index.wxml +15 -0
  128. package/src/mp/components/wxOpenApi/phoneCode/index.wxss +22 -0
  129. package/src/mp/components/wxOpenApi/share/index.js +117 -0
  130. package/src/mp/components/wxOpenApi/share/index.json +4 -0
  131. package/src/mp/components/wxOpenApi/share/index.wxml +15 -0
  132. package/src/mp/components/wxOpenApi/share/index.wxss +22 -0
  133. package/src/mp/components/wxOpenApi/userInfo/index.js +88 -0
  134. package/src/mp/components/wxOpenApi/userInfo/index.json +4 -0
  135. package/src/mp/components/wxOpenApi/userInfo/index.wxml +14 -0
  136. package/src/mp/components/wxOpenApi/userInfo/index.wxss +22 -0
  137. package/src/mp/index.json +18 -2
  138. package/src/mp/style/weda-ui.wxss +2 -0
  139. package/src/mp/utils/debounce.js +133 -0
  140. package/src/mp/utils/destr.js +48 -0
  141. package/src/mp/utils/dr_square_point.js +25 -0
  142. package/src/mp/utils/platform.js +25 -0
  143. package/src/mp/utils/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js +1336 -0
  144. package/src/mp/utils/spark-md5.js +776 -0
  145. package/src/mp/utils/tcb.js +62 -0
  146. package/src/setupTests.js +2 -1
  147. package/src/web/components/button/index.css +8 -1
  148. package/src/web/components/button/index.tsx +3 -2
  149. package/src/web/components/calendar/index.css +382 -0
  150. package/src/web/components/calendar/index.jsx +312 -0
  151. package/src/web/components/calendar/util.js +90 -0
  152. package/src/web/components/carousel/index.css +119 -0
  153. package/src/web/components/carousel/index.tsx +417 -0
  154. package/src/web/components/chart/bar/index.tsx +140 -0
  155. package/src/web/components/chart/common/config/bar.js +49 -0
  156. package/src/web/components/chart/common/config/global.js +16 -0
  157. package/src/web/components/chart/common/config/line.js +50 -0
  158. package/src/web/components/chart/common/config/pie.js +37 -0
  159. package/src/web/components/chart/common/core/eChartBar.js +265 -0
  160. package/src/web/components/chart/common/core/eChartBase.ts +383 -0
  161. package/src/web/components/chart/common/core/eChartLine.js +231 -0
  162. package/src/web/components/chart/common/core/eChartPie.js +170 -0
  163. package/src/web/components/chart/common/core/type.ts +34 -0
  164. package/src/web/components/chart/common/echart.css +106 -0
  165. package/src/web/components/chart/common/echarts.ts +33 -0
  166. package/src/web/components/chart/common/useChart.tsx +69 -0
  167. package/src/web/components/chart/line/index.tsx +136 -0
  168. package/src/web/components/chart/pie/index.tsx +99 -0
  169. package/src/web/components/chart/statisticsCard/index.css +62 -0
  170. package/src/web/components/chart/statisticsCard/index.tsx +307 -0
  171. package/src/web/components/chart/statisticsCard/interface.ts +14 -0
  172. package/src/web/components/dataView/index.tsx +20 -0
  173. package/src/web/components/dataView/interface.ts +6 -0
  174. package/src/web/components/form/checkbox/index.tsx +55 -23
  175. package/src/web/components/form/location/common/mapChoose.css +178 -0
  176. package/src/web/components/form/location/common/mapChoose.jsx +343 -0
  177. package/src/web/components/form/location/common/mapView.jsx +190 -0
  178. package/src/web/components/form/location/common/propsConfig.js +54 -0
  179. package/src/web/components/form/location/common/selectModal.css +44 -0
  180. package/src/web/components/form/location/common/selectModal.jsx +82 -0
  181. package/src/web/components/form/location/common/useLocationInfo.js +100 -0
  182. package/src/web/components/form/location/components/LocationH5/index.css +243 -0
  183. package/src/web/components/form/location/components/LocationH5/location.h5.jsx +403 -0
  184. package/src/web/components/form/location/components/LocationPC/Header.jsx +109 -0
  185. package/src/web/components/form/location/components/LocationPC/index.css +44 -0
  186. package/src/web/components/form/location/components/LocationPC/location.PC.jsx +323 -0
  187. package/src/web/components/form/location/constants.js +4 -0
  188. package/src/web/components/form/location/index.css +0 -0
  189. package/src/web/components/form/location/index.jsx +25 -0
  190. package/src/web/components/form/radio/index.tsx +84 -53
  191. package/src/web/components/form/select/h5.tsx +389 -71
  192. package/src/web/components/form/select/index.css +10 -0
  193. package/src/web/components/form/select/index.tsx +404 -144
  194. package/src/web/components/form/select/region/index.ts +122 -31
  195. package/src/web/components/form/select/time.jsx +90 -0
  196. package/src/web/components/form/select/year.tsx +170 -0
  197. package/src/web/components/form/uploader/uploader.h5.tsx +19 -4
  198. package/src/web/components/form/uploader/uploader.pc.tsx +8 -7
  199. package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +132 -113
  200. package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +16 -11
  201. package/src/web/components/graphicCard/index.css +159 -0
  202. package/src/web/components/graphicCard/index.tsx +310 -0
  203. package/src/web/components/image/image.tsx +1 -2
  204. package/src/web/components/image/index.tsx +1 -1
  205. package/src/web/components/index.js +24 -2
  206. package/src/web/components/link/index.tsx +6 -3
  207. package/src/web/components/listView/arrow-right-line.svg +3 -0
  208. package/src/web/components/listView/index.css +143 -0
  209. package/src/web/components/listView/index.tsx +359 -0
  210. package/src/web/components/listView/interface.ts +98 -0
  211. package/src/web/components/modal/index.tsx +3 -1
  212. package/src/web/components/navLayout/index.css +332 -0
  213. package/src/web/components/navLayout/index.tsx +247 -0
  214. package/src/web/components/navigationBar/chevron-right--double.svg +3 -0
  215. package/src/web/components/navigationBar/common.tsx +198 -0
  216. package/src/web/components/navigationBar/h5Menu.tsx +179 -0
  217. package/src/web/components/navigationBar/horizontalMenu.tsx +200 -0
  218. package/src/web/components/navigationBar/index.css +762 -0
  219. package/src/web/components/navigationBar/index.tsx +231 -0
  220. package/src/web/components/navigationBar/type.d.ts +111 -0
  221. package/src/web/components/navigationBar/verticalMenu.tsx +81 -0
  222. package/src/web/components/phone/index.css +0 -0
  223. package/src/web/components/phone/index.tsx +22 -0
  224. package/src/web/components/phoneCode/index.css +0 -0
  225. package/src/web/components/phoneCode/index.tsx +22 -0
  226. package/src/web/components/richTextView/index.tsx +3 -5
  227. package/src/web/components/share/index.css +0 -0
  228. package/src/web/components/share/index.tsx +38 -0
  229. package/src/web/components/tabs/index.tsx +4 -2
  230. package/src/web/components/tabs/tabs.h5.tsx +50 -37
  231. package/src/web/components/tabs/tabs.pc.tsx +23 -10
  232. package/src/web/components/text/index.tsx +6 -14
  233. package/src/web/components/uploaderFileView/index.css +9 -9
  234. package/src/web/components/uploaderFileView/index.jsx +32 -23
  235. package/src/web/components/userInfo/index.css +0 -0
  236. package/src/web/components/userInfo/index.tsx +30 -0
  237. package/src/web/types.d.ts +15 -14
  238. package/src/web/utils/debounce.js +98 -0
  239. package/src/web/utils/platform.js +40 -0
  240. package/src/web/utils/tcb.js +49 -0
  241. package/src/web/utils/tmap.js +4 -0
  242. package/src/web/weda-ui.css +2 -0
  243. package/CHANGELOG.md +0 -240
  244. package/src/.DS_Store +0 -0
  245. package/src/configs/.DS_Store +0 -0
  246. package/src/mp/.gitignore +0 -10
  247. package/src/web/.DS_Store +0 -0
  248. package/src/web/components/form/select/region/cities.ts +0 -2410
  249. package/src/web/components/form/select/region/provinces.ts +0 -240
  250. package/src/web/components/form/select/region/regions.ts +0 -20645
@@ -0,0 +1,382 @@
1
+ Component({
2
+ /**
3
+ * 组件的属性列表
4
+ */
5
+ properties: {
6
+ className: {
7
+ type: String,
8
+ value: '',
9
+ },
10
+ style: {
11
+ type: String,
12
+ value: '',
13
+ },
14
+ label: {
15
+ type: String,
16
+ value: '标题',
17
+ },
18
+ labelVisible: {
19
+ type: Boolean,
20
+ value: true,
21
+ },
22
+ source: {
23
+ type: String,
24
+ value: '',
25
+ },
26
+ showLngLat: {
27
+ type: Boolean,
28
+ value: true,
29
+ },
30
+ showMap: {
31
+ type: Boolean,
32
+ value: true,
33
+ },
34
+ defauleShowLocation: {
35
+ type: Boolean,
36
+ value: true,
37
+ },
38
+ drag: {
39
+ type: Boolean,
40
+ value: true,
41
+ },
42
+ zoom: {
43
+ type: Boolean,
44
+ value: true,
45
+ },
46
+ disabled: {
47
+ type: Boolean,
48
+ value: false,
49
+ },
50
+ requiredFlag: {
51
+ type: Boolean,
52
+ value: true,
53
+ },
54
+ value: {
55
+ type: Object,
56
+ value: {
57
+ latitude: 39.98410411,
58
+ longitude: 116.307503,
59
+ poiname: '',
60
+ },
61
+ },
62
+ locationType: {
63
+ type: Number,
64
+ value: 1,
65
+ },
66
+ customLocation: {
67
+ type: Object,
68
+ value: {
69
+ latitude: 22.540366,
70
+ longitude: 113.934559,
71
+ poiname: '深圳市南山区深南大道10000号腾讯大厦',
72
+ },
73
+ },
74
+ },
75
+
76
+ lifetimes: {
77
+ attached: function () {
78
+ const wxClientApi = wx;
79
+ const apiName = [
80
+ 'g',
81
+ 'e',
82
+ 't',
83
+ 'L',
84
+ 'o',
85
+ 'c',
86
+ 'a',
87
+ 't',
88
+ 'i',
89
+ 'o',
90
+ 'n',
91
+ ].join('');
92
+
93
+ // 在组件实例进入页面节点树时执行
94
+ const getCurrentLocation = (locationType) => {
95
+ wxClientApi[apiName]({
96
+ isHighAccuracy: true, //高精度定位
97
+ success: (res) => {
98
+ let { latitude, longitude } = res;
99
+ let location = {
100
+ latitude,
101
+ longitude,
102
+ poiname: '',
103
+ };
104
+ let marker = {
105
+ id: 887,
106
+ latitude,
107
+ longitude,
108
+ width: 25,
109
+ height: 35,
110
+ };
111
+ this.setData({
112
+ location,
113
+ markers: [marker],
114
+ currentLocations: location,
115
+ currentPosition: {
116
+ status: true,
117
+ message: '',
118
+ },
119
+ });
120
+ this.setLocation(location);
121
+ if (locationType === 1) {
122
+ this.triggerEvent('change', {
123
+ value: null,
124
+ });
125
+ } else {
126
+ this.setData({
127
+ isAddrShow: true,
128
+ });
129
+ this.changeValueFormat(location);
130
+ }
131
+ },
132
+ fail: ({ errMsg }) => {
133
+ console.log('getlocation', errMsg);
134
+ let currentPositionMsg = errMsg;
135
+ this.triggerEvent('change', {
136
+ value: null,
137
+ });
138
+ if (
139
+ errMsg ===
140
+ 'getLocation:fail 频繁调用会增加电量损耗,可考虑使用 wx.onLocationChange 监听地理位置变化'
141
+ ) {
142
+ currentPositionMsg = '频繁获取当前定位会增加电量损耗请稍后再选择';
143
+ setTimeout(() => {
144
+ getCurrentLocation(locationType);
145
+ }, 3000);
146
+ }
147
+ this.setData({
148
+ currentPosition: {
149
+ status: false,
150
+ message: currentPositionMsg,
151
+ },
152
+ currentLocations: {},
153
+ });
154
+ },
155
+ });
156
+ };
157
+ const { locationType, customLocation } = this.properties;
158
+ if (locationType === 1 || locationType === 2) {
159
+ // 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.record" 这个 scope
160
+ wx.getSetting({
161
+ success: (res) => {
162
+ if (!res.authSetting['scope.userLocation']) {
163
+ // 没有授权
164
+ wx.authorize({
165
+ scope: 'scope.userLocation',
166
+ success: () => {
167
+ // 用户已经同意小程序使用定位功能,后续调用 wx.getLocation 接口不会弹窗询问
168
+ getCurrentLocation(locationType);
169
+ },
170
+ fail: (err) => {
171
+ console.log('authorize fail', err);
172
+ this.setData({
173
+ currentPosition: {
174
+ status: false,
175
+ message: err.errMsg,
176
+ },
177
+ currentLocations: {},
178
+ });
179
+ this.triggerEvent('change', {
180
+ value: null,
181
+ });
182
+ wx.showToast({
183
+ icon: 'none',
184
+ title: err.errMsg,
185
+ });
186
+ },
187
+ });
188
+ } else {
189
+ // 已经授权
190
+ getCurrentLocation(locationType);
191
+ }
192
+ },
193
+ fail: (err) => {
194
+ console.log('getSetting fail', err);
195
+ wx.showToast({
196
+ icon: 'none',
197
+ title: 'getSetting fail',
198
+ });
199
+ },
200
+ });
201
+ } else if (locationType === 3) {
202
+ this.setData({
203
+ currentPosition: {
204
+ status: true,
205
+ message: '',
206
+ },
207
+ });
208
+ if (this.checkCustomLocation(customLocation)) {
209
+ wx.showToast({
210
+ icon: 'none',
211
+ title: '位置输入格式错误 请检查',
212
+ });
213
+ return;
214
+ } else {
215
+ this.setLocation(customLocation);
216
+ this.changeValueFormat(customLocation);
217
+ }
218
+ }
219
+ },
220
+ detached: function () {
221
+ // 在组件实例被从页面节点树移除时执行
222
+ },
223
+ },
224
+
225
+ /**
226
+ * 组件的初始数据
227
+ */
228
+ data: {
229
+ location: {
230
+ latitude: 39.98410411,
231
+ longitude: 116.307503,
232
+ poiname: '',
233
+ },
234
+ markers: [],
235
+ isAddrShow: false,
236
+ currentPosition: {
237
+ status: false,
238
+ message: '获取当前定位中',
239
+ },
240
+ currentLocations: {},
241
+ },
242
+
243
+ /**
244
+ * 组件的方法列表
245
+ */
246
+ methods: {
247
+ chooseSite() {
248
+ let { latitude, longitude } = this.data.location;
249
+ let currentPosition = this.data.currentPosition;
250
+ if (this.properties.disabled || !currentPosition.status) {
251
+ return wx.showToast({
252
+ icon: 'none',
253
+ title: currentPosition.status ? '已禁用' : currentPosition.message,
254
+ duration: 2000,
255
+ });
256
+ }
257
+ const wxClientApi = wx;
258
+ const apiName = [
259
+ 'c',
260
+ 'h',
261
+ 'o',
262
+ 'o',
263
+ 's',
264
+ 'e',
265
+ 'L',
266
+ 'o',
267
+ 'c',
268
+ 'a',
269
+ 't',
270
+ 'i',
271
+ 'o',
272
+ 'n',
273
+ ].join('');
274
+ wxClientApi[apiName]({
275
+ latitude,
276
+ longitude,
277
+ success: (res) => {
278
+ if (res.name) {
279
+ this.changeLocation({
280
+ ...res,
281
+ poiname: res.name,
282
+ });
283
+ }
284
+ },
285
+ fail: (err) => {
286
+ console.log('chooseLocation err', err);
287
+ },
288
+ });
289
+ },
290
+ changeLocation(location) {
291
+ let isAddrShow = this.data.isAddrShow;
292
+ if (!isAddrShow) {
293
+ this.setData({
294
+ isAddrShow: true,
295
+ });
296
+ }
297
+ let marker = {
298
+ id: 887,
299
+ latitude: location.latitude,
300
+ longitude: location.longitude,
301
+ width: 25,
302
+ height: 35,
303
+ };
304
+ this.setData({
305
+ location,
306
+ markers: [marker],
307
+ });
308
+ this.changeValueFormat(location);
309
+ },
310
+ checkCustomLocation(params) {
311
+ let { latitude, longitude } = params;
312
+ let message = '';
313
+ if (Object.prototype.toString.call(params) !== '[object Object]') {
314
+ return (message = '位置输入格式错误 请检查');
315
+ } else if (!latitude || !Number(latitude)) {
316
+ return (message = '位置输入格式错误 请检查');
317
+ } else if (!longitude || !Number(longitude)) {
318
+ return (message = '位置输入格式错误 请检查');
319
+ } else if (!params) {
320
+ return (message = '位置输入格式错误 请检查');
321
+ }
322
+ },
323
+ setLocation(value) {
324
+ const { latitude, longitude } = value;
325
+ let marker = {
326
+ id: 887,
327
+ latitude,
328
+ longitude,
329
+ width: 25,
330
+ height: 35,
331
+ };
332
+ this.setData({
333
+ location: value,
334
+ markers: [marker],
335
+ });
336
+ this.changeValueFormat(value);
337
+ },
338
+ changeValueFormat(value) {
339
+ const { latitude, longitude, poiname } = value;
340
+ let location = {
341
+ address: poiname,
342
+ geopoint: {
343
+ coordinates: [longitude, latitude],
344
+ type: 'Point',
345
+ },
346
+ };
347
+ this.triggerEvent('change', {
348
+ value: location,
349
+ });
350
+ },
351
+ },
352
+ observers: {
353
+ value: function (value) {
354
+ const currentLocations = this.data.currentLocations;
355
+ if (value || !currentLocations.latitude) return;
356
+ const locationType = this.properties.locationType;
357
+ const { latitude, longitude } = currentLocations;
358
+ let marker = {
359
+ id: 887,
360
+ latitude,
361
+ longitude,
362
+ width: 25,
363
+ height: 35,
364
+ };
365
+ this.setData({
366
+ location: currentLocations,
367
+ markers: [marker],
368
+ isAddrShow: false,
369
+ });
370
+ if (locationType === 1) {
371
+ this.triggerEvent('change', {
372
+ value: null,
373
+ });
374
+ } else if (locationType === 2) {
375
+ this.changeValueFormat(currentLocations);
376
+ this.setData({
377
+ isAddrShow: true,
378
+ });
379
+ }
380
+ },
381
+ },
382
+ });
@@ -0,0 +1,6 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {
4
+ "MapChoose":"./components/mapChoose/index"
5
+ }
6
+ }
@@ -0,0 +1,25 @@
1
+ <!--components/location/location.wxml-->
2
+
3
+ <view class="form-location">
4
+ <view class="form-location-warp">
5
+ <view class="form-location-label form-location_cell" wx:if="{{labelVisible}}">
6
+ {{label}}
7
+ </view>
8
+ <view class="form-location-con form-location_cell" bindtap="chooseSite" data-value="{{true}}" >
9
+ <image class="form-location-con_img" src="https://qcloudimg.tencent-cloud.cn/raw/6542e1ce1dd36a90085b2eb979801df9.png"></image>
10
+ <text class="form-location-con-text">选择地理位置</text>
11
+ </view>
12
+ </view>
13
+ <view class="form-location-addr" wx:if="{{isAddrShow}}">
14
+ <image wx:if="{{isAddrShow&&location.poiname}}" class="form-location-addr-image" src="https://qcloudimg.tencent-cloud.cn/raw/f9729e0b091f394110a6e12d3f4e7290.png" alt="" />
15
+ <view class="form-location-addr-box" >
16
+ <view class="form-location-addr-title">{{location.poiname}}</view>
17
+ <view class="form-location-addr-lat" wx:if="{{showLngLat}}">
18
+ {{location.longitude}}N,{{location.latitude}}E
19
+ </view>
20
+ </view>
21
+ </view>
22
+ <view style="padding-left: 32px;padding-right: 32px;margin-top: 8px;padding-bottom: 16px;" wx:if="{{showMap&&isAddrShow}}">
23
+ <map id="map" longitude="{{location.longitude}}" latitude="{{location.latitude}}" markers="{{markers}}" scale="16" enable-zoom="{{zoom}}" enable-scroll="{{drag}}" style="width: 100%; height: 200px;"></map>
24
+ </view>
25
+ </view>
@@ -0,0 +1,91 @@
1
+ /* components/location/location.wxss */
2
+
3
+ .form-location {
4
+ }
5
+
6
+ .form-location-warp {
7
+ display: flex;
8
+ white-space: nowrap;
9
+ position: relative;
10
+ overflow: hidden;
11
+ }
12
+
13
+ .form-location::before,
14
+ .form-location::after {
15
+ left: 32px;
16
+ right: 32px;
17
+ content: ' ';
18
+ position: absolute;
19
+ height: 0px;
20
+ z-index: 2;
21
+ color: #e2e1e1;
22
+ border-top: 1px solid #e2e1e1;
23
+ }
24
+
25
+ .form-location-warp::after {
26
+ bottom: 0;
27
+ }
28
+
29
+ .form-location-con {
30
+ flex: 1;
31
+ display: flex;
32
+ align-items: center;
33
+ }
34
+
35
+ .form-location-label_flag {
36
+ display: inline-block;
37
+ margin-right: 4px;
38
+ font-family: SimSun;
39
+ font-size: 12px;
40
+ color: #f60;
41
+ }
42
+
43
+ .form-location-label {
44
+ max-width: 150px;
45
+ overflow: hidden;
46
+ white-space: nowrap;
47
+ text-overflow: ellipsis;
48
+ }
49
+
50
+ .form-location-con_img {
51
+ min-width: 18px;
52
+ width: 18px;
53
+ height: 18px;
54
+ }
55
+ .form-location-con-text {
56
+ color: #006eff;
57
+ margin-left: 8px;
58
+ cursor: pointer;
59
+ }
60
+
61
+ .form-location_cell {
62
+ padding: 16px 32px;
63
+ line-height: 1.41176471;
64
+ font-size: 17px;
65
+ overflow: hidden;
66
+ position: relative;
67
+ }
68
+
69
+ .form-location-addr {
70
+ display: flex;
71
+ align-items: flex-start;
72
+ padding-left: 32px;
73
+ padding-right: 32px;
74
+ }
75
+
76
+ .form-location-addr-title {
77
+ font-size: 16px;
78
+ }
79
+ .form-location-addr-lat {
80
+ font-size: 12px;
81
+ color: rgba(0, 0, 0, 0.4);
82
+ line-height: 20px;
83
+ }
84
+
85
+ .form-location-addr-image {
86
+ width: 19px;
87
+ height: 19px;
88
+ }
89
+ .form-location-addr-box {
90
+ margin-left: 12px;
91
+ }
@@ -1,5 +1,7 @@
1
1
  import classNames from '../../../utils/classnames';
2
+ import destr from '../../../utils/destr';
2
3
  import handleEvents from '../../../utils/handleEvents';
4
+ import { callWedaApi } from '../../../utils/tcb';
3
5
 
4
6
  Component({
5
7
  options: {
@@ -41,6 +43,14 @@ Component({
41
43
  type: Boolean,
42
44
  value: false,
43
45
  },
46
+ format: {
47
+ type: String,
48
+ value: '',
49
+ },
50
+ enumName: {
51
+ type: String,
52
+ value: '',
53
+ }
44
54
  },
45
55
  data: {
46
56
  cls: '',
@@ -68,6 +78,22 @@ Component({
68
78
  },
69
79
  },
70
80
  methods: {
81
+ _fetchData: async function () {
82
+ let data = await callWedaApi({
83
+ action: 'DescribeGeneralOptionsDetailList',
84
+ data: { OptNameList: [this.properties.enumName], PageIndex: 1, PageSize: 10 },
85
+ });
86
+ const config = destr(data?.Items?.[0]?.Config) ?? [];
87
+ const option = config?.map(item => {
88
+ return {
89
+ label: item.value,
90
+ value: item.key,
91
+ checked: false
92
+ };
93
+ });
94
+ this.setData({ defaultRange: option });
95
+ },
96
+
71
97
  ...handleEvents([
72
98
  {
73
99
  name: 'change',
@@ -75,4 +101,16 @@ Component({
75
101
  },
76
102
  ]),
77
103
  },
104
+ observers: {
105
+ range: function (range) {
106
+ if (this.properties.format !== 'x-enum') {
107
+ this.setData({ defaultRange: range });
108
+ }
109
+ },
110
+ format: function (format) {
111
+ if (format === 'x-enum' && this.properties.enumName) {
112
+ this._fetchData();
113
+ }
114
+ }
115
+ },
78
116
  });