@heycar/heycars-map 0.2.4 → 0.2.6
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 +1 -0
- package/dist/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +13 -0
- package/dist/business-components/BusinessQuotingMap/index.d.ts +1 -0
- package/dist/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +24 -0
- package/dist/business-components/BusinessTaxiServiceMap/index.d.ts +1 -0
- package/dist/business-components/FitView/FitView.d.ts +9 -0
- package/dist/business-components/FitView/index.d.ts +1 -0
- package/dist/business-components/PassengerCircle/PassengerCircle.d.ts +18309 -4
- package/dist/business-components/PickupPoints/PickupPoints.d.ts +2 -1
- package/dist/business-components/PlaceCircle/PlaceCircle.d.ts +5 -3
- package/dist/business-components/TaxiCar/TaxiCar.d.ts +18309 -4
- package/dist/business-components/WalkingRoute/WalkingRoute.d.ts +0 -1
- package/dist/components/AmapMarker/AmapMarker.d.ts +5 -2
- package/dist/components/Demo/DemoBusinessQuoting.d.ts +1 -0
- package/dist/components/Demo/DemoBusinessTaxiService.d.ts +2 -0
- package/dist/components/GmapAdvancedMarkerView/GmapAdvancedMarkerView.d.ts +5 -2
- package/dist/hooks/useGeoLocation.d.ts +4 -0
- package/dist/hooks/useMap.d.ts +4 -0
- package/dist/hooks/useMapAutoComplete.d.ts +3 -0
- package/dist/hooks/useMapFitView.d.ts +6 -2296
- package/dist/hooks/useMapPlace.d.ts +3 -0
- package/dist/hooks/useMapRecomendPlace.d.ts +6 -0
- package/dist/hooks/useOverlay.d.ts +1 -0
- package/dist/hooks-business/useBusinessMapAutoComplete.d.ts +1 -0
- package/dist/hooks-business/useBusinessMapRecomendPlace.d.ts +6 -1
- package/dist/hooks-business/{useBusinessMapFitView.d.ts → useBusinessQuotingMap.d.ts} +494 -742
- package/dist/hooks-business/useBusinessTaxiServiceMap.d.ts +2049 -0
- package/dist/index.cjs +56 -56
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2389 -1921
- package/dist/types/interface.d.ts +2 -0
- package/dist/utils/compare.d.ts +1 -1
- package/package.json +1 -1
- package/src/App.tsx +4 -2
- package/src/business-components/BusinessQuotingMap/BusinessQuotingMap.tsx +49 -0
- package/src/business-components/BusinessQuotingMap/index.ts +1 -0
- package/src/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.tsx +358 -0
- package/src/business-components/BusinessTaxiServiceMap/index.ts +1 -0
- package/src/business-components/FitView/FitView.tsx +14 -0
- package/src/business-components/FitView/index.ts +1 -0
- package/src/business-components/PassengerCircle/PassengerCircle.tsx +26 -8
- package/src/business-components/PickupPoints/PickupPoints.tsx +8 -2
- package/src/business-components/PlaceCircle/PlaceCircle.tsx +29 -5
- package/src/business-components/TaxiCar/TaxiCar.tsx +18 -6
- package/src/business-components/WalkingRoute/WalkingRoute.tsx +0 -1
- package/src/components/AmapMarker/AmapMarker.ts +10 -3
- package/src/components/Demo/DemoBusinessQuoting.tsx +39 -0
- package/src/components/Demo/DemoBusinessTaxiService.tsx +53 -0
- package/src/components/Demo/HeycarDemo.tsx +19 -10
- package/src/components/GmapAdvancedMarkerView/GmapAdvancedMarkerView.ts +15 -4
- package/src/hooks/useGeoLocation.ts +7 -3
- package/src/hooks/useMap.ts +15 -1
- package/src/hooks/useMapFitView.ts +8 -1
- package/src/hooks/useOverlay.ts +1 -0
- package/src/hooks/useWalkingRoute.ts +14 -9
- package/src/hooks-business/useBusinessMapRecomendPlace.ts +24 -0
- package/src/hooks-business/useBusinessQuotingMap.ts +11 -0
- package/src/hooks-business/useBusinessTaxiServiceMap.ts +12 -0
- package/src/index.ts +2 -1
- package/src/types/interface.ts +13 -0
- package/src/utils/compare.ts +4 -1
- package/todo.md +7 -0
- package/src/hooks-business/useBusinessMapFitView.ts +0 -6
|
@@ -7,6 +7,7 @@ export type Place = {
|
|
|
7
7
|
lat: number;
|
|
8
8
|
name: string;
|
|
9
9
|
cityName?: string;
|
|
10
|
+
cityId?: string;
|
|
10
11
|
};
|
|
11
12
|
export interface AutoCompletePlace extends Place {
|
|
12
13
|
placeId?: string;
|
|
@@ -30,3 +31,4 @@ export interface Route {
|
|
|
30
31
|
distance: number;
|
|
31
32
|
duration: number;
|
|
32
33
|
}
|
|
34
|
+
export type DriverStatus = "dispatching" | "book-dispatching" | "dispatched" | "driverStartService" | "book-driverStartService" | "book-dispatched" | "driverArrived" | "inService" | "canceled" | "endService";
|
package/dist/utils/compare.d.ts
CHANGED
|
@@ -18,5 +18,5 @@ export declare function watchPostEffectForMapProperty<T, P>(targetRef: ShallowRe
|
|
|
18
18
|
export declare function watchNoneImmediatePostEffectForMapProperty<T, P>(targetRef: ShallowRef<T | undefined> | Ref<T | undefined>, props: P, nameOptions: PickSettableOptions<T, keyof P>[], watchOptions?: WatchOptions<false>): void;
|
|
19
19
|
type NamesRestrict<N, S extends string> = N extends `on${string}` ? Lowercase<N> extends `on${S}` ? N : never : never;
|
|
20
20
|
export declare function watchPostEffectForAMapEvent<T extends AMap.Event, P, E extends string = AMap.EventType>(targetRef: ShallowRef<T | undefined> | Ref<T | undefined> | undefined, props: P, emit: EmitFn<EmitByProps<P>>, propertyNames: NamesRestrict<keyof P, E>[]): void;
|
|
21
|
-
export declare function watchPostEffectForGMapEvent<T extends google.maps.MVCObject, P>(targetRef: ShallowRef<T | undefined> | Ref<T | undefined> | undefined, props: P, emit: EmitFn<EmitByProps<P>>, propertyNames: NamesRestrict<keyof P, string>[]): void;
|
|
21
|
+
export declare function watchPostEffectForGMapEvent<T extends google.maps.MVCObject | google.maps.marker.AdvancedMarkerView, P>(targetRef: ShallowRef<T | undefined> | Ref<T | undefined> | undefined, props: P, emit: EmitFn<EmitByProps<P>>, propertyNames: NamesRestrict<keyof P, string>[]): void;
|
|
22
22
|
export {};
|
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { defineComponent } from "vue-demi";
|
|
2
|
-
import {
|
|
2
|
+
import { DemoBusinessQuoting } from "./components/Demo/DemoBusinessQuoting";
|
|
3
3
|
|
|
4
4
|
export const App = defineComponent({
|
|
5
5
|
setup() {
|
|
6
6
|
// return () => <Hello class={"helloclass2"} qyc={2} style={{ color: "red" }} />;
|
|
7
7
|
// return () => <ABusinessDemo />;
|
|
8
8
|
// return () => <SearchDemo />;
|
|
9
|
-
return () => <
|
|
9
|
+
// return () => <DemoBusinessTaxiService />;
|
|
10
|
+
return () => <DemoBusinessQuoting />;
|
|
11
|
+
// return () => <HeycarDemo />;
|
|
10
12
|
},
|
|
11
13
|
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { HeycarMap, HeycarMapProps } from "../../components/MapProvider";
|
|
2
|
+
import type { MapMountedProps } from "../../hooks/useMap";
|
|
3
|
+
import type { MROP } from "../../hooks/useOverlay";
|
|
4
|
+
import { defineLagecySetup } from "../../types/helper";
|
|
5
|
+
import type { Place } from "../../types/interface";
|
|
6
|
+
import { place2point } from "../../utils/transform";
|
|
7
|
+
import { DrivingLine } from "../DrivingLine";
|
|
8
|
+
import { DrivingRoute } from "../DrivingRoute";
|
|
9
|
+
import { StartEndPoint } from "../StartEndPoint";
|
|
10
|
+
|
|
11
|
+
export type BusinessQuotingMapProps = Omit<HeycarMapProps, "center" | "zoom"> &
|
|
12
|
+
MROP &
|
|
13
|
+
MapMountedProps & {
|
|
14
|
+
from: Place;
|
|
15
|
+
to: Place;
|
|
16
|
+
renderDescription: (titleProps: { distance: number; duration: number }) => string;
|
|
17
|
+
};
|
|
18
|
+
export const BusinessQuotingMap = defineLagecySetup((props: BusinessQuotingMapProps) => {
|
|
19
|
+
const { registerOverlay, mapRef, renderDescription } = props;
|
|
20
|
+
return () => {
|
|
21
|
+
const { from: fromPlace, to: toPlace } = props;
|
|
22
|
+
const from = place2point(fromPlace);
|
|
23
|
+
const to = place2point(toPlace);
|
|
24
|
+
return (
|
|
25
|
+
<HeycarMap mapRef={mapRef} center={from} zoom={13}>
|
|
26
|
+
<StartEndPoint
|
|
27
|
+
type="start"
|
|
28
|
+
registerOverlay={registerOverlay}
|
|
29
|
+
position={from}
|
|
30
|
+
title={fromPlace.name}
|
|
31
|
+
/>
|
|
32
|
+
<DrivingRoute
|
|
33
|
+
to={to}
|
|
34
|
+
from={from}
|
|
35
|
+
render={({ path, distance, duration }) => [
|
|
36
|
+
<DrivingLine path={path} />,
|
|
37
|
+
<StartEndPoint
|
|
38
|
+
type="end"
|
|
39
|
+
registerOverlay={registerOverlay}
|
|
40
|
+
position={to}
|
|
41
|
+
title={toPlace.name}
|
|
42
|
+
description={renderDescription({ distance, duration })}
|
|
43
|
+
/>,
|
|
44
|
+
]}
|
|
45
|
+
></DrivingRoute>
|
|
46
|
+
</HeycarMap>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
}).props(["fallback", "from", "loading", "mapRef", "registerOverlay", "renderDescription", "to"]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BusinessQuotingMap";
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import { ref, watch } from "vue-demi";
|
|
2
|
+
import { HeycarMap, HeycarMapProps } from "../../components/MapProvider";
|
|
3
|
+
import { useGeoLocation } from "../../hooks/useGeoLocation";
|
|
4
|
+
import { MapMountedProps, onMapMounted } from "../../hooks/useMap";
|
|
5
|
+
import type { MROP } from "../../hooks/useOverlay";
|
|
6
|
+
import { defineLagecySetup, defineSetup } from "../../types/helper";
|
|
7
|
+
import type { DriverStatus, Place, Point } from "../../types/interface";
|
|
8
|
+
import { place2point } from "../../utils/transform";
|
|
9
|
+
import { DrivingLine } from "../DrivingLine";
|
|
10
|
+
import { DrivingRoute, DrivingRouteRenderProps } from "../DrivingRoute";
|
|
11
|
+
import { PassengerCircle } from "../PassengerCircle";
|
|
12
|
+
import { PlaceCircle } from "../PlaceCircle";
|
|
13
|
+
import { StartEndPoint } from "../StartEndPoint";
|
|
14
|
+
import { TaxiCar } from "../TaxiCar";
|
|
15
|
+
import { WalkingLine } from "../WalkingLine";
|
|
16
|
+
import { WalkingRoute } from "../WalkingRoute";
|
|
17
|
+
import { WaveCircle } from "../WaveCircle";
|
|
18
|
+
|
|
19
|
+
const STATUS_NEED_CAR_POSITION: DriverStatus[] = [
|
|
20
|
+
"book-driverStartService",
|
|
21
|
+
"dispatched",
|
|
22
|
+
"driverStartService",
|
|
23
|
+
"inService",
|
|
24
|
+
"driverArrived",
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
type SectionDispatchingProps = MROP &
|
|
28
|
+
MapMountedProps & {
|
|
29
|
+
title: string;
|
|
30
|
+
from: Place;
|
|
31
|
+
};
|
|
32
|
+
const SectionDispatching = defineSetup((props: SectionDispatchingProps, { emit }) => {
|
|
33
|
+
onMapMounted(() => emit("mapMounted"));
|
|
34
|
+
return () => {
|
|
35
|
+
const { from: fromPlace, title, registerOverlay } = props;
|
|
36
|
+
const from = place2point(fromPlace);
|
|
37
|
+
return (
|
|
38
|
+
<div>
|
|
39
|
+
<StartEndPoint
|
|
40
|
+
type="start"
|
|
41
|
+
position={from}
|
|
42
|
+
title={title}
|
|
43
|
+
registerOverlay={registerOverlay}
|
|
44
|
+
/>
|
|
45
|
+
<WaveCircle position={from} />
|
|
46
|
+
<PlaceCircle position={from} label={fromPlace.name} hideIcon />
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
type SectionDriverStartServiceProps = MROP &
|
|
53
|
+
MapMountedProps & {
|
|
54
|
+
passengerPosition: Point;
|
|
55
|
+
carPosition: Point;
|
|
56
|
+
from: Place;
|
|
57
|
+
renderTitle: (props: Pick<DrivingRouteRenderProps, "duration" | "distance">) => string;
|
|
58
|
+
};
|
|
59
|
+
const SectionDriverStartService = defineSetup((props: SectionDriverStartServiceProps, { emit }) => {
|
|
60
|
+
onMapMounted(() => emit("mapMounted"));
|
|
61
|
+
return () => {
|
|
62
|
+
const { from: fromPlace, carPosition, passengerPosition, renderTitle, registerOverlay } = props;
|
|
63
|
+
const from = place2point(fromPlace);
|
|
64
|
+
return (
|
|
65
|
+
<div>
|
|
66
|
+
<StartEndPoint type="start" position={from} registerOverlay={registerOverlay} />
|
|
67
|
+
<PlaceCircle position={from} label={fromPlace.name} hideIcon />
|
|
68
|
+
<DrivingRoute
|
|
69
|
+
from={carPosition}
|
|
70
|
+
to={from}
|
|
71
|
+
render={({ path, distance, duration }) => [
|
|
72
|
+
<DrivingLine path={path} />,
|
|
73
|
+
<TaxiCar position={carPosition} title={renderTitle({ distance, duration })} />,
|
|
74
|
+
]}
|
|
75
|
+
/>
|
|
76
|
+
<WalkingRoute
|
|
77
|
+
from={passengerPosition}
|
|
78
|
+
to={from}
|
|
79
|
+
render={({ path }) => <WalkingLine path={path} />}
|
|
80
|
+
/>
|
|
81
|
+
<PassengerCircle position={passengerPosition} registerOverlay={registerOverlay} />
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
type SectionBookDispatchedProps = MROP &
|
|
88
|
+
MapMountedProps & {
|
|
89
|
+
passengerPosition: Point;
|
|
90
|
+
from: Place;
|
|
91
|
+
// @example 司机位置将在临近出发时间展示
|
|
92
|
+
title: string;
|
|
93
|
+
};
|
|
94
|
+
const SectionBookDispatched = defineSetup((props: SectionBookDispatchedProps, { emit }) => {
|
|
95
|
+
onMapMounted(() => emit("mapMounted"));
|
|
96
|
+
return () => {
|
|
97
|
+
const { from: fromPlace, passengerPosition, title, registerOverlay } = props;
|
|
98
|
+
const from = place2point(fromPlace);
|
|
99
|
+
return (
|
|
100
|
+
<div>
|
|
101
|
+
<StartEndPoint
|
|
102
|
+
type="start"
|
|
103
|
+
position={from}
|
|
104
|
+
title={title}
|
|
105
|
+
registerOverlay={registerOverlay}
|
|
106
|
+
/>
|
|
107
|
+
<PlaceCircle position={from} label={fromPlace.name} hideIcon />
|
|
108
|
+
<PassengerCircle position={passengerPosition} registerOverlay={registerOverlay} />
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
type SectionDriverArrivedProps = MROP &
|
|
115
|
+
MapMountedProps & {
|
|
116
|
+
from: Place;
|
|
117
|
+
carPosition: Point;
|
|
118
|
+
passengerPosition: Point;
|
|
119
|
+
// @example 司机已等待 *00:35*
|
|
120
|
+
title: string;
|
|
121
|
+
};
|
|
122
|
+
const SectionDriverArrived = defineSetup((props: SectionDriverArrivedProps, { emit }) => {
|
|
123
|
+
onMapMounted(() => emit("mapMounted"));
|
|
124
|
+
return () => {
|
|
125
|
+
const { from: fromPlace, carPosition, passengerPosition, title, registerOverlay } = props;
|
|
126
|
+
const from = place2point(fromPlace);
|
|
127
|
+
return (
|
|
128
|
+
<div>
|
|
129
|
+
<TaxiCar position={carPosition} title={title} registerOverlay={registerOverlay} />
|
|
130
|
+
<StartEndPoint type="start" position={from} registerOverlay={registerOverlay} />
|
|
131
|
+
<PlaceCircle position={from} label={fromPlace.name} hideIcon />
|
|
132
|
+
<WalkingRoute
|
|
133
|
+
from={passengerPosition}
|
|
134
|
+
to={from}
|
|
135
|
+
render={({ path }) => <WalkingLine path={path} />}
|
|
136
|
+
/>
|
|
137
|
+
<PassengerCircle
|
|
138
|
+
position={passengerPosition}
|
|
139
|
+
size="small"
|
|
140
|
+
registerOverlay={registerOverlay}
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
type SectionInServiceProps = MROP &
|
|
148
|
+
MapMountedProps & {
|
|
149
|
+
to: Place;
|
|
150
|
+
carPosition: Point;
|
|
151
|
+
renderTitle: (props: Pick<DrivingRouteRenderProps, "duration" | "distance">) => string;
|
|
152
|
+
};
|
|
153
|
+
const SectionInService = defineSetup((props: SectionInServiceProps, { emit }) => {
|
|
154
|
+
onMapMounted(() => emit("mapMounted"));
|
|
155
|
+
return () => {
|
|
156
|
+
const { to: toPlace, carPosition, renderTitle, registerOverlay } = props;
|
|
157
|
+
const to = place2point(toPlace);
|
|
158
|
+
return (
|
|
159
|
+
<div>
|
|
160
|
+
<StartEndPoint type="end" position={to} registerOverlay={registerOverlay} />
|
|
161
|
+
<PlaceCircle position={carPosition} label="'WebSter Dental Plaza'" hideIcon />
|
|
162
|
+
<DrivingRoute
|
|
163
|
+
from={carPosition}
|
|
164
|
+
to={to}
|
|
165
|
+
render={({ path, distance, duration }) => [
|
|
166
|
+
<DrivingLine path={path} />,
|
|
167
|
+
<TaxiCar
|
|
168
|
+
position={carPosition}
|
|
169
|
+
title={renderTitle({ distance, duration })}
|
|
170
|
+
registerOverlay={registerOverlay}
|
|
171
|
+
/>,
|
|
172
|
+
]}
|
|
173
|
+
/>
|
|
174
|
+
</div>
|
|
175
|
+
);
|
|
176
|
+
};
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
type SectionCanceledProps = MROP &
|
|
180
|
+
MapMountedProps & {
|
|
181
|
+
from: Place;
|
|
182
|
+
to: Place;
|
|
183
|
+
};
|
|
184
|
+
const SectionCanceled = defineSetup((props: SectionCanceledProps, { emit }) => {
|
|
185
|
+
onMapMounted(() => emit("mapMounted"));
|
|
186
|
+
return () => {
|
|
187
|
+
const { from: fromPlace, to: toPlace, registerOverlay } = props;
|
|
188
|
+
const from = place2point(fromPlace);
|
|
189
|
+
const to = place2point(toPlace);
|
|
190
|
+
return (
|
|
191
|
+
<div>
|
|
192
|
+
<StartEndPoint type="start" position={from} registerOverlay={registerOverlay} />
|
|
193
|
+
<StartEndPoint type="end" position={to} registerOverlay={registerOverlay} />
|
|
194
|
+
<PlaceCircle position={from} label={fromPlace.name} hideIcon />
|
|
195
|
+
<PlaceCircle position={to} label={toPlace.name} hideIcon />
|
|
196
|
+
</div>
|
|
197
|
+
);
|
|
198
|
+
};
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
type SectionEndServiceProps = MROP &
|
|
202
|
+
MapMountedProps & {
|
|
203
|
+
from: Place;
|
|
204
|
+
to: Place;
|
|
205
|
+
};
|
|
206
|
+
const SectionEndService = defineSetup((props: SectionEndServiceProps, { emit }) => {
|
|
207
|
+
onMapMounted(() => emit("mapMounted"));
|
|
208
|
+
return () => {
|
|
209
|
+
const { from: fromPlace, to: toPlace, registerOverlay } = props;
|
|
210
|
+
const from = place2point(fromPlace);
|
|
211
|
+
const to = place2point(toPlace);
|
|
212
|
+
return (
|
|
213
|
+
<div>
|
|
214
|
+
<StartEndPoint type="start" position={from} registerOverlay={registerOverlay} />
|
|
215
|
+
<StartEndPoint type="end" position={to} registerOverlay={registerOverlay} />
|
|
216
|
+
<PlaceCircle position={from} label={fromPlace.name} hideIcon />
|
|
217
|
+
<PlaceCircle position={to} label={toPlace.name} hideIcon />
|
|
218
|
+
<DrivingRoute from={from} to={to} render={({ path }) => <DrivingLine path={path} done />} />
|
|
219
|
+
</div>
|
|
220
|
+
);
|
|
221
|
+
};
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
export type BusinessTaxiServiceMapProps = Omit<HeycarMapProps, "center" | "zoom"> &
|
|
225
|
+
MROP &
|
|
226
|
+
MapMountedProps & {
|
|
227
|
+
from: Place;
|
|
228
|
+
to: Place;
|
|
229
|
+
// @example 正在为您搜索附近司机
|
|
230
|
+
dispatchingTitle: string;
|
|
231
|
+
bookDispatchingTitle: string;
|
|
232
|
+
bookDispatchedTitle: string;
|
|
233
|
+
driverArrivedTitle: string;
|
|
234
|
+
driverStatus: DriverStatus;
|
|
235
|
+
interval: number;
|
|
236
|
+
renderStartSerivceTitle: (titleProps: { distance: number; duration: number }) => string;
|
|
237
|
+
renderInServiceTitle: (titleProps: { distance: number; duration: number }) => string;
|
|
238
|
+
getDriverPosition: () => Promise<Point>;
|
|
239
|
+
};
|
|
240
|
+
export const BusinessTaxiServiceMap = defineLagecySetup(
|
|
241
|
+
(props: BusinessTaxiServiceMapProps, { emit }) => {
|
|
242
|
+
const {
|
|
243
|
+
from,
|
|
244
|
+
interval,
|
|
245
|
+
registerOverlay,
|
|
246
|
+
mapRef,
|
|
247
|
+
getDriverPosition,
|
|
248
|
+
renderStartSerivceTitle,
|
|
249
|
+
renderInServiceTitle,
|
|
250
|
+
} = props;
|
|
251
|
+
const { geoPosition } = useGeoLocation({ geoDefaultPosition: place2point(from) });
|
|
252
|
+
const carPositionRef = ref<Point>(place2point(props.from));
|
|
253
|
+
const handleMounted = () => emit("mapMounted");
|
|
254
|
+
watch(
|
|
255
|
+
() => props.driverStatus,
|
|
256
|
+
(status, _, onCleanup) => {
|
|
257
|
+
if (!STATUS_NEED_CAR_POSITION.includes(status)) return;
|
|
258
|
+
const timer = setInterval(() => {
|
|
259
|
+
getDriverPosition().then((pos) => (carPositionRef.value = pos));
|
|
260
|
+
}, interval);
|
|
261
|
+
onCleanup(() => clearInterval(timer));
|
|
262
|
+
},
|
|
263
|
+
{ immediate: true }
|
|
264
|
+
);
|
|
265
|
+
return () => {
|
|
266
|
+
const {
|
|
267
|
+
driverStatus,
|
|
268
|
+
from,
|
|
269
|
+
to,
|
|
270
|
+
dispatchingTitle,
|
|
271
|
+
bookDispatchingTitle,
|
|
272
|
+
bookDispatchedTitle,
|
|
273
|
+
driverArrivedTitle,
|
|
274
|
+
} = props;
|
|
275
|
+
const carPosition = carPositionRef.value;
|
|
276
|
+
return (
|
|
277
|
+
<HeycarMap center={place2point(from)} zoom={13} mapRef={mapRef}>
|
|
278
|
+
{driverStatus === "dispatching" ? (
|
|
279
|
+
<SectionDispatching
|
|
280
|
+
from={from}
|
|
281
|
+
title={dispatchingTitle}
|
|
282
|
+
registerOverlay={registerOverlay}
|
|
283
|
+
onMapMounted={handleMounted}
|
|
284
|
+
/>
|
|
285
|
+
) : driverStatus === "book-dispatching" ? (
|
|
286
|
+
<SectionDispatching
|
|
287
|
+
from={from}
|
|
288
|
+
title={bookDispatchingTitle}
|
|
289
|
+
registerOverlay={registerOverlay}
|
|
290
|
+
onMapMounted={handleMounted}
|
|
291
|
+
/>
|
|
292
|
+
) : driverStatus === "dispatched" ||
|
|
293
|
+
driverStatus === "driverStartService" ||
|
|
294
|
+
driverStatus === "book-driverStartService" ? (
|
|
295
|
+
<SectionDriverStartService
|
|
296
|
+
from={from}
|
|
297
|
+
carPosition={carPosition}
|
|
298
|
+
passengerPosition={geoPosition.value}
|
|
299
|
+
renderTitle={renderStartSerivceTitle}
|
|
300
|
+
registerOverlay={registerOverlay}
|
|
301
|
+
onMapMounted={handleMounted}
|
|
302
|
+
/>
|
|
303
|
+
) : driverStatus === "book-dispatched" ? (
|
|
304
|
+
<SectionBookDispatched
|
|
305
|
+
from={from}
|
|
306
|
+
passengerPosition={geoPosition.value}
|
|
307
|
+
title={bookDispatchedTitle}
|
|
308
|
+
registerOverlay={registerOverlay}
|
|
309
|
+
onMapMounted={handleMounted}
|
|
310
|
+
/>
|
|
311
|
+
) : driverStatus === "inService" ? (
|
|
312
|
+
<SectionInService
|
|
313
|
+
to={to}
|
|
314
|
+
carPosition={carPosition}
|
|
315
|
+
renderTitle={renderInServiceTitle}
|
|
316
|
+
registerOverlay={registerOverlay}
|
|
317
|
+
onMapMounted={handleMounted}
|
|
318
|
+
/>
|
|
319
|
+
) : driverStatus === "driverArrived" ? (
|
|
320
|
+
<SectionDriverArrived
|
|
321
|
+
from={from}
|
|
322
|
+
carPosition={carPosition}
|
|
323
|
+
passengerPosition={geoPosition.value}
|
|
324
|
+
title={driverArrivedTitle}
|
|
325
|
+
registerOverlay={registerOverlay}
|
|
326
|
+
onMapMounted={handleMounted}
|
|
327
|
+
/>
|
|
328
|
+
) : driverStatus === "canceled" ? (
|
|
329
|
+
<SectionCanceled from={from} to={to} registerOverlay={registerOverlay} />
|
|
330
|
+
) : driverStatus === "endService" ? (
|
|
331
|
+
<SectionEndService
|
|
332
|
+
from={from}
|
|
333
|
+
to={to}
|
|
334
|
+
registerOverlay={registerOverlay}
|
|
335
|
+
onMapMounted={handleMounted}
|
|
336
|
+
/>
|
|
337
|
+
) : null}
|
|
338
|
+
</HeycarMap>
|
|
339
|
+
);
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
).props([
|
|
343
|
+
"bookDispatchedTitle",
|
|
344
|
+
"bookDispatchingTitle",
|
|
345
|
+
"dispatchingTitle",
|
|
346
|
+
"driverArrivedTitle",
|
|
347
|
+
"driverStatus",
|
|
348
|
+
"fallback",
|
|
349
|
+
"from",
|
|
350
|
+
"getDriverPosition",
|
|
351
|
+
"interval",
|
|
352
|
+
"loading",
|
|
353
|
+
"mapRef",
|
|
354
|
+
"renderInServiceTitle",
|
|
355
|
+
"renderStartSerivceTitle",
|
|
356
|
+
"to",
|
|
357
|
+
"registerOverlay",
|
|
358
|
+
]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BusinessTaxiServiceMap";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useMap } from "../../hooks/useMap";
|
|
2
|
+
import { useMapFitView, UseMapFitViewOutput, UseMapFitViewProps } from "../../hooks/useMapFitView";
|
|
3
|
+
import type { AmapOverlay, GmapOverlay } from "../../hooks/useOverlay";
|
|
4
|
+
import { defineSetup, VNodeChild } from "../../types/helper";
|
|
5
|
+
|
|
6
|
+
type FitViewRenderProps = UseMapFitViewOutput<AmapOverlay> | UseMapFitViewOutput<GmapOverlay>;
|
|
7
|
+
export interface FitViewProps extends Omit<UseMapFitViewProps, "mapRef"> {
|
|
8
|
+
render?: (props: FitViewRenderProps) => VNodeChild;
|
|
9
|
+
}
|
|
10
|
+
export const FitView = defineSetup(function FitView(props: FitViewProps, { slots }) {
|
|
11
|
+
const mapRef = useMap();
|
|
12
|
+
const ctx = useMapFitView({ ...props, mapRef });
|
|
13
|
+
return () => <div>{slots.render?.(ctx)}</div>;
|
|
14
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./FitView";
|
|
@@ -4,17 +4,20 @@ import imgPlaceCircle from "../../assets/icons/svg/place-circle.svg";
|
|
|
4
4
|
import { AmapMarker } from "../../components/AmapMarker";
|
|
5
5
|
import { GmapAdvancedMarkerView } from "../../components/GmapAdvancedMarkerView";
|
|
6
6
|
import { useMapSupplier } from "../../hooks/useMapSupplier";
|
|
7
|
+
import type { AmapOverlay, GmapOverlay, MapRegisterOverlayProps } from "../../hooks/useOverlay";
|
|
7
8
|
import { createElement, defineSetup } from "../../types/helper";
|
|
8
9
|
import { createDom } from "../../utils/dom";
|
|
9
10
|
import { vec2lnglat } from "../../utils/transform";
|
|
10
11
|
|
|
11
12
|
import * as css from "./PassengerCircle.css";
|
|
12
13
|
|
|
13
|
-
interface PassengerCircleProps {
|
|
14
|
+
interface PassengerCircleProps<T> extends MapRegisterOverlayProps<T> {
|
|
14
15
|
position: [number, number];
|
|
15
16
|
size?: "small" | "large";
|
|
16
17
|
}
|
|
17
|
-
export const APassengerCircle = defineSetup(function APassengerCircle(
|
|
18
|
+
export const APassengerCircle = defineSetup(function APassengerCircle(
|
|
19
|
+
props: PassengerCircleProps<AmapOverlay>
|
|
20
|
+
) {
|
|
18
21
|
const contentRef = computed(() => {
|
|
19
22
|
const { size = "large" } = props;
|
|
20
23
|
const src = size === "large" ? imgPassengerCircle : imgPlaceCircle;
|
|
@@ -22,23 +25,38 @@ export const APassengerCircle = defineSetup(function APassengerCircle(props: Pas
|
|
|
22
25
|
<img src="${src}" class="${css.passengerCircle({ size })}">
|
|
23
26
|
`;
|
|
24
27
|
});
|
|
25
|
-
return () =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
return () => {
|
|
29
|
+
return (
|
|
30
|
+
<AmapMarker
|
|
31
|
+
position={props.position}
|
|
32
|
+
content={contentRef.value}
|
|
33
|
+
anchor={"bottom-center"}
|
|
34
|
+
registerOverlay={props.registerOverlay}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
28
38
|
});
|
|
29
39
|
|
|
30
|
-
export const GPassengerCircle = defineSetup(function GPassengerCircle(
|
|
40
|
+
export const GPassengerCircle = defineSetup(function GPassengerCircle(
|
|
41
|
+
props: PassengerCircleProps<GmapOverlay>
|
|
42
|
+
) {
|
|
31
43
|
const contentRef = computed(() => {
|
|
32
44
|
const { size = "large" } = props;
|
|
33
45
|
const src = size === "large" ? imgPassengerCircle : imgPlaceCircle;
|
|
34
46
|
return createDom("img", { class: css.passengerCircle({ size }), src });
|
|
35
47
|
});
|
|
36
48
|
return () => (
|
|
37
|
-
<GmapAdvancedMarkerView
|
|
49
|
+
<GmapAdvancedMarkerView
|
|
50
|
+
position={vec2lnglat(props.position)}
|
|
51
|
+
content={contentRef.value}
|
|
52
|
+
registerOverlay={props.registerOverlay}
|
|
53
|
+
/>
|
|
38
54
|
);
|
|
39
55
|
});
|
|
40
56
|
|
|
41
|
-
export const PassengerCircle = defineSetup(function PassengerCircle(
|
|
57
|
+
export const PassengerCircle = defineSetup(function PassengerCircle(
|
|
58
|
+
props: PassengerCircleProps<AmapOverlay> | PassengerCircleProps<GmapOverlay>
|
|
59
|
+
) {
|
|
42
60
|
const payload = useMapSupplier();
|
|
43
61
|
return () => {
|
|
44
62
|
return createElement(payload.supplier === "gmap" ? GPassengerCircle : APassengerCircle, {
|
|
@@ -5,12 +5,18 @@ import { PlaceCircle } from "../PlaceCircle";
|
|
|
5
5
|
|
|
6
6
|
export interface PickupPointsProps {
|
|
7
7
|
places: Place[];
|
|
8
|
+
onClick?: (value: Place) => any;
|
|
8
9
|
}
|
|
9
|
-
export const PickupPoints = defineSetup(function PickupPoints(props: PickupPointsProps) {
|
|
10
|
+
export const PickupPoints = defineSetup(function PickupPoints(props: PickupPointsProps, { emit }) {
|
|
10
11
|
return () => (
|
|
11
12
|
<div>
|
|
12
13
|
{props.places.map((place) => (
|
|
13
|
-
<PlaceCircle
|
|
14
|
+
<PlaceCircle
|
|
15
|
+
position={place2point(place)}
|
|
16
|
+
label={place.name}
|
|
17
|
+
textAlign="left"
|
|
18
|
+
onClick={() => emit("click", place)}
|
|
19
|
+
/>
|
|
14
20
|
))}
|
|
15
21
|
</div>
|
|
16
22
|
);
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { computed } from "vue-demi";
|
|
2
2
|
import imgPlaceCircle from "../../assets/icons/svg/place-circle.svg";
|
|
3
|
-
import { AmapMarker } from "../../components/AmapMarker";
|
|
4
|
-
import {
|
|
3
|
+
import { AmapMarker, AmapMarkerProps } from "../../components/AmapMarker";
|
|
4
|
+
import {
|
|
5
|
+
GmapAdvancedMarkerView,
|
|
6
|
+
GmapAdvancedMarkerViewProps,
|
|
7
|
+
} from "../../components/GmapAdvancedMarkerView";
|
|
5
8
|
import { useMapSupplier } from "../../hooks/useMapSupplier";
|
|
6
9
|
import { AnchorType } from "../../types/amap/marker";
|
|
7
10
|
import { createElement, defineLagecySetup, defineSetup } from "../../types/helper";
|
|
11
|
+
import type { Point } from "../../types/interface";
|
|
8
12
|
import { createDom } from "../../utils/dom";
|
|
9
13
|
import { vec2lnglat } from "../../utils/transform";
|
|
10
14
|
import * as css from "./PlaceCircle.css";
|
|
@@ -14,8 +18,12 @@ export interface PlaceCircleProps {
|
|
|
14
18
|
label?: string;
|
|
15
19
|
textAlign?: "left" | "right";
|
|
16
20
|
hideIcon?: boolean;
|
|
21
|
+
onClick?: (value: Point) => any;
|
|
17
22
|
}
|
|
18
|
-
export const APlaceCircle = defineLagecySetup(function APlaceCircle(
|
|
23
|
+
export const APlaceCircle = defineLagecySetup(function APlaceCircle(
|
|
24
|
+
props: PlaceCircleProps,
|
|
25
|
+
{ emit }
|
|
26
|
+
) {
|
|
19
27
|
const textAlignRef = computed(() => props.textAlign ?? "right");
|
|
20
28
|
const contentRef = computed(() => {
|
|
21
29
|
const { hideIcon = false } = props;
|
|
@@ -34,16 +42,24 @@ export const APlaceCircle = defineLagecySetup(function APlaceCircle(props: Place
|
|
|
34
42
|
textAlign: textAlignRef.value,
|
|
35
43
|
})}" src="${imgPlaceCircle}">`;
|
|
36
44
|
});
|
|
45
|
+
const handleClick: AmapMarkerProps["onClick"] = (e) => {
|
|
46
|
+
console.log("on amap marker e = ", e);
|
|
47
|
+
emit("click", props.position);
|
|
48
|
+
};
|
|
37
49
|
return () => (
|
|
38
50
|
<AmapMarker
|
|
39
51
|
position={props.position}
|
|
40
52
|
content={props.label ? contentRef.value : contentWithoutLabelRef.value}
|
|
41
53
|
anchor={textAlignRef.value === "left" ? AnchorType.middleRight : AnchorType.middleLeft}
|
|
54
|
+
onClick={handleClick}
|
|
42
55
|
/>
|
|
43
56
|
);
|
|
44
57
|
}).props(["hideIcon", "label", "position", "textAlign"]);
|
|
45
58
|
|
|
46
|
-
export const GPlaceCircle = defineLagecySetup(function GPlaceCircle(
|
|
59
|
+
export const GPlaceCircle = defineLagecySetup(function GPlaceCircle(
|
|
60
|
+
props: PlaceCircleProps,
|
|
61
|
+
{ emit }
|
|
62
|
+
) {
|
|
47
63
|
const textAlignRef = computed(() => props.textAlign ?? "right");
|
|
48
64
|
const contentRef = computed(() => {
|
|
49
65
|
const { hideIcon = false } = props;
|
|
@@ -69,19 +85,27 @@ export const GPlaceCircle = defineLagecySetup(function GPlaceCircle(props: Place
|
|
|
69
85
|
src: imgPlaceCircle,
|
|
70
86
|
});
|
|
71
87
|
});
|
|
88
|
+
const handleClick: GmapAdvancedMarkerViewProps["onClick"] = (e) => {
|
|
89
|
+
console.log("on gmap advanced marker view e = ", e);
|
|
90
|
+
emit("click", props.position);
|
|
91
|
+
};
|
|
72
92
|
return () => (
|
|
73
93
|
<GmapAdvancedMarkerView
|
|
74
94
|
position={vec2lnglat(props.position)}
|
|
75
95
|
content={props.label ? contentRef.value : contentWithoutLabelRef.value}
|
|
96
|
+
onClick={handleClick}
|
|
76
97
|
/>
|
|
77
98
|
);
|
|
78
99
|
}).props(["hideIcon", "label", "position", "textAlign"]);
|
|
79
100
|
|
|
80
|
-
export const PlaceCircle = defineSetup(function PlaceCircle(props: PlaceCircleProps) {
|
|
101
|
+
export const PlaceCircle = defineSetup(function PlaceCircle(props: PlaceCircleProps, { emit }) {
|
|
81
102
|
const payload = useMapSupplier();
|
|
82
103
|
return () => {
|
|
83
104
|
return createElement(payload.supplier === "gmap" ? GPlaceCircle : APlaceCircle, {
|
|
84
105
|
attrs: props,
|
|
106
|
+
on: {
|
|
107
|
+
click: (value: any) => emit("click", value),
|
|
108
|
+
},
|
|
85
109
|
});
|
|
86
110
|
};
|
|
87
111
|
});
|