@heycar/heycars-map 0.3.7 → 0.3.8
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/business-components/AbsoluteAddressBox/AbsoluteAddressBox.d.ts +1 -2
- package/dist/business-components/AddressBox/AddressBox.d.ts +1 -2
- package/dist/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +1 -0
- package/dist/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +1 -2
- package/dist/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +1 -2
- package/dist/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +2 -3
- package/dist/business-components/DrivingLine/DrivingLine.d.ts +1 -2
- package/dist/business-components/DrivingRoute/DrivingRoute.d.ts +1 -2
- package/dist/business-components/PassengerCircle/PassengerCircle.d.ts +1 -2
- package/dist/business-components/PickupPoints/PickupPoints.d.ts +1 -2
- package/dist/business-components/PlaceCircle/PlaceCircle.d.ts +1 -2
- package/dist/business-components/StartEndPoint/StartEndPoint.d.ts +1 -2
- package/dist/business-components/TaxiCar/TaxiCar.d.ts +1 -2
- package/dist/business-components/WalkingLine/WalkingLine.d.ts +1 -2
- package/dist/business-components/WalkingRoute/WalkingRoute.d.ts +1 -2
- package/dist/business-components/WaveCircle/WaveCircle.d.ts +1 -2
- package/dist/components/Gmap/Gmap.d.ts +0 -2
- package/dist/components/MapProvider/MapProvider.d.ts +1 -4
- package/dist/hooks/useMapAutoComplete.d.ts +1 -2
- package/dist/hooks-business/useBusinessMapAutoComplete.d.ts +1 -2
- package/dist/index.cjs +55 -55
- package/dist/index.js +1966 -2061
- package/package.json +1 -1
- package/todo.md +16 -4
- package/dist/Demo/CityBound/SearchDemo.d.ts +0 -1
- package/dist/Demo/CityBound/country.d.ts +0 -5
- package/dist/Demo/CityBound/searchResult.d.ts +0 -8
- package/dist/hooks/useMapLog.d.ts +0 -5
- package/src/App.tsx +0 -27
- package/src/Demo/CityBound/SearchDemo.tsx +0 -142
- package/src/Demo/CityBound/country.ts +0 -4179
- package/src/Demo/CityBound/searchResult.ts +0 -21122
- package/src/Demo/Demo.css.ts +0 -6
- package/src/Demo/Demo.tsx +0 -97
- package/src/Demo/DemoBusinessQuoting.tsx +0 -18
- package/src/Demo/DemoBusinessRecomendPlace.tsx +0 -89
- package/src/Demo/DemoBusinessTaxiEnd.tsx +0 -38
- package/src/Demo/DemoBusinessTaxiService.tsx +0 -58
- package/src/Demo/sample.json +0 -793
- package/src/api/contants.ts +0 -3
- package/src/api/driving.ts +0 -87
- package/src/api/geocoder.ts +0 -88
- package/src/api/geometry.ts +0 -44
- package/src/api/place.ts +0 -105
- package/src/assets/icons/svg/address-locator.svg +0 -1
- package/src/assets/icons/svg/arrow-right.svg +0 -1
- package/src/assets/icons/svg/end-point.svg +0 -1
- package/src/assets/icons/svg/passenger-circle.svg +0 -1
- package/src/assets/icons/svg/place-circle.svg +0 -22
- package/src/assets/icons/svg/start-point.svg +0 -1
- package/src/assets/icons/svg/taxi-car.svg +0 -1
- package/src/assets/icons/svg/wave-circle.svg +0 -1
- package/src/business-components/AbsoluteAddressBox/AbsoluteAddressBox.css.ts +0 -68
- package/src/business-components/AbsoluteAddressBox/AbsoluteAddressBox.tsx +0 -50
- package/src/business-components/AbsoluteAddressBox/index.ts +0 -1
- package/src/business-components/AddressBox/AddressBox.css.ts +0 -55
- package/src/business-components/AddressBox/AddressBox.tsx +0 -76
- package/src/business-components/AddressBox/index.ts +0 -1
- package/src/business-components/AddressLocator/AddressLocator.css.ts +0 -7
- package/src/business-components/AddressLocator/AddressLocator.tsx +0 -40
- package/src/business-components/AddressLocator/index.ts +0 -1
- package/src/business-components/BusinessQuotingMap/BusinessQuotingMap.tsx +0 -49
- package/src/business-components/BusinessQuotingMap/index.ts +0 -1
- package/src/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.tsx +0 -218
- package/src/business-components/BusinessRecomendPlaceMap/index.ts +0 -1
- package/src/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.tsx +0 -43
- package/src/business-components/BusinessTaxiEndMap/index.ts +0 -1
- package/src/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.tsx +0 -453
- package/src/business-components/BusinessTaxiServiceMap/index.ts +0 -1
- package/src/business-components/DrivingLine/DrivingLine.css.ts +0 -10
- package/src/business-components/DrivingLine/DrivingLine.tsx +0 -135
- package/src/business-components/DrivingLine/index.ts +0 -1
- package/src/business-components/DrivingRoute/DrivingRoute.tsx +0 -52
- package/src/business-components/DrivingRoute/index.ts +0 -1
- package/src/business-components/FitView/FitView.tsx +0 -22
- package/src/business-components/FitView/index.ts +0 -1
- package/src/business-components/PassengerCircle/PassengerCircle.css.ts +0 -21
- package/src/business-components/PassengerCircle/PassengerCircle.tsx +0 -69
- package/src/business-components/PassengerCircle/index.ts +0 -1
- package/src/business-components/PickupPoints/PickupPoints.tsx +0 -38
- package/src/business-components/PickupPoints/index.ts +0 -1
- package/src/business-components/PlaceCircle/PlaceCircle.css.ts +0 -76
- package/src/business-components/PlaceCircle/PlaceCircle.tsx +0 -110
- package/src/business-components/PlaceCircle/index.ts +0 -1
- package/src/business-components/StartEndPoint/StartEndPoint.css.ts +0 -70
- package/src/business-components/StartEndPoint/StartEndPoint.tsx +0 -122
- package/src/business-components/StartEndPoint/index.ts +0 -1
- package/src/business-components/TaxiCar/TaxiCar.css.ts +0 -16
- package/src/business-components/TaxiCar/TaxiCar.tsx +0 -93
- package/src/business-components/TaxiCar/index.ts +0 -1
- package/src/business-components/WalkingLine/WalkingLine.tsx +0 -80
- package/src/business-components/WalkingLine/index.ts +0 -1
- package/src/business-components/WalkingRoute/WalkingRoute.tsx +0 -43
- package/src/business-components/WalkingRoute/index.ts +0 -1
- package/src/business-components/WaveCircle/WaveCircle.css.ts +0 -54
- package/src/business-components/WaveCircle/WaveCircle.tsx +0 -59
- package/src/business-components/WaveCircle/index.ts +0 -1
- package/src/components/Amap/Amap.css.ts +0 -5
- package/src/components/Amap/Amap.ts +0 -76
- package/src/components/Amap/index.ts +0 -1
- package/src/components/AmapInfoWindow/AmapInfoWindow.ts +0 -45
- package/src/components/AmapInfoWindow/index.ts +0 -1
- package/src/components/AmapLoader/AmapLoader.ts +0 -20
- package/src/components/AmapLoader/index.ts +0 -1
- package/src/components/AmapMarker/AmapMarker.ts +0 -48
- package/src/components/AmapMarker/index.ts +0 -1
- package/src/components/AmapPolygon/AmapPolygon.ts +0 -41
- package/src/components/AmapPolygon/index.ts +0 -1
- package/src/components/AmapPolyline/AmapPolyline.ts +0 -40
- package/src/components/AmapPolyline/index.ts +0 -1
- package/src/components/AmapText/AmapText.ts +0 -39
- package/src/components/AmapText/index.ts +0 -1
- package/src/components/Gmap/Gmap.css.ts +0 -10
- package/src/components/Gmap/Gmap.ts +0 -54
- package/src/components/Gmap/index.ts +0 -1
- package/src/components/GmapAdvancedMarkerView/GmapAdvancedMarkerView.ts +0 -63
- package/src/components/GmapAdvancedMarkerView/index.ts +0 -1
- package/src/components/GmapInfoWindow/GmapInfoWindow.ts +0 -38
- package/src/components/GmapInfoWindow/index.ts +0 -1
- package/src/components/GmapLoader/GmapLoader.ts +0 -21
- package/src/components/GmapLoader/index.ts +0 -1
- package/src/components/GmapMarker/GmapMarker.ts +0 -34
- package/src/components/GmapMarker/index.ts +0 -1
- package/src/components/GmapPolygon/GmapPolygon.ts +0 -29
- package/src/components/GmapPolygon/index.ts +0 -1
- package/src/components/GmapPolyline/GmapPolyline.ts +0 -29
- package/src/components/GmapPolyline/index.ts +0 -1
- package/src/components/MapProvider/MapProvider.tsx +0 -83
- package/src/components/MapProvider/index.ts +0 -1
- package/src/hooks/useDrivingRoute.ts +0 -106
- package/src/hooks/useGeoLocation.ts +0 -70
- package/src/hooks/useHeycarMap.ts +0 -28
- package/src/hooks/useMap.ts +0 -43
- package/src/hooks/useMapAngle.ts +0 -42
- package/src/hooks/useMapAutoComplete.ts +0 -130
- package/src/hooks/useMapCityBound.ts +0 -64
- package/src/hooks/useMapDrag.ts +0 -72
- package/src/hooks/useMapEventSource.ts +0 -20
- package/src/hooks/useMapFitView.ts +0 -135
- package/src/hooks/useMapGeometry.ts +0 -27
- package/src/hooks/useMapLngLatToVw.ts +0 -31
- package/src/hooks/useMapLoader.ts +0 -164
- package/src/hooks/useMapLog.ts +0 -24
- package/src/hooks/useMapPlace.ts +0 -138
- package/src/hooks/useMapRecomendPlace.ts +0 -150
- package/src/hooks/useMapSupplier.ts +0 -16
- package/src/hooks/useOverlay.ts +0 -23
- package/src/hooks/usePlacesLabelDirection.ts +0 -61
- package/src/hooks/useUdate.ts +0 -9
- package/src/hooks/useWaitTimer.ts +0 -25
- package/src/hooks/useWalkingRoute.ts +0 -87
- package/src/hooks-business/useBusinessMapAutoComplete.ts +0 -22
- package/src/hooks-business/useBusinessQuotingMap.ts +0 -11
- package/src/hooks-business/useBusinessRecomendPlaceMap.ts +0 -45
- package/src/hooks-business/useBusinessTaxiServiceMap.ts +0 -12
- package/src/index.ts +0 -33
- package/src/main.ts +0 -6
- package/src/style.css +0 -0
- package/src/types/amap/autocomplete.d.ts +0 -64
- package/src/types/amap/driving.d.ts +0 -170
- package/src/types/amap/geocoder.d.ts +0 -217
- package/src/types/amap/marker.ts +0 -11
- package/src/types/amap/place.d.ts +0 -114
- package/src/types/amap/plugin.d.ts +0 -27
- package/src/types/amap/walking.d.ts +0 -78
- package/src/types/global.d.ts +0 -10
- package/src/types/helper.ts +0 -172
- package/src/types/interface.ts +0 -62
- package/src/types/mapHelper.ts +0 -1
- package/src/utils/compare.ts +0 -189
- package/src/utils/dom.ts +0 -14
- package/src/utils/helper.ts +0 -5
- package/src/utils/transform.ts +0 -68
- package/src/vite-env.d.ts +0 -12
|
@@ -1,453 +0,0 @@
|
|
|
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 { MapLogProps, useMapLog } from "../../hooks/useMapLog";
|
|
6
|
-
import type { MROP } from "../../hooks/useOverlay";
|
|
7
|
-
import { defineLagecySetup, defineSetup } from "../../types/helper";
|
|
8
|
-
import type { DriverStatus, Place, Point } from "../../types/interface";
|
|
9
|
-
import { place2point } from "../../utils/transform";
|
|
10
|
-
import { DrivingLine } from "../DrivingLine";
|
|
11
|
-
import { DrivingRoute, DrivingRouteRenderProps } from "../DrivingRoute";
|
|
12
|
-
import { PassengerCircle } from "../PassengerCircle";
|
|
13
|
-
import { PlaceCircle } from "../PlaceCircle";
|
|
14
|
-
import { StartEndPoint } from "../StartEndPoint";
|
|
15
|
-
import { TaxiCar } from "../TaxiCar";
|
|
16
|
-
import { WalkingLine } from "../WalkingLine";
|
|
17
|
-
import { WalkingRoute } from "../WalkingRoute";
|
|
18
|
-
import { WaveCircle } from "../WaveCircle";
|
|
19
|
-
|
|
20
|
-
const STATUS_NEED_CAR_POSITION: DriverStatus[] = [
|
|
21
|
-
"book-driverStartService",
|
|
22
|
-
"dispatched",
|
|
23
|
-
"driverStartService",
|
|
24
|
-
"inService",
|
|
25
|
-
"driverArrived",
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
type SectionDispatchingProps = MROP &
|
|
29
|
-
MapLogProps &
|
|
30
|
-
MapMountedProps & {
|
|
31
|
-
title: string;
|
|
32
|
-
from: Place;
|
|
33
|
-
};
|
|
34
|
-
const SectionDispatching = defineSetup((props: SectionDispatchingProps, { emit }) => {
|
|
35
|
-
useMapLog(props, "SectionDispatching");
|
|
36
|
-
onMapMounted(() => emit("mapMounted"));
|
|
37
|
-
return () => {
|
|
38
|
-
const { from: fromPlace, title, registerOverlay } = props;
|
|
39
|
-
const from = place2point(fromPlace);
|
|
40
|
-
return (
|
|
41
|
-
<div>
|
|
42
|
-
<StartEndPoint
|
|
43
|
-
type="start"
|
|
44
|
-
position={from}
|
|
45
|
-
title={title}
|
|
46
|
-
registerOverlay={registerOverlay}
|
|
47
|
-
log={props.log}
|
|
48
|
-
/>
|
|
49
|
-
<WaveCircle position={from} log={props.log} />
|
|
50
|
-
<PlaceCircle position={from} label={fromPlace.name} hideIcon log={props.log} />
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
type SectionDriverStartServiceProps = MROP &
|
|
57
|
-
MapLogProps &
|
|
58
|
-
MapMountedProps & {
|
|
59
|
-
passengerPosition: Point;
|
|
60
|
-
carPosition: Point;
|
|
61
|
-
from: Place;
|
|
62
|
-
renderTitle: (props: Pick<DrivingRouteRenderProps, "duration" | "distance">) => string;
|
|
63
|
-
};
|
|
64
|
-
const SectionDriverStartService = defineSetup((props: SectionDriverStartServiceProps, { emit }) => {
|
|
65
|
-
useMapLog(props, "SectionDriverStartService");
|
|
66
|
-
onMapMounted(() => emit("mapMounted"));
|
|
67
|
-
return () => {
|
|
68
|
-
const { from: fromPlace, carPosition, passengerPosition, renderTitle, registerOverlay } = props;
|
|
69
|
-
const from = place2point(fromPlace);
|
|
70
|
-
return (
|
|
71
|
-
<div>
|
|
72
|
-
<StartEndPoint
|
|
73
|
-
type="start"
|
|
74
|
-
position={from}
|
|
75
|
-
registerOverlay={registerOverlay}
|
|
76
|
-
log={props.log}
|
|
77
|
-
/>
|
|
78
|
-
<PlaceCircle position={from} label={fromPlace.name} hideIcon log={props.log} />
|
|
79
|
-
<DrivingRoute
|
|
80
|
-
from={carPosition}
|
|
81
|
-
to={from}
|
|
82
|
-
log={props.log}
|
|
83
|
-
render={({ path, distance, duration }) => [
|
|
84
|
-
<DrivingLine path={path} log={props.log} />,
|
|
85
|
-
<TaxiCar
|
|
86
|
-
position={carPosition}
|
|
87
|
-
title={renderTitle({ distance, duration })}
|
|
88
|
-
log={props.log}
|
|
89
|
-
/>,
|
|
90
|
-
]}
|
|
91
|
-
/>
|
|
92
|
-
<WalkingRoute
|
|
93
|
-
from={passengerPosition}
|
|
94
|
-
to={from}
|
|
95
|
-
log={props.log}
|
|
96
|
-
render={({ path }) => <WalkingLine path={path} log={props.log} />}
|
|
97
|
-
/>
|
|
98
|
-
<PassengerCircle
|
|
99
|
-
position={passengerPosition}
|
|
100
|
-
registerOverlay={registerOverlay}
|
|
101
|
-
log={props.log}
|
|
102
|
-
/>
|
|
103
|
-
</div>
|
|
104
|
-
);
|
|
105
|
-
};
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
type SectionBookDispatchedProps = MROP &
|
|
109
|
-
MapLogProps &
|
|
110
|
-
MapMountedProps & {
|
|
111
|
-
passengerPosition: Point;
|
|
112
|
-
from: Place;
|
|
113
|
-
// @example 司机位置将在临近出发时间展示
|
|
114
|
-
title: string;
|
|
115
|
-
};
|
|
116
|
-
const SectionBookDispatched = defineSetup((props: SectionBookDispatchedProps, { emit }) => {
|
|
117
|
-
useMapLog(props, "SectionBookDispatched");
|
|
118
|
-
onMapMounted(() => emit("mapMounted"));
|
|
119
|
-
return () => {
|
|
120
|
-
const { from: fromPlace, passengerPosition, title, registerOverlay } = props;
|
|
121
|
-
const from = place2point(fromPlace);
|
|
122
|
-
return (
|
|
123
|
-
<div>
|
|
124
|
-
<StartEndPoint
|
|
125
|
-
type="start"
|
|
126
|
-
position={from}
|
|
127
|
-
title={title}
|
|
128
|
-
registerOverlay={registerOverlay}
|
|
129
|
-
log={props.log}
|
|
130
|
-
/>
|
|
131
|
-
<PlaceCircle position={from} label={fromPlace.name} hideIcon log={props.log} />
|
|
132
|
-
<PassengerCircle
|
|
133
|
-
position={passengerPosition}
|
|
134
|
-
registerOverlay={registerOverlay}
|
|
135
|
-
log={props.log}
|
|
136
|
-
/>
|
|
137
|
-
</div>
|
|
138
|
-
);
|
|
139
|
-
};
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
type SectionDriverArrivedProps = MROP &
|
|
143
|
-
MapLogProps &
|
|
144
|
-
MapMountedProps & {
|
|
145
|
-
from: Place;
|
|
146
|
-
carPosition: Point;
|
|
147
|
-
passengerPosition: Point;
|
|
148
|
-
// @example 司机已等待 *00:35*
|
|
149
|
-
title: string;
|
|
150
|
-
};
|
|
151
|
-
const SectionDriverArrived = defineSetup((props: SectionDriverArrivedProps, { emit }) => {
|
|
152
|
-
useMapLog(props, "SectionDriverArrived");
|
|
153
|
-
onMapMounted(() => emit("mapMounted"));
|
|
154
|
-
return () => {
|
|
155
|
-
const { from: fromPlace, carPosition, passengerPosition, title, registerOverlay } = props;
|
|
156
|
-
const from = place2point(fromPlace);
|
|
157
|
-
return (
|
|
158
|
-
<div>
|
|
159
|
-
<TaxiCar
|
|
160
|
-
position={carPosition}
|
|
161
|
-
title={title}
|
|
162
|
-
registerOverlay={registerOverlay}
|
|
163
|
-
log={props.log}
|
|
164
|
-
/>
|
|
165
|
-
<StartEndPoint
|
|
166
|
-
type="start"
|
|
167
|
-
position={from}
|
|
168
|
-
registerOverlay={registerOverlay}
|
|
169
|
-
log={props.log}
|
|
170
|
-
/>
|
|
171
|
-
<PlaceCircle position={from} label={fromPlace.name} hideIcon log={props.log} />
|
|
172
|
-
<WalkingRoute
|
|
173
|
-
from={passengerPosition}
|
|
174
|
-
to={from}
|
|
175
|
-
log={props.log}
|
|
176
|
-
render={({ path }) => <WalkingLine path={path} />}
|
|
177
|
-
/>
|
|
178
|
-
<PassengerCircle
|
|
179
|
-
position={passengerPosition}
|
|
180
|
-
size="small"
|
|
181
|
-
registerOverlay={registerOverlay}
|
|
182
|
-
log={props.log}
|
|
183
|
-
/>
|
|
184
|
-
</div>
|
|
185
|
-
);
|
|
186
|
-
};
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
type SectionInServiceProps = MROP &
|
|
190
|
-
MapLogProps &
|
|
191
|
-
MapMountedProps & {
|
|
192
|
-
to: Place;
|
|
193
|
-
carPosition: Point;
|
|
194
|
-
renderTitle: (props: Pick<DrivingRouteRenderProps, "duration" | "distance">) => string;
|
|
195
|
-
};
|
|
196
|
-
const SectionInService = defineSetup((props: SectionInServiceProps, { emit }) => {
|
|
197
|
-
useMapLog(props, "SectionInService");
|
|
198
|
-
onMapMounted(() => emit("mapMounted"));
|
|
199
|
-
return () => {
|
|
200
|
-
const { to: toPlace, carPosition, renderTitle, registerOverlay } = props;
|
|
201
|
-
const to = place2point(toPlace);
|
|
202
|
-
return (
|
|
203
|
-
<div>
|
|
204
|
-
<StartEndPoint type="end" position={to} registerOverlay={registerOverlay} log={props.log} />
|
|
205
|
-
<PlaceCircle
|
|
206
|
-
position={carPosition}
|
|
207
|
-
label="'WebSter Dental Plaza'"
|
|
208
|
-
hideIcon
|
|
209
|
-
log={props.log}
|
|
210
|
-
/>
|
|
211
|
-
<DrivingRoute
|
|
212
|
-
from={carPosition}
|
|
213
|
-
to={to}
|
|
214
|
-
log={props.log}
|
|
215
|
-
render={({ path, distance, duration }) => [
|
|
216
|
-
<DrivingLine path={path} log={props.log} />,
|
|
217
|
-
<TaxiCar
|
|
218
|
-
position={carPosition}
|
|
219
|
-
title={renderTitle({ distance, duration })}
|
|
220
|
-
registerOverlay={registerOverlay}
|
|
221
|
-
log={props.log}
|
|
222
|
-
/>,
|
|
223
|
-
]}
|
|
224
|
-
/>
|
|
225
|
-
</div>
|
|
226
|
-
);
|
|
227
|
-
};
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
type SectionCanceledProps = MROP &
|
|
231
|
-
MapLogProps &
|
|
232
|
-
MapMountedProps & {
|
|
233
|
-
from: Place;
|
|
234
|
-
to: Place;
|
|
235
|
-
};
|
|
236
|
-
const SectionCanceled = defineSetup((props: SectionCanceledProps, { emit }) => {
|
|
237
|
-
useMapLog(props, "SectionCanceled");
|
|
238
|
-
onMapMounted(() => emit("mapMounted"));
|
|
239
|
-
return () => {
|
|
240
|
-
const { from: fromPlace, to: toPlace, registerOverlay } = props;
|
|
241
|
-
const from = place2point(fromPlace);
|
|
242
|
-
const to = place2point(toPlace);
|
|
243
|
-
return (
|
|
244
|
-
<div>
|
|
245
|
-
<StartEndPoint
|
|
246
|
-
type="start"
|
|
247
|
-
position={from}
|
|
248
|
-
registerOverlay={registerOverlay}
|
|
249
|
-
log={props.log}
|
|
250
|
-
/>
|
|
251
|
-
<StartEndPoint type="end" position={to} registerOverlay={registerOverlay} log={props.log} />
|
|
252
|
-
<PlaceCircle position={from} label={fromPlace.name} hideIcon log={props.log} />
|
|
253
|
-
<PlaceCircle position={to} label={toPlace.name} hideIcon log={props.log} />
|
|
254
|
-
</div>
|
|
255
|
-
);
|
|
256
|
-
};
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
export type SectionEndServiceProps = MROP &
|
|
260
|
-
MapLogProps &
|
|
261
|
-
MapMountedProps & {
|
|
262
|
-
from: Place;
|
|
263
|
-
to: Place;
|
|
264
|
-
};
|
|
265
|
-
export const SectionEndService = defineSetup((props: SectionEndServiceProps, { emit }) => {
|
|
266
|
-
useMapLog(props, "SectionEndService");
|
|
267
|
-
onMapMounted(() => emit("mapMounted"));
|
|
268
|
-
return () => {
|
|
269
|
-
const { from: fromPlace, to: toPlace, registerOverlay } = props;
|
|
270
|
-
const from = place2point(fromPlace);
|
|
271
|
-
const to = place2point(toPlace);
|
|
272
|
-
return (
|
|
273
|
-
<div>
|
|
274
|
-
<StartEndPoint
|
|
275
|
-
type="start"
|
|
276
|
-
position={from}
|
|
277
|
-
registerOverlay={registerOverlay}
|
|
278
|
-
log={props.log}
|
|
279
|
-
/>
|
|
280
|
-
<StartEndPoint type="end" position={to} registerOverlay={registerOverlay} log={props.log} />
|
|
281
|
-
<PlaceCircle position={from} label={fromPlace.name} hideIcon log={props.log} />
|
|
282
|
-
<PlaceCircle position={to} label={toPlace.name} hideIcon log={props.log} />
|
|
283
|
-
<DrivingRoute
|
|
284
|
-
from={from}
|
|
285
|
-
to={to}
|
|
286
|
-
render={({ path }) => <DrivingLine path={path} done log={props.log} />}
|
|
287
|
-
log={props.log}
|
|
288
|
-
/>
|
|
289
|
-
</div>
|
|
290
|
-
);
|
|
291
|
-
};
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
export type BusinessTaxiServiceMapProps = Omit<HeycarMapProps, "center" | "zoom"> &
|
|
295
|
-
Required<MROP> &
|
|
296
|
-
MapLogProps & {
|
|
297
|
-
from: Place;
|
|
298
|
-
to: Place;
|
|
299
|
-
// @example 正在为您搜索附近司机
|
|
300
|
-
dispatchingTitle: string;
|
|
301
|
-
bookDispatchingTitle: string;
|
|
302
|
-
bookDispatchedTitle: string;
|
|
303
|
-
driverArrivedTitle: string;
|
|
304
|
-
driverStatus: DriverStatus;
|
|
305
|
-
interval: number;
|
|
306
|
-
renderStartSerivceTitle: (titleProps: { distance: number; duration: number }) => string;
|
|
307
|
-
renderInServiceTitle: (titleProps: { distance: number; duration: number }) => string;
|
|
308
|
-
getDriverPosition: () => Promise<Point>;
|
|
309
|
-
};
|
|
310
|
-
export const BusinessTaxiServiceMap = defineLagecySetup((props: BusinessTaxiServiceMapProps) => {
|
|
311
|
-
useMapLog(props, "BusinessTaxiServiceMap");
|
|
312
|
-
const {
|
|
313
|
-
from,
|
|
314
|
-
interval,
|
|
315
|
-
registerOverlay,
|
|
316
|
-
mapRef,
|
|
317
|
-
getDriverPosition,
|
|
318
|
-
renderStartSerivceTitle,
|
|
319
|
-
renderInServiceTitle,
|
|
320
|
-
} = props;
|
|
321
|
-
const { setFitView } = registerOverlay;
|
|
322
|
-
const { geoPosition } = useGeoLocation({ geoDefaultPosition: place2point(from) });
|
|
323
|
-
const carPositionRef = ref<Point>(place2point(props.from));
|
|
324
|
-
watch(
|
|
325
|
-
() => props.driverStatus,
|
|
326
|
-
(status, _, onCleanup) => {
|
|
327
|
-
if (!STATUS_NEED_CAR_POSITION.includes(status)) return;
|
|
328
|
-
const timer = setInterval(() => {
|
|
329
|
-
getDriverPosition().then((pos) => (carPositionRef.value = pos));
|
|
330
|
-
}, interval);
|
|
331
|
-
onCleanup(() => clearInterval(timer));
|
|
332
|
-
},
|
|
333
|
-
{ immediate: true }
|
|
334
|
-
);
|
|
335
|
-
return () => {
|
|
336
|
-
const {
|
|
337
|
-
driverStatus,
|
|
338
|
-
from,
|
|
339
|
-
to,
|
|
340
|
-
dispatchingTitle,
|
|
341
|
-
bookDispatchingTitle,
|
|
342
|
-
bookDispatchedTitle,
|
|
343
|
-
driverArrivedTitle,
|
|
344
|
-
} = props;
|
|
345
|
-
const carPosition = carPositionRef.value;
|
|
346
|
-
return (
|
|
347
|
-
<HeycarMap center={place2point(from)} zoom={13} mapRef={mapRef} log={props.log}>
|
|
348
|
-
{driverStatus === "dispatching" ? (
|
|
349
|
-
<SectionDispatching
|
|
350
|
-
from={from}
|
|
351
|
-
title={dispatchingTitle}
|
|
352
|
-
registerOverlay={registerOverlay}
|
|
353
|
-
onMapMounted={setFitView}
|
|
354
|
-
log={props.log}
|
|
355
|
-
/>
|
|
356
|
-
) : driverStatus === "book-dispatching" ? (
|
|
357
|
-
<SectionDispatching
|
|
358
|
-
from={from}
|
|
359
|
-
title={bookDispatchingTitle}
|
|
360
|
-
registerOverlay={registerOverlay}
|
|
361
|
-
onMapMounted={setFitView}
|
|
362
|
-
log={props.log}
|
|
363
|
-
/>
|
|
364
|
-
) : driverStatus === "dispatched" ||
|
|
365
|
-
driverStatus === "driverStartService" ||
|
|
366
|
-
driverStatus === "book-driverStartService" ? (
|
|
367
|
-
<SectionDriverStartService
|
|
368
|
-
from={from}
|
|
369
|
-
carPosition={carPosition}
|
|
370
|
-
passengerPosition={geoPosition.value}
|
|
371
|
-
renderTitle={renderStartSerivceTitle}
|
|
372
|
-
registerOverlay={registerOverlay}
|
|
373
|
-
onMapMounted={setFitView}
|
|
374
|
-
log={props.log}
|
|
375
|
-
/>
|
|
376
|
-
) : driverStatus === "book-dispatched" ? (
|
|
377
|
-
<SectionBookDispatched
|
|
378
|
-
from={from}
|
|
379
|
-
passengerPosition={geoPosition.value}
|
|
380
|
-
title={bookDispatchedTitle}
|
|
381
|
-
registerOverlay={registerOverlay}
|
|
382
|
-
onMapMounted={setFitView}
|
|
383
|
-
log={props.log}
|
|
384
|
-
/>
|
|
385
|
-
) : driverStatus === "inService" ? (
|
|
386
|
-
<SectionInService
|
|
387
|
-
to={to}
|
|
388
|
-
carPosition={carPosition}
|
|
389
|
-
renderTitle={renderInServiceTitle}
|
|
390
|
-
registerOverlay={registerOverlay}
|
|
391
|
-
onMapMounted={setFitView}
|
|
392
|
-
log={props.log}
|
|
393
|
-
/>
|
|
394
|
-
) : driverStatus === "driverArrived" ? (
|
|
395
|
-
<SectionDriverArrived
|
|
396
|
-
from={from}
|
|
397
|
-
carPosition={carPosition}
|
|
398
|
-
passengerPosition={geoPosition.value}
|
|
399
|
-
title={driverArrivedTitle}
|
|
400
|
-
registerOverlay={registerOverlay}
|
|
401
|
-
onMapMounted={setFitView}
|
|
402
|
-
log={props.log}
|
|
403
|
-
/>
|
|
404
|
-
) : driverStatus === "canceled" || driverStatus === "canceling" ? (
|
|
405
|
-
<SectionCanceled from={from} to={to} registerOverlay={registerOverlay} log={props.log} />
|
|
406
|
-
) : driverStatus === "endService" ||
|
|
407
|
-
driverStatus === "completed" ||
|
|
408
|
-
driverStatus === "banlanceRefund" ||
|
|
409
|
-
driverStatus === "waitBanlanceRefund" ||
|
|
410
|
-
driverStatus === "rechargePayed" ||
|
|
411
|
-
driverStatus === "waitRechargePay" ||
|
|
412
|
-
driverStatus === "payed" ||
|
|
413
|
-
driverStatus === "waitpay" ||
|
|
414
|
-
driverStatus === "refund" ||
|
|
415
|
-
driverStatus === "confirmed" ? (
|
|
416
|
-
<SectionEndService
|
|
417
|
-
from={from}
|
|
418
|
-
to={to}
|
|
419
|
-
registerOverlay={registerOverlay}
|
|
420
|
-
onMapMounted={setFitView}
|
|
421
|
-
log={props.log}
|
|
422
|
-
/>
|
|
423
|
-
) : (
|
|
424
|
-
// 匹配不到就显示灰色路线
|
|
425
|
-
<SectionEndService
|
|
426
|
-
from={from}
|
|
427
|
-
to={to}
|
|
428
|
-
registerOverlay={registerOverlay}
|
|
429
|
-
onMapMounted={setFitView}
|
|
430
|
-
log={props.log}
|
|
431
|
-
/>
|
|
432
|
-
)}
|
|
433
|
-
</HeycarMap>
|
|
434
|
-
);
|
|
435
|
-
};
|
|
436
|
-
}).props([
|
|
437
|
-
"log",
|
|
438
|
-
"bookDispatchedTitle",
|
|
439
|
-
"bookDispatchingTitle",
|
|
440
|
-
"dispatchingTitle",
|
|
441
|
-
"driverArrivedTitle",
|
|
442
|
-
"driverStatus",
|
|
443
|
-
"fallback",
|
|
444
|
-
"from",
|
|
445
|
-
"getDriverPosition",
|
|
446
|
-
"interval",
|
|
447
|
-
"loading",
|
|
448
|
-
"mapRef",
|
|
449
|
-
"renderInServiceTitle",
|
|
450
|
-
"renderStartSerivceTitle",
|
|
451
|
-
"to",
|
|
452
|
-
"registerOverlay",
|
|
453
|
-
]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./BusinessTaxiServiceMap";
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { computed } from "vue-demi";
|
|
2
|
-
import { AmapPolyline } from "../../components/AmapPolyline";
|
|
3
|
-
import { GmapPolyline } from "../../components/GmapPolyline";
|
|
4
|
-
import { MapLogProps, useMapLog } from "../../hooks/useMapLog";
|
|
5
|
-
import { useMapSupplier } from "../../hooks/useMapSupplier";
|
|
6
|
-
import { createElement, defineSetup } from "../../types/helper";
|
|
7
|
-
import { vec2lnglat } from "../../utils/transform";
|
|
8
|
-
|
|
9
|
-
export interface DrivingLineProps extends MapLogProps {
|
|
10
|
-
done?: boolean;
|
|
11
|
-
path: [number, number][];
|
|
12
|
-
}
|
|
13
|
-
export const ADrivingLine = defineSetup(function ADrivingLine(props: DrivingLineProps) {
|
|
14
|
-
useMapLog(props, "ADrivingLine");
|
|
15
|
-
return () => {
|
|
16
|
-
const vw = window.innerWidth * 0.01;
|
|
17
|
-
const strokeWidth = 2.5 * vw;
|
|
18
|
-
const borderWidth = 0.35 * vw;
|
|
19
|
-
const dirWidth = 0.6 * vw;
|
|
20
|
-
const outlineWidth = 1 * vw;
|
|
21
|
-
const dashLength = 0.75 * vw;
|
|
22
|
-
const strokeColorInner = props.done ? "#96B2CA" : "#487BF4";
|
|
23
|
-
const strokeColorOuter = props.done ? "#7693AF" : "#4175F1";
|
|
24
|
-
const strokeColorBorder = props.done ? "#7693AF" : "#6C95F5";
|
|
25
|
-
return (
|
|
26
|
-
<div>
|
|
27
|
-
<AmapPolyline
|
|
28
|
-
path={props.path}
|
|
29
|
-
strokeWeight={strokeWidth + 2 * borderWidth + 2 * outlineWidth}
|
|
30
|
-
strokeOpacity={1}
|
|
31
|
-
strokeColor={strokeColorOuter}
|
|
32
|
-
lineJoin={"round"}
|
|
33
|
-
lineCap={"round"}
|
|
34
|
-
/>
|
|
35
|
-
<AmapPolyline
|
|
36
|
-
path={props.path}
|
|
37
|
-
strokeWeight={strokeWidth + 2 * borderWidth}
|
|
38
|
-
strokeOpacity={1}
|
|
39
|
-
strokeColor={strokeColorBorder}
|
|
40
|
-
lineJoin={"round"}
|
|
41
|
-
lineCap={"round"}
|
|
42
|
-
strokeStyle={"dashed"}
|
|
43
|
-
strokeDasharray={[dashLength, dashLength * 0.5]}
|
|
44
|
-
/>
|
|
45
|
-
<AmapPolyline
|
|
46
|
-
path={props.path}
|
|
47
|
-
strokeWeight={strokeWidth}
|
|
48
|
-
strokeOpacity={1}
|
|
49
|
-
strokeColor={strokeColorInner}
|
|
50
|
-
lineJoin={"round"}
|
|
51
|
-
lineCap={"round"}
|
|
52
|
-
/>
|
|
53
|
-
<AmapPolyline
|
|
54
|
-
showDir
|
|
55
|
-
path={props.path}
|
|
56
|
-
strokeWeight={strokeWidth + 2 * dirWidth}
|
|
57
|
-
strokeOpacity={1}
|
|
58
|
-
strokeColor={"transparent"}
|
|
59
|
-
lineJoin={"round"}
|
|
60
|
-
lineCap={"round"}
|
|
61
|
-
/>
|
|
62
|
-
</div>
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
export const GDrivingLine = defineSetup(function GDrivingLine(props: DrivingLineProps) {
|
|
68
|
-
useMapLog(props, "ADrivingLine");
|
|
69
|
-
const pathRef = computed(() => props.path.map(vec2lnglat));
|
|
70
|
-
return () => {
|
|
71
|
-
const vw = window.innerWidth * 0.01;
|
|
72
|
-
const repeat = 10 * vw;
|
|
73
|
-
const strokeWidth = 2.5 * vw;
|
|
74
|
-
const borderWidth = 0.35 * vw;
|
|
75
|
-
const dirStrokeWeight = 0.75 * vw;
|
|
76
|
-
const outlineWidth = 1 * vw;
|
|
77
|
-
const strokeColorInner = props.done ? "#96B2CA" : "#487BF4";
|
|
78
|
-
const strokeColorOuter = props.done ? "#7693AF" : "#4175F1";
|
|
79
|
-
const strokeColorBorder = props.done ? "#7693AF" : "#6C95F5";
|
|
80
|
-
return (
|
|
81
|
-
<div>
|
|
82
|
-
<GmapPolyline
|
|
83
|
-
path={pathRef.value}
|
|
84
|
-
strokeWeight={strokeWidth + 2 * borderWidth + 2 * outlineWidth}
|
|
85
|
-
strokeOpacity={1}
|
|
86
|
-
strokeColor={strokeColorOuter}
|
|
87
|
-
/>
|
|
88
|
-
<GmapPolyline
|
|
89
|
-
path={pathRef.value}
|
|
90
|
-
icons={[
|
|
91
|
-
{
|
|
92
|
-
icon: {
|
|
93
|
-
path: `M 0,-0.5 0,0.5`,
|
|
94
|
-
strokeWeight: strokeWidth + 2 * borderWidth,
|
|
95
|
-
strokeColor: strokeColorBorder,
|
|
96
|
-
fillColor: strokeColorBorder,
|
|
97
|
-
scale: 1,
|
|
98
|
-
},
|
|
99
|
-
repeat: `${strokeWidth}px`,
|
|
100
|
-
offset: `${strokeWidth / 2}px`,
|
|
101
|
-
},
|
|
102
|
-
]}
|
|
103
|
-
/>
|
|
104
|
-
<GmapPolyline
|
|
105
|
-
path={pathRef.value}
|
|
106
|
-
strokeWeight={strokeWidth}
|
|
107
|
-
strokeOpacity={1}
|
|
108
|
-
strokeColor={strokeColorInner}
|
|
109
|
-
icons={[
|
|
110
|
-
{
|
|
111
|
-
icon: {
|
|
112
|
-
path: google.maps.SymbolPath.FORWARD_OPEN_ARROW,
|
|
113
|
-
strokeColor: "white",
|
|
114
|
-
strokeWeight: dirStrokeWeight,
|
|
115
|
-
// todo: 3 maybe not responsive
|
|
116
|
-
scale: 3,
|
|
117
|
-
},
|
|
118
|
-
repeat: `${repeat}px`,
|
|
119
|
-
},
|
|
120
|
-
]}
|
|
121
|
-
/>
|
|
122
|
-
</div>
|
|
123
|
-
);
|
|
124
|
-
};
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
export const DrivingLine = defineSetup(function DrivingLine(props: DrivingLineProps) {
|
|
128
|
-
const payload = useMapSupplier();
|
|
129
|
-
return () => {
|
|
130
|
-
if (!props.path.length) return null;
|
|
131
|
-
return createElement(payload.supplier === "gmap" ? GDrivingLine : ADrivingLine, {
|
|
132
|
-
attrs: props,
|
|
133
|
-
});
|
|
134
|
-
};
|
|
135
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./DrivingLine";
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { reactive, toRefs, VNodeData } from "vue-demi";
|
|
2
|
-
import {
|
|
3
|
-
useADrivingRoute,
|
|
4
|
-
UseDrivingRouteProps,
|
|
5
|
-
useGDrivingRoute,
|
|
6
|
-
} from "../../hooks/useDrivingRoute";
|
|
7
|
-
import { useAmap, useGmap } from "../../hooks/useMap";
|
|
8
|
-
import { useAmapAngle, useGmapAngle } from "../../hooks/useMapAngle";
|
|
9
|
-
import { MapLogProps, useMapLog } from "../../hooks/useMapLog";
|
|
10
|
-
import { useMapSupplier } from "../../hooks/useMapSupplier";
|
|
11
|
-
import { createElement, defineSetup, VNodeChild } from "../../types/helper";
|
|
12
|
-
import type { Point } from "../../types/interface";
|
|
13
|
-
|
|
14
|
-
export type DrivingRouteRenderProps = {
|
|
15
|
-
path: Point[];
|
|
16
|
-
angle?: number;
|
|
17
|
-
distance: number;
|
|
18
|
-
duration: number;
|
|
19
|
-
};
|
|
20
|
-
export interface DrivingRouteProps extends UseDrivingRouteProps, MapLogProps {
|
|
21
|
-
render?: (props: DrivingRouteRenderProps) => VNodeChild;
|
|
22
|
-
}
|
|
23
|
-
export const ADrivingRoute = defineSetup(function DrivingRoute(
|
|
24
|
-
props: DrivingRouteProps,
|
|
25
|
-
{ slots }
|
|
26
|
-
) {
|
|
27
|
-
useMapLog(props, "ADrivingRoute");
|
|
28
|
-
const map = useAmap();
|
|
29
|
-
const { path, distance, duration } = toRefs(useADrivingRoute(props));
|
|
30
|
-
const angle = useAmapAngle(reactive({ path, map }));
|
|
31
|
-
return () => <div>{slots.render?.(reactive({ path, angle, distance, duration }))}</div>;
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
export const GDrivingRoute = defineSetup(function DrivingRoute(
|
|
35
|
-
props: DrivingRouteProps,
|
|
36
|
-
{ slots }
|
|
37
|
-
) {
|
|
38
|
-
useMapLog(props, "GDrivingRoute");
|
|
39
|
-
const map = useGmap();
|
|
40
|
-
const { path, distance, duration } = toRefs(useGDrivingRoute(props));
|
|
41
|
-
const angle = useGmapAngle(reactive({ path, map }));
|
|
42
|
-
return () => <div>{slots.render?.(reactive({ path, angle, distance, duration }))}</div>;
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
export const DrivingRoute = defineSetup(function DrivingRoute(props: DrivingRouteProps, { slots }) {
|
|
46
|
-
const { supplier } = useMapSupplier();
|
|
47
|
-
return () =>
|
|
48
|
-
createElement(supplier === "gmap" ? GDrivingRoute : ADrivingRoute, {
|
|
49
|
-
attrs: props,
|
|
50
|
-
scopedSlots: slots as VNodeData["scopedSlots"],
|
|
51
|
-
});
|
|
52
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./DrivingRoute";
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { onMapMounted, useMap } from "../../hooks/useMap";
|
|
2
|
-
import { useMapFitView, UseMapFitViewOutput, UseMapFitViewProps } from "../../hooks/useMapFitView";
|
|
3
|
-
import type { AmapOverlay, GmapOverlay, MROP } 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
|
-
});
|
|
15
|
-
|
|
16
|
-
export type FitViewOnceProps = Required<MROP>;
|
|
17
|
-
export const FitViewOnce = defineSetup(function FitViewOnce(props: FitViewOnceProps, { slots }) {
|
|
18
|
-
const { registerOverlay } = props;
|
|
19
|
-
const { setFitView } = registerOverlay;
|
|
20
|
-
onMapMounted(setFitView);
|
|
21
|
-
return () => <div>{slots.default?.()}</div>;
|
|
22
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./FitView";
|