@heycar/heycars-map 2.0.0-switchMap1 → 2.0.0-switchMap10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -29
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/v2/App.js +5 -3
- package/dist/v2/Demo/DemoBusinessQuoting.js +3 -2
- package/dist/v2/Demo/DemoBusinessRecomendPlace.js +1 -1
- package/dist/v2/api/cdn.d.ts +1 -0
- package/dist/v2/api/cdn.js +2 -0
- package/dist/v2/api/googleSnapRoad.js +7 -2
- package/dist/v2/api/pingConnection.d.ts +9 -0
- package/dist/v2/api/pingConnection.js +111 -0
- package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.js +5 -2
- package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +2 -2
- package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +4 -3
- package/dist/v2/business-components/BusinessRecomendPlaceMap/index.js +3 -3
- package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +2 -2
- package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +22 -13
- package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +12 -5
- package/dist/v2/chunks/{BusinessRecomendPlaceMap.5be4fdcf.js → BusinessRecomendPlaceMap.b4d45108.js} +30 -18
- package/dist/v2/chunks/{Loading.fc6e75d0.js → Loading.492acbc2.js} +30 -2
- package/dist/v2/components/Loading/Loading.css.d.ts +5 -0
- package/dist/v2/components/Loading/Loading.d.ts +6 -0
- package/dist/v2/components/Loading/Loading.js +4 -2
- package/dist/v2/components/Loading/index.js +3 -2
- package/dist/v2/components/MapProvider/MapProvider.d.ts +2 -2
- package/dist/v2/components/MapProvider/MapProvider.js +23 -13
- package/dist/v2/css/Loading-49e58ced.css +46 -0
- package/dist/v2/hooks/useDrivingRoute.js +4 -0
- package/dist/v2/hooks/useMapGCJ02.js +4 -37
- package/dist/v2/hooks/useMapGeometry.d.ts +1 -3
- package/dist/v2/hooks/useMapGeometry.js +4 -4
- package/dist/v2/hooks/useMapGraspRoad.js +1 -2
- package/dist/v2/hooks/useMapInChina.d.ts +3 -15
- package/dist/v2/hooks/useMapInChina.js +11 -16
- package/dist/v2/hooks/useMapLoader.d.ts +13 -7
- package/dist/v2/hooks/useMapLoader.js +144 -82
- package/dist/v2/hooks/useMapPlace.d.ts +1 -0
- package/dist/v2/hooks/useMapPlace.js +52 -44
- package/dist/v2/hooks/useMapRecomendPlace.d.ts +1 -0
- package/dist/v2/hooks/useMapRecomendPlace.js +75 -67
- package/dist/v2/hooks/useMapSupplier.d.ts +8 -0
- package/dist/v2/hooks/useMapSupplier.js +17 -0
- package/dist/v2/hooks/usePingConnection.d.ts +10 -0
- package/dist/v2/hooks/usePingConnection.js +26 -0
- package/dist/v2/hooks-business/useBusinessQuotingMap.d.ts +2 -0
- package/dist/v2/hooks-business/useBusinessQuotingMap.js +7 -2
- package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.js +1 -1
- package/dist/v2/index.js +1 -1
- package/dist/v2/types/global.d.ts +3 -0
- package/dist/v2/types/interface.d.ts +1 -1
- package/dist/v2/utils/ManualAbortError.d.ts +3 -0
- package/dist/v2/utils/ManualAbortError.js +14 -0
- package/dist/v2/utils/helper.d.ts +2 -0
- package/dist/v2/utils/helper.js +29 -0
- package/dist/v2/utils/log.js +1 -1
- package/dist/v2/utils/patchGoogleMapLoader.d.ts +2 -0
- package/dist/v2/utils/patchGoogleMapLoader.js +64 -0
- package/dist/v3/App.js +5 -3
- package/dist/v3/Demo/DemoBusinessQuoting.js +4 -3
- package/dist/v3/Demo/DemoBusinessRecomendPlace.js +1 -1
- package/dist/v3/api/cdn.d.ts +1 -0
- package/dist/v3/api/cdn.js +2 -0
- package/dist/v3/api/googleSnapRoad.js +7 -2
- package/dist/v3/api/pingConnection.d.ts +9 -0
- package/dist/v3/api/pingConnection.js +111 -0
- package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.js +5 -2
- package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +2 -2
- package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +4 -3
- package/dist/v3/business-components/BusinessRecomendPlaceMap/index.js +3 -3
- package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +2 -2
- package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +22 -13
- package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +12 -5
- package/dist/v3/chunks/{BusinessRecomendPlaceMap.39888296.js → BusinessRecomendPlaceMap.6ba5dbb1.js} +30 -18
- package/dist/v3/chunks/{Loading.a8e2f26a.js → Loading.21d8e759.js} +26 -2
- package/dist/v3/components/Loading/Loading.css.d.ts +5 -0
- package/dist/v3/components/Loading/Loading.d.ts +8 -0
- package/dist/v3/components/Loading/Loading.js +4 -2
- package/dist/v3/components/Loading/index.js +3 -2
- package/dist/v3/components/MapProvider/MapProvider.d.ts +6 -3
- package/dist/v3/components/MapProvider/MapProvider.js +21 -13
- package/dist/v3/css/Loading-49e58ced.css +46 -0
- package/dist/v3/hooks/useDrivingRoute.js +4 -0
- package/dist/v3/hooks/useMapGCJ02.js +4 -37
- package/dist/v3/hooks/useMapGeometry.d.ts +1 -3
- package/dist/v3/hooks/useMapGeometry.js +4 -4
- package/dist/v3/hooks/useMapGraspRoad.js +1 -2
- package/dist/v3/hooks/useMapInChina.d.ts +3 -15
- package/dist/v3/hooks/useMapInChina.js +11 -16
- package/dist/v3/hooks/useMapLoader.d.ts +13 -7
- package/dist/v3/hooks/useMapLoader.js +144 -82
- package/dist/v3/hooks/useMapPlace.d.ts +1 -0
- package/dist/v3/hooks/useMapPlace.js +52 -44
- package/dist/v3/hooks/useMapRecomendPlace.d.ts +1 -0
- package/dist/v3/hooks/useMapRecomendPlace.js +75 -67
- package/dist/v3/hooks/useMapSupplier.d.ts +8 -0
- package/dist/v3/hooks/useMapSupplier.js +17 -0
- package/dist/v3/hooks/usePingConnection.d.ts +10 -0
- package/dist/v3/hooks/usePingConnection.js +26 -0
- package/dist/v3/hooks-business/useBusinessQuotingMap.d.ts +2 -0
- package/dist/v3/hooks-business/useBusinessQuotingMap.js +7 -2
- package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.js +1 -1
- package/dist/v3/index.js +1 -1
- package/dist/v3/types/global.d.ts +3 -0
- package/dist/v3/types/interface.d.ts +1 -1
- package/dist/v3/utils/ManualAbortError.d.ts +3 -0
- package/dist/v3/utils/ManualAbortError.js +14 -0
- package/dist/v3/utils/helper.d.ts +2 -0
- package/dist/v3/utils/helper.js +29 -0
- package/dist/v3/utils/log.js +1 -1
- package/dist/v3/utils/patchGoogleMapLoader.d.ts +2 -0
- package/dist/v3/utils/patchGoogleMapLoader.js +64 -0
- package/package.json +2 -2
- package/dist/v2/api/googleConnection.d.ts +0 -5
- package/dist/v2/api/googleConnection.js +0 -51
- package/dist/v2/css/Loading-523061b9.css +0 -9
- package/dist/v2/hooks/useGoogleConnection.d.ts +0 -7
- package/dist/v2/hooks/useGoogleConnection.js +0 -15
- package/dist/v3/api/googleConnection.d.ts +0 -5
- package/dist/v3/api/googleConnection.js +0 -51
- package/dist/v3/css/Loading-523061b9.css +0 -9
- package/dist/v3/hooks/useGoogleConnection.d.ts +0 -7
- package/dist/v3/hooks/useGoogleConnection.js +0 -15
package/README.md
CHANGED
|
@@ -120,6 +120,12 @@ export interface BusinessGeolocationPositionError extends GeolocationPositionErr
|
|
|
120
120
|
gmapKey={gmapApiKey}
|
|
121
121
|
// 使用哪个地图供应商,目前两个供应商: amap 高德 / gmap 谷歌
|
|
122
122
|
supplier={"amap"}
|
|
123
|
+
// 地图加载失败时显示的标题
|
|
124
|
+
renderLoadFailedTitle={() => (supplier === "gmap" ? "未能成功访问谷歌地图" : "高德地图加载失败")}
|
|
125
|
+
// 地图加载失败时显示的描述
|
|
126
|
+
renderLoadFailedDescription={() =>
|
|
127
|
+
supplier === "gmap" ? "请确认您的网络能正常访问谷歌地图, \n或切回高德地图" : undefined
|
|
128
|
+
}
|
|
123
129
|
>
|
|
124
130
|
...
|
|
125
131
|
</MapProvider>
|
|
@@ -134,6 +140,8 @@ export interface BusinessGeolocationPositionError extends GeolocationPositionErr
|
|
|
134
140
|
:amap-key="amapApiKey"
|
|
135
141
|
:amap-secret="amapApiSecret"
|
|
136
142
|
supplier="amap"
|
|
143
|
+
render-load-failed-title='() => supplier === "gmap" ? "未能成功访问谷歌地图" : "高德地图加载失败"'
|
|
144
|
+
render-load-failed-description='() => supplier === "gmap" ? "请确认您的网络能正常访问谷歌地图,\n或切回高德地图" : undefined'
|
|
137
145
|
>
|
|
138
146
|
...
|
|
139
147
|
</MapProvider>
|
|
@@ -431,36 +439,42 @@ import { BusinessQuotingMap, useBusinessQuotingMap } from "@heycar/heycars-map";
|
|
|
431
439
|
|
|
432
440
|
export default defineComponent({
|
|
433
441
|
setup() {
|
|
434
|
-
const { mapContext } = useBusinessQuotingMap();
|
|
442
|
+
const { mapContext, toAmapCoordinateType } = useBusinessQuotingMap();
|
|
435
443
|
return () => (
|
|
436
|
-
<
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
444
|
+
<div>
|
|
445
|
+
<BusinessQuotingMap
|
|
446
|
+
class={"demo"}
|
|
447
|
+
from={{
|
|
448
|
+
displayName: "The Malayan Council",
|
|
449
|
+
name: "10 Winstedt Rd, #01-17, Singapore 227977",
|
|
450
|
+
type: "wgs84",
|
|
451
|
+
lat: 1.311295,
|
|
452
|
+
lng: 103.841974,
|
|
453
|
+
}}
|
|
454
|
+
to={{
|
|
455
|
+
displayName: "CDG Engie Charging Station",
|
|
456
|
+
name: "21 Kent Ridge Rd, Singapore 119220",
|
|
457
|
+
type: "wgs84",
|
|
458
|
+
lat: 1.2966426,
|
|
459
|
+
lng: 103.7763939,
|
|
460
|
+
}}
|
|
461
|
+
fromDescription={"您将在此上车"}
|
|
462
|
+
renderDescription={({ distance, duration, tolls }) =>
|
|
463
|
+
`全程 *${distance / 1000}公里* 约行驶 *${duration}* 高速费用 *${tolls ?? 0}*元`
|
|
464
|
+
}
|
|
465
|
+
mapContext={mapContext}
|
|
466
|
+
onClickStartPoint={(place) => console.log("点击起点时触发 palce = ", place)}
|
|
467
|
+
onClickEndPoint={(place) => console.log("点击终点时触发 palce = ", place)}
|
|
468
|
+
onChangeGoogleConnection={(status) =>
|
|
469
|
+
// 根据目前的产品需求,连通性检测只会被检测一次。
|
|
470
|
+
console.log("谷歌连通性发生变化时触发,连通性状态是:", status)
|
|
471
|
+
}
|
|
472
|
+
/>
|
|
473
|
+
<div>
|
|
474
|
+
经度 103.841974, 纬度 1.311295 在高德地图上的坐标类型是:
|
|
475
|
+
{toAmapCoordinateType([103.841974, 1.311295])}
|
|
476
|
+
</div>
|
|
477
|
+
<div>
|
|
464
478
|
);
|
|
465
479
|
},
|
|
466
480
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./v2"
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./v2"
|
package/dist/v2/App.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h } from "vue";
|
|
2
2
|
import { defineComponent, ref } from "vue-demi";
|
|
3
|
-
import {
|
|
3
|
+
import { DemoBusinessQuoting } from "./Demo/DemoBusinessQuoting.js";
|
|
4
4
|
import { MapProvider } from "./components/MapProvider/MapProvider.js";
|
|
5
5
|
const gmapApiKey = "AIzaSyCRtkaNSWMOhOXDOUpJK4OVbm5RIstYj-I";
|
|
6
6
|
const gmapId = "d0af0c05331af64a";
|
|
@@ -19,9 +19,11 @@ const App = defineComponent({
|
|
|
19
19
|
"gmapRasterId": gmapRasterId,
|
|
20
20
|
"gmapKey": gmapApiKey,
|
|
21
21
|
"language": "en",
|
|
22
|
-
"supplier": supplierRef.value
|
|
22
|
+
"supplier": supplierRef.value,
|
|
23
|
+
"renderLoadFailedTitle": () => supplierRef.value === "gmap" ? "未能成功访问谷歌地图" : "高德地图加载失败",
|
|
24
|
+
"renderLoadFailedDescription": () => supplierRef.value === "gmap" ? "请确认您的网络能正常访问谷歌地图, \n或切回高德地图" : void 0
|
|
23
25
|
}
|
|
24
|
-
}, [h(
|
|
26
|
+
}, [h(DemoBusinessQuoting)]);
|
|
25
27
|
}
|
|
26
28
|
});
|
|
27
29
|
export {
|
|
@@ -5,7 +5,8 @@ import { defineSetup } from "../types/helper.js";
|
|
|
5
5
|
import { d as demo } from "../chunks/Demo.css.e921a2f6.js";
|
|
6
6
|
const DemoBusinessQuoting = defineSetup("DemoBusinessQuoting", function() {
|
|
7
7
|
const {
|
|
8
|
-
mapContext
|
|
8
|
+
mapContext,
|
|
9
|
+
toAmapCoordinateType
|
|
9
10
|
} = useBusinessQuotingMap();
|
|
10
11
|
return () => h("div", [h(BusinessQuotingMap, {
|
|
11
12
|
"class": demo,
|
|
@@ -36,7 +37,7 @@ const DemoBusinessQuoting = defineSetup("DemoBusinessQuoting", function() {
|
|
|
36
37
|
"clickStartPoint": (place) => console.log("点击起点时触发 palce = ", place),
|
|
37
38
|
"clickEndPoint": (place) => console.log("点击终点时触发 palce = ", place)
|
|
38
39
|
}
|
|
39
|
-
})]);
|
|
40
|
+
}), h("div", ["经度 103.841974, 纬度 1.311295 在高德地图上的坐标类型是:", toAmapCoordinateType([103.841974, 1.311295])])]);
|
|
40
41
|
});
|
|
41
42
|
export {
|
|
42
43
|
DemoBusinessQuoting
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h } from "vue";
|
|
2
|
-
import { B as BusinessRecomendPlaceMap } from "../chunks/BusinessRecomendPlaceMap.
|
|
2
|
+
import { B as BusinessRecomendPlaceMap } from "../chunks/BusinessRecomendPlaceMap.b4d45108.js";
|
|
3
3
|
import { useBusinessRecomendPlaceMap } from "../hooks-business/useBusinessRecomendPlaceMap.js";
|
|
4
4
|
import { defineSetup } from "../types/helper.js";
|
|
5
5
|
import { d as demo } from "../chunks/Demo.css.e921a2f6.js";
|
package/dist/v2/api/cdn.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export declare const ICON_END_POINT_EN_URL = "https://overseas-oss.heycars.cn/he
|
|
|
5
5
|
export declare const ICON_END_POINT_ZH_TW_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/end-point-zh-TW.svg";
|
|
6
6
|
export declare const ICON_TAXI_CAR_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/taxi-car.svg";
|
|
7
7
|
export declare const ICON_DOT_LOADING_URL = "https://overseas-oss.heycars.cn/heycar-map/gif/dot-loading.gif";
|
|
8
|
+
export declare const ICON_LOAD_FAILED_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/load-failed.svg";
|
package/dist/v2/api/cdn.js
CHANGED
|
@@ -5,12 +5,14 @@ const ICON_END_POINT_EN_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/en
|
|
|
5
5
|
const ICON_END_POINT_ZH_TW_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/end-point-zh-TW.svg";
|
|
6
6
|
const ICON_TAXI_CAR_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/taxi-car.svg";
|
|
7
7
|
const ICON_DOT_LOADING_URL = "https://overseas-oss.heycars.cn/heycar-map/gif/dot-loading.gif";
|
|
8
|
+
const ICON_LOAD_FAILED_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/load-failed.svg";
|
|
8
9
|
export {
|
|
9
10
|
AMAP_DEFAULT_MARKER_ICON_URL,
|
|
10
11
|
ICON_DOT_LOADING_URL,
|
|
11
12
|
ICON_END_POINT_EN_URL,
|
|
12
13
|
ICON_END_POINT_ZH_TW_URL,
|
|
13
14
|
ICON_FULL_SCREEN_URL,
|
|
15
|
+
ICON_LOAD_FAILED_URL,
|
|
14
16
|
ICON_START_POINT_EN_URL,
|
|
15
17
|
ICON_TAXI_CAR_URL
|
|
16
18
|
};
|
|
@@ -13,9 +13,14 @@ function assertLatitudeLongitudeLiteral(value) {
|
|
|
13
13
|
throw Error(`MyError: expect type LatitudeLongitudeLiteral, actual is: ${JSON.stringify(value)}`);
|
|
14
14
|
}
|
|
15
15
|
function assertSnappedPoint(value) {
|
|
16
|
-
|
|
16
|
+
const error = Error(`MyError: expect type SnappedPoint, actual is: ${JSON.stringify(value)}`);
|
|
17
|
+
if (!value)
|
|
18
|
+
throw error;
|
|
19
|
+
try {
|
|
17
20
|
assertLatitudeLongitudeLiteral(value.location);
|
|
18
|
-
|
|
21
|
+
} catch {
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
25
|
function assertSnapToRoadsResponse(value) {
|
|
21
26
|
const error = Error(
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ConnectionStatus } from "../types/interface";
|
|
2
|
+
export type PingConnectionOnChangeHandler = (status: ConnectionStatus) => void;
|
|
3
|
+
export type PingConnectionOnChangeCleanup = () => void;
|
|
4
|
+
export declare const apiGetPingAmapStatus: () => ConnectionStatus;
|
|
5
|
+
export declare const apiGetPingGmapStatus: () => ConnectionStatus;
|
|
6
|
+
export declare const apiPingAmap: () => Promise<ConnectionStatus>;
|
|
7
|
+
export declare const apiPingGmap: () => Promise<ConnectionStatus>;
|
|
8
|
+
export declare const apiSubscribePingAmapChange: (handler: PingConnectionOnChangeHandler) => PingConnectionOnChangeCleanup;
|
|
9
|
+
export declare const apiSubscribePingGmapChange: (handler: PingConnectionOnChangeHandler) => PingConnectionOnChangeCleanup;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { sleep } from "../utils/helper.js";
|
|
8
|
+
const PING_AMAP_URL = "https://webapi.amap.com/maps";
|
|
9
|
+
const PING_AMAP_TIMEOUT = 5e3;
|
|
10
|
+
const PING_AMAP_INTERVAL = 5e3;
|
|
11
|
+
const PING_GMAP_URL = "https://maps.googleapis.com/maps/api/mapsjs/gen_204";
|
|
12
|
+
const PING_GMAP_TIMEOUT = 5e3;
|
|
13
|
+
const PING_GMAP_INTERVAL = 5e3;
|
|
14
|
+
const noop = () => {
|
|
15
|
+
};
|
|
16
|
+
const toUncachableUrl = (url, label = "") => {
|
|
17
|
+
const parsedUrl = new URL(url);
|
|
18
|
+
const randomKey = `ping${Date.now()}`;
|
|
19
|
+
parsedUrl.searchParams.set(randomKey, label);
|
|
20
|
+
return parsedUrl.toString();
|
|
21
|
+
};
|
|
22
|
+
class PingConnection {
|
|
23
|
+
constructor({ timeout, url, fetchOption }) {
|
|
24
|
+
__publicField(this, "timeout");
|
|
25
|
+
__publicField(this, "url");
|
|
26
|
+
__publicField(this, "fetchOption");
|
|
27
|
+
__publicField(this, "status", "pending");
|
|
28
|
+
__publicField(this, "listeners", /* @__PURE__ */ new Set());
|
|
29
|
+
__publicField(this, "updatingPromise");
|
|
30
|
+
this.timeout = timeout;
|
|
31
|
+
this.url = url;
|
|
32
|
+
this.fetchOption = fetchOption;
|
|
33
|
+
}
|
|
34
|
+
// 只有订阅了 onChange 事件,listen 才会更新状态
|
|
35
|
+
async listen(interval) {
|
|
36
|
+
while (true) {
|
|
37
|
+
if (this.listeners.size > 0)
|
|
38
|
+
await this.updateStatus();
|
|
39
|
+
await sleep(interval);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async updateStatus() {
|
|
43
|
+
const { url, timeout, fetchOption } = this;
|
|
44
|
+
if (this.updatingPromise)
|
|
45
|
+
return this.updatingPromise;
|
|
46
|
+
return this.updatingPromise = this.check(url, timeout, fetchOption).then((status) => {
|
|
47
|
+
this.status = status;
|
|
48
|
+
this.updatingPromise = void 0;
|
|
49
|
+
for (const handler of this.listeners) {
|
|
50
|
+
try {
|
|
51
|
+
handler(status);
|
|
52
|
+
} catch (err) {
|
|
53
|
+
console.error(err);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return status;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
check(url, timeout, fetchOption) {
|
|
60
|
+
const controller = new AbortController();
|
|
61
|
+
const timer = setTimeout(() => controller.abort(), timeout);
|
|
62
|
+
return fetch(toUncachableUrl(url, timeout.toString()), {
|
|
63
|
+
signal: controller.signal,
|
|
64
|
+
...fetchOption
|
|
65
|
+
}).then(() => "connected").catch(() => "unconnected").finally(() => clearTimeout(timer));
|
|
66
|
+
}
|
|
67
|
+
onChange(handler) {
|
|
68
|
+
if (typeof handler !== "function")
|
|
69
|
+
return noop;
|
|
70
|
+
this.listeners.add(handler);
|
|
71
|
+
const clear = () => {
|
|
72
|
+
this.listeners.delete(handler);
|
|
73
|
+
};
|
|
74
|
+
return clear;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const pingAmapConnection = new PingConnection({
|
|
78
|
+
timeout: PING_AMAP_TIMEOUT,
|
|
79
|
+
url: PING_AMAP_URL,
|
|
80
|
+
fetchOption: {
|
|
81
|
+
method: "HEAD"
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const pingGmapConnection = new PingConnection({
|
|
85
|
+
timeout: PING_GMAP_TIMEOUT,
|
|
86
|
+
url: PING_GMAP_URL
|
|
87
|
+
});
|
|
88
|
+
pingAmapConnection.listen(PING_AMAP_INTERVAL);
|
|
89
|
+
pingGmapConnection.listen(PING_GMAP_INTERVAL);
|
|
90
|
+
const apiGetPingAmapStatus = () => {
|
|
91
|
+
return pingAmapConnection.status;
|
|
92
|
+
};
|
|
93
|
+
const apiGetPingGmapStatus = () => {
|
|
94
|
+
return pingGmapConnection.status;
|
|
95
|
+
};
|
|
96
|
+
const apiPingAmap = () => {
|
|
97
|
+
return pingAmapConnection.updateStatus();
|
|
98
|
+
};
|
|
99
|
+
const apiPingGmap = () => {
|
|
100
|
+
return pingGmapConnection.updateStatus();
|
|
101
|
+
};
|
|
102
|
+
const apiSubscribePingAmapChange = (handler) => pingAmapConnection.onChange(handler);
|
|
103
|
+
const apiSubscribePingGmapChange = (handler) => pingGmapConnection.onChange(handler);
|
|
104
|
+
export {
|
|
105
|
+
apiGetPingAmapStatus,
|
|
106
|
+
apiGetPingGmapStatus,
|
|
107
|
+
apiPingAmap,
|
|
108
|
+
apiPingGmap,
|
|
109
|
+
apiSubscribePingAmapChange,
|
|
110
|
+
apiSubscribePingGmapChange
|
|
111
|
+
};
|
|
@@ -4,7 +4,7 @@ import { createElement } from "../../demi-polyfill/demi-polyfill.js";
|
|
|
4
4
|
import { useHeycarMap } from "../../hooks/useHeycarMap.js";
|
|
5
5
|
import { useMapCoordinatify } from "../../hooks/useMapCoordinatify.js";
|
|
6
6
|
import { useMapFitView } from "../../hooks/useMapFitView.js";
|
|
7
|
-
import { useMapSupplier } from "../../hooks/useMapSupplier.js";
|
|
7
|
+
import { useMapSupplier, useMapAssertSupplier } from "../../hooks/useMapSupplier.js";
|
|
8
8
|
import { defineSetup, defineLagecySetup } from "../../types/helper.js";
|
|
9
9
|
import { generateCreateElementV2PropsOn } from "../../utils/compare.js";
|
|
10
10
|
import { place2point, pipeDefer } from "../../utils/transform.js";
|
|
@@ -25,6 +25,9 @@ const BusinessQuotingMapInner = defineSetup("BusinessQuotingMapInner", function(
|
|
|
25
25
|
const {
|
|
26
26
|
language
|
|
27
27
|
} = useMapSupplier();
|
|
28
|
+
const {
|
|
29
|
+
assertSupplier
|
|
30
|
+
} = useMapAssertSupplier();
|
|
28
31
|
const {
|
|
29
32
|
mapRef,
|
|
30
33
|
setMap
|
|
@@ -40,7 +43,7 @@ const BusinessQuotingMapInner = defineSetup("BusinessQuotingMapInner", function(
|
|
|
40
43
|
mapRef,
|
|
41
44
|
padding: BUSINESS_QUOTING_FITVIEW_PANDING
|
|
42
45
|
});
|
|
43
|
-
mapContext.setFitView = () => setFitView(false);
|
|
46
|
+
mapContext.setFitView = assertSupplier(() => setFitView(false));
|
|
44
47
|
const fittableRegistryOverlay = createFittableRegisterOverlay({
|
|
45
48
|
registerOverlay,
|
|
46
49
|
immediate: true
|
|
@@ -45,5 +45,5 @@ export interface BusinessRecomendPlaceMapProps extends CoordinatifyProps<Omit<He
|
|
|
45
45
|
onClickLocatorText?: AbsoluteAddressBoxProps["onClickText"];
|
|
46
46
|
onClickLocatorPhoto?: AbsoluteAddressBoxProps["onClickPhoto"];
|
|
47
47
|
}
|
|
48
|
-
export declare const BusinessRecomendPlaceMapInner: import("vue-demi").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessRecomendPlaceMapProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<BusinessRecomendPlaceMapProps, Required<BusinessRecomendPlaceMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "
|
|
49
|
-
export declare const BusinessRecomendPlaceMap: import("vue-demi").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessRecomendPlaceMapProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<BusinessRecomendPlaceMapProps, Required<BusinessRecomendPlaceMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "
|
|
48
|
+
export declare const BusinessRecomendPlaceMapInner: import("vue-demi").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessRecomendPlaceMapProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<BusinessRecomendPlaceMapProps, Required<BusinessRecomendPlaceMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "changePlace" | "loadGeoLocation" | "loadDefaultGeoLocation" | "changeByDrag" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", BusinessRecomendPlaceMapProps>;
|
|
49
|
+
export declare const BusinessRecomendPlaceMap: import("vue-demi").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessRecomendPlaceMapProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<BusinessRecomendPlaceMapProps, Required<BusinessRecomendPlaceMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "changePlace" | "loadGeoLocation" | "loadDefaultGeoLocation" | "changeByDrag" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", BusinessRecomendPlaceMapProps>;
|
|
@@ -14,6 +14,7 @@ import "../../hooks/useMapSupplier.js";
|
|
|
14
14
|
import "../../hooks/useMapZoom.js";
|
|
15
15
|
import "../../types/helper.js";
|
|
16
16
|
import "../../types/interface.js";
|
|
17
|
+
import "../../utils/ManualAbortError.js";
|
|
17
18
|
import "../../utils/compare.js";
|
|
18
19
|
import "../../utils/helper.js";
|
|
19
20
|
import "../../utils/platform.js";
|
|
@@ -25,15 +26,15 @@ import "../GreenZone/GreenZone.js";
|
|
|
25
26
|
import "../PassengerCircle/PassengerCircle.js";
|
|
26
27
|
import "../PickupPoints/PickupPoints.js";
|
|
27
28
|
import "./useCacheCenterPlace.js";
|
|
28
|
-
import { B, f, D, E,
|
|
29
|
+
import { B, f, D, E, R, c, a, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.b4d45108.js";
|
|
29
30
|
export {
|
|
30
31
|
B as BusinessRecomendPlaceMap,
|
|
31
32
|
f as BusinessRecomendPlaceMapInner,
|
|
32
33
|
D as DEFAULT_ZOOM,
|
|
33
34
|
E as EMPTY_PLACE,
|
|
34
|
-
|
|
35
|
+
R as RECOMMEND_PLACE_DRAG_LIMIT,
|
|
35
36
|
c as RECOMMEND_PLACE_ICON_ZOOM_MIN,
|
|
36
|
-
|
|
37
|
+
a as RECOMMEND_PLACE_LARGE_LIMIT,
|
|
37
38
|
e as RECOMMEND_PLACE_TEXT_ZOOM_MIN,
|
|
38
39
|
b as RECOMMEND_PLACE_ZONE_ICON_MIN,
|
|
39
40
|
d as RECOMMEND_PLACE_ZONE_TEXT_MIN,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { B, f, D, E,
|
|
1
|
+
import { B, f, D, E, R, c, a, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.b4d45108.js";
|
|
2
2
|
export {
|
|
3
3
|
B as BusinessRecomendPlaceMap,
|
|
4
4
|
f as BusinessRecomendPlaceMapInner,
|
|
5
5
|
D as DEFAULT_ZOOM,
|
|
6
6
|
E as EMPTY_PLACE,
|
|
7
|
-
|
|
7
|
+
R as RECOMMEND_PLACE_DRAG_LIMIT,
|
|
8
8
|
c as RECOMMEND_PLACE_ICON_ZOOM_MIN,
|
|
9
|
-
|
|
9
|
+
a as RECOMMEND_PLACE_LARGE_LIMIT,
|
|
10
10
|
e as RECOMMEND_PLACE_TEXT_ZOOM_MIN,
|
|
11
11
|
b as RECOMMEND_PLACE_ZONE_ICON_MIN,
|
|
12
12
|
d as RECOMMEND_PLACE_ZONE_TEXT_MIN,
|
|
@@ -3,5 +3,5 @@ import { type BusinessRecomendPlaceMapProps } from "../BusinessRecomendPlaceMap"
|
|
|
3
3
|
export interface BusinessReselectPlaceMapProps extends Pick<BusinessRecomendPlaceMapProps, "geoErrorOnceNotificationKey" | "loading" | "fallback" | "log" | "getAvailable" | "getRecomendPlace" | "unavailableTitle" | "emptyTitle" | "queryingTitle" | "recomendDescription" | "disableLocator" | "disableLocatorPhoto" | "mapContext" | "renderPlacePhoto" | "renderPlaceTag" | "onChangeGeoLocation" | "onChangePlace" | "onChangeRecomandPlace" | "onGeoError" | "onGeoErrorOnce" | "onClickLocatorText" | "onClickLocatorPhoto"> {
|
|
4
4
|
defaultPlace?: CoordinatePlace;
|
|
5
5
|
}
|
|
6
|
-
export declare const BusinessReselectPlaceMapInner: import("vue-demi").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessReselectPlaceMapProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<BusinessReselectPlaceMapProps, Required<BusinessReselectPlaceMapProps>>, "
|
|
7
|
-
export declare const BusinessReselectPlaceMap: import("vue-demi").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessReselectPlaceMapProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<BusinessReselectPlaceMapProps, Required<BusinessReselectPlaceMapProps>>, "
|
|
6
|
+
export declare const BusinessReselectPlaceMapInner: import("vue-demi").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessReselectPlaceMapProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<BusinessReselectPlaceMapProps, Required<BusinessReselectPlaceMapProps>>, "changePlace" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", BusinessReselectPlaceMapProps>;
|
|
7
|
+
export declare const BusinessReselectPlaceMap: import("vue-demi").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessReselectPlaceMapProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<BusinessReselectPlaceMapProps, Required<BusinessReselectPlaceMapProps>>, "changePlace" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", BusinessReselectPlaceMapProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h } from "vue";
|
|
2
|
-
import { reactive, watch, watchEffect } from "vue-demi";
|
|
2
|
+
import { reactive, watch, watchEffect, onUnmounted } from "vue-demi";
|
|
3
3
|
import { apiMemoryShouldSkipByKey } from "../../api/memory.js";
|
|
4
4
|
import { HeycarMap } from "../../components/MapProvider/MapProvider.js";
|
|
5
5
|
import { createElement } from "../../demi-polyfill/demi-polyfill.js";
|
|
@@ -9,17 +9,18 @@ import { useMapCoordinatify } from "../../hooks/useMapCoordinatify.js";
|
|
|
9
9
|
import { useMapDrag } from "../../hooks/useMapDrag.js";
|
|
10
10
|
import { useMapGeometry } from "../../hooks/useMapGeometry.js";
|
|
11
11
|
import { useMapRecomendPlace } from "../../hooks/useMapRecomendPlace.js";
|
|
12
|
-
import { useMapSupplier } from "../../hooks/useMapSupplier.js";
|
|
12
|
+
import { useMapAssertSupplier, useMapSupplier } from "../../hooks/useMapSupplier.js";
|
|
13
13
|
import { useMapZoom } from "../../hooks/useMapZoom.js";
|
|
14
14
|
import { defineSetup, defineLagecySetup } from "../../types/helper.js";
|
|
15
15
|
import { CenterPlaceStatus } from "../../types/interface.js";
|
|
16
|
+
import { throwNoneManualAbortError, MANUAL_ABORT_MESSAGE } from "../../utils/ManualAbortError.js";
|
|
16
17
|
import { watchPostEffectOnce, generateCreateElementV2PropsOn } from "../../utils/compare.js";
|
|
17
18
|
import { equalAssign, isPlacesInclude } from "../../utils/helper.js";
|
|
18
19
|
import { detectBrowserPlatform } from "../../utils/platform.js";
|
|
19
20
|
import { place2point, isPlaceEqual, pipeOnlyLastEffect, isZoneEqual, geoPositionError2businessTimeout } from "../../utils/transform.js";
|
|
20
21
|
import { toCoordinatePlaceType, toCoordinatePointType, toCoordinateRecommendZonePlacesType } from "../../utils/typeChecking.js";
|
|
21
22
|
import { AbsoluteAddressBox } from "../AbsoluteAddressBox/AbsoluteAddressBox.js";
|
|
22
|
-
import { E as EMPTY_PLACE, m as memoize, R as
|
|
23
|
+
import { E as EMPTY_PLACE, m as memoize, R as RECOMMEND_PLACE_DRAG_LIMIT, a as RECOMMEND_PLACE_LARGE_LIMIT, Z as ZONE_ZOOM, b as RECOMMEND_PLACE_ZONE_ICON_MIN, c as RECOMMEND_PLACE_ICON_ZOOM_MIN, d as RECOMMEND_PLACE_ZONE_TEXT_MIN, e as RECOMMEND_PLACE_TEXT_ZOOM_MIN, D as DEFAULT_ZOOM } from "../../chunks/BusinessRecomendPlaceMap.b4d45108.js";
|
|
23
24
|
import { DeviceOrientation } from "../DeviceOrientation/DeviceOrientation.js";
|
|
24
25
|
import { GreenZone } from "../GreenZone/GreenZone.js";
|
|
25
26
|
import { PassengerCircle } from "../PassengerCircle/PassengerCircle.js";
|
|
@@ -41,6 +42,7 @@ const BusinessReselectPlaceMapInner = defineSetup("BusinessReselectPlaceMapInner
|
|
|
41
42
|
...EMPTY_PLACE
|
|
42
43
|
}
|
|
43
44
|
} = props;
|
|
45
|
+
const abortController = new AbortController();
|
|
44
46
|
const {
|
|
45
47
|
coordinatifyPoint,
|
|
46
48
|
unCoordinatifyPoint,
|
|
@@ -51,7 +53,7 @@ const BusinessReselectPlaceMapInner = defineSetup("BusinessReselectPlaceMapInner
|
|
|
51
53
|
coordinatifyGeoPosition
|
|
52
54
|
} = useMapCoordinatify();
|
|
53
55
|
const pipedGetAvailable = getAvailable && pipeOnlyLastEffect((p) => getAvailable(coordinatifyPlace(p)));
|
|
54
|
-
const pipedGetRecomendPlace = pipeOnlyLastEffect((p) => getRecomendPlace(coordinatifyPlace(p)).then((r) => r && unCoordinatifyRecommendZonePlaces(toCoordinateRecommendZonePlacesType(r))));
|
|
56
|
+
const pipedGetRecomendPlace = pipeOnlyLastEffect((p, context) => getRecomendPlace(coordinatifyPlace(p), context).then((r) => r && unCoordinatifyRecommendZonePlaces(toCoordinateRecommendZonePlacesType(r))));
|
|
55
57
|
const {
|
|
56
58
|
apiMapDistance
|
|
57
59
|
} = useMapGeometry();
|
|
@@ -68,6 +70,9 @@ const BusinessReselectPlaceMapInner = defineSetup("BusinessReselectPlaceMapInner
|
|
|
68
70
|
mapRef,
|
|
69
71
|
defaultValue: DEFAULT_ZOOM
|
|
70
72
|
});
|
|
73
|
+
const {
|
|
74
|
+
assertSupplier
|
|
75
|
+
} = useMapAssertSupplier();
|
|
71
76
|
const defaultPlace = unCoordinatifyPlace(toCoordinatePlaceType(inputDefaultPlace));
|
|
72
77
|
const centerPlace = reactive({
|
|
73
78
|
lng: defaultPlace.lng,
|
|
@@ -94,6 +99,7 @@ const BusinessReselectPlaceMapInner = defineSetup("BusinessReselectPlaceMapInner
|
|
|
94
99
|
place: inputPlace,
|
|
95
100
|
recommends: inputRecommends
|
|
96
101
|
}) => {
|
|
102
|
+
centerSource.source = "api";
|
|
97
103
|
const place = unCoordinatifyPlace(toCoordinatePlaceType(inputPlace));
|
|
98
104
|
const recommends = unCoordinatifyRecommendZonePlaces(toCoordinateRecommendZonePlacesType(inputRecommends));
|
|
99
105
|
const isSameZone = recommends.zone && isZoneEqual(recommends.zone, zoneRef.value);
|
|
@@ -148,19 +154,19 @@ const BusinessReselectPlaceMapInner = defineSetup("BusinessReselectPlaceMapInner
|
|
|
148
154
|
emitGeoErrorOnce(error);
|
|
149
155
|
}
|
|
150
156
|
});
|
|
151
|
-
mapContext.apiMapDistance = (from, to) => {
|
|
157
|
+
mapContext.apiMapDistance = assertSupplier((from, to) => {
|
|
152
158
|
return apiMapDistance(unCoordinatifyPoint(toCoordinatePointType(from)), unCoordinatifyPoint(toCoordinatePointType(to)));
|
|
153
|
-
};
|
|
154
|
-
mapContext.setCenterPlaceByUserSpecified = setCenterPlaceByUserSpecified;
|
|
155
|
-
mapContext.setCenterPlaceByUserSpecifiedInZone = setCenterPlaceByUserSpecifiedInZone;
|
|
156
|
-
mapContext.panToGeoPositionByRecomend = () => {
|
|
159
|
+
});
|
|
160
|
+
mapContext.setCenterPlaceByUserSpecified = assertSupplier(setCenterPlaceByUserSpecified);
|
|
161
|
+
mapContext.setCenterPlaceByUserSpecifiedInZone = assertSupplier(setCenterPlaceByUserSpecifiedInZone);
|
|
162
|
+
mapContext.panToGeoPositionByRecomend = assertSupplier(() => {
|
|
157
163
|
if (geoError.value)
|
|
158
164
|
return false;
|
|
159
165
|
updateCenterPlaceByPoint(geoPosition.value, {
|
|
160
166
|
source: "geo"
|
|
161
167
|
});
|
|
162
168
|
return true;
|
|
163
|
-
};
|
|
169
|
+
});
|
|
164
170
|
const {
|
|
165
171
|
isDragging
|
|
166
172
|
} = useMapDrag({
|
|
@@ -183,6 +189,7 @@ const BusinessReselectPlaceMapInner = defineSetup("BusinessReselectPlaceMapInner
|
|
|
183
189
|
emptyPlaceName: emptyTitle,
|
|
184
190
|
queryingPlaceName: queryingTitle,
|
|
185
191
|
context: centerSource,
|
|
192
|
+
signal: abortController.signal,
|
|
186
193
|
getAvailable: pipedGetAvailable,
|
|
187
194
|
getRecomendPlace: pipedGetRecomendPlace,
|
|
188
195
|
getLimit: (context) => {
|
|
@@ -195,14 +202,15 @@ const BusinessReselectPlaceMapInner = defineSetup("BusinessReselectPlaceMapInner
|
|
|
195
202
|
case "default":
|
|
196
203
|
return RECOMMEND_PLACE_LARGE_LIMIT;
|
|
197
204
|
default:
|
|
198
|
-
|
|
205
|
+
console.error(new Error(`MyError: should not call getLimit on source: ${source}`));
|
|
206
|
+
return RECOMMEND_PLACE_DRAG_LIMIT;
|
|
199
207
|
}
|
|
200
208
|
},
|
|
201
209
|
onQueryingPlace: (place) => equalAssign(centerPlace, {
|
|
202
210
|
...place
|
|
203
211
|
}),
|
|
204
212
|
onChangePlace: (place) => emit("changePlace", coordinatifyPlace(place)),
|
|
205
|
-
onChange:
|
|
213
|
+
onChange: ({
|
|
206
214
|
place,
|
|
207
215
|
inputPlace,
|
|
208
216
|
isInZone,
|
|
@@ -224,7 +232,7 @@ const BusinessReselectPlaceMapInner = defineSetup("BusinessReselectPlaceMapInner
|
|
|
224
232
|
}));
|
|
225
233
|
}
|
|
226
234
|
});
|
|
227
|
-
watchPostEffectOnce(() => updateRecommendPlaceOnlyInZone(defaultPlace));
|
|
235
|
+
watchPostEffectOnce(() => updateRecommendPlaceOnlyInZone(defaultPlace).catch(throwNoneManualAbortError));
|
|
228
236
|
watch(centerPlace, (place) => {
|
|
229
237
|
equalAssign(mapContext.centerPlace, coordinatifyPlace({
|
|
230
238
|
...place
|
|
@@ -236,6 +244,7 @@ const BusinessReselectPlaceMapInner = defineSetup("BusinessReselectPlaceMapInner
|
|
|
236
244
|
watchEffect(() => {
|
|
237
245
|
mapContext.centerPlaceStatusRef.value = isQueryingRef.value ? CenterPlaceStatus.QUERYING_INFO : !availableRef.value ? CenterPlaceStatus.SERVICE_UNAVAILABLE : CenterPlaceStatus.OK;
|
|
238
246
|
});
|
|
247
|
+
onUnmounted(() => abortController.abort(MANUAL_ABORT_MESSAGE));
|
|
239
248
|
return () => {
|
|
240
249
|
var _a, _b, _c;
|
|
241
250
|
const {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h } from "vue";
|
|
2
|
-
import { ref, watch } from "vue-demi";
|
|
2
|
+
import { ref, watch, onUnmounted } from "vue-demi";
|
|
3
3
|
import { apiGetAuxiliaryGrapStatus } from "../../api/browser.js";
|
|
4
4
|
import { setGlobalGoogleSnapRoadProxyUrl } from "../../api/googleSnapRoad.js";
|
|
5
5
|
import { HeycarMap } from "../../components/MapProvider/MapProvider.js";
|
|
@@ -8,9 +8,10 @@ import { useGeoLocation } from "../../hooks/useGeoLocation.js";
|
|
|
8
8
|
import { useHeycarMap } from "../../hooks/useHeycarMap.js";
|
|
9
9
|
import { useMapCoordinatify } from "../../hooks/useMapCoordinatify.js";
|
|
10
10
|
import { useMapFitView } from "../../hooks/useMapFitView.js";
|
|
11
|
-
import { useMapSupplier } from "../../hooks/useMapSupplier.js";
|
|
11
|
+
import { useMapAssertSupplier, useMapSupplier } from "../../hooks/useMapSupplier.js";
|
|
12
12
|
import { defineSetup, defineLagecySetup } from "../../types/helper.js";
|
|
13
|
-
import {
|
|
13
|
+
import { MANUAL_ABORT_MESSAGE } from "../../utils/ManualAbortError.js";
|
|
14
|
+
import { createAbortable, assertNotEmptyArray } from "../../utils/helper.js";
|
|
14
15
|
import { place2point, pipeDefer, lnglat2point } from "../../utils/transform.js";
|
|
15
16
|
import { toCoordinatePlaceType, toCoordinateTrackPoint } from "../../utils/typeChecking.js";
|
|
16
17
|
import { AuxiliaryGraspRoad } from "../AuxiliaryGraspRoad/AuxiliaryGraspRoad.js";
|
|
@@ -26,7 +27,6 @@ const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", f
|
|
|
26
27
|
interval,
|
|
27
28
|
disablePassenger,
|
|
28
29
|
mapContext,
|
|
29
|
-
getDriverPositionTrack,
|
|
30
30
|
renderStartSerivceTitle,
|
|
31
31
|
renderInServiceTitle
|
|
32
32
|
} = props;
|
|
@@ -36,6 +36,12 @@ const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", f
|
|
|
36
36
|
setMap,
|
|
37
37
|
mapElementRef
|
|
38
38
|
} = useHeycarMap();
|
|
39
|
+
const {
|
|
40
|
+
assertSupplier
|
|
41
|
+
} = useMapAssertSupplier();
|
|
42
|
+
const abortController = new AbortController();
|
|
43
|
+
const abortable = createAbortable(abortController.signal);
|
|
44
|
+
const getDriverPositionTrack = abortable(props.getDriverPositionTrack);
|
|
39
45
|
const {
|
|
40
46
|
unCoordinatifyPlace,
|
|
41
47
|
unCoordinatifyTrackPoint
|
|
@@ -47,7 +53,7 @@ const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", f
|
|
|
47
53
|
mapRef,
|
|
48
54
|
padding: BUSINESS_TAXI_SERVICE_FITVIEW_PANDING
|
|
49
55
|
});
|
|
50
|
-
mapContext.setFitView = () => setFitView(false);
|
|
56
|
+
mapContext.setFitView = assertSupplier(() => setFitView(false));
|
|
51
57
|
const deferedSetFitView = pipeDefer(() => registerOverlay.setFitView(true));
|
|
52
58
|
const {
|
|
53
59
|
geoLoading,
|
|
@@ -79,6 +85,7 @@ const BusinessTaxiServiceMapInner = defineSetup("BusinessTaxiServiceMapInner", f
|
|
|
79
85
|
}, {
|
|
80
86
|
immediate: true
|
|
81
87
|
});
|
|
88
|
+
onUnmounted(() => abortController.abort(MANUAL_ABORT_MESSAGE));
|
|
82
89
|
return () => {
|
|
83
90
|
const {
|
|
84
91
|
driverStatus,
|