@heycar/heycars-map 0.2.5 → 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 +5 -3
- package/dist/business-components/PassengerCircle/PassengerCircle.d.ts +18309 -4
- package/dist/business-components/TaxiCar/TaxiCar.d.ts +18309 -4
- package/dist/components/Demo/DemoBusinessQuoting.d.ts +1 -0
- package/dist/hooks/useMap.d.ts +4 -0
- package/dist/hooks/useMapAutoComplete.d.ts +3 -0
- 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 +2 -0
- package/dist/hooks-business/useBusinessQuotingMap.d.ts +2049 -0
- package/dist/hooks-business/useBusinessTaxiServiceMap.d.ts +2049 -0
- package/dist/index.cjs +51 -51
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1423 -1329
- package/dist/types/interface.d.ts +1 -0
- package/package.json +1 -1
- package/src/App.tsx +3 -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 +213 -140
- package/src/business-components/PassengerCircle/PassengerCircle.tsx +26 -8
- package/src/business-components/TaxiCar/TaxiCar.tsx +18 -6
- package/src/components/Demo/DemoBusinessQuoting.tsx +39 -0
- package/src/components/Demo/DemoBusinessTaxiService.tsx +6 -1
- package/src/hooks/useGeoLocation.ts +3 -3
- package/src/hooks/useMap.ts +15 -1
- package/src/hooks/useOverlay.ts +1 -0
- package/src/hooks/useWalkingRoute.ts +0 -1
- package/src/hooks-business/useBusinessMapRecomendPlace.ts +1 -0
- package/src/hooks-business/useBusinessQuotingMap.ts +11 -0
- package/src/hooks-business/useBusinessTaxiServiceMap.ts +12 -0
- package/src/index.ts +1 -1
- package/src/types/interface.ts +1 -0
- package/dist/hooks-business/useBusinessMapFitView.d.ts +0 -2291
- package/src/hooks-business/useBusinessMapFitView.ts +0 -6
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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() {
|
|
@@ -7,6 +7,7 @@ export const App = defineComponent({
|
|
|
7
7
|
// return () => <ABusinessDemo />;
|
|
8
8
|
// return () => <SearchDemo />;
|
|
9
9
|
// return () => <DemoBusinessTaxiService />;
|
|
10
|
-
return () => <
|
|
10
|
+
return () => <DemoBusinessQuoting />;
|
|
11
|
+
// return () => <HeycarDemo />;
|
|
11
12
|
},
|
|
12
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";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ref, watch } from "vue-demi";
|
|
2
2
|
import { HeycarMap, HeycarMapProps } from "../../components/MapProvider";
|
|
3
3
|
import { useGeoLocation } from "../../hooks/useGeoLocation";
|
|
4
|
+
import { MapMountedProps, onMapMounted } from "../../hooks/useMap";
|
|
5
|
+
import type { MROP } from "../../hooks/useOverlay";
|
|
4
6
|
import { defineLagecySetup, defineSetup } from "../../types/helper";
|
|
5
7
|
import type { DriverStatus, Place, Point } from "../../types/interface";
|
|
6
8
|
import { place2point } from "../../utils/transform";
|
|
@@ -22,17 +24,24 @@ const STATUS_NEED_CAR_POSITION: DriverStatus[] = [
|
|
|
22
24
|
"driverArrived",
|
|
23
25
|
];
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
type SectionDispatchingProps = MROP &
|
|
28
|
+
MapMountedProps & {
|
|
29
|
+
title: string;
|
|
30
|
+
from: Place;
|
|
31
|
+
};
|
|
32
|
+
const SectionDispatching = defineSetup((props: SectionDispatchingProps, { emit }) => {
|
|
33
|
+
onMapMounted(() => emit("mapMounted"));
|
|
30
34
|
return () => {
|
|
31
|
-
const { from: fromPlace, title } = props;
|
|
35
|
+
const { from: fromPlace, title, registerOverlay } = props;
|
|
32
36
|
const from = place2point(fromPlace);
|
|
33
37
|
return (
|
|
34
38
|
<div>
|
|
35
|
-
<StartEndPoint
|
|
39
|
+
<StartEndPoint
|
|
40
|
+
type="start"
|
|
41
|
+
position={from}
|
|
42
|
+
title={title}
|
|
43
|
+
registerOverlay={registerOverlay}
|
|
44
|
+
/>
|
|
36
45
|
<WaveCircle position={from} />
|
|
37
46
|
<PlaceCircle position={from} label={fromPlace.name} hideIcon />
|
|
38
47
|
</div>
|
|
@@ -40,19 +49,21 @@ const SectionDispatching = defineSetup((props: SectionDispatchingProps) => {
|
|
|
40
49
|
};
|
|
41
50
|
});
|
|
42
51
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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"));
|
|
50
61
|
return () => {
|
|
51
|
-
const { from: fromPlace, carPosition, passengerPosition, renderTitle } = props;
|
|
62
|
+
const { from: fromPlace, carPosition, passengerPosition, renderTitle, registerOverlay } = props;
|
|
52
63
|
const from = place2point(fromPlace);
|
|
53
64
|
return (
|
|
54
65
|
<div>
|
|
55
|
-
<StartEndPoint type="start" position={from} />
|
|
66
|
+
<StartEndPoint type="start" position={from} registerOverlay={registerOverlay} />
|
|
56
67
|
<PlaceCircle position={from} label={fromPlace.name} hideIcon />
|
|
57
68
|
<DrivingRoute
|
|
58
69
|
from={carPosition}
|
|
@@ -67,78 +78,97 @@ const SectionDriverStartService = defineSetup((props: SectionDriverStartServiceP
|
|
|
67
78
|
to={from}
|
|
68
79
|
render={({ path }) => <WalkingLine path={path} />}
|
|
69
80
|
/>
|
|
70
|
-
<PassengerCircle position={passengerPosition} />
|
|
81
|
+
<PassengerCircle position={passengerPosition} registerOverlay={registerOverlay} />
|
|
71
82
|
</div>
|
|
72
83
|
);
|
|
73
84
|
};
|
|
74
85
|
});
|
|
75
86
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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"));
|
|
83
96
|
return () => {
|
|
84
|
-
const { from: fromPlace, passengerPosition, title } = props;
|
|
97
|
+
const { from: fromPlace, passengerPosition, title, registerOverlay } = props;
|
|
85
98
|
const from = place2point(fromPlace);
|
|
86
99
|
return (
|
|
87
100
|
<div>
|
|
88
|
-
<StartEndPoint
|
|
101
|
+
<StartEndPoint
|
|
102
|
+
type="start"
|
|
103
|
+
position={from}
|
|
104
|
+
title={title}
|
|
105
|
+
registerOverlay={registerOverlay}
|
|
106
|
+
/>
|
|
89
107
|
<PlaceCircle position={from} label={fromPlace.name} hideIcon />
|
|
90
|
-
<PassengerCircle position={passengerPosition}
|
|
108
|
+
<PassengerCircle position={passengerPosition} registerOverlay={registerOverlay} />
|
|
91
109
|
</div>
|
|
92
110
|
);
|
|
93
111
|
};
|
|
94
112
|
});
|
|
95
113
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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"));
|
|
104
124
|
return () => {
|
|
105
|
-
const { from: fromPlace, carPosition, passengerPosition, title } = props;
|
|
125
|
+
const { from: fromPlace, carPosition, passengerPosition, title, registerOverlay } = props;
|
|
106
126
|
const from = place2point(fromPlace);
|
|
107
127
|
return (
|
|
108
128
|
<div>
|
|
109
|
-
<TaxiCar position={carPosition} title={title} />
|
|
110
|
-
<StartEndPoint type="start" position={from} />
|
|
129
|
+
<TaxiCar position={carPosition} title={title} registerOverlay={registerOverlay} />
|
|
130
|
+
<StartEndPoint type="start" position={from} registerOverlay={registerOverlay} />
|
|
111
131
|
<PlaceCircle position={from} label={fromPlace.name} hideIcon />
|
|
112
132
|
<WalkingRoute
|
|
113
133
|
from={passengerPosition}
|
|
114
134
|
to={from}
|
|
115
135
|
render={({ path }) => <WalkingLine path={path} />}
|
|
116
136
|
/>
|
|
117
|
-
<PassengerCircle
|
|
137
|
+
<PassengerCircle
|
|
138
|
+
position={passengerPosition}
|
|
139
|
+
size="small"
|
|
140
|
+
registerOverlay={registerOverlay}
|
|
141
|
+
/>
|
|
118
142
|
</div>
|
|
119
143
|
);
|
|
120
144
|
};
|
|
121
145
|
});
|
|
122
146
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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"));
|
|
129
155
|
return () => {
|
|
130
|
-
const { to: toPlace, carPosition, renderTitle } = props;
|
|
156
|
+
const { to: toPlace, carPosition, renderTitle, registerOverlay } = props;
|
|
131
157
|
const to = place2point(toPlace);
|
|
132
158
|
return (
|
|
133
159
|
<div>
|
|
134
|
-
<StartEndPoint type="end" position={to} />
|
|
135
|
-
<PlaceCircle position={carPosition} label="'WebSter Dental Plaza'"
|
|
160
|
+
<StartEndPoint type="end" position={to} registerOverlay={registerOverlay} />
|
|
161
|
+
<PlaceCircle position={carPosition} label="'WebSter Dental Plaza'" hideIcon />
|
|
136
162
|
<DrivingRoute
|
|
137
163
|
from={carPosition}
|
|
138
164
|
to={to}
|
|
139
165
|
render={({ path, distance, duration }) => [
|
|
140
166
|
<DrivingLine path={path} />,
|
|
141
|
-
<TaxiCar
|
|
167
|
+
<TaxiCar
|
|
168
|
+
position={carPosition}
|
|
169
|
+
title={renderTitle({ distance, duration })}
|
|
170
|
+
registerOverlay={registerOverlay}
|
|
171
|
+
/>,
|
|
142
172
|
]}
|
|
143
173
|
/>
|
|
144
174
|
</div>
|
|
@@ -146,19 +176,21 @@ const SectionInService = defineSetup((props: SectionInServiceProps) => {
|
|
|
146
176
|
};
|
|
147
177
|
});
|
|
148
178
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
179
|
+
type SectionCanceledProps = MROP &
|
|
180
|
+
MapMountedProps & {
|
|
181
|
+
from: Place;
|
|
182
|
+
to: Place;
|
|
183
|
+
};
|
|
184
|
+
const SectionCanceled = defineSetup((props: SectionCanceledProps, { emit }) => {
|
|
185
|
+
onMapMounted(() => emit("mapMounted"));
|
|
154
186
|
return () => {
|
|
155
|
-
const { from: fromPlace, to: toPlace } = props;
|
|
187
|
+
const { from: fromPlace, to: toPlace, registerOverlay } = props;
|
|
156
188
|
const from = place2point(fromPlace);
|
|
157
189
|
const to = place2point(toPlace);
|
|
158
190
|
return (
|
|
159
191
|
<div>
|
|
160
|
-
<StartEndPoint type="start" position={from} />
|
|
161
|
-
<StartEndPoint type="end" position={to} />
|
|
192
|
+
<StartEndPoint type="start" position={from} registerOverlay={registerOverlay} />
|
|
193
|
+
<StartEndPoint type="end" position={to} registerOverlay={registerOverlay} />
|
|
162
194
|
<PlaceCircle position={from} label={fromPlace.name} hideIcon />
|
|
163
195
|
<PlaceCircle position={to} label={toPlace.name} hideIcon />
|
|
164
196
|
</div>
|
|
@@ -166,19 +198,21 @@ const SectionCanceled = defineSetup((props: SectionCanceledProps) => {
|
|
|
166
198
|
};
|
|
167
199
|
});
|
|
168
200
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
201
|
+
type SectionEndServiceProps = MROP &
|
|
202
|
+
MapMountedProps & {
|
|
203
|
+
from: Place;
|
|
204
|
+
to: Place;
|
|
205
|
+
};
|
|
206
|
+
const SectionEndService = defineSetup((props: SectionEndServiceProps, { emit }) => {
|
|
207
|
+
onMapMounted(() => emit("mapMounted"));
|
|
174
208
|
return () => {
|
|
175
|
-
const { from: fromPlace, to: toPlace } = props;
|
|
209
|
+
const { from: fromPlace, to: toPlace, registerOverlay } = props;
|
|
176
210
|
const from = place2point(fromPlace);
|
|
177
211
|
const to = place2point(toPlace);
|
|
178
212
|
return (
|
|
179
213
|
<div>
|
|
180
|
-
<StartEndPoint type="start" position={from} />
|
|
181
|
-
<StartEndPoint type="end" position={to} />
|
|
214
|
+
<StartEndPoint type="start" position={from} registerOverlay={registerOverlay} />
|
|
215
|
+
<StartEndPoint type="end" position={to} registerOverlay={registerOverlay} />
|
|
182
216
|
<PlaceCircle position={from} label={fromPlace.name} hideIcon />
|
|
183
217
|
<PlaceCircle position={to} label={toPlace.name} hideIcon />
|
|
184
218
|
<DrivingRoute from={from} to={to} render={({ path }) => <DrivingLine path={path} done />} />
|
|
@@ -187,87 +221,125 @@ const SectionEndService = defineSetup((props: SectionEndServiceProps) => {
|
|
|
187
221
|
};
|
|
188
222
|
});
|
|
189
223
|
|
|
190
|
-
export
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
watch(
|
|
209
|
-
() => props.driverStatus,
|
|
210
|
-
(status, _, onCleanup) => {
|
|
211
|
-
if (!STATUS_NEED_CAR_POSITION.includes(status)) return;
|
|
212
|
-
const timer = setInterval(() => {
|
|
213
|
-
getDriverPosition().then((pos) => (carPositionRef.value = pos));
|
|
214
|
-
}, interval);
|
|
215
|
-
onCleanup(() => clearInterval(timer));
|
|
216
|
-
},
|
|
217
|
-
{ immediate: true }
|
|
218
|
-
);
|
|
219
|
-
return () => {
|
|
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 }) => {
|
|
220
242
|
const {
|
|
221
|
-
driverStatus,
|
|
222
243
|
from,
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
driverArrivedTitle,
|
|
244
|
+
interval,
|
|
245
|
+
registerOverlay,
|
|
246
|
+
mapRef,
|
|
247
|
+
getDriverPosition,
|
|
228
248
|
renderStartSerivceTitle,
|
|
229
249
|
renderInServiceTitle,
|
|
230
250
|
} = props;
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
passengerPosition={geoPosition.value}
|
|
245
|
-
renderTitle={renderStartSerivceTitle}
|
|
246
|
-
/>
|
|
247
|
-
) : driverStatus === "book-dispatched" ? (
|
|
248
|
-
<SectionBookDispatched
|
|
249
|
-
from={from}
|
|
250
|
-
passengerPosition={geoPosition.value}
|
|
251
|
-
title={bookDispatchedTitle}
|
|
252
|
-
/>
|
|
253
|
-
) : driverStatus === "inService" ? (
|
|
254
|
-
<SectionInService to={to} carPosition={carPosition} renderTitle={renderInServiceTitle} />
|
|
255
|
-
) : driverStatus === "driverArrived" ? (
|
|
256
|
-
<SectionDriverArrived
|
|
257
|
-
from={from}
|
|
258
|
-
carPosition={carPosition}
|
|
259
|
-
passengerPosition={geoPosition.value}
|
|
260
|
-
title={driverArrivedTitle}
|
|
261
|
-
/>
|
|
262
|
-
) : driverStatus === "canceled" ? (
|
|
263
|
-
<SectionCanceled from={from} to={to} />
|
|
264
|
-
) : driverStatus === "endService" ? (
|
|
265
|
-
<SectionEndService from={from} to={to} />
|
|
266
|
-
) : null}
|
|
267
|
-
</HeycarMap>
|
|
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 }
|
|
268
264
|
);
|
|
269
|
-
|
|
270
|
-
|
|
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([
|
|
271
343
|
"bookDispatchedTitle",
|
|
272
344
|
"bookDispatchingTitle",
|
|
273
345
|
"dispatchingTitle",
|
|
@@ -282,4 +354,5 @@ export const BusinessTaxiServiceMap = defineLagecySetup((props: BusinessTaxiServ
|
|
|
282
354
|
"renderInServiceTitle",
|
|
283
355
|
"renderStartSerivceTitle",
|
|
284
356
|
"to",
|
|
357
|
+
"registerOverlay",
|
|
285
358
|
]);
|
|
@@ -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, {
|