@heycar/heycars-map 0.4.7 → 0.4.9
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/dist/Demo/Demo.css.d.ts +2 -0
- package/dist/Demo/DemoBusinessTaxiEnd.d.ts +1 -0
- package/dist/Demo/DemoBusinessTaxiService.d.ts +1 -0
- package/dist/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +1 -1
- package/dist/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +1 -2
- package/dist/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +1 -1
- package/dist/components/Amap/Amap.d.ts +2 -1
- package/dist/components/MapProvider/MapProvider.d.ts +2 -1
- package/dist/index.cjs +97 -32
- package/dist/index.js +97 -32
- package/dist/utils/helper.d.ts +1 -0
- package/dist/utils/singleGeoWatch.d.ts +13 -0
- package/dist/utils/waitQueue.d.ts +7 -0
- package/package.json +1 -1
- package/todo.md +12 -18
package/dist/Demo/Demo.css.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const DemoBusinessTaxiEnd: import("vue").DefineComponent<{}, unknown, {
|
|
2
2
|
from: {};
|
|
3
3
|
to: {};
|
|
4
|
+
contentHeight: number;
|
|
4
5
|
}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
@@ -2050,6 +2050,7 @@ export declare const DemoBusinessTaxiService: import("vue").DefineComponent<Read
|
|
|
2050
2050
|
from: Partial<Place>;
|
|
2051
2051
|
to: Partial<Place>;
|
|
2052
2052
|
status: DriverStatus;
|
|
2053
|
+
contentHeight: number;
|
|
2053
2054
|
}, {}, {
|
|
2054
2055
|
getDriverPosition(): Promise<Point>;
|
|
2055
2056
|
}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<Readonly<{}>>>, {}>;
|
|
@@ -11,4 +11,4 @@ export type BusinessQuotingMapProps = Omit<HeycarMapProps, "center" | "zoom"> &
|
|
|
11
11
|
}) => string;
|
|
12
12
|
log?: boolean;
|
|
13
13
|
};
|
|
14
|
-
export declare const BusinessQuotingMap: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<BusinessQuotingMapProps>, 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<BusinessQuotingMapProps, Required<BusinessQuotingMapProps>>, "dragEnd" | "zoomEnd", BusinessQuotingMapProps, {} | {}>;
|
|
14
|
+
export declare const BusinessQuotingMap: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<BusinessQuotingMapProps>, 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<BusinessQuotingMapProps, Required<BusinessQuotingMapProps>>, "resize" | "dragEnd" | "zoomEnd", BusinessQuotingMapProps, {} | {}>;
|
|
@@ -14,7 +14,6 @@ export interface BusinessRecomendPlaceMapProps extends Omit<HeycarMapProps, "cen
|
|
|
14
14
|
geoLoadingTitle: string;
|
|
15
15
|
unavailableTitle: string;
|
|
16
16
|
recomendDescription: string;
|
|
17
|
-
noRecomendDescription: string;
|
|
18
17
|
geoDefaultPosition?: Point;
|
|
19
18
|
mapContext: BusinessRecomendPlaceContext;
|
|
20
19
|
getDefaultCenterPlace: () => Promise<Place | undefined>;
|
|
@@ -28,4 +27,4 @@ export interface BusinessRecomendPlaceMapProps extends Omit<HeycarMapProps, "cen
|
|
|
28
27
|
onGeoError?: UseGeoLocationProps["onError"];
|
|
29
28
|
onClickLocator?: AbsoluteAddressBoxProps["onClick"];
|
|
30
29
|
}
|
|
31
|
-
export declare const BusinessRecomendPlaceMap: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").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>>, "dragEnd" | "zoomEnd" | "changeCity" | "changePlace" | "loadGeoLocation" | "loadDefaultGeoLocation" | "changeByDrag" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "clickLocator", BusinessRecomendPlaceMapProps, {}>;
|
|
30
|
+
export declare const BusinessRecomendPlaceMap: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").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" | "changeCity" | "changePlace" | "loadGeoLocation" | "loadDefaultGeoLocation" | "changeByDrag" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "clickLocator", BusinessRecomendPlaceMapProps, {}>;
|
|
@@ -20,4 +20,4 @@ export type BusinessTaxiServiceMapProps = Omit<HeycarMapProps, "center" | "zoom"
|
|
|
20
20
|
}) => string;
|
|
21
21
|
getDriverPosition: () => Promise<Point>;
|
|
22
22
|
};
|
|
23
|
-
export declare const BusinessTaxiServiceMap: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<BusinessTaxiServiceMapProps>, 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<BusinessTaxiServiceMapProps, Required<BusinessTaxiServiceMapProps>>, "dragEnd" | "zoomEnd", BusinessTaxiServiceMapProps, {} | {}>;
|
|
23
|
+
export declare const BusinessTaxiServiceMap: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<BusinessTaxiServiceMapProps>, 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<BusinessTaxiServiceMapProps, Required<BusinessTaxiServiceMapProps>>, "resize" | "dragEnd" | "zoomEnd", BusinessTaxiServiceMapProps, {} | {}>;
|
|
@@ -15,5 +15,6 @@ export interface AmapProps extends Omit<AMap.MapOptions, "vectorMapForeign"> {
|
|
|
15
15
|
onDragStart?: MapEventHandler<AMap.Map>;
|
|
16
16
|
onDragEnd?: MapEventHandler<AMap.Map>;
|
|
17
17
|
onZoomEnd?: MapEventHandler<AMap.Map>;
|
|
18
|
+
onResize?: MapEventHandler<AMap.Map>;
|
|
18
19
|
}
|
|
19
|
-
export declare const Amap: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<AmapProps>, 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<AmapProps, Required<AmapProps>>, "dragStart" | "dragEnd" | "zoomEnd", AmapProps, {}>;
|
|
20
|
+
export declare const Amap: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<AmapProps>, 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<AmapProps, Required<AmapProps>>, "resize" | "dragStart" | "dragEnd" | "zoomEnd", AmapProps, {}>;
|
|
@@ -9,6 +9,7 @@ export interface HeycarMapProps extends Pick<GmapLoaderProps, "fallback" | "load
|
|
|
9
9
|
mapRef?: SetMap<AMap.Map> | SetMap<google.maps.Map>;
|
|
10
10
|
onDragEnd?: (value: [number, number]) => any;
|
|
11
11
|
onZoomEnd?: (value: number) => any;
|
|
12
|
+
onResize?: () => any;
|
|
12
13
|
touchEnable?: boolean;
|
|
13
14
|
}
|
|
14
|
-
export declare const HeycarMap: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<HeycarMapProps>, 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<HeycarMapProps, Required<HeycarMapProps>>, "dragEnd" | "zoomEnd", HeycarMapProps, {}>;
|
|
15
|
+
export declare const HeycarMap: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<HeycarMapProps>, 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<HeycarMapProps, Required<HeycarMapProps>>, "resize" | "dragEnd" | "zoomEnd", HeycarMapProps, {}>;
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __publicField = (obj, key, value) => {
|
|
5
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
+
return value;
|
|
7
|
+
};
|
|
2
8
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
9
|
const Vue = require("vue");
|
|
4
10
|
const style = "";
|
|
@@ -1860,6 +1866,7 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
|
|
|
1860
1866
|
onDragStart,
|
|
1861
1867
|
onDragEnd,
|
|
1862
1868
|
onZoomEnd,
|
|
1869
|
+
onResize,
|
|
1863
1870
|
mapRef: setMap,
|
|
1864
1871
|
vectorMapForeign = "style_zh_cn",
|
|
1865
1872
|
...defaultOptions
|
|
@@ -1926,7 +1933,12 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
|
|
|
1926
1933
|
{ name: "mask", defaultValue: [] },
|
|
1927
1934
|
{ name: "labelRejectMask", defaultValue: false }
|
|
1928
1935
|
]);
|
|
1929
|
-
watchPostEffectForAMapEvent(mapRef, props, emit, [
|
|
1936
|
+
watchPostEffectForAMapEvent(mapRef, props, emit, [
|
|
1937
|
+
"onDragStart",
|
|
1938
|
+
"onDragEnd",
|
|
1939
|
+
"onZoomEnd",
|
|
1940
|
+
"onResize"
|
|
1941
|
+
]);
|
|
1930
1942
|
return () => {
|
|
1931
1943
|
var _a;
|
|
1932
1944
|
return Vue.h("div", { ref: elementRef, class: amap }, (_a = slots.default) == null ? void 0 : _a.call(slots));
|
|
@@ -2020,7 +2032,7 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
|
|
|
2020
2032
|
emit
|
|
2021
2033
|
}) {
|
|
2022
2034
|
const payload = useMapSupplier();
|
|
2023
|
-
const
|
|
2035
|
+
const gmapHandleDargEnd = ({
|
|
2024
2036
|
target
|
|
2025
2037
|
}) => {
|
|
2026
2038
|
const {
|
|
@@ -2029,7 +2041,7 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
|
|
|
2029
2041
|
} = target.getCenter();
|
|
2030
2042
|
emit("dragEnd", [lng(), lat()]);
|
|
2031
2043
|
};
|
|
2032
|
-
const
|
|
2044
|
+
const amapHandleDragEnd = ({
|
|
2033
2045
|
target
|
|
2034
2046
|
}) => {
|
|
2035
2047
|
const {
|
|
@@ -2038,6 +2050,7 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
|
|
|
2038
2050
|
} = target.getCenter();
|
|
2039
2051
|
emit("dragEnd", [lng, lat]);
|
|
2040
2052
|
};
|
|
2053
|
+
const handleResize = () => emit("resize");
|
|
2041
2054
|
return () => {
|
|
2042
2055
|
var _a, _b, _c;
|
|
2043
2056
|
const {
|
|
@@ -2075,7 +2088,7 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
|
|
|
2075
2088
|
"panControl": touchEnable
|
|
2076
2089
|
},
|
|
2077
2090
|
"on": {
|
|
2078
|
-
"dragEnd":
|
|
2091
|
+
"dragEnd": gmapHandleDargEnd
|
|
2079
2092
|
}
|
|
2080
2093
|
}, [children]);
|
|
2081
2094
|
default:
|
|
@@ -2095,7 +2108,8 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
|
|
|
2095
2108
|
"pitchEnable": touchEnable
|
|
2096
2109
|
},
|
|
2097
2110
|
"on": {
|
|
2098
|
-
"dragEnd":
|
|
2111
|
+
"dragEnd": amapHandleDragEnd,
|
|
2112
|
+
"resize": handleResize
|
|
2099
2113
|
}
|
|
2100
2114
|
}, [children]);
|
|
2101
2115
|
}
|
|
@@ -2205,7 +2219,7 @@ const ADrivingLine = defineSetup(function ADrivingLine2(props) {
|
|
|
2205
2219
|
"attrs": {
|
|
2206
2220
|
"showDir": true,
|
|
2207
2221
|
"path": props.path,
|
|
2208
|
-
"strokeWeight": strokeWidth +
|
|
2222
|
+
"strokeWeight": strokeWidth + dirWidth,
|
|
2209
2223
|
"strokeOpacity": 1,
|
|
2210
2224
|
"strokeColor": "transparent",
|
|
2211
2225
|
"lineJoin": "round",
|
|
@@ -2830,6 +2844,7 @@ const BusinessQuotingMap = defineLagecySetup(function BusinessQuotingMap2(props)
|
|
|
2830
2844
|
renderDescription
|
|
2831
2845
|
} = props;
|
|
2832
2846
|
const fittableRegistryOverlay = createFittableRegisterOverlay(registerOverlay);
|
|
2847
|
+
const deferedSetFitView = pipeDefer(registerOverlay.setFitView);
|
|
2833
2848
|
return () => {
|
|
2834
2849
|
const {
|
|
2835
2850
|
from: fromPlace,
|
|
@@ -2843,6 +2858,9 @@ const BusinessQuotingMap = defineLagecySetup(function BusinessQuotingMap2(props)
|
|
|
2843
2858
|
"mapRef": mapRef,
|
|
2844
2859
|
"center": from,
|
|
2845
2860
|
"zoom": 13
|
|
2861
|
+
},
|
|
2862
|
+
"on": {
|
|
2863
|
+
"resize": deferedSetFitView
|
|
2846
2864
|
}
|
|
2847
2865
|
}, [Vue.h(StartEndPoint, {
|
|
2848
2866
|
"attrs": {
|
|
@@ -2884,6 +2902,49 @@ const BusinessQuotingMap = defineLagecySetup(function BusinessQuotingMap2(props)
|
|
|
2884
2902
|
})]);
|
|
2885
2903
|
};
|
|
2886
2904
|
}).props(["fallback", "from", "loading", "mapRef", "registerOverlay", "renderDescription", "to", "fromDescription", "log"]);
|
|
2905
|
+
const isPlace = (place) => {
|
|
2906
|
+
return place.lng !== void 0 && place.lat !== void 0;
|
|
2907
|
+
};
|
|
2908
|
+
const sleep = (milliSeconds) => new Promise((resolve) => setTimeout(resolve, milliSeconds));
|
|
2909
|
+
class SingleGeoWatch {
|
|
2910
|
+
constructor(option) {
|
|
2911
|
+
__publicField(this, "id", 0);
|
|
2912
|
+
__publicField(this, "listeners", /* @__PURE__ */ new Map());
|
|
2913
|
+
__publicField(this, "option", {});
|
|
2914
|
+
__publicField(this, "singleWatchId");
|
|
2915
|
+
this.option = option != null ? option : {};
|
|
2916
|
+
}
|
|
2917
|
+
watchPosition(onSuccess, onError) {
|
|
2918
|
+
this.id += 1;
|
|
2919
|
+
const { id } = this;
|
|
2920
|
+
this.listeners.set(id, [onSuccess, onError]);
|
|
2921
|
+
this.start();
|
|
2922
|
+
return id;
|
|
2923
|
+
}
|
|
2924
|
+
clearWatch(id) {
|
|
2925
|
+
this.listeners.delete(id);
|
|
2926
|
+
}
|
|
2927
|
+
async start() {
|
|
2928
|
+
const { listeners, option, singleWatchId } = this;
|
|
2929
|
+
if (singleWatchId) {
|
|
2930
|
+
navigator.geolocation.clearWatch(singleWatchId);
|
|
2931
|
+
await sleep(20);
|
|
2932
|
+
}
|
|
2933
|
+
this.singleWatchId = navigator.geolocation.watchPosition(
|
|
2934
|
+
(position) => {
|
|
2935
|
+
for (const [onSuccess] of listeners.values()) {
|
|
2936
|
+
onSuccess(position);
|
|
2937
|
+
}
|
|
2938
|
+
},
|
|
2939
|
+
(error) => {
|
|
2940
|
+
for (const [_, onError] of listeners.values()) {
|
|
2941
|
+
onError == null ? void 0 : onError(error);
|
|
2942
|
+
}
|
|
2943
|
+
},
|
|
2944
|
+
option
|
|
2945
|
+
);
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2887
2948
|
const useAmapGCJ02 = () => {
|
|
2888
2949
|
const { readyPromise } = useMapSupplier();
|
|
2889
2950
|
async function toGcj02(point) {
|
|
@@ -2914,6 +2975,11 @@ const useMapGCJ02 = () => {
|
|
|
2914
2975
|
return supplier === "gmap" ? useGmapGCJ02() : useAmapGCJ02();
|
|
2915
2976
|
};
|
|
2916
2977
|
const GEO_TIMEOUT = 5e3;
|
|
2978
|
+
const singleGeoWatch = new SingleGeoWatch({
|
|
2979
|
+
timeout: GEO_TIMEOUT,
|
|
2980
|
+
maximumAge: 0,
|
|
2981
|
+
enableHighAccuracy: false
|
|
2982
|
+
});
|
|
2917
2983
|
const useGeoLocation = (props) => {
|
|
2918
2984
|
var _a, _b;
|
|
2919
2985
|
const { onChange, onLoad, onLoadDefault, onError, geoDefaultPosition } = props != null ? props : {};
|
|
@@ -2936,12 +3002,11 @@ const useGeoLocation = (props) => {
|
|
|
2936
3002
|
() => true,
|
|
2937
3003
|
(_1, _2, onCleanup) => {
|
|
2938
3004
|
loading.value = true;
|
|
2939
|
-
const watchId =
|
|
3005
|
+
const watchId = singleGeoWatch.watchPosition(
|
|
2940
3006
|
async (position) => {
|
|
2941
3007
|
const coordinate = position.coords;
|
|
2942
3008
|
const wgsPoint = [position.coords.longitude, position.coords.latitude];
|
|
2943
3009
|
const point = await toGcj02(wgsPoint);
|
|
2944
|
-
console.log("wgsPoint, point = ", wgsPoint, point);
|
|
2945
3010
|
coordinateRef.value = coordinate;
|
|
2946
3011
|
positionRef.value = point;
|
|
2947
3012
|
if (loading.value) {
|
|
@@ -2960,10 +3025,9 @@ const useGeoLocation = (props) => {
|
|
|
2960
3025
|
onLoadDefault == null ? void 0 : onLoadDefault({ position });
|
|
2961
3026
|
}
|
|
2962
3027
|
onError == null ? void 0 : onError(error);
|
|
2963
|
-
}
|
|
2964
|
-
{ timeout: GEO_TIMEOUT, maximumAge: 0, enableHighAccuracy: false }
|
|
3028
|
+
}
|
|
2965
3029
|
);
|
|
2966
|
-
onCleanup(() =>
|
|
3030
|
+
onCleanup(() => singleGeoWatch.clearWatch(watchId));
|
|
2967
3031
|
},
|
|
2968
3032
|
{ immediate: true }
|
|
2969
3033
|
);
|
|
@@ -3888,11 +3952,10 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
3888
3952
|
const {
|
|
3889
3953
|
geoLoadingTitle,
|
|
3890
3954
|
recomendDescription,
|
|
3891
|
-
noRecomendDescription,
|
|
3892
3955
|
unavailableTitle
|
|
3893
3956
|
} = props;
|
|
3894
3957
|
const title = geoLoading.value ? geoLoadingTitle : !availableRef.value ? unavailableTitle : (_a2 = centerPlace.name) != null ? _a2 : DEFAULT_PLACE_NAME;
|
|
3895
|
-
const description = !availableRef.value ? void 0 : isElectedRef.value ? recomendDescription :
|
|
3958
|
+
const description = !availableRef.value ? void 0 : isElectedRef.value ? recomendDescription : void 0;
|
|
3896
3959
|
return Vue.h(HeycarMap, {
|
|
3897
3960
|
"attrs": {
|
|
3898
3961
|
"center": centerPoint.value,
|
|
@@ -3922,11 +3985,8 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
3922
3985
|
}
|
|
3923
3986
|
})]);
|
|
3924
3987
|
};
|
|
3925
|
-
}).props(["log", "geoLoadingTitle", "unavailableTitle", "recomendDescription", "
|
|
3988
|
+
}).props(["log", "geoLoadingTitle", "unavailableTitle", "recomendDescription", "fallback", "geoDefaultPosition", "getRecomendPlace", "getDefaultCenterPlace", "loading", "mapContext"]);
|
|
3926
3989
|
const BEIJIN_POINT = [116.2317, 39.5427];
|
|
3927
|
-
const isPlace = (place) => {
|
|
3928
|
-
return place.lng !== void 0 && place.lat !== void 0;
|
|
3929
|
-
};
|
|
3930
3990
|
const useAmapGeometry = () => {
|
|
3931
3991
|
const payload = useMapSupplier();
|
|
3932
3992
|
const apiMapDistance = (from, to) => {
|
|
@@ -4715,6 +4775,7 @@ const BusinessTaxiEndMap = defineSetup(function BusinessTaxiEndMap2(props) {
|
|
|
4715
4775
|
autoFitTimeout: 5e3,
|
|
4716
4776
|
padding: [25, 20, 15, 15]
|
|
4717
4777
|
});
|
|
4778
|
+
const deferedSetFitView = pipeDefer(registerFitVeiw.setFitView);
|
|
4718
4779
|
return () => {
|
|
4719
4780
|
const {
|
|
4720
4781
|
from,
|
|
@@ -4728,6 +4789,9 @@ const BusinessTaxiEndMap = defineSetup(function BusinessTaxiEndMap2(props) {
|
|
|
4728
4789
|
"zoom": 3,
|
|
4729
4790
|
"mapRef": setMap,
|
|
4730
4791
|
"touchEnable": false
|
|
4792
|
+
},
|
|
4793
|
+
"on": {
|
|
4794
|
+
"resize": deferedSetFitView
|
|
4731
4795
|
}
|
|
4732
4796
|
}, [isReady && Vue.h(SectionEndService, {
|
|
4733
4797
|
"attrs": {
|
|
@@ -4741,7 +4805,6 @@ const BusinessTaxiEndMap = defineSetup(function BusinessTaxiEndMap2(props) {
|
|
|
4741
4805
|
const STATUS_NEED_CAR_POSITION = ["book-driverStartService", "dispatched", "driverStartService", "inService", "driverArrived"];
|
|
4742
4806
|
const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap2(props) {
|
|
4743
4807
|
const {
|
|
4744
|
-
from,
|
|
4745
4808
|
interval,
|
|
4746
4809
|
registerOverlay,
|
|
4747
4810
|
mapRef,
|
|
@@ -4749,12 +4812,11 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4749
4812
|
renderStartSerivceTitle,
|
|
4750
4813
|
renderInServiceTitle
|
|
4751
4814
|
} = props;
|
|
4815
|
+
const deferedSetFitView = pipeDefer(registerOverlay.setFitView);
|
|
4752
4816
|
const {
|
|
4753
4817
|
geoPosition,
|
|
4754
4818
|
geoError
|
|
4755
|
-
} = useGeoLocation(
|
|
4756
|
-
geoDefaultPosition: place2point(from)
|
|
4757
|
-
});
|
|
4819
|
+
} = useGeoLocation();
|
|
4758
4820
|
const carPositionRef = Vue.ref(place2point(props.from));
|
|
4759
4821
|
Vue.watch(() => props.driverStatus, (status, _, onCleanup) => {
|
|
4760
4822
|
if (!STATUS_NEED_CAR_POSITION.includes(status))
|
|
@@ -4769,7 +4831,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4769
4831
|
return () => {
|
|
4770
4832
|
const {
|
|
4771
4833
|
driverStatus,
|
|
4772
|
-
from
|
|
4834
|
+
from,
|
|
4773
4835
|
to,
|
|
4774
4836
|
dispatchingTitle,
|
|
4775
4837
|
bookDispatchingTitle,
|
|
@@ -4780,33 +4842,36 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4780
4842
|
const passengerPosition = geoError.value ? void 0 : geoPosition.value;
|
|
4781
4843
|
return Vue.h(HeycarMap, {
|
|
4782
4844
|
"attrs": {
|
|
4783
|
-
"center": place2point(
|
|
4845
|
+
"center": place2point(from),
|
|
4784
4846
|
"zoom": 13,
|
|
4785
4847
|
"mapRef": mapRef,
|
|
4786
4848
|
"touchEnable": touchEnable
|
|
4849
|
+
},
|
|
4850
|
+
"on": {
|
|
4851
|
+
"resize": deferedSetFitView
|
|
4787
4852
|
}
|
|
4788
4853
|
}, [driverStatus === "dispatching" ? Vue.h(SectionDispatching, {
|
|
4789
4854
|
"attrs": {
|
|
4790
|
-
"from":
|
|
4855
|
+
"from": from,
|
|
4791
4856
|
"title": dispatchingTitle,
|
|
4792
4857
|
"registerOverlay": registerOverlay
|
|
4793
4858
|
}
|
|
4794
4859
|
}) : driverStatus === "book-dispatching" ? Vue.h(SectionDispatching, {
|
|
4795
4860
|
"attrs": {
|
|
4796
|
-
"from":
|
|
4861
|
+
"from": from,
|
|
4797
4862
|
"title": bookDispatchingTitle,
|
|
4798
4863
|
"registerOverlay": registerOverlay
|
|
4799
4864
|
}
|
|
4800
4865
|
}) : driverStatus === "assign" || driverStatus === "confirmed" ? Vue.h(SectionConfirmed, {
|
|
4801
4866
|
"attrs": {
|
|
4802
|
-
"from":
|
|
4867
|
+
"from": from,
|
|
4803
4868
|
"to": to,
|
|
4804
4869
|
"passengerPosition": passengerPosition,
|
|
4805
4870
|
"registerOverlay": registerOverlay
|
|
4806
4871
|
}
|
|
4807
4872
|
}) : driverStatus === "dispatched" || driverStatus === "driverStartService" || driverStatus === "book-driverStartService" ? Vue.h(SectionDriverStartService, {
|
|
4808
4873
|
"attrs": {
|
|
4809
|
-
"from":
|
|
4874
|
+
"from": from,
|
|
4810
4875
|
"carPosition": carPosition,
|
|
4811
4876
|
"passengerPosition": passengerPosition,
|
|
4812
4877
|
"renderTitle": renderStartSerivceTitle,
|
|
@@ -4814,7 +4879,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4814
4879
|
}
|
|
4815
4880
|
}) : driverStatus === "book-dispatched" ? Vue.h(SectionBookDispatched, {
|
|
4816
4881
|
"attrs": {
|
|
4817
|
-
"from":
|
|
4882
|
+
"from": from,
|
|
4818
4883
|
"to": to,
|
|
4819
4884
|
"passengerPosition": passengerPosition,
|
|
4820
4885
|
"registerOverlay": registerOverlay
|
|
@@ -4828,7 +4893,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4828
4893
|
}
|
|
4829
4894
|
}) : driverStatus === "driverArrived" ? Vue.h(SectionDriverArrived, {
|
|
4830
4895
|
"attrs": {
|
|
4831
|
-
"from":
|
|
4896
|
+
"from": from,
|
|
4832
4897
|
"carPosition": carPosition,
|
|
4833
4898
|
"passengerPosition": passengerPosition,
|
|
4834
4899
|
"title": driverArrivedTitle,
|
|
@@ -4836,13 +4901,13 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4836
4901
|
}
|
|
4837
4902
|
}) : driverStatus === "canceled" || driverStatus === "canceling" ? Vue.h(SectionCanceled, {
|
|
4838
4903
|
"attrs": {
|
|
4839
|
-
"from":
|
|
4904
|
+
"from": from,
|
|
4840
4905
|
"to": to,
|
|
4841
4906
|
"registerOverlay": registerOverlay
|
|
4842
4907
|
}
|
|
4843
4908
|
}) : driverStatus === "endService" || driverStatus === "completed" || driverStatus === "banlanceRefund" || driverStatus === "waitBanlanceRefund" || driverStatus === "rechargePayed" || driverStatus === "waitRechargePay" || driverStatus === "payed" || driverStatus === "waitpay" || driverStatus === "refund" ? Vue.h(SectionEndService, {
|
|
4844
4909
|
"attrs": {
|
|
4845
|
-
"from":
|
|
4910
|
+
"from": from,
|
|
4846
4911
|
"to": to,
|
|
4847
4912
|
"registerOverlay": registerOverlay
|
|
4848
4913
|
}
|
|
@@ -4850,7 +4915,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4850
4915
|
// 匹配不到就显示灰色路线
|
|
4851
4916
|
Vue.h(SectionEndService, {
|
|
4852
4917
|
"attrs": {
|
|
4853
|
-
"from":
|
|
4918
|
+
"from": from,
|
|
4854
4919
|
"to": to,
|
|
4855
4920
|
"registerOverlay": registerOverlay
|
|
4856
4921
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
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
|
+
};
|
|
1
7
|
import Vue, { defineComponent, h, computed, inject, provide, watch, onMounted, onUnmounted, watchPostEffect, shallowRef, reactive, toRefs, ref, toRef, watchEffect } from "vue";
|
|
2
8
|
const style = "";
|
|
3
9
|
Vue.util.warn;
|
|
@@ -1858,6 +1864,7 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
|
|
|
1858
1864
|
onDragStart,
|
|
1859
1865
|
onDragEnd,
|
|
1860
1866
|
onZoomEnd,
|
|
1867
|
+
onResize,
|
|
1861
1868
|
mapRef: setMap,
|
|
1862
1869
|
vectorMapForeign = "style_zh_cn",
|
|
1863
1870
|
...defaultOptions
|
|
@@ -1924,7 +1931,12 @@ const Amap = defineSetup(function Amap2(props, { slots, emit }) {
|
|
|
1924
1931
|
{ name: "mask", defaultValue: [] },
|
|
1925
1932
|
{ name: "labelRejectMask", defaultValue: false }
|
|
1926
1933
|
]);
|
|
1927
|
-
watchPostEffectForAMapEvent(mapRef, props, emit, [
|
|
1934
|
+
watchPostEffectForAMapEvent(mapRef, props, emit, [
|
|
1935
|
+
"onDragStart",
|
|
1936
|
+
"onDragEnd",
|
|
1937
|
+
"onZoomEnd",
|
|
1938
|
+
"onResize"
|
|
1939
|
+
]);
|
|
1928
1940
|
return () => {
|
|
1929
1941
|
var _a;
|
|
1930
1942
|
return h("div", { ref: elementRef, class: amap }, (_a = slots.default) == null ? void 0 : _a.call(slots));
|
|
@@ -2018,7 +2030,7 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
|
|
|
2018
2030
|
emit
|
|
2019
2031
|
}) {
|
|
2020
2032
|
const payload = useMapSupplier();
|
|
2021
|
-
const
|
|
2033
|
+
const gmapHandleDargEnd = ({
|
|
2022
2034
|
target
|
|
2023
2035
|
}) => {
|
|
2024
2036
|
const {
|
|
@@ -2027,7 +2039,7 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
|
|
|
2027
2039
|
} = target.getCenter();
|
|
2028
2040
|
emit("dragEnd", [lng(), lat()]);
|
|
2029
2041
|
};
|
|
2030
|
-
const
|
|
2042
|
+
const amapHandleDragEnd = ({
|
|
2031
2043
|
target
|
|
2032
2044
|
}) => {
|
|
2033
2045
|
const {
|
|
@@ -2036,6 +2048,7 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
|
|
|
2036
2048
|
} = target.getCenter();
|
|
2037
2049
|
emit("dragEnd", [lng, lat]);
|
|
2038
2050
|
};
|
|
2051
|
+
const handleResize = () => emit("resize");
|
|
2039
2052
|
return () => {
|
|
2040
2053
|
var _a, _b, _c;
|
|
2041
2054
|
const {
|
|
@@ -2073,7 +2086,7 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
|
|
|
2073
2086
|
"panControl": touchEnable
|
|
2074
2087
|
},
|
|
2075
2088
|
"on": {
|
|
2076
|
-
"dragEnd":
|
|
2089
|
+
"dragEnd": gmapHandleDargEnd
|
|
2077
2090
|
}
|
|
2078
2091
|
}, [children]);
|
|
2079
2092
|
default:
|
|
@@ -2093,7 +2106,8 @@ const HeycarMap = defineLagecySetup(function HeycarMap2(props, {
|
|
|
2093
2106
|
"pitchEnable": touchEnable
|
|
2094
2107
|
},
|
|
2095
2108
|
"on": {
|
|
2096
|
-
"dragEnd":
|
|
2109
|
+
"dragEnd": amapHandleDragEnd,
|
|
2110
|
+
"resize": handleResize
|
|
2097
2111
|
}
|
|
2098
2112
|
}, [children]);
|
|
2099
2113
|
}
|
|
@@ -2203,7 +2217,7 @@ const ADrivingLine = defineSetup(function ADrivingLine2(props) {
|
|
|
2203
2217
|
"attrs": {
|
|
2204
2218
|
"showDir": true,
|
|
2205
2219
|
"path": props.path,
|
|
2206
|
-
"strokeWeight": strokeWidth +
|
|
2220
|
+
"strokeWeight": strokeWidth + dirWidth,
|
|
2207
2221
|
"strokeOpacity": 1,
|
|
2208
2222
|
"strokeColor": "transparent",
|
|
2209
2223
|
"lineJoin": "round",
|
|
@@ -2828,6 +2842,7 @@ const BusinessQuotingMap = defineLagecySetup(function BusinessQuotingMap2(props)
|
|
|
2828
2842
|
renderDescription
|
|
2829
2843
|
} = props;
|
|
2830
2844
|
const fittableRegistryOverlay = createFittableRegisterOverlay(registerOverlay);
|
|
2845
|
+
const deferedSetFitView = pipeDefer(registerOverlay.setFitView);
|
|
2831
2846
|
return () => {
|
|
2832
2847
|
const {
|
|
2833
2848
|
from: fromPlace,
|
|
@@ -2841,6 +2856,9 @@ const BusinessQuotingMap = defineLagecySetup(function BusinessQuotingMap2(props)
|
|
|
2841
2856
|
"mapRef": mapRef,
|
|
2842
2857
|
"center": from,
|
|
2843
2858
|
"zoom": 13
|
|
2859
|
+
},
|
|
2860
|
+
"on": {
|
|
2861
|
+
"resize": deferedSetFitView
|
|
2844
2862
|
}
|
|
2845
2863
|
}, [h(StartEndPoint, {
|
|
2846
2864
|
"attrs": {
|
|
@@ -2882,6 +2900,49 @@ const BusinessQuotingMap = defineLagecySetup(function BusinessQuotingMap2(props)
|
|
|
2882
2900
|
})]);
|
|
2883
2901
|
};
|
|
2884
2902
|
}).props(["fallback", "from", "loading", "mapRef", "registerOverlay", "renderDescription", "to", "fromDescription", "log"]);
|
|
2903
|
+
const isPlace = (place) => {
|
|
2904
|
+
return place.lng !== void 0 && place.lat !== void 0;
|
|
2905
|
+
};
|
|
2906
|
+
const sleep = (milliSeconds) => new Promise((resolve) => setTimeout(resolve, milliSeconds));
|
|
2907
|
+
class SingleGeoWatch {
|
|
2908
|
+
constructor(option) {
|
|
2909
|
+
__publicField(this, "id", 0);
|
|
2910
|
+
__publicField(this, "listeners", /* @__PURE__ */ new Map());
|
|
2911
|
+
__publicField(this, "option", {});
|
|
2912
|
+
__publicField(this, "singleWatchId");
|
|
2913
|
+
this.option = option != null ? option : {};
|
|
2914
|
+
}
|
|
2915
|
+
watchPosition(onSuccess, onError) {
|
|
2916
|
+
this.id += 1;
|
|
2917
|
+
const { id } = this;
|
|
2918
|
+
this.listeners.set(id, [onSuccess, onError]);
|
|
2919
|
+
this.start();
|
|
2920
|
+
return id;
|
|
2921
|
+
}
|
|
2922
|
+
clearWatch(id) {
|
|
2923
|
+
this.listeners.delete(id);
|
|
2924
|
+
}
|
|
2925
|
+
async start() {
|
|
2926
|
+
const { listeners, option, singleWatchId } = this;
|
|
2927
|
+
if (singleWatchId) {
|
|
2928
|
+
navigator.geolocation.clearWatch(singleWatchId);
|
|
2929
|
+
await sleep(20);
|
|
2930
|
+
}
|
|
2931
|
+
this.singleWatchId = navigator.geolocation.watchPosition(
|
|
2932
|
+
(position) => {
|
|
2933
|
+
for (const [onSuccess] of listeners.values()) {
|
|
2934
|
+
onSuccess(position);
|
|
2935
|
+
}
|
|
2936
|
+
},
|
|
2937
|
+
(error) => {
|
|
2938
|
+
for (const [_, onError] of listeners.values()) {
|
|
2939
|
+
onError == null ? void 0 : onError(error);
|
|
2940
|
+
}
|
|
2941
|
+
},
|
|
2942
|
+
option
|
|
2943
|
+
);
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2885
2946
|
const useAmapGCJ02 = () => {
|
|
2886
2947
|
const { readyPromise } = useMapSupplier();
|
|
2887
2948
|
async function toGcj02(point) {
|
|
@@ -2912,6 +2973,11 @@ const useMapGCJ02 = () => {
|
|
|
2912
2973
|
return supplier === "gmap" ? useGmapGCJ02() : useAmapGCJ02();
|
|
2913
2974
|
};
|
|
2914
2975
|
const GEO_TIMEOUT = 5e3;
|
|
2976
|
+
const singleGeoWatch = new SingleGeoWatch({
|
|
2977
|
+
timeout: GEO_TIMEOUT,
|
|
2978
|
+
maximumAge: 0,
|
|
2979
|
+
enableHighAccuracy: false
|
|
2980
|
+
});
|
|
2915
2981
|
const useGeoLocation = (props) => {
|
|
2916
2982
|
var _a, _b;
|
|
2917
2983
|
const { onChange, onLoad, onLoadDefault, onError, geoDefaultPosition } = props != null ? props : {};
|
|
@@ -2934,12 +3000,11 @@ const useGeoLocation = (props) => {
|
|
|
2934
3000
|
() => true,
|
|
2935
3001
|
(_1, _2, onCleanup) => {
|
|
2936
3002
|
loading.value = true;
|
|
2937
|
-
const watchId =
|
|
3003
|
+
const watchId = singleGeoWatch.watchPosition(
|
|
2938
3004
|
async (position) => {
|
|
2939
3005
|
const coordinate = position.coords;
|
|
2940
3006
|
const wgsPoint = [position.coords.longitude, position.coords.latitude];
|
|
2941
3007
|
const point = await toGcj02(wgsPoint);
|
|
2942
|
-
console.log("wgsPoint, point = ", wgsPoint, point);
|
|
2943
3008
|
coordinateRef.value = coordinate;
|
|
2944
3009
|
positionRef.value = point;
|
|
2945
3010
|
if (loading.value) {
|
|
@@ -2958,10 +3023,9 @@ const useGeoLocation = (props) => {
|
|
|
2958
3023
|
onLoadDefault == null ? void 0 : onLoadDefault({ position });
|
|
2959
3024
|
}
|
|
2960
3025
|
onError == null ? void 0 : onError(error);
|
|
2961
|
-
}
|
|
2962
|
-
{ timeout: GEO_TIMEOUT, maximumAge: 0, enableHighAccuracy: false }
|
|
3026
|
+
}
|
|
2963
3027
|
);
|
|
2964
|
-
onCleanup(() =>
|
|
3028
|
+
onCleanup(() => singleGeoWatch.clearWatch(watchId));
|
|
2965
3029
|
},
|
|
2966
3030
|
{ immediate: true }
|
|
2967
3031
|
);
|
|
@@ -3886,11 +3950,10 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
3886
3950
|
const {
|
|
3887
3951
|
geoLoadingTitle,
|
|
3888
3952
|
recomendDescription,
|
|
3889
|
-
noRecomendDescription,
|
|
3890
3953
|
unavailableTitle
|
|
3891
3954
|
} = props;
|
|
3892
3955
|
const title = geoLoading.value ? geoLoadingTitle : !availableRef.value ? unavailableTitle : (_a2 = centerPlace.name) != null ? _a2 : DEFAULT_PLACE_NAME;
|
|
3893
|
-
const description = !availableRef.value ? void 0 : isElectedRef.value ? recomendDescription :
|
|
3956
|
+
const description = !availableRef.value ? void 0 : isElectedRef.value ? recomendDescription : void 0;
|
|
3894
3957
|
return h(HeycarMap, {
|
|
3895
3958
|
"attrs": {
|
|
3896
3959
|
"center": centerPoint.value,
|
|
@@ -3920,11 +3983,8 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
3920
3983
|
}
|
|
3921
3984
|
})]);
|
|
3922
3985
|
};
|
|
3923
|
-
}).props(["log", "geoLoadingTitle", "unavailableTitle", "recomendDescription", "
|
|
3986
|
+
}).props(["log", "geoLoadingTitle", "unavailableTitle", "recomendDescription", "fallback", "geoDefaultPosition", "getRecomendPlace", "getDefaultCenterPlace", "loading", "mapContext"]);
|
|
3924
3987
|
const BEIJIN_POINT = [116.2317, 39.5427];
|
|
3925
|
-
const isPlace = (place) => {
|
|
3926
|
-
return place.lng !== void 0 && place.lat !== void 0;
|
|
3927
|
-
};
|
|
3928
3988
|
const useAmapGeometry = () => {
|
|
3929
3989
|
const payload = useMapSupplier();
|
|
3930
3990
|
const apiMapDistance = (from, to) => {
|
|
@@ -4713,6 +4773,7 @@ const BusinessTaxiEndMap = defineSetup(function BusinessTaxiEndMap2(props) {
|
|
|
4713
4773
|
autoFitTimeout: 5e3,
|
|
4714
4774
|
padding: [25, 20, 15, 15]
|
|
4715
4775
|
});
|
|
4776
|
+
const deferedSetFitView = pipeDefer(registerFitVeiw.setFitView);
|
|
4716
4777
|
return () => {
|
|
4717
4778
|
const {
|
|
4718
4779
|
from,
|
|
@@ -4726,6 +4787,9 @@ const BusinessTaxiEndMap = defineSetup(function BusinessTaxiEndMap2(props) {
|
|
|
4726
4787
|
"zoom": 3,
|
|
4727
4788
|
"mapRef": setMap,
|
|
4728
4789
|
"touchEnable": false
|
|
4790
|
+
},
|
|
4791
|
+
"on": {
|
|
4792
|
+
"resize": deferedSetFitView
|
|
4729
4793
|
}
|
|
4730
4794
|
}, [isReady && h(SectionEndService, {
|
|
4731
4795
|
"attrs": {
|
|
@@ -4739,7 +4803,6 @@ const BusinessTaxiEndMap = defineSetup(function BusinessTaxiEndMap2(props) {
|
|
|
4739
4803
|
const STATUS_NEED_CAR_POSITION = ["book-driverStartService", "dispatched", "driverStartService", "inService", "driverArrived"];
|
|
4740
4804
|
const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap2(props) {
|
|
4741
4805
|
const {
|
|
4742
|
-
from,
|
|
4743
4806
|
interval,
|
|
4744
4807
|
registerOverlay,
|
|
4745
4808
|
mapRef,
|
|
@@ -4747,12 +4810,11 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4747
4810
|
renderStartSerivceTitle,
|
|
4748
4811
|
renderInServiceTitle
|
|
4749
4812
|
} = props;
|
|
4813
|
+
const deferedSetFitView = pipeDefer(registerOverlay.setFitView);
|
|
4750
4814
|
const {
|
|
4751
4815
|
geoPosition,
|
|
4752
4816
|
geoError
|
|
4753
|
-
} = useGeoLocation(
|
|
4754
|
-
geoDefaultPosition: place2point(from)
|
|
4755
|
-
});
|
|
4817
|
+
} = useGeoLocation();
|
|
4756
4818
|
const carPositionRef = ref(place2point(props.from));
|
|
4757
4819
|
watch(() => props.driverStatus, (status, _, onCleanup) => {
|
|
4758
4820
|
if (!STATUS_NEED_CAR_POSITION.includes(status))
|
|
@@ -4767,7 +4829,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4767
4829
|
return () => {
|
|
4768
4830
|
const {
|
|
4769
4831
|
driverStatus,
|
|
4770
|
-
from
|
|
4832
|
+
from,
|
|
4771
4833
|
to,
|
|
4772
4834
|
dispatchingTitle,
|
|
4773
4835
|
bookDispatchingTitle,
|
|
@@ -4778,33 +4840,36 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4778
4840
|
const passengerPosition = geoError.value ? void 0 : geoPosition.value;
|
|
4779
4841
|
return h(HeycarMap, {
|
|
4780
4842
|
"attrs": {
|
|
4781
|
-
"center": place2point(
|
|
4843
|
+
"center": place2point(from),
|
|
4782
4844
|
"zoom": 13,
|
|
4783
4845
|
"mapRef": mapRef,
|
|
4784
4846
|
"touchEnable": touchEnable
|
|
4847
|
+
},
|
|
4848
|
+
"on": {
|
|
4849
|
+
"resize": deferedSetFitView
|
|
4785
4850
|
}
|
|
4786
4851
|
}, [driverStatus === "dispatching" ? h(SectionDispatching, {
|
|
4787
4852
|
"attrs": {
|
|
4788
|
-
"from":
|
|
4853
|
+
"from": from,
|
|
4789
4854
|
"title": dispatchingTitle,
|
|
4790
4855
|
"registerOverlay": registerOverlay
|
|
4791
4856
|
}
|
|
4792
4857
|
}) : driverStatus === "book-dispatching" ? h(SectionDispatching, {
|
|
4793
4858
|
"attrs": {
|
|
4794
|
-
"from":
|
|
4859
|
+
"from": from,
|
|
4795
4860
|
"title": bookDispatchingTitle,
|
|
4796
4861
|
"registerOverlay": registerOverlay
|
|
4797
4862
|
}
|
|
4798
4863
|
}) : driverStatus === "assign" || driverStatus === "confirmed" ? h(SectionConfirmed, {
|
|
4799
4864
|
"attrs": {
|
|
4800
|
-
"from":
|
|
4865
|
+
"from": from,
|
|
4801
4866
|
"to": to,
|
|
4802
4867
|
"passengerPosition": passengerPosition,
|
|
4803
4868
|
"registerOverlay": registerOverlay
|
|
4804
4869
|
}
|
|
4805
4870
|
}) : driverStatus === "dispatched" || driverStatus === "driverStartService" || driverStatus === "book-driverStartService" ? h(SectionDriverStartService, {
|
|
4806
4871
|
"attrs": {
|
|
4807
|
-
"from":
|
|
4872
|
+
"from": from,
|
|
4808
4873
|
"carPosition": carPosition,
|
|
4809
4874
|
"passengerPosition": passengerPosition,
|
|
4810
4875
|
"renderTitle": renderStartSerivceTitle,
|
|
@@ -4812,7 +4877,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4812
4877
|
}
|
|
4813
4878
|
}) : driverStatus === "book-dispatched" ? h(SectionBookDispatched, {
|
|
4814
4879
|
"attrs": {
|
|
4815
|
-
"from":
|
|
4880
|
+
"from": from,
|
|
4816
4881
|
"to": to,
|
|
4817
4882
|
"passengerPosition": passengerPosition,
|
|
4818
4883
|
"registerOverlay": registerOverlay
|
|
@@ -4826,7 +4891,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4826
4891
|
}
|
|
4827
4892
|
}) : driverStatus === "driverArrived" ? h(SectionDriverArrived, {
|
|
4828
4893
|
"attrs": {
|
|
4829
|
-
"from":
|
|
4894
|
+
"from": from,
|
|
4830
4895
|
"carPosition": carPosition,
|
|
4831
4896
|
"passengerPosition": passengerPosition,
|
|
4832
4897
|
"title": driverArrivedTitle,
|
|
@@ -4834,13 +4899,13 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4834
4899
|
}
|
|
4835
4900
|
}) : driverStatus === "canceled" || driverStatus === "canceling" ? h(SectionCanceled, {
|
|
4836
4901
|
"attrs": {
|
|
4837
|
-
"from":
|
|
4902
|
+
"from": from,
|
|
4838
4903
|
"to": to,
|
|
4839
4904
|
"registerOverlay": registerOverlay
|
|
4840
4905
|
}
|
|
4841
4906
|
}) : driverStatus === "endService" || driverStatus === "completed" || driverStatus === "banlanceRefund" || driverStatus === "waitBanlanceRefund" || driverStatus === "rechargePayed" || driverStatus === "waitRechargePay" || driverStatus === "payed" || driverStatus === "waitpay" || driverStatus === "refund" ? h(SectionEndService, {
|
|
4842
4907
|
"attrs": {
|
|
4843
|
-
"from":
|
|
4908
|
+
"from": from,
|
|
4844
4909
|
"to": to,
|
|
4845
4910
|
"registerOverlay": registerOverlay
|
|
4846
4911
|
}
|
|
@@ -4848,7 +4913,7 @@ const BusinessTaxiServiceMap = defineLagecySetup(function BusinessTaxiServiceMap
|
|
|
4848
4913
|
// 匹配不到就显示灰色路线
|
|
4849
4914
|
h(SectionEndService, {
|
|
4850
4915
|
"attrs": {
|
|
4851
|
-
"from":
|
|
4916
|
+
"from": from,
|
|
4852
4917
|
"to": to,
|
|
4853
4918
|
"registerOverlay": registerOverlay
|
|
4854
4919
|
}
|
package/dist/utils/helper.d.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @note navigator.geolocation.watchPosition 期间,再调用 watchPosition 或 getCurrentPosition 会导致定位失败。
|
|
3
|
+
*/
|
|
4
|
+
export declare class SingleGeoWatch {
|
|
5
|
+
id: number;
|
|
6
|
+
listeners: Map<number, [PositionCallback, PositionErrorCallback | undefined]>;
|
|
7
|
+
option: PositionOptions;
|
|
8
|
+
singleWatchId: number | undefined;
|
|
9
|
+
constructor(option?: PositionOptions);
|
|
10
|
+
watchPosition(onSuccess: PositionCallback, onError?: PositionErrorCallback): number;
|
|
11
|
+
clearWatch(id: number): void;
|
|
12
|
+
start(): Promise<void>;
|
|
13
|
+
}
|
package/package.json
CHANGED
package/todo.md
CHANGED
|
@@ -2,30 +2,15 @@ https://dawchihliou.github.io/articles/building-custom-google-maps-marker-react-
|
|
|
2
2
|
|
|
3
3
|
2. Google 地址名称太长
|
|
4
4
|
3. 高德地图加载期间出现大量的请求
|
|
5
|
+
4. 做完其他事情进入首页,变成了获取定位失败,但其实 gps 是 ok 的,因为刷新页面是有点位的
|
|
5
6
|
|
|
6
7
|
郝瑞
|
|
7
8
|
|
|
8
9
|
- 5033 是否可以关闭
|
|
9
10
|
- 5177 不太明白
|
|
10
11
|
|
|
11
|
-
孙明
|
|
12
|
-
|
|
13
|
-
- 4991
|
|
14
|
-
- 5236 地图高度问题
|
|
15
|
-
- 5237
|
|
16
|
-
- 5240
|
|
17
|
-
|
|
18
|
-
谭红亚
|
|
19
|
-
|
|
20
|
-
- 4772
|
|
21
|
-
|
|
22
|
-
谭瑞平
|
|
23
|
-
|
|
24
|
-
- 5145 关闭浏览器再打开,sensor 失效了
|
|
25
|
-
|
|
26
12
|
测试环境看下
|
|
27
13
|
|
|
28
|
-
- 4903
|
|
29
14
|
- 4914
|
|
30
15
|
- 4976
|
|
31
16
|
- 5002
|
|
@@ -34,8 +19,6 @@ https://dawchihliou.github.io/articles/building-custom-google-maps-marker-react-
|
|
|
34
19
|
- 5017
|
|
35
20
|
- 5036
|
|
36
21
|
- 5092
|
|
37
|
-
- 5095 大概率可以关掉
|
|
38
|
-
- 5223
|
|
39
22
|
- 5225
|
|
40
23
|
- 5229 优先看
|
|
41
24
|
- 5238
|
|
@@ -80,3 +63,14 @@ setView 类 bug
|
|
|
80
63
|
- 4836
|
|
81
64
|
- 4915
|
|
82
65
|
- 5228
|
|
66
|
+
|
|
67
|
+
0.4.8
|
|
68
|
+
|
|
69
|
+
- 5014
|
|
70
|
+
|
|
71
|
+
0.4.9
|
|
72
|
+
|
|
73
|
+
- 4903
|
|
74
|
+
- 5006
|
|
75
|
+
- 5017
|
|
76
|
+
- 5238
|