@10yun/cv-mobile-ui 0.5.38 → 0.5.39

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.
@@ -0,0 +1,517 @@
1
+ function AMapWX(a) {
2
+ this.key = a.key;
3
+ this.requestConfig = {
4
+ key: a.key,
5
+ s: 'rsx',
6
+ platform: 'WXJS',
7
+ appname: a.key,
8
+ sdkversion: '1.2.0',
9
+ logversion: '2.0'
10
+ };
11
+ }
12
+ AMapWX.prototype.getWxLocation = function (a, b) {
13
+ wx.getLocation({
14
+ type: 'gcj02',
15
+ success: function (c) {
16
+ c = c.longitude + ',' + c.latitude;
17
+ wx.setStorage({
18
+ key: 'userLocation',
19
+ data: c
20
+ });
21
+ b(c);
22
+ },
23
+ fail: function (c) {
24
+ wx.getStorage({
25
+ key: 'userLocation',
26
+ success: function (d) {
27
+ d.data && b(d.data);
28
+ }
29
+ });
30
+ a.fail({
31
+ errCode: '0',
32
+ errMsg: c.errMsg || ''
33
+ });
34
+ }
35
+ });
36
+ };
37
+ AMapWX.prototype.getRegeo = function (a) {
38
+ function c(c) {
39
+ var d = b.requestConfig;
40
+ wx.request({
41
+ url: 'https://restapi.amap.com/v3/geocode/regeo',
42
+ data: {
43
+ key: b.key,
44
+ location: c,
45
+ extensions: 'all',
46
+ s: d.s,
47
+ platform: d.platform,
48
+ appname: b.key,
49
+ sdkversion: d.sdkversion,
50
+ logversion: d.logversion
51
+ },
52
+ method: 'GET',
53
+ header: {
54
+ 'content-type': 'application/json'
55
+ },
56
+ success: function (b) {
57
+ var d, e, f, g, h, i, j, k, l;
58
+ b.data.status && '1' == b.data.status
59
+ ? ((d = b.data.regeocode),
60
+ (e = d.addressComponent),
61
+ (f = []),
62
+ (g = ''),
63
+ d && d.roads[0] && d.roads[0].name && (g = d.roads[0].name + '附近'),
64
+ (h = c.split(',')[0]),
65
+ (i = c.split(',')[1]),
66
+ d.pois &&
67
+ d.pois[0] &&
68
+ ((g = d.pois[0].name + '附近'),
69
+ (j = d.pois[0].location),
70
+ j && ((h = parseFloat(j.split(',')[0])), (i = parseFloat(j.split(',')[1])))),
71
+ e.provice && f.push(e.provice),
72
+ e.city && f.push(e.city),
73
+ e.district && f.push(e.district),
74
+ e.streetNumber && e.streetNumber.street && e.streetNumber.number
75
+ ? (f.push(e.streetNumber.street), f.push(e.streetNumber.number))
76
+ : ((k = ''), d && d.roads[0] && d.roads[0].name && (k = d.roads[0].name), f.push(k)),
77
+ (f = f.join('')),
78
+ (l = [
79
+ {
80
+ iconPath: a.iconPath,
81
+ width: a.iconWidth,
82
+ height: a.iconHeight,
83
+ name: f,
84
+ desc: g,
85
+ longitude: h,
86
+ latitude: i,
87
+ id: 0,
88
+ regeocodeData: d
89
+ }
90
+ ]),
91
+ a.success(l))
92
+ : a.fail({
93
+ errCode: b.data.infocode,
94
+ errMsg: b.data.info
95
+ });
96
+ },
97
+ fail: function (b) {
98
+ a.fail({
99
+ errCode: '0',
100
+ errMsg: b.errMsg || ''
101
+ });
102
+ }
103
+ });
104
+ }
105
+ var b = this;
106
+ a.location
107
+ ? c(a.location)
108
+ : b.getWxLocation(a, function (a) {
109
+ c(a);
110
+ });
111
+ };
112
+ AMapWX.prototype.getWeather = function (a) {
113
+ function d(d) {
114
+ var e = 'base';
115
+ a.type && 'forecast' == a.type && (e = 'all'),
116
+ wx.request({
117
+ url: 'https://restapi.amap.com/v3/weather/weatherInfo',
118
+ data: {
119
+ key: b.key,
120
+ city: d,
121
+ extensions: e,
122
+ s: c.s,
123
+ platform: c.platform,
124
+ appname: b.key,
125
+ sdkversion: c.sdkversion,
126
+ logversion: c.logversion
127
+ },
128
+ method: 'GET',
129
+ header: {
130
+ 'content-type': 'application/json'
131
+ },
132
+ success: function (b) {
133
+ function c(a) {
134
+ var b = {
135
+ city: { text: '城市', data: a.city },
136
+ weather: {
137
+ text: '天气',
138
+ data: a.weather
139
+ },
140
+ temperature: {
141
+ text: '温度',
142
+ data: a.temperature
143
+ },
144
+ winddirection: {
145
+ text: '风向',
146
+ data: a.winddirection + '风'
147
+ },
148
+ windpower: {
149
+ text: '风力',
150
+ data: a.windpower + '级'
151
+ },
152
+ humidity: {
153
+ text: '湿度',
154
+ data: a.humidity + '%'
155
+ }
156
+ };
157
+ return b;
158
+ }
159
+ var d, e;
160
+ b.data.status && '1' == b.data.status
161
+ ? b.data.lives
162
+ ? ((d = b.data.lives), d && d.length > 0 && ((d = d[0]), (e = c(d)), (e['liveData'] = d), a.success(e)))
163
+ : b.data.forecasts &&
164
+ b.data.forecasts[0] &&
165
+ a.success({
166
+ forecast: b.data.forecasts[0]
167
+ })
168
+ : a.fail({
169
+ errCode: b.data.infocode,
170
+ errMsg: b.data.info
171
+ });
172
+ },
173
+ fail: function (b) {
174
+ a.fail({
175
+ errCode: '0',
176
+ errMsg: b.errMsg || ''
177
+ });
178
+ }
179
+ });
180
+ }
181
+
182
+ function e(e) {
183
+ wx.request({
184
+ url: 'https://restapi.amap.com/v3/geocode/regeo',
185
+ data: {
186
+ key: b.key,
187
+ location: e,
188
+ extensions: 'all',
189
+ s: c.s,
190
+ platform: c.platform,
191
+ appname: b.key,
192
+ sdkversion: c.sdkversion,
193
+ logversion: c.logversion
194
+ },
195
+ method: 'GET',
196
+ header: {
197
+ 'content-type': 'application/json'
198
+ },
199
+ success: function (b) {
200
+ var c, e;
201
+ b.data.status && '1' == b.data.status
202
+ ? ((e = b.data.regeocode),
203
+ e.addressComponent ? (c = e.addressComponent.adcode) : e.aois && e.aois.length > 0 && (c = e.aois[0].adcode),
204
+ d(c))
205
+ : a.fail({
206
+ errCode: b.data.infocode,
207
+ errMsg: b.data.info
208
+ });
209
+ },
210
+ fail: function (b) {
211
+ a.fail({
212
+ errCode: '0',
213
+ errMsg: b.errMsg || ''
214
+ });
215
+ }
216
+ });
217
+ }
218
+ var b = this,
219
+ c = b.requestConfig;
220
+ a.city
221
+ ? d(a.city)
222
+ : b.getWxLocation(a, function (a) {
223
+ e(a);
224
+ });
225
+ };
226
+ AMapWX.prototype.getPoiAround = function (a) {
227
+ function d(d) {
228
+ var e = {
229
+ key: b.key,
230
+ location: d,
231
+ s: c.s,
232
+ platform: c.platform,
233
+ appname: b.key,
234
+ sdkversion: c.sdkversion,
235
+ logversion: c.logversion
236
+ };
237
+ a.querytypes && (e['types'] = a.querytypes),
238
+ a.querykeywords && (e['keywords'] = a.querykeywords),
239
+ wx.request({
240
+ url: 'https://restapi.amap.com/v3/place/around',
241
+ data: e,
242
+ method: 'GET',
243
+ header: {
244
+ 'content-type': 'application/json'
245
+ },
246
+ success: function (b) {
247
+ var c, d, e, f;
248
+ if (b.data.status && '1' == b.data.status) {
249
+ if (((b = b.data), b && b.pois)) {
250
+ for (c = [], d = 0; d < b.pois.length; d++)
251
+ (e = 0 == d ? a.iconPathSelected : a.iconPath),
252
+ c.push({
253
+ latitude: parseFloat(b.pois[d].location.split(',')[1]),
254
+ longitude: parseFloat(b.pois[d].location.split(',')[0]),
255
+ iconPath: e,
256
+ width: 22,
257
+ height: 32,
258
+ id: d,
259
+ name: b.pois[d].name,
260
+ address: b.pois[d].address
261
+ });
262
+ (f = {
263
+ markers: c,
264
+ poisData: b.pois
265
+ }),
266
+ a.success(f);
267
+ }
268
+ } else
269
+ a.fail({
270
+ errCode: b.data.infocode,
271
+ errMsg: b.data.info
272
+ });
273
+ },
274
+ fail: function (b) {
275
+ a.fail({
276
+ errCode: '0',
277
+ errMsg: b.errMsg || ''
278
+ });
279
+ }
280
+ });
281
+ }
282
+ var b = this,
283
+ c = b.requestConfig;
284
+ a.location
285
+ ? d(a.location)
286
+ : b.getWxLocation(a, function (a) {
287
+ d(a);
288
+ });
289
+ };
290
+ AMapWX.prototype.getStaticmap = function (a) {
291
+ function f(b) {
292
+ c.push('location=' + b),
293
+ a.zoom && c.push('zoom=' + a.zoom),
294
+ a.size && c.push('size=' + a.size),
295
+ a.scale && c.push('scale=' + a.scale),
296
+ a.markers && c.push('markers=' + a.markers),
297
+ a.labels && c.push('labels=' + a.labels),
298
+ a.paths && c.push('paths=' + a.paths),
299
+ a.traffic && c.push('traffic=' + a.traffic);
300
+ var e = d + c.join('&');
301
+ a.success({
302
+ url: e
303
+ });
304
+ }
305
+ var e,
306
+ b = this,
307
+ c = [],
308
+ d = 'https://restapi.amap.com/v3/staticmap?';
309
+ c.push('key=' + b.key),
310
+ (e = b.requestConfig),
311
+ c.push('s=' + e.s),
312
+ c.push('platform=' + e.platform),
313
+ c.push('appname=' + e.appname),
314
+ c.push('sdkversion=' + e.sdkversion),
315
+ c.push('logversion=' + e.logversion),
316
+ a.location
317
+ ? f(a.location)
318
+ : b.getWxLocation(a, function (a) {
319
+ f(a);
320
+ });
321
+ };
322
+ AMapWX.prototype.getInputtips = function (a) {
323
+ var b = this,
324
+ c = b.requestConfig,
325
+ d = {
326
+ key: b.key,
327
+ s: c.s,
328
+ platform: c.platform,
329
+ appname: b.key,
330
+ sdkversion: c.sdkversion,
331
+ logversion: c.logversion
332
+ };
333
+ a.location && (d['location'] = a.location),
334
+ a.keywords && (d['keywords'] = a.keywords),
335
+ a.type && (d['type'] = a.type),
336
+ a.city && (d['city'] = a.city),
337
+ a.citylimit && (d['citylimit'] = a.citylimit),
338
+ wx.request({
339
+ url: 'https://restapi.amap.com/v3/assistant/inputtips',
340
+ data: d,
341
+ method: 'GET',
342
+ header: {
343
+ 'content-type': 'application/json'
344
+ },
345
+ success: function (b) {
346
+ b &&
347
+ b.data &&
348
+ b.data.tips &&
349
+ a.success({
350
+ tips: b.data.tips
351
+ });
352
+ },
353
+ fail: function (b) {
354
+ a.fail({
355
+ errCode: '0',
356
+ errMsg: b.errMsg || ''
357
+ });
358
+ }
359
+ });
360
+ };
361
+ AMapWX.prototype.getDrivingRoute = function (a) {
362
+ var b = this,
363
+ c = b.requestConfig,
364
+ d = {
365
+ key: b.key,
366
+ s: c.s,
367
+ platform: c.platform,
368
+ appname: b.key,
369
+ sdkversion: c.sdkversion,
370
+ logversion: c.logversion
371
+ };
372
+ a.origin && (d['origin'] = a.origin),
373
+ a.destination && (d['destination'] = a.destination),
374
+ a.strategy && (d['strategy'] = a.strategy),
375
+ a.waypoints && (d['waypoints'] = a.waypoints),
376
+ a.avoidpolygons && (d['avoidpolygons'] = a.avoidpolygons),
377
+ a.avoidroad && (d['avoidroad'] = a.avoidroad),
378
+ wx.request({
379
+ url: 'https://restapi.amap.com/v3/direction/driving',
380
+ data: d,
381
+ method: 'GET',
382
+ header: {
383
+ 'content-type': 'application/json'
384
+ },
385
+ success: function (b) {
386
+ b &&
387
+ b.data &&
388
+ b.data.route &&
389
+ a.success({
390
+ paths: b.data.route.paths,
391
+ taxi_cost: b.data.route.taxi_cost || ''
392
+ });
393
+ },
394
+ fail: function (b) {
395
+ a.fail({
396
+ errCode: '0',
397
+ errMsg: b.errMsg || ''
398
+ });
399
+ }
400
+ });
401
+ };
402
+ AMapWX.prototype.getWalkingRoute = function (a) {
403
+ var b = this,
404
+ c = b.requestConfig,
405
+ d = {
406
+ key: b.key,
407
+ s: c.s,
408
+ platform: c.platform,
409
+ appname: b.key,
410
+ sdkversion: c.sdkversion,
411
+ logversion: c.logversion
412
+ };
413
+ a.origin && (d['origin'] = a.origin),
414
+ a.destination && (d['destination'] = a.destination),
415
+ wx.request({
416
+ url: 'https://restapi.amap.com/v3/direction/walking',
417
+ data: d,
418
+ method: 'GET',
419
+ header: {
420
+ 'content-type': 'application/json'
421
+ },
422
+ success: function (b) {
423
+ b &&
424
+ b.data &&
425
+ b.data.route &&
426
+ a.success({
427
+ paths: b.data.route.paths
428
+ });
429
+ },
430
+ fail: function (b) {
431
+ a.fail({
432
+ errCode: '0',
433
+ errMsg: b.errMsg || ''
434
+ });
435
+ }
436
+ });
437
+ };
438
+ AMapWX.prototype.getTransitRoute = function (a) {
439
+ var b = this,
440
+ c = b.requestConfig,
441
+ d = {
442
+ key: b.key,
443
+ s: c.s,
444
+ platform: c.platform,
445
+ appname: b.key,
446
+ sdkversion: c.sdkversion,
447
+ logversion: c.logversion
448
+ };
449
+ a.origin && (d['origin'] = a.origin),
450
+ a.destination && (d['destination'] = a.destination),
451
+ a.strategy && (d['strategy'] = a.strategy),
452
+ a.city && (d['city'] = a.city),
453
+ a.cityd && (d['cityd'] = a.cityd),
454
+ wx.request({
455
+ url: 'https://restapi.amap.com/v3/direction/transit/integrated',
456
+ data: d,
457
+ method: 'GET',
458
+ header: {
459
+ 'content-type': 'application/json'
460
+ },
461
+ success: function (b) {
462
+ if (b && b.data && b.data.route) {
463
+ var c = b.data.route;
464
+ a.success({
465
+ distance: c.distance || '',
466
+ taxi_cost: c.taxi_cost || '',
467
+ transits: c.transits
468
+ });
469
+ }
470
+ },
471
+ fail: function (b) {
472
+ a.fail({
473
+ errCode: '0',
474
+ errMsg: b.errMsg || ''
475
+ });
476
+ }
477
+ });
478
+ };
479
+ AMapWX.prototype.getRidingRoute = function (a) {
480
+ var b = this,
481
+ c = b.requestConfig,
482
+ d = {
483
+ key: b.key,
484
+ s: c.s,
485
+ platform: c.platform,
486
+ appname: b.key,
487
+ sdkversion: c.sdkversion,
488
+ logversion: c.logversion
489
+ };
490
+ a.origin && (d['origin'] = a.origin),
491
+ a.destination && (d['destination'] = a.destination),
492
+ wx.request({
493
+ url: 'https://restapi.amap.com/v4/direction/bicycling',
494
+ data: d,
495
+ method: 'GET',
496
+ header: {
497
+ 'content-type': 'application/json'
498
+ },
499
+ success: function (b) {
500
+ b &&
501
+ b.data &&
502
+ b.data.data &&
503
+ a.success({
504
+ paths: b.data.data.paths
505
+ });
506
+ },
507
+ fail: function (b) {
508
+ a.fail({
509
+ errCode: '0',
510
+ errMsg: b.errMsg || ''
511
+ });
512
+ }
513
+ });
514
+ };
515
+ export default { AMapWX };
516
+ export default AMapWX;
517
+ // module.exports.AMapWX = AMapWX;
@@ -0,0 +1,10 @@
1
+ pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!
2
+ Theme: GitHub Dark
3
+ Description: Dark theme as seen on github.com
4
+ Author: github.com
5
+ Maintainer: @Hirse
6
+ Updated: 2021-05-15
7
+
8
+ Outdated base version: https://github.com/primer/github-syntax-dark
9
+ Current colors taken from GitHub's CSS
10
+ */.hljs{color:#c9d1d9;background:#0d1117}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#ff7b72}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#d2a8ff}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#79c0ff}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#a5d6ff}.hljs-built_in,.hljs-symbol{color:#ffa657}.hljs-code,.hljs-comment,.hljs-formula{color:#8b949e}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#7ee787}.hljs-subst{color:#c9d1d9}.hljs-section{color:#1f6feb;font-weight:700}.hljs-bullet{color:#f2cc60}.hljs-emphasis{color:#c9d1d9;font-style:italic}.hljs-strong{color:#c9d1d9;font-weight:700}.hljs-addition{color:#aff5b4;background-color:#033a16}.hljs-deletion{color:#ffdcd7;background-color:#67060c}