新增IOS跳转高德,优化安卓跳转高德

This commit is contained in:
weipengfei 2023-08-25 16:34:30 +08:00
parent e9da383a41
commit 23d9264123
4 changed files with 81 additions and 30 deletions

View File

@ -71,6 +71,9 @@
}
}
},
"apple":{
"urlschemewhitelist":["iosamap"]
},
"splashscreen" : {
"useOriginalMsgbox" : true
},

View File

@ -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('');
// iOSmanifest
// manifest.jsonapp-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

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -113,7 +113,7 @@
id: 2,
latitude: undefined,
longitude: undefined,
iconPath: '../../static/img/logistics/QS.png', //
iconPath: '../../static/img/logistics/SL.png', //
}
],
polyline: [],