@heycar/heycars-map 0.10.6-googleRoute1 → 0.10.7-externalRoute1

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.
Files changed (38) hide show
  1. package/README.md +48 -7
  2. package/dist/v2/Demo/DemoBusinessTaxiEnd.d.ts +1 -0
  3. package/dist/v2/Demo/DemoBusinessTaxiEnd.js +9 -2
  4. package/dist/v2/Demo/DemoBusinessTaxiService.d.ts +2 -2
  5. package/dist/v2/Demo/DemoBusinessTaxiService.js +14 -34
  6. package/dist/v2/Demo/demo.data.mock.d.ts +3 -0
  7. package/dist/v2/Demo/demo.data.mock.js +986 -0
  8. package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +2 -1
  9. package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +5 -2
  10. package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +2 -1
  11. package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +38 -5
  12. package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.d.ts +6 -1
  13. package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.js +72 -10
  14. package/dist/v2/hooks/useMapAngle.d.ts +13 -5
  15. package/dist/v2/hooks/useMapAngle.js +14 -3
  16. package/dist/v2/types/interface.d.ts +9 -0
  17. package/dist/v2/utils/log.js +1 -1
  18. package/dist/v2/utils/transform.d.ts +14 -1
  19. package/dist/v2/utils/transform.js +33 -1
  20. package/dist/v3/Demo/DemoBusinessTaxiEnd.d.ts +1 -0
  21. package/dist/v3/Demo/DemoBusinessTaxiEnd.js +9 -2
  22. package/dist/v3/Demo/DemoBusinessTaxiService.d.ts +2 -2
  23. package/dist/v3/Demo/DemoBusinessTaxiService.js +14 -34
  24. package/dist/v3/Demo/demo.data.mock.d.ts +3 -0
  25. package/dist/v3/Demo/demo.data.mock.js +986 -0
  26. package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +2 -1
  27. package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +5 -2
  28. package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +2 -1
  29. package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +38 -5
  30. package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.d.ts +6 -1
  31. package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceSection.js +54 -10
  32. package/dist/v3/hooks/useMapAngle.d.ts +13 -5
  33. package/dist/v3/hooks/useMapAngle.js +14 -3
  34. package/dist/v3/types/interface.d.ts +9 -0
  35. package/dist/v3/utils/log.js +1 -1
  36. package/dist/v3/utils/transform.d.ts +14 -1
  37. package/dist/v3/utils/transform.js +33 -1
  38. 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,30 @@ export default defineComponent({
456
475
  renderInServiceTitle={({ distance, duration }) =>
457
476
  `距离终点*${distance}*公里, 预计*${duration}*分钟`
458
477
  }
459
- getDriverPositionTrack={async () => {
460
- // 向后端请求司机的历史轨迹
461
- return Promise.resolve<TrackPoint[]>([
462
- { lng: 121.4036983, lat: 31.216324, angle: 30, timestamp: 1698058438000 },
463
- { lng: 121.4036983, lat: 31.216324, angle: 30, timestamp: 1698058439000 },
464
- { lng: 121.403581, lat: 31.216415, angle: 30, timestamp: 1698058442000 },
465
- ]);
478
+ getDriverRouteOrTrack={async () => {
479
+ // 后端返回司机的真实导航路径或者历史轨迹
480
+ return (
481
+ Promise.resolve <
482
+ GetDriverRouteOrTrackOutput >
483
+ {
484
+ routes: {
485
+ distance: 4270,
486
+ duration: 1310,
487
+ path: [
488
+ [121.401554, 31.21653],
489
+ [121.401554, 31.21653],
490
+ [121.401795, 31.21654],
491
+ ],
492
+ },
493
+ }
494
+ );
495
+ // return Promise.resolve<GetDriverRouteOrTrackOutput>({
496
+ // tracks: [
497
+ // { lng: 121.4036983, lat: 31.216324, angle: 30, timestamp: 1698058438000 },
498
+ // { lng: 121.4036983, lat: 31.216324, angle: 30, timestamp: 1698058439000 },
499
+ // { lng: 121.403581, lat: 31.216415, angle: 30, timestamp: 1698058442000 },
500
+ // ]
501
+ // });
466
502
  }}
467
503
  interval={5000}
468
504
  mapRef={setMap}
@@ -498,6 +534,11 @@ export default defineComponent({
498
534
  lat: 1.2966426,
499
535
  lng: 103.7763939,
500
536
  }}
537
+ path={{[
538
+ [103.996211, 1.35202],
539
+ [103.996469, 1.352348],
540
+ [103.996581, 1.3526],
541
+ ]}}
501
542
  />
502
543
  );
503
544
  },
@@ -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, TrackPoint } from "../types/interface";
2
+ import type { DriverStatus, GetDriverRouteOrTrackOutput, Place } 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<({
@@ -2398,5 +2398,5 @@ export declare const DemoBusinessTaxiService: import("vue-demi").DefineComponent
2398
2398
  status: DriverStatus;
2399
2399
  contentHeight: number;
2400
2400
  }, {}, {
2401
- getDriverPositionTrack(): Promise<TrackPoint[]>;
2401
+ getDriverRouteOrTrack(): Promise<GetDriverRouteOrTrackOutput>;
2402
2402
  }, 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 { 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
- const mockDriverTrackPoints = [
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() {
@@ -82,23 +60,25 @@ const DemoBusinessTaxiService = defineComponent({
82
60
  return status;
83
61
  };
84
62
  window.addDriverPosition = (lng, lat, angle = 0) => {
85
- mockDriverTrackPoints.push({
86
- lng,
87
- lat,
88
- angle,
89
- timestamp: Date.now()
90
- });
63
+ };
64
+ window.updateDriverRoute = () => {
65
+ mockDriverRoute = {
66
+ ...mockDriverRoute,
67
+ path: mockDriverRoute.path.slice(5)
68
+ };
91
69
  };
92
70
  },
93
71
  methods: {
94
- getDriverPositionTrack() {
95
- return Promise.resolve(mockDriverTrackPoints);
72
+ getDriverRouteOrTrack() {
73
+ return Promise.resolve({
74
+ routes: mockDriverRoute
75
+ });
96
76
  }
97
77
  },
98
78
  render() {
99
79
  const {
100
80
  setMap,
101
- getDriverPositionTrack,
81
+ getDriverRouteOrTrack,
102
82
  registerFitVeiw,
103
83
  from,
104
84
  to,
@@ -132,7 +112,7 @@ const DemoBusinessTaxiService = defineComponent({
132
112
  distance,
133
113
  duration
134
114
  }) => `距离终点*${distance / 1e3}*公里, 预计*${duration}*分钟`,
135
- "getDriverPositionTrack": getDriverPositionTrack,
115
+ "getDriverRouteOrTrack": getDriverRouteOrTrack,
136
116
  "interval": 5e3,
137
117
  "mapRef": setMap,
138
118
  "registerOverlay": registerFitVeiw
@@ -0,0 +1,3 @@
1
+ import type { ExternalRoute, Point } from "../types/interface";
2
+ export declare const mockPath: Point[];
3
+ export declare const mockExternalRoute: ExternalRoute;