1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
| toMapAPP(data) { const { lat, lng, shopName, name } = data; let url = ""; if (plus.os.name == "Android") { plus.nativeUI.actionSheet({ title: "选择地图应用", cancel: "取消", buttons: [{ title: "百度地图", }, { title: "高德地图", }, ], }, function(e) { switch (e.index) { case 1: url = `baidumap://map/marker?location=${lat},${lng}&title=${name||shopName}&src=taoliangche&coord_type=gcj02` break; case 2: url = `androidamap://arroundpoi?sourceApplication=softname&keywords=${name||shopName}&lat=${lat}&lon=${lng}&dev=0`; break; default: break; } if (url != "") { url = encodeURI(url); plus.runtime.openURL(url, function(e) { plus.nativeUI.alert("本机未安装指定的地图应用"); }); } } ); } else { plus.nativeUI.actionSheet({ title: "选择地图应用", cancel: "取消", buttons: [ { title: "百度地图", }, { title: "高德地图", }, ], }, function(e) { switch (e.index) { case 1: url = `baidumap://map/direction?origin={{我的位置}}&destination=latlng:${lat},${lng}|name=${shopName||name}&mode=driving&coord_type=bd09ll`; break; case 2: url = `iosamap://path?sourceApplication=掏靓车&keywords=${shopName||name}&dlat=${lat}&dlon=${lng}&dev=0&style=0`; break; default: break; } if (url != "") { url = encodeURI(url); plus.runtime.openURL(url, function(e) { plus.nativeUI.alert("本机未安装指定的地图应用"); }); } } ); } },
|