@cloudbase/weda-ui-mp 3.9.0 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/form/location/components/mapChoose/index.js +32 -7
- package/components/form/location/index.js +38 -10
- package/components/form/location/index.wxml +1 -1
- package/components/wd-location/index.js +8 -0
- package/components/wd-location/index.wxml +2 -0
- package/components/wd-markdown/index.js +14 -0
- package/components/web-view/index.js +0 -3
- package/package.json +1 -1
- package/utils/error.js +12 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import debounce from '../../../../../utils/debounce';
|
|
2
2
|
import { getCurrentLocation } from '../../../../../utils/getCustomInfo';
|
|
3
|
+
import { errorHandler } from '../../../../../utils/error';
|
|
4
|
+
|
|
3
5
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
4
6
|
let QQMapWX = require('../../../../../utils/qqmap-wx-jssdk1.2/qqmap-wx-jssdk');
|
|
5
7
|
let qqmapsdk;
|
|
@@ -9,6 +11,10 @@ Component({
|
|
|
9
11
|
* 组件的属性列表
|
|
10
12
|
*/
|
|
11
13
|
properties: {
|
|
14
|
+
id: {
|
|
15
|
+
Type: String,
|
|
16
|
+
value: '',
|
|
17
|
+
},
|
|
12
18
|
location: {
|
|
13
19
|
type: Object,
|
|
14
20
|
value: {
|
|
@@ -44,6 +50,7 @@ Component({
|
|
|
44
50
|
lifetimes: {
|
|
45
51
|
attached: function () {
|
|
46
52
|
this.getInitialization();
|
|
53
|
+
this.setData({ id: this.id });
|
|
47
54
|
},
|
|
48
55
|
},
|
|
49
56
|
|
|
@@ -273,7 +280,12 @@ Component({
|
|
|
273
280
|
});
|
|
274
281
|
},
|
|
275
282
|
fail: function (error) {
|
|
276
|
-
|
|
283
|
+
const { comErrorInfo } = errorHandler({
|
|
284
|
+
id: this.id,
|
|
285
|
+
code: 'WdLocation.SearchError',
|
|
286
|
+
error: error,
|
|
287
|
+
});
|
|
288
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
277
289
|
_this.setData({
|
|
278
290
|
searchLoadingStatus: false,
|
|
279
291
|
});
|
|
@@ -297,11 +309,12 @@ Component({
|
|
|
297
309
|
}
|
|
298
310
|
},
|
|
299
311
|
fail: function (error) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
312
|
+
const { comErrorInfo } = errorHandler({
|
|
313
|
+
id: this.id,
|
|
314
|
+
code: 'WdLocation.GetSuggestionError',
|
|
315
|
+
error: error,
|
|
304
316
|
});
|
|
317
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
305
318
|
},
|
|
306
319
|
});
|
|
307
320
|
}
|
|
@@ -332,7 +345,12 @@ Component({
|
|
|
332
345
|
}
|
|
333
346
|
},
|
|
334
347
|
fail: (error) => {
|
|
335
|
-
|
|
348
|
+
const { comErrorInfo } = errorHandler({
|
|
349
|
+
id: this.id,
|
|
350
|
+
code: 'WdLocation.ReverseGeocoderError',
|
|
351
|
+
error: error,
|
|
352
|
+
});
|
|
353
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
336
354
|
let item = {
|
|
337
355
|
id: 'current-location',
|
|
338
356
|
location: {
|
|
@@ -479,7 +497,14 @@ Component({
|
|
|
479
497
|
latitude: Number(latitude.toFixed(6)),
|
|
480
498
|
longitude: Number(longitude.toFixed(6)),
|
|
481
499
|
};
|
|
482
|
-
} catch (e) {
|
|
500
|
+
} catch (e) {
|
|
501
|
+
const { comErrorInfo } = errorHandler({
|
|
502
|
+
id: this.id,
|
|
503
|
+
code: 'WdLocation.GetLatestLocationError',
|
|
504
|
+
error: e,
|
|
505
|
+
});
|
|
506
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
507
|
+
}
|
|
483
508
|
return location;
|
|
484
509
|
},
|
|
485
510
|
},
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { callDataSource } from '../../../utils/tcb';
|
|
2
2
|
import classNames from '../../../utils/classnames';
|
|
3
3
|
import customInfo from '../../../utils/getCustomInfo';
|
|
4
|
+
import { errorHandler } from '../../../utils/error';
|
|
5
|
+
|
|
4
6
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
5
7
|
let QQMapWX = require('../../../utils/qqmap-wx-jssdk1.2/qqmap-wx-jssdk');
|
|
6
8
|
let qqmapsdk;
|
|
@@ -17,6 +19,10 @@ Component({
|
|
|
17
19
|
type: String,
|
|
18
20
|
value: '',
|
|
19
21
|
},
|
|
22
|
+
id: {
|
|
23
|
+
Type: String,
|
|
24
|
+
value: '',
|
|
25
|
+
},
|
|
20
26
|
style: {
|
|
21
27
|
type: String,
|
|
22
28
|
value: '',
|
|
@@ -97,6 +103,7 @@ Component({
|
|
|
97
103
|
|
|
98
104
|
lifetimes: {
|
|
99
105
|
attached: function () {
|
|
106
|
+
this.setData({ id: this.id });
|
|
100
107
|
const { locationType, dataSource } = this.properties;
|
|
101
108
|
const getReverseGeocoder = async (location) => {
|
|
102
109
|
const { isApikeyStatus } = this.data;
|
|
@@ -182,7 +189,12 @@ Component({
|
|
|
182
189
|
}
|
|
183
190
|
getReverseGeocoder(location);
|
|
184
191
|
} catch (err) {
|
|
185
|
-
|
|
192
|
+
const { comErrorInfo } = errorHandler({
|
|
193
|
+
id: this.id,
|
|
194
|
+
code: 'WdLocation.DrowMapMarksError',
|
|
195
|
+
error: err,
|
|
196
|
+
});
|
|
197
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
186
198
|
}
|
|
187
199
|
};
|
|
188
200
|
const getCustomInfoLocation = () => {
|
|
@@ -206,6 +218,12 @@ Component({
|
|
|
206
218
|
},
|
|
207
219
|
currentLocations: {},
|
|
208
220
|
});
|
|
221
|
+
const { comErrorInfo } = errorHandler({
|
|
222
|
+
id: this.id,
|
|
223
|
+
code: 'WdLocation.GetCurrentLocationError',
|
|
224
|
+
error,
|
|
225
|
+
});
|
|
226
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
209
227
|
});
|
|
210
228
|
} else {
|
|
211
229
|
drowMapMarks(customInfoLocation);
|
|
@@ -225,7 +243,6 @@ Component({
|
|
|
225
243
|
getCustomInfoLocation();
|
|
226
244
|
},
|
|
227
245
|
fail: (err) => {
|
|
228
|
-
console.log('authorize fail', err);
|
|
229
246
|
this.setData({
|
|
230
247
|
currentPosition: {
|
|
231
248
|
status: false,
|
|
@@ -236,10 +253,12 @@ Component({
|
|
|
236
253
|
this.triggerEvent('change', {
|
|
237
254
|
value: {},
|
|
238
255
|
});
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
256
|
+
const { comErrorInfo } = errorHandler({
|
|
257
|
+
id: this.id,
|
|
258
|
+
code: 'WdLocation.AuthorizeFail',
|
|
259
|
+
error: err,
|
|
242
260
|
});
|
|
261
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
243
262
|
},
|
|
244
263
|
});
|
|
245
264
|
} else {
|
|
@@ -248,11 +267,12 @@ Component({
|
|
|
248
267
|
}
|
|
249
268
|
},
|
|
250
269
|
fail: (err) => {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
270
|
+
const { comErrorInfo } = errorHandler({
|
|
271
|
+
id: this.id,
|
|
272
|
+
code: 'WdLocation.GetSettingFail',
|
|
273
|
+
error: err,
|
|
255
274
|
});
|
|
275
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
256
276
|
},
|
|
257
277
|
});
|
|
258
278
|
}
|
|
@@ -336,7 +356,6 @@ Component({
|
|
|
336
356
|
});
|
|
337
357
|
}
|
|
338
358
|
} catch (error) {
|
|
339
|
-
console.log('getApikey error', error);
|
|
340
359
|
this.setData({
|
|
341
360
|
isApikeyStatus: {
|
|
342
361
|
status: false,
|
|
@@ -344,6 +363,12 @@ Component({
|
|
|
344
363
|
apiKey: '',
|
|
345
364
|
},
|
|
346
365
|
});
|
|
366
|
+
const { comErrorInfo } = errorHandler({
|
|
367
|
+
id: this.id,
|
|
368
|
+
code: 'WdLocation.GetApikeyError',
|
|
369
|
+
error,
|
|
370
|
+
});
|
|
371
|
+
this.triggerEvent('error', { error: comErrorInfo });
|
|
347
372
|
}
|
|
348
373
|
},
|
|
349
374
|
chooseLocation() {
|
|
@@ -434,6 +459,9 @@ Component({
|
|
|
434
459
|
isMapChooseVisible: false,
|
|
435
460
|
});
|
|
436
461
|
},
|
|
462
|
+
handleError: function (e) {
|
|
463
|
+
this.triggerEvent('error', e.detail);
|
|
464
|
+
},
|
|
437
465
|
},
|
|
438
466
|
observers: {
|
|
439
467
|
value: function (value) {
|
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
<view style="padding-left: 16px; padding-right: 16px; margin-top: 16px; padding-bottom: 16px" wx:if="{{showMap&&isAddrShow}}">
|
|
25
25
|
<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>
|
|
26
26
|
</view>
|
|
27
|
-
<mapChoose isVisible="{{isMapChooseVisible}}" bindonClose="mapChooseOnClose" bindonConfirm="mapChooseOnConfirm" location="{{location}}" apiKey="{{isApikeyStatus.apiKey}}" circleRadius="{{locationRange}}" customRange="{{customRange}}" currentLocations="{{currentLocations}}" />
|
|
27
|
+
<mapChoose id="{{id}}" isVisible="{{isMapChooseVisible}}" bindonClose="mapChooseOnClose" bindonConfirm="mapChooseOnConfirm" location="{{location}}" apiKey="{{isApikeyStatus.apiKey}}" circleRadius="{{locationRange}}" customRange="{{customRange}}" currentLocations="{{currentLocations}}" bind:error="handleError" />
|
|
28
28
|
</view>
|
|
29
29
|
</formcell>
|
|
@@ -14,6 +14,10 @@ Component({
|
|
|
14
14
|
customLocation: {
|
|
15
15
|
type: null,
|
|
16
16
|
},
|
|
17
|
+
id: {
|
|
18
|
+
Type: String,
|
|
19
|
+
value: '',
|
|
20
|
+
},
|
|
17
21
|
},
|
|
18
22
|
data: {
|
|
19
23
|
_oldLocationValue: null,
|
|
@@ -30,6 +34,9 @@ Component({
|
|
|
30
34
|
const e = { detail: { value: null } };
|
|
31
35
|
this.handleChange(e);
|
|
32
36
|
},
|
|
37
|
+
handleError: function (e) {
|
|
38
|
+
this.triggerEvent('error', e.detail);
|
|
39
|
+
},
|
|
33
40
|
},
|
|
34
41
|
observers: {
|
|
35
42
|
'name, value, label, required, visible, disabled, readOnly, before, after':
|
|
@@ -44,6 +51,7 @@ Component({
|
|
|
44
51
|
lifetimes: {
|
|
45
52
|
attached: function () {
|
|
46
53
|
this.updateWidgetAPI();
|
|
54
|
+
this.setData({ id: this.id });
|
|
47
55
|
},
|
|
48
56
|
},
|
|
49
57
|
});
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
<wd-input-group before="{{before}}" after="{{after}}" block="{{true}}" size="{{_size}}" classRoot="{{classRoot}}">
|
|
25
25
|
<wd-input-wrap block="{{block}}" classRoot="{{classRoot}}" before="{{before}}" after="{{after}}" disabled="{{disabled}}" prefixType="{{prefixType}}" prefixIcon="{{prefixIcon}}" prefixSrc="{{prefixSrc}}" suffixType="{{suffixType}}" suffixIcon="{{suffixIcon}}" suffixSrc="{{suffixSrc}}" hasClearIcon="{{hasClearIcon}}" bind:onClear="handleClear">
|
|
26
26
|
<old-location
|
|
27
|
+
id="{{id}}"
|
|
27
28
|
name="{{name}}"
|
|
28
29
|
labelVisible="{{false}}"
|
|
29
30
|
value="{{value}}"
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
readOnly="{{readOnly}}"
|
|
41
42
|
disabled="{{disabled || readOnly}}"
|
|
42
43
|
bind:change="handleChange"
|
|
44
|
+
bind:error="handleError"
|
|
43
45
|
/>
|
|
44
46
|
</wd-input-wrap>
|
|
45
47
|
</wd-input-group>
|
|
@@ -59,10 +59,20 @@ Component({
|
|
|
59
59
|
...options,
|
|
60
60
|
});
|
|
61
61
|
this.setData({ mdInstance: md });
|
|
62
|
+
this.triggerEvent('onReady', { markdownInstance: md });
|
|
62
63
|
this.setData({
|
|
63
64
|
__html: md.render(this.data.value),
|
|
64
65
|
});
|
|
65
66
|
},
|
|
67
|
+
updateWidgetAPI() {
|
|
68
|
+
this.setReadonlyAttributes &&
|
|
69
|
+
this.setReadonlyAttributes({
|
|
70
|
+
value: this.properties.value,
|
|
71
|
+
markdownInstance: this.data.mdInstance,
|
|
72
|
+
updateMarkdownInstance: ({ markdownInstance }) =>
|
|
73
|
+
this.setData({ mdInstance: markdownInstance }),
|
|
74
|
+
});
|
|
75
|
+
},
|
|
66
76
|
},
|
|
67
77
|
observers: {
|
|
68
78
|
value: function () {
|
|
@@ -76,10 +86,14 @@ Component({
|
|
|
76
86
|
options: function () {
|
|
77
87
|
this.init();
|
|
78
88
|
},
|
|
89
|
+
'value,mdInstance': function () {
|
|
90
|
+
this.updateWidgetAPI();
|
|
91
|
+
},
|
|
79
92
|
},
|
|
80
93
|
lifetimes: {
|
|
81
94
|
attached() {
|
|
82
95
|
this.init();
|
|
96
|
+
this.updateWidgetAPI();
|
|
83
97
|
},
|
|
84
98
|
},
|
|
85
99
|
});
|
package/package.json
CHANGED
package/utils/error.js
CHANGED
|
@@ -10,3 +10,15 @@ export class WdCompError extends Error {
|
|
|
10
10
|
this.original = context ? context.original : {};
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
export const errorHandler = ({ id = '', code, error }) => {
|
|
15
|
+
const comErrorInfo = {
|
|
16
|
+
code: error?.code || code,
|
|
17
|
+
requestId: error?.requestId,
|
|
18
|
+
original: error,
|
|
19
|
+
message: `[组件${id}:${code}]${error?.message || error?.errMsg || code}`,
|
|
20
|
+
};
|
|
21
|
+
const compError = new WdCompError(comErrorInfo.message, comErrorInfo);
|
|
22
|
+
console.error(comErrorInfo);
|
|
23
|
+
return { compError, comErrorInfo };
|
|
24
|
+
};
|