|
@@ -46,24 +46,26 @@ export const getLocation = async (options) => {
|
46
|
46
|
};
|
47
|
47
|
const key = "HTPBZ-HHJA7-XD2XD-PRS37-H3HVJ-U5BAA";
|
48
|
48
|
export const h5GetLocation = () => {
|
49
|
|
- return new Promise((resolve, reject) => {
|
50
|
|
- const url = `${MAPHOST}/ws/location/v1/ip?key=${key}`;
|
51
|
|
- const res = Taro.request({
|
52
|
|
- url: url,
|
53
|
|
- method: "GET",
|
54
|
|
- dataType: "json",
|
55
|
|
- header: {
|
56
|
|
- "content-type": "application/json",
|
57
|
|
- },
|
58
|
|
- });
|
59
|
|
- resolve(res);
|
60
|
|
- reject(res);
|
61
|
|
- // .then((res) => {
|
62
|
|
- // resolve(res.result);
|
63
|
|
- // })
|
64
|
|
- // .catch((error) => {
|
65
|
|
- // reject(error);
|
66
|
|
- // console.error("请求失败", error);
|
67
|
|
- // });
|
68
|
|
- });
|
|
49
|
+ return new TMap.service.IPLocation().locate();
|
|
50
|
+
|
|
51
|
+ // return new Promise((resolve, reject) => {
|
|
52
|
+ // const url = `${MAPHOST}/ws/location/v1/ip?key=${key}`;
|
|
53
|
+ // const res = Taro.request({
|
|
54
|
+ // url: url,
|
|
55
|
+ // method: "GET",
|
|
56
|
+ // dataType: "json",
|
|
57
|
+ // header: {
|
|
58
|
+ // "content-type": "application/json",
|
|
59
|
+ // },
|
|
60
|
+ // });
|
|
61
|
+ // resolve(res);
|
|
62
|
+ // reject(res);
|
|
63
|
+ // // .then((res) => {
|
|
64
|
+ // // resolve(res.result);
|
|
65
|
+ // // })
|
|
66
|
+ // // .catch((error) => {
|
|
67
|
+ // // reject(error);
|
|
68
|
+ // // console.error("请求失败", error);
|
|
69
|
+ // // });
|
|
70
|
+ // });
|
69
|
71
|
};
|