新增IOS跳转高德,优化安卓跳转高德
This commit is contained in:
parent
e9da383a41
commit
23d9264123
@ -71,6 +71,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"apple":{
|
||||
"urlschemewhitelist":["iosamap"]
|
||||
},
|
||||
"splashscreen" : {
|
||||
"useOriginalMsgbox" : true
|
||||
},
|
||||
|
@ -101,6 +101,7 @@
|
||||
import {
|
||||
takeGoods
|
||||
} from "@/api/logistics.js"
|
||||
import { Toast } from "../../libs/uniApi";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -165,7 +166,43 @@
|
||||
|
||||
// 唤起高德
|
||||
test() {
|
||||
if (this.is_captain) return
|
||||
if (this.is_captain) return;
|
||||
let that = this;
|
||||
uni.getSystemInfo({
|
||||
success(e) {
|
||||
if(e.platform ==='ios'){
|
||||
// Toast('不支持');
|
||||
// iOS上获取本机是否安装了百度高德地图,需要在manifest里配置
|
||||
// 在manifest.json文件app-plus->distribute->apple->urlschemewhitelist节点下添加
|
||||
//(如urlschemewhitelist:["iosamap","baidumap"])
|
||||
plus.nativeUI.actionSheet({
|
||||
title: "选择地图应用",
|
||||
cancel: "取消",
|
||||
buttons: [{title: "高德地图"}]
|
||||
}, function(e) {
|
||||
if(e.index!=1)return;
|
||||
try{
|
||||
let url = `iosamap://viewMap?sourceApplication=applicationName&poiname=${that.goodsDetil.logistics.shop_name}&lat=${that.markers[0].latitude}&lon=${that.markers[0].longitude}&dev=0`;
|
||||
if (url != "") {
|
||||
url = encodeURI(url);
|
||||
plus.runtime.openURL(url, function(e) {
|
||||
plus.nativeUI.alert("本机未安装指定的地图应用");
|
||||
});
|
||||
}
|
||||
}catch(e){
|
||||
console.log(e);
|
||||
Toast('暂不支持唤起地图')
|
||||
}
|
||||
})
|
||||
}
|
||||
else {
|
||||
plus.nativeUI.actionSheet({
|
||||
title: "选择地图应用",
|
||||
cancel: "取消",
|
||||
buttons: [{title: "高德地图"}]
|
||||
}, function(e) {
|
||||
if(e.index!=1)return;
|
||||
try{
|
||||
var packageName = 'com.autonavi.minimap';
|
||||
var main = plus.android.runtimeMainActivity();
|
||||
var packageManager = main.getPackageManager();
|
||||
@ -175,7 +212,7 @@
|
||||
var Uri = plus.android.importClass("android.net.Uri");
|
||||
var url =
|
||||
`amapuri://route/plan?sourceApplication=maxuslife+
|
||||
&sid=A&slat=36.702558&slon=116.876678&sname=我的位置&did=B&dlat=${this.markers[0].latitude}&dlon=${this.markers[0].longitude}&dname=${this.goodsDetil.logistics.shop_name}&dev=0&t=0`;
|
||||
&sid=A&slat=36.702558&slon=116.876678&sname=我的位置&did=B&dlat=${that.markers[0].latitude}&dlon=${that.markers[0].longitude}&dname=${that.goodsDetil.logistics.shop_name}&dev=0&t=0`;
|
||||
var Intent = plus.android.importClass('android.content.Intent');
|
||||
var intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
@ -186,7 +223,8 @@
|
||||
intent.setPackage("com.autonavi.minimap");
|
||||
var main = plus.android.runtimeMainActivity();
|
||||
main.startActivity(intent);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// alert('未安装' + packageName + '')
|
||||
uni.showToast({
|
||||
title: `只支持高德地图`,
|
||||
@ -194,6 +232,16 @@
|
||||
})
|
||||
}
|
||||
console.log("唤醒高德线路规划")
|
||||
}catch(e){
|
||||
console.log(e);
|
||||
Toast('启动出错')
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
showToast() {
|
||||
this.$refs.uToast.show({
|
||||
|
BIN
static/img/logistics/SL.png
Normal file
BIN
static/img/logistics/SL.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
@ -113,7 +113,7 @@
|
||||
id: 2,
|
||||
latitude: undefined,
|
||||
longitude: undefined,
|
||||
iconPath: '../../static/img/logistics/QS.png', //显示的图标
|
||||
iconPath: '../../static/img/logistics/SL.png', //显示的图标
|
||||
}
|
||||
],
|
||||
polyline: [],
|
||||
|
Loading…
x
Reference in New Issue
Block a user