|
|
@@ -2,7 +2,8 @@ import * as Location from 'expo-location';
|
|
|
import * as Permissions from 'expo-permissions';
|
|
|
import * as TaskManager from 'expo-task-manager';
|
|
|
import request from './RequestUtils';
|
|
|
-import { alert } from './TotastUtils';
|
|
|
+import { alert } from './SystemUtils';
|
|
|
+import * as Linking from 'expo-linking';
|
|
|
|
|
|
const key = 'c4faf80125b298f93bbc1477db10e69c';
|
|
|
const tengxunKey = 'GLFBZ-ZR2W6-76XSA-MF7CQ-GDJ6Z-6FB5K';
|
|
|
@@ -107,4 +108,27 @@ function mapMarks(params) {
|
|
|
return `https://restapi.amap.com/v3/staticmap?zoom=15&size=500*500&paths=10,0x0000ff,1,,:116.31604,39.96491;116.320816,39.966606;116.321785,39.966827;116.32361,39.966957&key=${key}`;
|
|
|
}
|
|
|
|
|
|
-export { getLocation, getSearch };
|
|
|
+function changeCord(lnglat) {
|
|
|
+ if (lnglat) {
|
|
|
+ const strs = lnglat.split(',');
|
|
|
+ return strs[1] + ',' + strs[0];
|
|
|
+ } else {
|
|
|
+ return ',';
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function goMap(toName, tocoord, navigation) {
|
|
|
+ var url = `qqmap://map/routeplan?type=drive&to=${toName}&tocoord=${tocoord}&referer=${tengxunKey}`;
|
|
|
+ Linking.canOpenURL(url).then((res) => {
|
|
|
+ if (res) {
|
|
|
+ Linking.openURL(url);
|
|
|
+ } else {
|
|
|
+ alert(navigation, {
|
|
|
+ msg: '请下载腾讯地图app进行精准导航',
|
|
|
+ hasCancel: false,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+export { getLocation, getSearch, tengxunKey, changeCord, goMap };
|