@heycar/heycars-map 0.10.6-googleRoute1 → 0.10.7-externalRoute2
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 +61 -7
- package/dist/v2/Demo/DemoBusinessTaxiEnd.d.ts +1 -0
- package/dist/v2/Demo/DemoBusinessTaxiEnd.js +9 -2
- package/dist/v2/Demo/DemoBusinessTaxiService.d.ts +3 -2
- package/dist/v2/Demo/DemoBusinessTaxiService.js +18 -34
- package/dist/v2/Demo/demo.data.mock.d.ts +4 -0
- package/dist/v2/Demo/demo.data.mock.js +1194 -0
- package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +2 -1
- package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +5 -2
- package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +4 -1
- package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +43 -6
- package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.d.ts +6 -1
- package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.js +72 -10
- package/dist/v2/hooks/useMapAngle.d.ts +13 -5
- package/dist/v2/hooks/useMapAngle.js +14 -3
- package/dist/v2/types/interface.d.ts +9 -0
- package/dist/v2/utils/log.js +1 -1
- package/dist/v2/utils/transform.d.ts +14 -1
- package/dist/v2/utils/transform.js +33 -1
- package/dist/v3/Demo/DemoBusinessTaxiEnd.d.ts +1 -0
- package/dist/v3/Demo/DemoBusinessTaxiEnd.js +9 -2
- package/dist/v3/Demo/DemoBusinessTaxiService.d.ts +3 -2
- package/dist/v3/Demo/DemoBusinessTaxiService.js +18 -34
- package/dist/v3/Demo/demo.data.mock.d.ts +4 -0
- package/dist/v3/Demo/demo.data.mock.js +1194 -0
- package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +2 -1
- package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +5 -2
- package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +4 -1
- package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +43 -6
- package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.d.ts +6 -1
- package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.js +54 -10
- package/dist/v3/hooks/useMapAngle.d.ts +13 -5
- package/dist/v3/hooks/useMapAngle.js +14 -3
- package/dist/v3/types/interface.d.ts +9 -0
- package/dist/v3/utils/log.js +1 -1
- package/dist/v3/utils/transform.d.ts +14 -1
- package/dist/v3/utils/transform.js +33 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,6 +66,25 @@ export enum CenterPlaceStatus {
|
|
|
66
66
|
SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
|
|
67
67
|
OK = "OK",
|
|
68
68
|
}
|
|
69
|
+
|
|
70
|
+
export type ExternalRoute = {
|
|
71
|
+
path: Point[];
|
|
72
|
+
duration: number;
|
|
73
|
+
distance: number;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export interface TrackPoint {
|
|
77
|
+
lng: number;
|
|
78
|
+
lat: number;
|
|
79
|
+
angle?: number;
|
|
80
|
+
speed?: number;
|
|
81
|
+
timestamp: number;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export type GetDriverRouteOrTrackOutput = {
|
|
85
|
+
routes?: ExternalRoute;
|
|
86
|
+
tracks?: TrackPoint[];
|
|
87
|
+
};
|
|
69
88
|
```
|
|
70
89
|
|
|
71
90
|
#### 在 入口文件添加 `MapProvider`
|
|
@@ -456,13 +475,43 @@ export default defineComponent({
|
|
|
456
475
|
renderInServiceTitle={({ distance, duration }) =>
|
|
457
476
|
`距离终点*${distance}*公里, 预计*${duration}*分钟`
|
|
458
477
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
478
|
+
// 司机接单时,第三方指定的起点到终点的路径
|
|
479
|
+
// confirmedPath={[
|
|
480
|
+
// [121.401554, 31.21653],
|
|
481
|
+
// [121.401554, 31.21653],
|
|
482
|
+
// [121.401795, 31.21654],
|
|
483
|
+
// ]}
|
|
484
|
+
|
|
485
|
+
// 订单结束时,第三方提供的实际行驶路径
|
|
486
|
+
// endServicePath={[
|
|
487
|
+
// [121.401554, 31.21653],
|
|
488
|
+
// [121.401554, 31.21653],
|
|
489
|
+
// [121.401795, 31.21654],
|
|
490
|
+
// ]}
|
|
491
|
+
getDriverRouteOrTrack={async () => {
|
|
492
|
+
// 后端返回司机的真实导航路径或者历史轨迹
|
|
493
|
+
return (
|
|
494
|
+
Promise.resolve <
|
|
495
|
+
GetDriverRouteOrTrackOutput >
|
|
496
|
+
{
|
|
497
|
+
routes: {
|
|
498
|
+
distance: 4270,
|
|
499
|
+
duration: 1310,
|
|
500
|
+
path: [
|
|
501
|
+
[121.401554, 31.21653],
|
|
502
|
+
[121.401554, 31.21653],
|
|
503
|
+
[121.401795, 31.21654],
|
|
504
|
+
],
|
|
505
|
+
},
|
|
506
|
+
}
|
|
507
|
+
);
|
|
508
|
+
// return Promise.resolve<GetDriverRouteOrTrackOutput>({
|
|
509
|
+
// tracks: [
|
|
510
|
+
// { lng: 121.4036983, lat: 31.216324, angle: 30, timestamp: 1698058438000 },
|
|
511
|
+
// { lng: 121.4036983, lat: 31.216324, angle: 30, timestamp: 1698058439000 },
|
|
512
|
+
// { lng: 121.403581, lat: 31.216415, angle: 30, timestamp: 1698058442000 },
|
|
513
|
+
// ]
|
|
514
|
+
// });
|
|
466
515
|
}}
|
|
467
516
|
interval={5000}
|
|
468
517
|
mapRef={setMap}
|
|
@@ -498,6 +547,11 @@ export default defineComponent({
|
|
|
498
547
|
lat: 1.2966426,
|
|
499
548
|
lng: 103.7763939,
|
|
500
549
|
}}
|
|
550
|
+
path={{[
|
|
551
|
+
[103.996211, 1.35202],
|
|
552
|
+
[103.996469, 1.352348],
|
|
553
|
+
[103.996581, 1.3526],
|
|
554
|
+
]}}
|
|
501
555
|
/>
|
|
502
556
|
);
|
|
503
557
|
},
|
|
@@ -11,5 +11,6 @@ export declare const DemoBusinessTaxiEnd: import("vue-demi").DefineComponent<{},
|
|
|
11
11
|
name: string;
|
|
12
12
|
displayName: string;
|
|
13
13
|
};
|
|
14
|
+
path: import("..").Point[];
|
|
14
15
|
contentHeight: number;
|
|
15
16
|
}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue-demi").ExtractPropTypes<{}>>, {}>;
|
|
@@ -2,6 +2,7 @@ import { h } from "vue";
|
|
|
2
2
|
import { defineComponent } from "vue-demi";
|
|
3
3
|
import { BusinessTaxiEndMap } from "../business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js";
|
|
4
4
|
import { l as layout, a as adjustedDemo } from "../chunks/Demo.css.e921a2f6.js";
|
|
5
|
+
import { mockPath } from "./demo.data.mock.js";
|
|
5
6
|
const DemoBusinessTaxiEnd = defineComponent({
|
|
6
7
|
name: "DemoBusinessTaxiEnd",
|
|
7
8
|
data() {
|
|
@@ -18,10 +19,14 @@ const DemoBusinessTaxiEnd = defineComponent({
|
|
|
18
19
|
name: "",
|
|
19
20
|
displayName: ""
|
|
20
21
|
},
|
|
22
|
+
path: [...mockPath],
|
|
21
23
|
contentHeight: 200
|
|
22
24
|
};
|
|
23
25
|
},
|
|
24
26
|
created() {
|
|
27
|
+
window.updatePath = () => {
|
|
28
|
+
this.path = mockPath.slice(100);
|
|
29
|
+
};
|
|
25
30
|
setTimeout(() => {
|
|
26
31
|
this.from = {
|
|
27
32
|
displayName: "樟宜机场",
|
|
@@ -44,7 +49,8 @@ const DemoBusinessTaxiEnd = defineComponent({
|
|
|
44
49
|
const {
|
|
45
50
|
from,
|
|
46
51
|
to,
|
|
47
|
-
contentHeight
|
|
52
|
+
contentHeight,
|
|
53
|
+
path
|
|
48
54
|
} = this;
|
|
49
55
|
return h("div", {
|
|
50
56
|
"class": layout
|
|
@@ -52,7 +58,8 @@ const DemoBusinessTaxiEnd = defineComponent({
|
|
|
52
58
|
"class": adjustedDemo,
|
|
53
59
|
"attrs": {
|
|
54
60
|
"from": from,
|
|
55
|
-
"to": to
|
|
61
|
+
"to": to,
|
|
62
|
+
"path": path
|
|
56
63
|
}
|
|
57
64
|
}), h("div", {
|
|
58
65
|
"style": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="google.maps" />
|
|
2
|
-
import type { DriverStatus, Place,
|
|
2
|
+
import type { DriverStatus, GetDriverRouteOrTrackOutput, Place, Point } from "../types/interface";
|
|
3
3
|
export declare const DemoBusinessTaxiService: import("vue-demi").DefineComponent<Readonly<{}>, {
|
|
4
4
|
setMap: import("../hooks/useHeycarMap").SetMap<import("../components/Amap/SafeAmap").SafeAmap> | import("../hooks/useHeycarMap").SetMap<google.maps.Map>;
|
|
5
5
|
registerFitVeiw: import("../types/interface").RegisterOverlay<({
|
|
@@ -2396,7 +2396,8 @@ export declare const DemoBusinessTaxiService: import("vue-demi").DefineComponent
|
|
|
2396
2396
|
to: Partial<Place>;
|
|
2397
2397
|
relayTo: Partial<Place>;
|
|
2398
2398
|
status: DriverStatus;
|
|
2399
|
+
confirmedPath: Point[];
|
|
2399
2400
|
contentHeight: number;
|
|
2400
2401
|
}, {}, {
|
|
2401
|
-
|
|
2402
|
+
getDriverRouteOrTrack(): Promise<GetDriverRouteOrTrackOutput>;
|
|
2402
2403
|
}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue-demi").ExtractPropTypes<Readonly<{}>>>, {}>;
|
|
@@ -4,31 +4,9 @@ import { BusinessTaxiServiceMap } from "../business-components/BusinessTaxiServi
|
|
|
4
4
|
import { useBusinessTaxiServiceMap } from "../hooks-business/useBusinessTaxiServiceMap.js";
|
|
5
5
|
import { isPlace } from "../utils/helper.js";
|
|
6
6
|
import { l as layout, a as adjustedDemo } from "../chunks/Demo.css.e921a2f6.js";
|
|
7
|
+
import { mockConfirmedPath, mockExternalRoute } from "./demo.data.mock.js";
|
|
7
8
|
const allDriverStatus = ["dispatching", "book-dispatching", "dispatched", "driverStartRelayService", "driverStartService", "book-driverStartService", "book-dispatched", "driverArrived", "inService", "canceled", "endService", "completed", "canceling", "banlanceRefund", "waitBanlanceRefund", "rechargePayed", "waitRechargePay", "payed", "waitpay", "refund", "confirmed", "assign"];
|
|
8
|
-
|
|
9
|
-
{
|
|
10
|
-
lng: 121.4036983,
|
|
11
|
-
lat: 31.216324,
|
|
12
|
-
angle: 30,
|
|
13
|
-
timestamp: 1698058438e3
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
lng: 121.4036983,
|
|
17
|
-
lat: 31.216324,
|
|
18
|
-
angle: 30,
|
|
19
|
-
timestamp: 1698058439e3
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
lng: 121.403581,
|
|
23
|
-
lat: 31.216415,
|
|
24
|
-
angle: 30,
|
|
25
|
-
timestamp: 1698058442e3
|
|
26
|
-
}
|
|
27
|
-
// 台湾
|
|
28
|
-
// { lng: 121.565839, lat: 25.040161, angle: 30, timestamp: 1698058438000 },
|
|
29
|
-
// { lng: 121.565839, lat: 25.040661, angle: 30, timestamp: 1698058439000 },
|
|
30
|
-
// { lng: 121.565839, lat: 25.041161, angle: 30, timestamp: 1698058442000 },
|
|
31
|
-
];
|
|
9
|
+
let mockDriverRoute = mockExternalRoute;
|
|
32
10
|
const DemoBusinessTaxiService = defineComponent({
|
|
33
11
|
name: "DemoBusinessTaxiService",
|
|
34
12
|
setup() {
|
|
@@ -47,6 +25,7 @@ const DemoBusinessTaxiService = defineComponent({
|
|
|
47
25
|
to: {},
|
|
48
26
|
relayTo: {},
|
|
49
27
|
status: "driverStartRelayService",
|
|
28
|
+
confirmedPath: [],
|
|
50
29
|
contentHeight: 200
|
|
51
30
|
};
|
|
52
31
|
},
|
|
@@ -82,23 +61,28 @@ const DemoBusinessTaxiService = defineComponent({
|
|
|
82
61
|
return status;
|
|
83
62
|
};
|
|
84
63
|
window.addDriverPosition = (lng, lat, angle = 0) => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
64
|
+
};
|
|
65
|
+
window.updateDriverRoute = () => {
|
|
66
|
+
mockDriverRoute = {
|
|
67
|
+
...mockDriverRoute,
|
|
68
|
+
path: mockDriverRoute.path.slice(5)
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
window.updateConfirmedPath = () => {
|
|
72
|
+
this.confirmedPath = mockConfirmedPath;
|
|
91
73
|
};
|
|
92
74
|
},
|
|
93
75
|
methods: {
|
|
94
|
-
|
|
95
|
-
return Promise.resolve(
|
|
76
|
+
getDriverRouteOrTrack() {
|
|
77
|
+
return Promise.resolve({
|
|
78
|
+
routes: mockDriverRoute
|
|
79
|
+
});
|
|
96
80
|
}
|
|
97
81
|
},
|
|
98
82
|
render() {
|
|
99
83
|
const {
|
|
100
84
|
setMap,
|
|
101
|
-
|
|
85
|
+
getDriverRouteOrTrack,
|
|
102
86
|
registerFitVeiw,
|
|
103
87
|
from,
|
|
104
88
|
to,
|
|
@@ -132,7 +116,7 @@ const DemoBusinessTaxiService = defineComponent({
|
|
|
132
116
|
distance,
|
|
133
117
|
duration
|
|
134
118
|
}) => `距离终点*${distance / 1e3}*公里, 预计*${duration}*分钟`,
|
|
135
|
-
"
|
|
119
|
+
"getDriverRouteOrTrack": getDriverRouteOrTrack,
|
|
136
120
|
"interval": 5e3,
|
|
137
121
|
"mapRef": setMap,
|
|
138
122
|
"registerOverlay": registerFitVeiw
|