@heycar/heycars-map 0.2.5 → 0.2.7
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 +12 -0
- package/dist/business-components/BusinessQuotingMap/index.d.ts +1 -0
- package/dist/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +4 -3
- package/dist/business-components/FitView/FitView.d.ts +3 -1
- 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 +3 -1
- package/dist/index.js +1460 -1276
- package/dist/style.css +1 -1
- package/dist/types/interface.d.ts +2 -0
- package/package.json +1 -1
- package/src/App.tsx +4 -3
- 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 +159 -89
- package/src/business-components/FitView/FitView.tsx +10 -2
- package/src/business-components/PassengerCircle/PassengerCircle.tsx +26 -8
- package/src/business-components/TaxiCar/TaxiCar.tsx +18 -6
- package/src/components/Demo/DemoBusinessQuoting.tsx +38 -0
- package/src/components/Demo/DemoBusinessTaxiService.tsx +5 -1
- package/src/hooks/useGeoLocation.ts +3 -3
- package/src/hooks/useMap.ts +15 -1
- package/src/hooks/useMapFitView.ts +18 -16
- 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 +3 -1
- package/src/types/interface.ts +2 -0
- package/dist/hooks-business/useBusinessMapFitView.d.ts +0 -2291
- package/src/hooks-business/useBusinessMapFitView.ts +0 -6
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.rgf09w0{width:7.1045vw;height:10.93vw;display:flex}._15rq2xn0{display:flex;flex-direction:column;align-items:center;margin-bottom:-1.6vw}._15rq2xn1{padding:2.13vw 4.5vw 2.67vw 4.27vw;display:flex;align-items:center;background:linear-gradient(90deg,#79AFFF 0%,#5C8DFF 32%,#507FFF 75%,#4471FF 100%);border-radius:3.2vw}._15rq2xn2{font-size:3.47vw;font-family:PingFangSC-Semibold,PingFang SC;font-weight:600;color:#fff;line-height:4.8vw;white-space:nowrap}._15rq2xn3{font-size:2.93vw;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:#eafaf8;line-height:4.27vw;white-space:nowrap;opacity:.8}._15rq2xn4{margin-left:3.2vw;width:1.44vw;height:2.4vw}._15rq2xn5{width:.8vw;height:4vw;background:#4C80FF;border-radius:0vw 0vw 26.67vw 26.67vw;z-index:1}._15rq2xn6{margin-top:-1.5vw;width:3.2vw;height:3.2vw}.
|
|
1
|
+
.rgf09w0{width:7.1045vw;height:10.93vw;display:flex}._15rq2xn0{display:flex;flex-direction:column;align-items:center;margin-bottom:-1.6vw}._15rq2xn1{padding:2.13vw 4.5vw 2.67vw 4.27vw;display:flex;align-items:center;background:linear-gradient(90deg,#79AFFF 0%,#5C8DFF 32%,#507FFF 75%,#4471FF 100%);border-radius:3.2vw}._15rq2xn2{font-size:3.47vw;font-family:PingFangSC-Semibold,PingFang SC;font-weight:600;color:#fff;line-height:4.8vw;white-space:nowrap}._15rq2xn3{font-size:2.93vw;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:#eafaf8;line-height:4.27vw;white-space:nowrap;opacity:.8}._15rq2xn4{margin-left:3.2vw;width:1.44vw;height:2.4vw}._15rq2xn5{width:.8vw;height:4vw;background:#4C80FF;border-radius:0vw 0vw 26.67vw 26.67vw;z-index:1}._15rq2xn6{margin-top:-1.5vw;width:3.2vw;height:3.2vw}._4a4ovk0{margin-bottom:-.4vw;display:flex;flex-direction:column;align-items:center}._4a4ovk1{padding:1.07vw 2.4vw 1.6vw 2.67vw;background:#FFFFFF;box-shadow:0 .53vw 2.4vw #3f3f3f33;border-radius:2.13vw}._4a4ovk2{padding:2.67vw 2.67vw 2.4vw 3.2vw;background:#FFFFFF;box-shadow:0 0 2.67vw #4e556c26;border-radius:4.8vw;font-size:3.2vw;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:#1e1e1e;line-height:4.53vw;white-space:nowrap}._4a4ovk3{font-size:3.2vw;font-family:PingFangSC-Medium,PingFang SC;font-weight:500;color:#1e1e1e;line-height:4.53vw;white-space:nowrap}._4a4ovk4{font-size:2.4vw;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;color:#7e7e7e;line-height:3.47vw;white-space:nowrap}._4a4ovk5{color:#4471ff;font-family:PingFangSC-Medium,PingFang SC;font-weight:500}._4a4ovk6{margin-top:1.33vw;width:6.192vw;height:7.998vw}._4a4ovk7{margin-top:2.4vw;width:6.192vw;height:7.998vw}._1l6offo0{display:flex}._1l6offo1{width:4.53vw;height:4.53vw;margin-bottom:-2.265vw}._1l6offo2{width:16.27vw;height:16.27vw;margin-bottom:-8.135vw}.fhyw80{display:flex;align-items:center}.fhyw81{flex-direction:row-reverse}.fhyw83{margin-right:-2.265vw}.fhyw84{margin-left:-2.265vw}.fhyw85{margin-bottom:-2.265vw}.fhyw86{margin-right:calc(50% - 2.265vw)}.fhyw87{margin-left:calc(50% - 2.265vw)}.fhyw88{display:flex;width:4.53vw;height:4.53vw}.fhyw89{opacity:0}.fhyw8b{font-size:3.47vw;font-family:PingFangSC-Semibold,PingFang SC;font-weight:600;color:#243e66;line-height:4.53vw;white-space:nowrap}._65j3sr1{margin-top:1.87vw;margin-bottom:-5.5vw;width:6vw;height:11vw}@keyframes rrvp0y0{0%{transform:scale(0);opacity:1}33.33%{transform:scale(.5);opacity:1}66.66%{transform:scale(1);opacity:0}to{transform:scale(1);opacity:0}}@keyframes rrvp0y1{0%{transform:scale(0);opacity:0}33.33%{transform:scale(0);opacity:1}66.66%{transform:scale(.5);opacity:1}to{transform:scale(1);opacity:0}}.rrvp0y2{display:flex;margin-bottom:-30.935vw;width:61.87vw;height:61.87vw;animation-name:rrvp0y0;animation-duration:3s;animation-iteration-count:infinite;animation-timing-function:linear}.rrvp0y3{animation-name:rrvp0y1}
|
|
@@ -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;
|
|
@@ -24,6 +25,7 @@ export type City = {
|
|
|
24
25
|
export interface RegisterOverlay<T> {
|
|
25
26
|
add: (overlay: T) => void;
|
|
26
27
|
remove: (overlay: T) => void;
|
|
28
|
+
setFitView: () => void;
|
|
27
29
|
}
|
|
28
30
|
export interface Route {
|
|
29
31
|
path: Point[];
|
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { defineComponent } from "vue-demi";
|
|
2
|
-
import {
|
|
2
|
+
import { DemoBusinessTaxiService } from "./components/Demo/DemoBusinessTaxiService";
|
|
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
|
-
|
|
10
|
-
return () => <
|
|
9
|
+
return () => <DemoBusinessTaxiService />;
|
|
10
|
+
// return () => <DemoBusinessQuoting />;
|
|
11
|
+
// return () => <HeycarDemo />;
|
|
11
12
|
},
|
|
12
13
|
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { HeycarMap, HeycarMapProps } from "../../components/MapProvider";
|
|
2
|
+
import type { MROP } from "../../hooks/useOverlay";
|
|
3
|
+
import { defineLagecySetup } from "../../types/helper";
|
|
4
|
+
import type { Place } from "../../types/interface";
|
|
5
|
+
import { place2point } from "../../utils/transform";
|
|
6
|
+
import { DrivingLine } from "../DrivingLine";
|
|
7
|
+
import { DrivingRoute } from "../DrivingRoute";
|
|
8
|
+
import { FitViewOnce } from "../FitView";
|
|
9
|
+
import { StartEndPoint } from "../StartEndPoint";
|
|
10
|
+
|
|
11
|
+
export type BusinessQuotingMapProps = Omit<HeycarMapProps, "center" | "zoom"> &
|
|
12
|
+
Required<MROP> & {
|
|
13
|
+
from: Place;
|
|
14
|
+
to: Place;
|
|
15
|
+
renderDescription: (titleProps: { distance: number; duration: number }) => string;
|
|
16
|
+
};
|
|
17
|
+
export const BusinessQuotingMap = defineLagecySetup((props: BusinessQuotingMapProps) => {
|
|
18
|
+
const { registerOverlay, mapRef, renderDescription } = props;
|
|
19
|
+
return () => {
|
|
20
|
+
const { from: fromPlace, to: toPlace } = props;
|
|
21
|
+
const from = place2point(fromPlace);
|
|
22
|
+
const to = place2point(toPlace);
|
|
23
|
+
return (
|
|
24
|
+
<HeycarMap mapRef={mapRef} center={from} zoom={13}>
|
|
25
|
+
<StartEndPoint
|
|
26
|
+
type="start"
|
|
27
|
+
registerOverlay={registerOverlay}
|
|
28
|
+
position={from}
|
|
29
|
+
title={fromPlace.name}
|
|
30
|
+
/>
|
|
31
|
+
<DrivingRoute
|
|
32
|
+
to={to}
|
|
33
|
+
from={from}
|
|
34
|
+
render={({ path, distance, duration }) => [
|
|
35
|
+
<DrivingLine path={path} />,
|
|
36
|
+
<StartEndPoint
|
|
37
|
+
type="end"
|
|
38
|
+
registerOverlay={registerOverlay}
|
|
39
|
+
position={to}
|
|
40
|
+
title={toPlace.name}
|
|
41
|
+
description={renderDescription({ distance, duration })}
|
|
42
|
+
/>,
|
|
43
|
+
]}
|
|
44
|
+
/>
|
|
45
|
+
<FitViewOnce registerOverlay={registerOverlay} />
|
|
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,23 +221,33 @@ 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
|
-
|
|
224
|
+
export type BusinessTaxiServiceMapProps = Omit<HeycarMapProps, "center" | "zoom"> &
|
|
225
|
+
Required<MROP> & {
|
|
226
|
+
from: Place;
|
|
227
|
+
to: Place;
|
|
228
|
+
// @example 正在为您搜索附近司机
|
|
229
|
+
dispatchingTitle: string;
|
|
230
|
+
bookDispatchingTitle: string;
|
|
231
|
+
bookDispatchedTitle: string;
|
|
232
|
+
driverArrivedTitle: string;
|
|
233
|
+
driverStatus: DriverStatus;
|
|
234
|
+
interval: number;
|
|
235
|
+
renderStartSerivceTitle: (titleProps: { distance: number; duration: number }) => string;
|
|
236
|
+
renderInServiceTitle: (titleProps: { distance: number; duration: number }) => string;
|
|
237
|
+
getDriverPosition: () => Promise<Point>;
|
|
238
|
+
};
|
|
204
239
|
export const BusinessTaxiServiceMap = defineLagecySetup((props: BusinessTaxiServiceMapProps) => {
|
|
205
|
-
const {
|
|
206
|
-
|
|
240
|
+
const {
|
|
241
|
+
from,
|
|
242
|
+
interval,
|
|
243
|
+
registerOverlay,
|
|
244
|
+
mapRef,
|
|
245
|
+
getDriverPosition,
|
|
246
|
+
renderStartSerivceTitle,
|
|
247
|
+
renderInServiceTitle,
|
|
248
|
+
} = props;
|
|
249
|
+
const { setFitView } = registerOverlay;
|
|
250
|
+
const { geoPosition } = useGeoLocation({ geoDefaultPosition: place2point(from) });
|
|
207
251
|
const carPositionRef = ref<Point>(place2point(props.from));
|
|
208
252
|
watch(
|
|
209
253
|
() => props.driverStatus,
|
|
@@ -225,16 +269,24 @@ export const BusinessTaxiServiceMap = defineLagecySetup((props: BusinessTaxiServ
|
|
|
225
269
|
bookDispatchingTitle,
|
|
226
270
|
bookDispatchedTitle,
|
|
227
271
|
driverArrivedTitle,
|
|
228
|
-
renderStartSerivceTitle,
|
|
229
|
-
renderInServiceTitle,
|
|
230
272
|
} = props;
|
|
231
273
|
const carPosition = carPositionRef.value;
|
|
232
274
|
return (
|
|
233
|
-
<HeycarMap center={place2point(from)} zoom={13}>
|
|
275
|
+
<HeycarMap center={place2point(from)} zoom={13} mapRef={mapRef}>
|
|
234
276
|
{driverStatus === "dispatching" ? (
|
|
235
|
-
<SectionDispatching
|
|
277
|
+
<SectionDispatching
|
|
278
|
+
from={from}
|
|
279
|
+
title={dispatchingTitle}
|
|
280
|
+
registerOverlay={registerOverlay}
|
|
281
|
+
onMapMounted={setFitView}
|
|
282
|
+
/>
|
|
236
283
|
) : driverStatus === "book-dispatching" ? (
|
|
237
|
-
<SectionDispatching
|
|
284
|
+
<SectionDispatching
|
|
285
|
+
from={from}
|
|
286
|
+
title={bookDispatchingTitle}
|
|
287
|
+
registerOverlay={registerOverlay}
|
|
288
|
+
onMapMounted={setFitView}
|
|
289
|
+
/>
|
|
238
290
|
) : driverStatus === "dispatched" ||
|
|
239
291
|
driverStatus === "driverStartService" ||
|
|
240
292
|
driverStatus === "book-driverStartService" ? (
|
|
@@ -243,26 +295,43 @@ export const BusinessTaxiServiceMap = defineLagecySetup((props: BusinessTaxiServ
|
|
|
243
295
|
carPosition={carPosition}
|
|
244
296
|
passengerPosition={geoPosition.value}
|
|
245
297
|
renderTitle={renderStartSerivceTitle}
|
|
298
|
+
registerOverlay={registerOverlay}
|
|
299
|
+
onMapMounted={setFitView}
|
|
246
300
|
/>
|
|
247
301
|
) : driverStatus === "book-dispatched" ? (
|
|
248
302
|
<SectionBookDispatched
|
|
249
303
|
from={from}
|
|
250
304
|
passengerPosition={geoPosition.value}
|
|
251
305
|
title={bookDispatchedTitle}
|
|
306
|
+
registerOverlay={registerOverlay}
|
|
307
|
+
onMapMounted={setFitView}
|
|
252
308
|
/>
|
|
253
309
|
) : driverStatus === "inService" ? (
|
|
254
|
-
<SectionInService
|
|
310
|
+
<SectionInService
|
|
311
|
+
to={to}
|
|
312
|
+
carPosition={carPosition}
|
|
313
|
+
renderTitle={renderInServiceTitle}
|
|
314
|
+
registerOverlay={registerOverlay}
|
|
315
|
+
onMapMounted={setFitView}
|
|
316
|
+
/>
|
|
255
317
|
) : driverStatus === "driverArrived" ? (
|
|
256
318
|
<SectionDriverArrived
|
|
257
319
|
from={from}
|
|
258
320
|
carPosition={carPosition}
|
|
259
321
|
passengerPosition={geoPosition.value}
|
|
260
322
|
title={driverArrivedTitle}
|
|
323
|
+
registerOverlay={registerOverlay}
|
|
324
|
+
onMapMounted={setFitView}
|
|
261
325
|
/>
|
|
262
326
|
) : driverStatus === "canceled" ? (
|
|
263
|
-
<SectionCanceled from={from} to={to} />
|
|
327
|
+
<SectionCanceled from={from} to={to} registerOverlay={registerOverlay} />
|
|
264
328
|
) : driverStatus === "endService" ? (
|
|
265
|
-
<SectionEndService
|
|
329
|
+
<SectionEndService
|
|
330
|
+
from={from}
|
|
331
|
+
to={to}
|
|
332
|
+
registerOverlay={registerOverlay}
|
|
333
|
+
onMapMounted={setFitView}
|
|
334
|
+
/>
|
|
266
335
|
) : null}
|
|
267
336
|
</HeycarMap>
|
|
268
337
|
);
|
|
@@ -282,4 +351,5 @@ export const BusinessTaxiServiceMap = defineLagecySetup((props: BusinessTaxiServ
|
|
|
282
351
|
"renderInServiceTitle",
|
|
283
352
|
"renderStartSerivceTitle",
|
|
284
353
|
"to",
|
|
354
|
+
"registerOverlay",
|
|
285
355
|
]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useMap } from "../../hooks/useMap";
|
|
1
|
+
import { onMapMounted, useMap } from "../../hooks/useMap";
|
|
2
2
|
import { useMapFitView, UseMapFitViewOutput, UseMapFitViewProps } from "../../hooks/useMapFitView";
|
|
3
|
-
import type { AmapOverlay, GmapOverlay } from "../../hooks/useOverlay";
|
|
3
|
+
import type { AmapOverlay, GmapOverlay, MROP } from "../../hooks/useOverlay";
|
|
4
4
|
import { defineSetup, VNodeChild } from "../../types/helper";
|
|
5
5
|
|
|
6
6
|
type FitViewRenderProps = UseMapFitViewOutput<AmapOverlay> | UseMapFitViewOutput<GmapOverlay>;
|
|
@@ -12,3 +12,11 @@ export const FitView = defineSetup(function FitView(props: FitViewProps, { slots
|
|
|
12
12
|
const ctx = useMapFitView({ ...props, mapRef });
|
|
13
13
|
return () => <div>{slots.render?.(ctx)}</div>;
|
|
14
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
|
+
});
|
|
@@ -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, {
|
|
@@ -3,17 +3,18 @@ import imgTaxicar from "../../assets/icons/svg/taxi-car.svg";
|
|
|
3
3
|
import { AmapMarker } from "../../components/AmapMarker";
|
|
4
4
|
import { GmapAdvancedMarkerView } from "../../components/GmapAdvancedMarkerView/GmapAdvancedMarkerView";
|
|
5
5
|
import { useMapSupplier } from "../../hooks/useMapSupplier";
|
|
6
|
+
import type { AmapOverlay, GmapOverlay, MapRegisterOverlayProps } from "../../hooks/useOverlay";
|
|
6
7
|
import { createElement, defineSetup } from "../../types/helper";
|
|
7
8
|
import { createDom } from "../../utils/dom";
|
|
8
9
|
import { decodeAsterisk, vec2lnglat } from "../../utils/transform";
|
|
9
10
|
import * as css from "./TaxiCar.css";
|
|
10
11
|
|
|
11
|
-
export interface TaxiCarProps {
|
|
12
|
+
export interface TaxiCarProps<T> extends MapRegisterOverlayProps<T> {
|
|
12
13
|
position: [number, number];
|
|
13
14
|
angle?: number;
|
|
14
15
|
title?: string;
|
|
15
16
|
}
|
|
16
|
-
export const ATaxiCar = defineSetup(function ATaxiCar(props: TaxiCarProps) {
|
|
17
|
+
export const ATaxiCar = defineSetup(function ATaxiCar(props: TaxiCarProps<AmapOverlay>) {
|
|
17
18
|
const contentRef = computed(() => {
|
|
18
19
|
const titleRow = !props.title
|
|
19
20
|
? ""
|
|
@@ -34,11 +35,16 @@ export const ATaxiCar = defineSetup(function ATaxiCar(props: TaxiCarProps) {
|
|
|
34
35
|
`;
|
|
35
36
|
});
|
|
36
37
|
return () => (
|
|
37
|
-
<AmapMarker
|
|
38
|
+
<AmapMarker
|
|
39
|
+
position={props.position}
|
|
40
|
+
content={contentRef.value}
|
|
41
|
+
anchor={"bottom-center"}
|
|
42
|
+
registerOverlay={props.registerOverlay}
|
|
43
|
+
/>
|
|
38
44
|
);
|
|
39
45
|
});
|
|
40
46
|
|
|
41
|
-
export const GTaxiCar = defineSetup(function GTaxiCar(props: TaxiCarProps) {
|
|
47
|
+
export const GTaxiCar = defineSetup(function GTaxiCar(props: TaxiCarProps<GmapOverlay>) {
|
|
42
48
|
const contentRef = computed(() => {
|
|
43
49
|
const titleRow = !props.title
|
|
44
50
|
? ""
|
|
@@ -63,12 +69,18 @@ export const GTaxiCar = defineSetup(function GTaxiCar(props: TaxiCarProps) {
|
|
|
63
69
|
});
|
|
64
70
|
return () => {
|
|
65
71
|
return (
|
|
66
|
-
<GmapAdvancedMarkerView
|
|
72
|
+
<GmapAdvancedMarkerView
|
|
73
|
+
position={vec2lnglat(props.position)}
|
|
74
|
+
content={contentRef.value}
|
|
75
|
+
registerOverlay={props.registerOverlay}
|
|
76
|
+
/>
|
|
67
77
|
);
|
|
68
78
|
};
|
|
69
79
|
});
|
|
70
80
|
|
|
71
|
-
export const TaxiCar = defineSetup(function TaxiCar(
|
|
81
|
+
export const TaxiCar = defineSetup(function TaxiCar(
|
|
82
|
+
props: TaxiCarProps<AmapOverlay> | TaxiCarProps<GmapOverlay>
|
|
83
|
+
) {
|
|
72
84
|
const payload = useMapSupplier();
|
|
73
85
|
return () => {
|
|
74
86
|
return createElement(payload.supplier === "gmap" ? GTaxiCar : ATaxiCar, {
|