jufubao-base 1.0.373 → 1.0.375
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/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
>
|
|
12
12
|
<bm-navigation anchor="BMAP_ANCHOR_TOP_RIGHT" type="NavigationControlType"></bm-navigation>
|
|
13
13
|
<bm-geolocation
|
|
14
|
-
v-if="isGeolocation"
|
|
14
|
+
v-if="isGeolocation && !isWebviewMp"
|
|
15
15
|
@locationSuccess="handleLocationSuccess"
|
|
16
16
|
class="xd-baidu__content-geolocation"
|
|
17
17
|
anchor="BMAP_ANCHOR_BOTTOM_RIGHT"
|
|
@@ -230,12 +230,14 @@
|
|
|
230
230
|
//判断地图是否加载完成
|
|
231
231
|
BMap: null,
|
|
232
232
|
loaded: false,
|
|
233
|
+
isWebviewMp: false,//是否是小程序套嵌情况
|
|
233
234
|
}
|
|
234
235
|
},
|
|
235
236
|
|
|
236
237
|
|
|
237
238
|
created() {
|
|
238
239
|
this.uiAk = this.$settings.baiduAk || this.ak;
|
|
240
|
+
this.isWebviewMp = !!navigator.userAgent.match(/miniprogram/i);
|
|
239
241
|
if(!this.uiAk) throw new Error('请传入百度AK值');
|
|
240
242
|
else{
|
|
241
243
|
let uiCenter = '北京';
|
|
@@ -292,24 +294,34 @@
|
|
|
292
294
|
|
|
293
295
|
handleInitDone({BMap}){
|
|
294
296
|
if(this.isGeolocation) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
(
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
this.
|
|
304
|
-
|
|
305
|
-
|
|
297
|
+
|
|
298
|
+
//非小程序套嵌情况
|
|
299
|
+
if(!this.isWebviewMp){
|
|
300
|
+
let geolocation = new BMap['Geolocation']();
|
|
301
|
+
geolocation['enableSDKLocation']();
|
|
302
|
+
geolocation.getCurrentPosition(
|
|
303
|
+
(location) => {
|
|
304
|
+
console.log('handleInitDone',location)
|
|
305
|
+
if(!this.defaultOverlays || this.defaultOverlays.length === 0) {
|
|
306
|
+
let point = this.$xdUniHelper.cloneDeep(location.point);
|
|
307
|
+
delete point['of']
|
|
308
|
+
this.uiGeolocation = point;
|
|
309
|
+
this.uiLevel = 15;
|
|
310
|
+
this.uiCenter = point;
|
|
311
|
+
}
|
|
312
|
+
this.$emit('onLocationSuccess',location);
|
|
313
|
+
},
|
|
314
|
+
(error) => {
|
|
315
|
+
console.log('handleInitDone',error)
|
|
306
316
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
317
|
+
)
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
//小程序套嵌情况
|
|
321
|
+
else {
|
|
322
|
+
//todo
|
|
323
|
+
}
|
|
324
|
+
|
|
313
325
|
}
|
|
314
326
|
},
|
|
315
327
|
|