@heycar/heycars-map 0.2.7 → 0.2.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.d.ts +2 -0
- package/dist/Demo/DemoBusinessQuoting.d.ts +1 -0
- package/dist/Demo/DemoBusinessRecomendPlace.d.ts +1 -0
- package/dist/Demo/DemoBusinessTaxiEnd.d.ts +1 -0
- package/dist/Demo/DemoBusinessTaxiService.d.ts +1 -0
- package/dist/business-components/AbsoluteAddressBox/AbsoluteAddressBox.d.ts +2 -0
- package/dist/business-components/AbsoluteAddressBox/index.d.ts +1 -0
- package/dist/business-components/AddressBox/AddressBox.d.ts +1 -2
- package/dist/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +25 -0
- package/dist/business-components/BusinessRecomendPlaceMap/index.d.ts +1 -0
- package/dist/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +6 -0
- package/dist/business-components/BusinessTaxiEndMap/index.d.ts +1 -0
- package/dist/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +6 -0
- package/dist/hooks/useGeoLocation.d.ts +1 -0
- package/dist/hooks/useMapRecomendPlace.d.ts +4 -1
- package/dist/hooks-business/useBusinessRecomendPlaceMap.d.ts +27 -0
- package/dist/hooks-business/{useBusinessMapRecomendPlace.d.ts → useLagecyMapRecomendPlace.d.ts} +2 -2
- package/dist/index.cjs +52 -52
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1039 -907
- package/dist/types/interface.d.ts +1 -1
- package/package.json +1 -1
- package/src/App.tsx +21 -7
- package/src/{components/Demo → Demo/CityBound}/SearchDemo.tsx +2 -2
- package/src/{components/Demo → Demo}/Demo.tsx +13 -13
- package/src/Demo/DemoBusinessQuoting.tsx +18 -0
- package/src/Demo/DemoBusinessRecomendPlace.tsx +66 -0
- package/src/Demo/DemoBusinessTaxiEnd.tsx +13 -0
- package/src/{components/Demo → Demo}/DemoBusinessTaxiService.tsx +6 -26
- package/src/business-components/AbsoluteAddressBox/AbsoluteAddressBox.tsx +8 -0
- package/src/business-components/AbsoluteAddressBox/index.ts +1 -0
- package/src/business-components/AddressBox/AddressBox.tsx +1 -1
- package/src/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.tsx +166 -0
- package/src/business-components/BusinessRecomendPlaceMap/index.ts +1 -0
- package/src/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.tsx +33 -0
- package/src/business-components/BusinessTaxiEndMap/index.ts +1 -0
- package/src/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.tsx +22 -5
- package/src/business-components/PlaceCircle/PlaceCircle.tsx +15 -19
- package/src/hooks/useGeoLocation.ts +3 -1
- package/src/hooks/useMapGeometry.ts +4 -4
- package/src/hooks/useMapRecomendPlace.ts +34 -3
- package/src/hooks-business/useBusinessRecomendPlaceMap.ts +45 -0
- package/src/hooks-business/{useBusinessMapRecomendPlace.ts → useLagecyMapRecomendPlace.ts} +3 -2
- package/src/index.ts +3 -1
- package/src/types/interface.ts +11 -1
- package/todo.md +6 -0
- package/dist/components/Demo/BusinessDemo.d.ts +0 -2
- package/dist/components/Demo/Demo.d.ts +0 -2
- package/dist/components/Demo/DemoBusinessQuoting.d.ts +0 -1
- package/dist/components/Demo/DemoBusinessTaxiService.d.ts +0 -2
- package/dist/components/Demo/Hello.d.ts +0 -17
- package/dist/components/Demo/HeycarDemo.d.ts +0 -3
- package/dist/components/Demo/index.d.ts +0 -1
- package/src/components/Demo/BusinessDemo.tsx +0 -117
- package/src/components/Demo/DemoBusinessQuoting.tsx +0 -38
- package/src/components/Demo/Hello.tsx +0 -15
- package/src/components/Demo/HeycarDemo.tsx +0 -181
- package/src/components/Demo/TemplateDemo.vue +0 -11
- package/src/components/Demo/index.ts +0 -1
- /package/dist/{components/Demo → Demo/CityBound}/SearchDemo.d.ts +0 -0
- /package/dist/{components/Demo → Demo/CityBound}/country.d.ts +0 -0
- /package/dist/{components/Demo → Demo/CityBound}/searchResult.d.ts +0 -0
- /package/dist/{components/Demo → Demo}/Demo.css.d.ts +0 -0
- /package/src/{components/Demo → Demo/CityBound}/country.ts +0 -0
- /package/src/{components/Demo → Demo/CityBound}/searchResult.ts +0 -0
- /package/src/{components/Demo → Demo}/Demo.css.ts +0 -0
|
@@ -33,12 +33,14 @@ export interface UseMapRecomendPlaceProps<C = Record<string, any>> {
|
|
|
33
33
|
pointRef: Ref<Point>;
|
|
34
34
|
context?: C;
|
|
35
35
|
getLimit: (context?: C) => number;
|
|
36
|
-
|
|
36
|
+
// 如果返回 undefined, 表示当前位置无服务可提供
|
|
37
|
+
getRecomendPlace: (place: Place, context?: C) => Promise<Place[] | undefined>;
|
|
37
38
|
onChangePlace?: UseMapPlaceProps["onChange"];
|
|
38
39
|
onChange?: (place: Place) => any;
|
|
39
40
|
}
|
|
40
41
|
export const useAmapRecomendPlace = <C>(props: UseMapRecomendPlaceProps<C>) => {
|
|
41
42
|
const { pointRef, getRecomendPlace, getLimit, context, onChange, onChangePlace } = props;
|
|
43
|
+
const availableRef = ref(true);
|
|
42
44
|
const placeCandidatesRef = ref<Place[]>([]);
|
|
43
45
|
const { idx: recomendPlaceKey, update: updateRecomandPlace } = useUpdate();
|
|
44
46
|
const { readyPromise } = useMapSupplier();
|
|
@@ -49,19 +51,34 @@ export const useAmapRecomendPlace = <C>(props: UseMapRecomendPlaceProps<C>) => {
|
|
|
49
51
|
async () => {
|
|
50
52
|
await readyPromise;
|
|
51
53
|
const placeCandidates = await getRecomendPlace({ ...place }, context);
|
|
54
|
+
if (placeCandidates === undefined) {
|
|
55
|
+
availableRef.value = false;
|
|
56
|
+
placeCandidatesRef.value = [];
|
|
57
|
+
Object.assign(recomendPlace, { ...place });
|
|
58
|
+
onChange?.({ ...place });
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
52
61
|
const { shortestPlace, shortestDistance } = findAmapNearestPlace(place, placeCandidates);
|
|
53
62
|
const limit = getLimit(context);
|
|
54
63
|
const resultPlace = shortestDistance > limit ? place : shortestPlace;
|
|
64
|
+
availableRef.value = true;
|
|
55
65
|
placeCandidatesRef.value = placeCandidates;
|
|
56
66
|
Object.assign(recomendPlace, { ...resultPlace });
|
|
57
67
|
onChange?.({ ...resultPlace });
|
|
58
68
|
}
|
|
59
69
|
);
|
|
60
|
-
return {
|
|
70
|
+
return {
|
|
71
|
+
recomendPlace,
|
|
72
|
+
placeCandidates: placeCandidatesRef,
|
|
73
|
+
availableRef,
|
|
74
|
+
updateRecomandPlace,
|
|
75
|
+
updatePlace,
|
|
76
|
+
};
|
|
61
77
|
};
|
|
62
78
|
|
|
63
79
|
export const useGmapRecomendPlace = <C>(props: UseMapRecomendPlaceProps<C>) => {
|
|
64
80
|
const { pointRef, getRecomendPlace, getLimit, context, onChange, onChangePlace } = props;
|
|
81
|
+
const availableRef = ref(true);
|
|
65
82
|
const placeCandidatesRef = ref<Place[]>([]);
|
|
66
83
|
const { idx: recomendPlaceKey, update: updateRecomandPlace } = useUpdate();
|
|
67
84
|
const { readyPromise } = useMapSupplier();
|
|
@@ -72,15 +89,29 @@ export const useGmapRecomendPlace = <C>(props: UseMapRecomendPlaceProps<C>) => {
|
|
|
72
89
|
async () => {
|
|
73
90
|
await readyPromise;
|
|
74
91
|
const placeCandidates = await getRecomendPlace({ ...place }, context);
|
|
92
|
+
if (placeCandidates === undefined) {
|
|
93
|
+
availableRef.value = false;
|
|
94
|
+
placeCandidatesRef.value = [];
|
|
95
|
+
Object.assign(recomendPlace, { ...place });
|
|
96
|
+
onChange?.({ ...place });
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
75
99
|
const { shortestPlace, shortestDistance } = findGmapNearestPlace(place, placeCandidates);
|
|
76
100
|
const limit = getLimit(context);
|
|
77
101
|
const resultPlace = shortestDistance > limit ? place : shortestPlace;
|
|
102
|
+
availableRef.value = true;
|
|
78
103
|
placeCandidatesRef.value = placeCandidates;
|
|
79
104
|
Object.assign(recomendPlace, { ...resultPlace });
|
|
80
105
|
onChange?.({ ...resultPlace });
|
|
81
106
|
}
|
|
82
107
|
);
|
|
83
|
-
return {
|
|
108
|
+
return {
|
|
109
|
+
recomendPlace,
|
|
110
|
+
placeCandidates: placeCandidatesRef,
|
|
111
|
+
availableRef,
|
|
112
|
+
updateRecomandPlace,
|
|
113
|
+
updatePlace,
|
|
114
|
+
};
|
|
84
115
|
};
|
|
85
116
|
|
|
86
117
|
export const useMapRecomendPlace = <C>(props: UseMapRecomendPlaceProps<C>) => {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { reactive, ref } from "vue-demi";
|
|
2
|
+
import { useMapGeometry } from "../hooks/useMapGeometry";
|
|
3
|
+
import type { Place, Point } from "../types/interface";
|
|
4
|
+
|
|
5
|
+
export interface BusinessRecomendPlaceContext {
|
|
6
|
+
panTo: (value: Point) => void;
|
|
7
|
+
setCenterPlaceByRecomand: (value: Point) => void;
|
|
8
|
+
onChangeCenterPlace: (value: Place) => void;
|
|
9
|
+
onChangeRecomendPlaces: (value: Place[]) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const useBusinessRecomendPlaceMap = () => {
|
|
13
|
+
const centerPlace = reactive<Place>({
|
|
14
|
+
lng: 0,
|
|
15
|
+
lat: 0,
|
|
16
|
+
name: "",
|
|
17
|
+
cityName: undefined,
|
|
18
|
+
});
|
|
19
|
+
const placeCandidates = ref<Place[]>([]);
|
|
20
|
+
const { apiMapDistance } = useMapGeometry();
|
|
21
|
+
const panTo = (value: Point) => mapContext.panTo(value);
|
|
22
|
+
const setCenterPlaceByRecomand = (value: Point) => mapContext.setCenterPlaceByRecomand(value);
|
|
23
|
+
const mapContext: BusinessRecomendPlaceContext = {
|
|
24
|
+
panTo: () => {
|
|
25
|
+
throw new Error("MyError: panTo used before assigned");
|
|
26
|
+
},
|
|
27
|
+
setCenterPlaceByRecomand: () => {
|
|
28
|
+
throw new Error("MyError: setCenterPlaceByRecomand used before assigned");
|
|
29
|
+
},
|
|
30
|
+
onChangeCenterPlace: (place: Place) => {
|
|
31
|
+
Object.assign(centerPlace, { ...place });
|
|
32
|
+
},
|
|
33
|
+
onChangeRecomendPlaces: (places: Place[]) => {
|
|
34
|
+
placeCandidates.value = [...places];
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
mapContext,
|
|
39
|
+
centerPlace,
|
|
40
|
+
placeCandidates,
|
|
41
|
+
panTo,
|
|
42
|
+
setCenterPlaceByRecomand,
|
|
43
|
+
apiMapDistance,
|
|
44
|
+
};
|
|
45
|
+
};
|
|
@@ -9,7 +9,7 @@ import type { MapShallowRef, Place, Point } from "../types/interface";
|
|
|
9
9
|
interface CenterPlaceSource {
|
|
10
10
|
source: "default" | "geo" | "drag" | "recomend" | "api";
|
|
11
11
|
}
|
|
12
|
-
export interface
|
|
12
|
+
export interface UseLagecyMapRecomendPlace
|
|
13
13
|
extends Pick<UseMapRecomendPlaceProps<CenterPlaceSource>, "getRecomendPlace"> {
|
|
14
14
|
mapRef: MapShallowRef;
|
|
15
15
|
defaultCenterPoint?: Point;
|
|
@@ -23,7 +23,7 @@ export interface UseBusinessMapRecomendPlaceProps
|
|
|
23
23
|
onChangePlace?: UseMapPlaceProps["onChange"];
|
|
24
24
|
onChangeRecomandPlace?: UseMapRecomendPlaceProps["onChange"];
|
|
25
25
|
}
|
|
26
|
-
export const
|
|
26
|
+
export const useLagecyMapRecomendPlace = (props: UseLagecyMapRecomendPlace) => {
|
|
27
27
|
const {
|
|
28
28
|
mapRef,
|
|
29
29
|
geoDefaultPosition,
|
|
@@ -135,6 +135,7 @@ export const useBusinessMapRecomendPlace = (props: UseBusinessMapRecomendPlacePr
|
|
|
135
135
|
onChangeRecomandPlace?.(place);
|
|
136
136
|
},
|
|
137
137
|
});
|
|
138
|
+
|
|
138
139
|
return {
|
|
139
140
|
isDragging,
|
|
140
141
|
geoLoading,
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
2
|
export { AddressBox } from "./business-components/AddressBox";
|
|
3
3
|
export { BusinessQuotingMap } from "./business-components/BusinessQuotingMap";
|
|
4
|
+
export { BusinessRecomendPlaceMap } from "./business-components/BusinessRecomendPlaceMap";
|
|
5
|
+
export { BusinessTaxiEndMap } from "./business-components/BusinessTaxiEndMap";
|
|
4
6
|
export { BusinessTaxiServiceMap } from "./business-components/BusinessTaxiServiceMap";
|
|
5
7
|
export { DrivingLine } from "./business-components/DrivingLine";
|
|
6
8
|
export { DrivingRoute } from "./business-components/DrivingRoute";
|
|
@@ -14,8 +16,8 @@ export { WalkingRoute } from "./business-components/WalkingRoute";
|
|
|
14
16
|
export { WaveCircle } from "./business-components/WaveCircle";
|
|
15
17
|
export * from "./components/MapProvider";
|
|
16
18
|
export * from "./hooks-business/useBusinessMapAutoComplete";
|
|
17
|
-
export * from "./hooks-business/useBusinessMapRecomendPlace";
|
|
18
19
|
export * from "./hooks-business/useBusinessQuotingMap";
|
|
20
|
+
export * from "./hooks-business/useBusinessRecomendPlaceMap";
|
|
19
21
|
export * from "./hooks-business/useBusinessTaxiServiceMap";
|
|
20
22
|
export { useDrivingRoute } from "./hooks/useDrivingRoute";
|
|
21
23
|
export { useGeoLocation } from "./hooks/useGeoLocation";
|
package/src/types/interface.ts
CHANGED
|
@@ -47,4 +47,14 @@ export type DriverStatus =
|
|
|
47
47
|
| "driverArrived"
|
|
48
48
|
| "inService"
|
|
49
49
|
| "canceled"
|
|
50
|
-
| "endService"
|
|
50
|
+
| "endService"
|
|
51
|
+
| "completed"
|
|
52
|
+
| "canceling"
|
|
53
|
+
| "banlanceRefund"
|
|
54
|
+
| "waitBanlanceRefund"
|
|
55
|
+
| "rechargePayed"
|
|
56
|
+
| "waitRechargePay"
|
|
57
|
+
| "payed"
|
|
58
|
+
| "waitpay"
|
|
59
|
+
| "refund"
|
|
60
|
+
| "confirmed";
|
package/todo.md
CHANGED
|
@@ -23,3 +23,9 @@ https://dawchihliou.github.io/articles/building-custom-google-maps-marker-react-
|
|
|
23
23
|
2. locator 气泡长度限制
|
|
24
24
|
3. locator 拖动次数多了会不更新
|
|
25
25
|
4. 郝瑞 searh Place 接口搜索次数多了会不更新
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
1. apiDistance 在 created 生命周期里调用的时候,即便设置了 5 秒延迟,运行到 api 内部的时候 status === 'loading'
|
|
30
|
+
2. getRecomend 接口需要增加一个返回参数,表示当前地区是否可以提供服务
|
|
31
|
+
3. 孙明 刚才传入 complted 状态,地图未显示
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const ABusinessDemo: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<unknown>, 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<unknown, Required<unknown>>, never, unknown, {}>;
|
|
2
|
-
export declare const GBusinessDemo: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<unknown>, 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<unknown, Required<unknown>>, never, unknown, {}>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const DemoGmap: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<unknown>, 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<unknown, Required<unknown>>, never, unknown, {}>;
|
|
2
|
-
export declare const DemoAmap: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<unknown>, 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<unknown, Required<unknown>>, never, unknown, {}>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const DemoBusinessQuoting: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<unknown>, 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<unknown, Required<unknown>>, never, unknown, {}>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const DemoBusinessTaxiService: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<unknown>, 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<unknown, Required<unknown>>, never, unknown, {}>;
|
|
2
|
-
export declare const TaxiCarServicePage: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<unknown>, 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<unknown, Required<unknown>>, never, unknown, {}>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare const Hello: import("vue").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<{
|
|
2
|
-
className?: string | undefined;
|
|
3
|
-
qyc: number;
|
|
4
|
-
style: any;
|
|
5
|
-
}>, 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<{
|
|
6
|
-
className?: string | undefined;
|
|
7
|
-
qyc: number;
|
|
8
|
-
style: any;
|
|
9
|
-
}, Required<{
|
|
10
|
-
className?: string | undefined;
|
|
11
|
-
qyc: number;
|
|
12
|
-
style: any;
|
|
13
|
-
}>>, never, {
|
|
14
|
-
className?: string | undefined;
|
|
15
|
-
qyc: number;
|
|
16
|
-
style: any;
|
|
17
|
-
}, {}>;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const HeycarDemo: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<unknown>, 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<unknown, Required<unknown>>, never, unknown, {}>;
|
|
2
|
-
export declare const SomeOuterPage: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<unknown>, 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<unknown, Required<unknown>>, never, unknown, {}>;
|
|
3
|
-
export declare const SomeHomePage: import("vue-demi").DefineComponent<import("vue/types/v3-component-props").ComponentObjectPropsOptions<unknown>, 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<unknown, Required<unknown>>, never, unknown, {}>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Demo";
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { APlaceCircle, GPlaceCircle } from "../../business-components/PlaceCircle";
|
|
2
|
-
import { GWaveCircle } from "../../business-components/WaveCircle";
|
|
3
|
-
import { defineSetup } from "../../types/helper";
|
|
4
|
-
import { Amap } from "../Amap";
|
|
5
|
-
import { AmapLoader } from "../AmapLoader";
|
|
6
|
-
import { Gmap } from "../Gmap";
|
|
7
|
-
import { GmapLoader } from "../GmapLoader";
|
|
8
|
-
import * as css from "./Demo.css";
|
|
9
|
-
|
|
10
|
-
const gmapApiKey = import.meta.env.VITE_GMAP_API_KEY;
|
|
11
|
-
const gmapId = import.meta.env.VITE_GMAP_MAP_ID;
|
|
12
|
-
const amapApiKey = import.meta.env.VITE_AMAP_API_KEY;
|
|
13
|
-
const amapApiSecret = import.meta.env.VITE_AMAP_API_SECRET;
|
|
14
|
-
|
|
15
|
-
export const ABusinessDemo = defineSetup(function ABusinessDemo() {
|
|
16
|
-
return () => (
|
|
17
|
-
<AmapLoader
|
|
18
|
-
apiKey={amapApiKey}
|
|
19
|
-
apiSecret={amapApiSecret}
|
|
20
|
-
loading={() => <div>loading</div>}
|
|
21
|
-
fallback={() => <div>error</div>}
|
|
22
|
-
plugins={["AMap.AutoComplete"]}
|
|
23
|
-
>
|
|
24
|
-
<Amap class={css.demo} center={[0, 0]} zoom={3}>
|
|
25
|
-
{/* <APassengerCircle position={[0, 0]} /> */}
|
|
26
|
-
{/* <AAddressBox position={[0, 0]} title={"Martyrs Lawn"} description={"您将在此处上车"} /> */}
|
|
27
|
-
<APlaceCircle position={[0, 0]} label={"Kenkey Hut"} />
|
|
28
|
-
{/* <AAddressLocator position={[0, 0]} /> */}
|
|
29
|
-
{/* <AmapMarker position={[0, 0]} /> */}
|
|
30
|
-
{/* <AStartEndPoint
|
|
31
|
-
type="end"
|
|
32
|
-
position={[0, 0]}
|
|
33
|
-
title="2月14日 11:00 用车"
|
|
34
|
-
description={"全程 *4.12公里* 约行驶 *22分钟*"}
|
|
35
|
-
/> */}
|
|
36
|
-
{/* <ATaxiCar position={[0, 0]} angle={90} title="距离终点 *4.2公里* 预计 *25分钟*" /> */}
|
|
37
|
-
{/* <ADrivingLine
|
|
38
|
-
path={[
|
|
39
|
-
[-5, -5],
|
|
40
|
-
[-4, -3],
|
|
41
|
-
[-3, -4],
|
|
42
|
-
[-2, -1],
|
|
43
|
-
[-1, -2],
|
|
44
|
-
[0, 1],
|
|
45
|
-
[1, 0],
|
|
46
|
-
[2, 2],
|
|
47
|
-
]}
|
|
48
|
-
/> */}
|
|
49
|
-
{/* <AWalkingLine
|
|
50
|
-
path={[
|
|
51
|
-
[-5, -5],
|
|
52
|
-
[-4, -3],
|
|
53
|
-
[-3, -4],
|
|
54
|
-
[-2, -1],
|
|
55
|
-
[-1, -2],
|
|
56
|
-
[0, 1],
|
|
57
|
-
[1, 0],
|
|
58
|
-
[2, 2],
|
|
59
|
-
]}
|
|
60
|
-
/> */}
|
|
61
|
-
{/* <AWaveCircle position={[0, 0]} /> */}
|
|
62
|
-
</Amap>
|
|
63
|
-
</AmapLoader>
|
|
64
|
-
);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
export const GBusinessDemo = defineSetup(function GBusinessDemo() {
|
|
68
|
-
return () => (
|
|
69
|
-
<GmapLoader
|
|
70
|
-
version="beta"
|
|
71
|
-
apiKey={gmapApiKey}
|
|
72
|
-
loading={() => <div>loading</div>}
|
|
73
|
-
fallback={() => <div>error</div>}
|
|
74
|
-
libraries={["places", "marker"]}
|
|
75
|
-
>
|
|
76
|
-
<Gmap class={css.demo} center={{ lat: 0, lng: 0 }} zoom={3} mapId={gmapId}>
|
|
77
|
-
{/* {/* <GmapMarker position={{ lat: 0, lng: 0 }} /> */}
|
|
78
|
-
{/* <GPassengerCircle position={[0, 0]} /> */}
|
|
79
|
-
{/* <GAddressLocator position={[0, 0]} /> */}
|
|
80
|
-
<GPlaceCircle position={[0, 0]} />
|
|
81
|
-
{/* <GAddressBox position={[0, 0]} title={"当前区域暂未开通服务"} /> */}
|
|
82
|
-
{/* <GStartEndPoint
|
|
83
|
-
type="start"
|
|
84
|
-
position={[0, 0]}
|
|
85
|
-
title="Webster Dental Plaza"
|
|
86
|
-
description={"全程 *4.12公里* 约行驶 *22分钟*"}
|
|
87
|
-
/> */}
|
|
88
|
-
{/* <GTaxiCar position={[0, 0]} /> */}
|
|
89
|
-
{/* <GDrivingLine
|
|
90
|
-
path={[
|
|
91
|
-
[-5, -5],
|
|
92
|
-
[-4, -3],
|
|
93
|
-
[-3, -4],
|
|
94
|
-
[-2, -1],
|
|
95
|
-
[-1, -2],
|
|
96
|
-
[0, 1],
|
|
97
|
-
[1, 0],
|
|
98
|
-
[2, 2],
|
|
99
|
-
]}
|
|
100
|
-
/> */}
|
|
101
|
-
{/* <GWalkingLine
|
|
102
|
-
path={[
|
|
103
|
-
[-5, -5],
|
|
104
|
-
[-4, -3],
|
|
105
|
-
[-3, -4],
|
|
106
|
-
[-2, -1],
|
|
107
|
-
[-1, -2],
|
|
108
|
-
[0, 1],
|
|
109
|
-
[1, 0],
|
|
110
|
-
[2, 2],
|
|
111
|
-
]}
|
|
112
|
-
/> */}
|
|
113
|
-
<GWaveCircle position={[0, 0]} />
|
|
114
|
-
</Gmap>
|
|
115
|
-
</GmapLoader>
|
|
116
|
-
);
|
|
117
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { BusinessQuotingMap } from "../../business-components/BusinessQuotingMap";
|
|
2
|
-
import { useBusinessQuotingMap } from "../../hooks-business/useBusinessQuotingMap";
|
|
3
|
-
import { defineSetup } from "../../types/helper";
|
|
4
|
-
import { MapProvider } from "../MapProvider/MapProvider";
|
|
5
|
-
import * as css from "./Demo.css";
|
|
6
|
-
|
|
7
|
-
const gmapApiKey = import.meta.env.VITE_GMAP_API_KEY;
|
|
8
|
-
const gmapId = import.meta.env.VITE_GMAP_MAP_ID;
|
|
9
|
-
const amapApiKey = import.meta.env.VITE_AMAP_API_KEY;
|
|
10
|
-
const amapApiSecret = import.meta.env.VITE_AMAP_API_SECRET;
|
|
11
|
-
|
|
12
|
-
export const DemoBusinessQuoting = defineSetup(function DemoBusinessTaxiService() {
|
|
13
|
-
return () => (
|
|
14
|
-
<MapProvider
|
|
15
|
-
amapKey={amapApiKey}
|
|
16
|
-
amapSecret={amapApiSecret}
|
|
17
|
-
gmapId={gmapId}
|
|
18
|
-
gmapKey={gmapApiKey}
|
|
19
|
-
supplier={"amap"}
|
|
20
|
-
>
|
|
21
|
-
<SomeQuotingPage />
|
|
22
|
-
</MapProvider>
|
|
23
|
-
);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const SomeQuotingPage = defineSetup(function SomeQuotingPage() {
|
|
27
|
-
const { setMap, registerFitVeiw } = useBusinessQuotingMap();
|
|
28
|
-
return () => (
|
|
29
|
-
<BusinessQuotingMap
|
|
30
|
-
class={css.demo}
|
|
31
|
-
from={{ lng: 121.4, lat: 31.2, name: "from place name" }}
|
|
32
|
-
to={{ lng: 121.5, lat: 31.4, name: "to place name" }}
|
|
33
|
-
renderDescription={({ distance, duration }) => `全程 *${distance}公里* 约行驶 *${duration}*`}
|
|
34
|
-
mapRef={setMap}
|
|
35
|
-
registerOverlay={registerFitVeiw}
|
|
36
|
-
/>
|
|
37
|
-
);
|
|
38
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { defineSetup } from "../../types/helper";
|
|
2
|
-
|
|
3
|
-
export const Hello = defineSetup(function Hello(props: {
|
|
4
|
-
className?: string;
|
|
5
|
-
qyc: number;
|
|
6
|
-
style: any;
|
|
7
|
-
}) {
|
|
8
|
-
return () => (
|
|
9
|
-
<section>
|
|
10
|
-
<span class={props.className} style={props.style}>
|
|
11
|
-
hello
|
|
12
|
-
</span>
|
|
13
|
-
</section>
|
|
14
|
-
);
|
|
15
|
-
});
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { computed } from "vue-demi";
|
|
2
|
-
import { PickupPoints } from "../../business-components/PickupPoints";
|
|
3
|
-
import { useBusinessMapAutoComplete } from "../../hooks-business/useBusinessMapAutoComplete";
|
|
4
|
-
import {
|
|
5
|
-
useBusinessMapRecomendPlace,
|
|
6
|
-
UseBusinessMapRecomendPlaceProps,
|
|
7
|
-
} from "../../hooks-business/useBusinessMapRecomendPlace";
|
|
8
|
-
import { useHeycarMap } from "../../hooks/useHeycarMap";
|
|
9
|
-
import { useMapFitView } from "../../hooks/useMapFitView";
|
|
10
|
-
import { useMapGeometry } from "../../hooks/useMapGeometry";
|
|
11
|
-
import { defineSetup } from "../../types/helper";
|
|
12
|
-
import { HeycarMap, MapProvider } from "../MapProvider/MapProvider";
|
|
13
|
-
import * as css from "./Demo.css";
|
|
14
|
-
|
|
15
|
-
const gmapApiKey = import.meta.env.VITE_GMAP_API_KEY;
|
|
16
|
-
const gmapId = import.meta.env.VITE_GMAP_MAP_ID;
|
|
17
|
-
const amapApiKey = import.meta.env.VITE_AMAP_API_KEY;
|
|
18
|
-
const amapApiSecret = import.meta.env.VITE_AMAP_API_SECRET;
|
|
19
|
-
|
|
20
|
-
export const HeycarDemo = defineSetup(function HeycarDemo() {
|
|
21
|
-
return () => (
|
|
22
|
-
<MapProvider
|
|
23
|
-
amapKey={amapApiKey}
|
|
24
|
-
amapSecret={amapApiSecret}
|
|
25
|
-
gmapId={gmapId}
|
|
26
|
-
gmapKey={gmapApiKey}
|
|
27
|
-
supplier={"amap"}
|
|
28
|
-
>
|
|
29
|
-
<SomeHomePage />
|
|
30
|
-
</MapProvider>
|
|
31
|
-
);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
export const SomeOuterPage = defineSetup(function SomeOuterPage() {
|
|
35
|
-
return () => {
|
|
36
|
-
return (
|
|
37
|
-
<div>
|
|
38
|
-
<SomeAutoComplete cityName="上海市"></SomeAutoComplete>
|
|
39
|
-
<HeycarMap
|
|
40
|
-
class={css.demo}
|
|
41
|
-
fallback={() => <div>error</div>}
|
|
42
|
-
loading={() => <div>loading</div>}
|
|
43
|
-
center={[121.5, 31]}
|
|
44
|
-
zoom={13}
|
|
45
|
-
></HeycarMap>
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
const SomeAutoComplete = defineSetup(function SomeAutoComplete(props: { cityName: string }) {
|
|
51
|
-
const { autoCompletePlaces, setKeyword, setCity } = useBusinessMapAutoComplete({
|
|
52
|
-
cityNameRef: computed(() => props.cityName),
|
|
53
|
-
});
|
|
54
|
-
(window as any).setKeyword = setKeyword;
|
|
55
|
-
(window as any).setCity = setCity;
|
|
56
|
-
return () => {
|
|
57
|
-
const list = autoCompletePlaces.value.map((place) => (
|
|
58
|
-
<div>
|
|
59
|
-
{place.lng} | {place.lat} | {place.name} | {place.description}
|
|
60
|
-
</div>
|
|
61
|
-
));
|
|
62
|
-
return <div>{list}</div>;
|
|
63
|
-
};
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
export const SomeHomePage = defineSetup(function SomeHomePage() {
|
|
67
|
-
const { mapRef, setMap } = useHeycarMap();
|
|
68
|
-
const getRecomendPlace: UseBusinessMapRecomendPlaceProps["getRecomendPlace"] = async (
|
|
69
|
-
place,
|
|
70
|
-
context
|
|
71
|
-
) => {
|
|
72
|
-
const { lat, lng } = place;
|
|
73
|
-
console.log("getRecomendPlace context?.source = ", context?.source);
|
|
74
|
-
return [
|
|
75
|
-
{ lat: lat + 0.0001, lng: lng + 0.0001, name: "place name 1" },
|
|
76
|
-
{ lat: lat + 0.002, lng: lng + 0.002, name: "place name 2" },
|
|
77
|
-
];
|
|
78
|
-
};
|
|
79
|
-
const {
|
|
80
|
-
centerPlace,
|
|
81
|
-
centerPoint,
|
|
82
|
-
placeCandidates,
|
|
83
|
-
isDragging,
|
|
84
|
-
geoLoading,
|
|
85
|
-
geoPosition,
|
|
86
|
-
setCenterPlaceByRecomand,
|
|
87
|
-
setCenterByPlace,
|
|
88
|
-
} = useBusinessMapRecomendPlace({
|
|
89
|
-
geoDefaultPosition: [0, 0],
|
|
90
|
-
mapRef,
|
|
91
|
-
recomendPlaceGeoLimit: 300,
|
|
92
|
-
recomendPlaceDragLimit: 30,
|
|
93
|
-
getRecomendPlace,
|
|
94
|
-
onChangeGeoLocation: (v) => console.log("onChangeGeoLocation: ", v),
|
|
95
|
-
onChangePlace: (v) => console.log("onChangePlace: ", v),
|
|
96
|
-
onChangeRecomandPlace: (v) => console.log("onChangeRecomandPlace: ", v),
|
|
97
|
-
});
|
|
98
|
-
const { registerFitVeiw, setFitView } = useMapFitView({
|
|
99
|
-
mapRef,
|
|
100
|
-
padding: [15, 15, 5, 15],
|
|
101
|
-
autoFitTimeout: 5000,
|
|
102
|
-
});
|
|
103
|
-
const { apiMapDistance } = useMapGeometry();
|
|
104
|
-
(window as any).setCenterPlaceByRecomand = setCenterPlaceByRecomand;
|
|
105
|
-
(window as any).setFitView = setFitView;
|
|
106
|
-
return () => {
|
|
107
|
-
return (
|
|
108
|
-
<div>
|
|
109
|
-
distance:{" "}
|
|
110
|
-
{apiMapDistance(centerPoint.value, [
|
|
111
|
-
centerPoint.value[0] + 0.01,
|
|
112
|
-
centerPoint.value[1] + 0.01,
|
|
113
|
-
])}{" "}
|
|
114
|
-
<br />
|
|
115
|
-
geoLoading: {`${geoLoading.value}`} <br />
|
|
116
|
-
isDragging: {`${isDragging.value}`} <br />
|
|
117
|
-
geoPosition: {geoPosition.value[0]} | {geoPosition.value[1]} <br />
|
|
118
|
-
centerPlace: {centerPlace.lng} | {centerPlace.lat} | {centerPlace.name} |{" "}
|
|
119
|
-
{centerPlace.cityName} <br />
|
|
120
|
-
<HeycarMap
|
|
121
|
-
class={css.demo}
|
|
122
|
-
fallback={() => <div>error</div>}
|
|
123
|
-
loading={() => <div>loading</div>}
|
|
124
|
-
center={centerPoint.value}
|
|
125
|
-
zoom={centerPoint.value[0] === 0 ? 3 : 13}
|
|
126
|
-
mapRef={setMap}
|
|
127
|
-
>
|
|
128
|
-
{/* <StartEndPoint
|
|
129
|
-
registerOverlay={registerFitVeiw}
|
|
130
|
-
position={[121.4897065, 31.0842552]}
|
|
131
|
-
title={"start point"}
|
|
132
|
-
type="start"
|
|
133
|
-
/> */}
|
|
134
|
-
{/* <StartEndPoint
|
|
135
|
-
registerOverlay={registerFitVeiw}
|
|
136
|
-
position={[centerPoint.value[0] + 0.01, centerPoint.value[1] + 0.01]}
|
|
137
|
-
title={"end point"}
|
|
138
|
-
type="end"
|
|
139
|
-
/> */}
|
|
140
|
-
<PickupPoints places={placeCandidates.value} onClick={setCenterByPlace} />
|
|
141
|
-
{/* <AddressBox
|
|
142
|
-
type="box"
|
|
143
|
-
position={centerPoint.value}
|
|
144
|
-
title={"Martyrs Lawn"}
|
|
145
|
-
description={"您将在此处上车"}
|
|
146
|
-
/> */}
|
|
147
|
-
{/* <TaxiCar position={[121, 31]} angle={0} /> */}
|
|
148
|
-
{/* <PickupPoints
|
|
149
|
-
positions={[
|
|
150
|
-
[-1, -1],
|
|
151
|
-
[-2, -2],
|
|
152
|
-
]}
|
|
153
|
-
labels={["place name 1", "place name 2"]}
|
|
154
|
-
/> */}
|
|
155
|
-
{/* <DrivingRoute
|
|
156
|
-
from={[121, 31]}
|
|
157
|
-
to={[121.6, 31.3]}
|
|
158
|
-
render={({ path, angle }) => [
|
|
159
|
-
<DrivingLine path={path} />,
|
|
160
|
-
<TaxiCar position={[121, 31]} angle={angle} />,
|
|
161
|
-
]}
|
|
162
|
-
/> */}
|
|
163
|
-
{/* <PassengerCircle position={centerPoint.value} size="small" /> */}
|
|
164
|
-
{/* <PlaceCircle
|
|
165
|
-
position={centerPoint.value}
|
|
166
|
-
label={"some place"}
|
|
167
|
-
hideIcon
|
|
168
|
-
onClick={() => {
|
|
169
|
-
debugger;
|
|
170
|
-
}}
|
|
171
|
-
/> */}
|
|
172
|
-
{/* <WalkingRoute
|
|
173
|
-
from={centerPoint.value}
|
|
174
|
-
to={[centerPoint.value[0] + 0.01, centerPoint.value[1] + 0.01]}
|
|
175
|
-
render={({ path }) => <WalkingLine path={path} />}
|
|
176
|
-
/> */}
|
|
177
|
-
</HeycarMap>
|
|
178
|
-
</div>
|
|
179
|
-
);
|
|
180
|
-
};
|
|
181
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Demo";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|