@heycar/heycars-map 0.7.8 → 0.7.11
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 +306 -60
- package/dist/index.cjs +521 -113
- package/dist/index.js +523 -115
- package/dist/{Demo → src/Demo}/DemoBusinessTaxiService.d.ts +1 -1
- package/dist/{api → src/api}/contants.d.ts +2 -0
- package/dist/src/business-components/GreenZone/GreenZone.d.ts +8 -0
- package/dist/src/business-components/GreenZone/index.d.ts +1 -0
- package/dist/{business-components → src/business-components}/PassengerCircle/PassengerCircle.d.ts +8 -8
- package/dist/{business-components → src/business-components}/PlaceCircle/PlaceCircle.css.d.ts +2 -0
- package/dist/{business-components → src/business-components}/StartEndPoint/StartEndPoint.d.ts +8 -8
- package/dist/{business-components → src/business-components}/TaxiCar/TaxiCar.d.ts +8 -8
- package/dist/src/components/AmapPolygon/AmapPolygon.d.ts +7 -0
- package/dist/{hooks → src/hooks}/useMapFitView.d.ts +1 -1
- package/dist/{hooks → src/hooks}/useMapRecomendPlace.d.ts +18 -9
- package/dist/{hooks-business → src/hooks-business}/useBusinessQuotingMap.d.ts +1 -1
- package/dist/{hooks-business → src/hooks-business}/useBusinessRecomendPlaceMap.d.ts +7 -1
- package/dist/{hooks-business → src/hooks-business}/useBusinessTaxiServiceMap.d.ts +1 -1
- package/dist/{index.d.ts → src/index.d.ts} +1 -0
- package/dist/{types → src/types}/interface.d.ts +9 -0
- package/dist/src/types/mapHelper.d.ts +10 -0
- package/dist/{types → src/types}/wx.d.ts +9 -0
- package/dist/{utils → src/utils}/log.d.ts +1 -0
- package/dist/src/utils/patchMiniprogram.d.ts +4 -0
- package/dist/style.css +9 -0
- package/package.json +1 -1
- package/todo.md +1 -0
- package/dist/components/AmapPolygon/AmapPolygon.d.ts +0 -2
- package/dist/types/mapHelper.d.ts +0 -3
- /package/dist/{App.d.ts → src/App.d.ts} +0 -0
- /package/dist/{Demo → src/Demo}/Demo.css.d.ts +0 -0
- /package/dist/{Demo → src/Demo}/Demo.d.ts +0 -0
- /package/dist/{Demo → src/Demo}/DemoBusinessQuoting.d.ts +0 -0
- /package/dist/{Demo → src/Demo}/DemoBusinessRecomendPlace.d.ts +0 -0
- /package/dist/{Demo → src/Demo}/DemoBusinessTaxiEnd.d.ts +0 -0
- /package/dist/{api → src/api}/driving.d.ts +0 -0
- /package/dist/{api → src/api}/geocoder.d.ts +0 -0
- /package/dist/{api → src/api}/geometry.d.ts +0 -0
- /package/dist/{api → src/api}/place.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/AbsoluteAddressBox/AbsoluteAddressBox.css.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/AbsoluteAddressBox/AbsoluteAddressBox.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/AbsoluteAddressBox/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/AddressBox/AddressBox.css.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/AddressBox/AddressBox.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/AddressBox/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/AddressLocator/AddressLocator.css.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/AddressLocator/AddressLocator.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/AddressLocator/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/BusinessQuotingMap/BusinessQuotingMap.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/BusinessQuotingMap/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/BusinessRecomendPlaceMap/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/BusinessRecomendPlaceMap/useFirstWorkflowRecomendLoading.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/BusinessTaxiEndMap/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/BusinessTaxiServiceMap/BusinessTaxiServiceSection.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/BusinessTaxiServiceMap/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/DrivingLine/DrivingLine.css.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/DrivingLine/DrivingLine.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/DrivingLine/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/DrivingRoute/DrivingRoute.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/DrivingRoute/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/FitView/FitView.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/FitView/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/PassengerCircle/PassengerCircle.css.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/PassengerCircle/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/PickupPoints/PickupPoints.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/PickupPoints/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/PlaceCircle/PlaceCircle.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/PlaceCircle/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/StartEndPoint/StartEndPoint.css.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/StartEndPoint/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/TaxiCar/TaxiCar.css.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/TaxiCar/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/WalkingLine/WalkingLine.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/WalkingLine/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/WalkingRoute/WalkingRoute.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/WalkingRoute/index.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/WaveCircle/WaveCircle.css.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/WaveCircle/WaveCircle.d.ts +0 -0
- /package/dist/{business-components → src/business-components}/WaveCircle/index.d.ts +0 -0
- /package/dist/{components → src/components}/Amap/Amap.css.d.ts +0 -0
- /package/dist/{components → src/components}/Amap/Amap.d.ts +0 -0
- /package/dist/{components → src/components}/Amap/index.d.ts +0 -0
- /package/dist/{components → src/components}/AmapInfoWindow/AmapInfoWindow.d.ts +0 -0
- /package/dist/{components → src/components}/AmapInfoWindow/index.d.ts +0 -0
- /package/dist/{components → src/components}/AmapLoader/AmapLoader.d.ts +0 -0
- /package/dist/{components → src/components}/AmapLoader/index.d.ts +0 -0
- /package/dist/{components → src/components}/AmapMarker/AmapMarker.d.ts +0 -0
- /package/dist/{components → src/components}/AmapMarker/index.d.ts +0 -0
- /package/dist/{components → src/components}/AmapPolygon/index.d.ts +0 -0
- /package/dist/{components → src/components}/AmapPolyline/AmapPolyline.d.ts +0 -0
- /package/dist/{components → src/components}/AmapPolyline/index.d.ts +0 -0
- /package/dist/{components → src/components}/AmapText/AmapText.d.ts +0 -0
- /package/dist/{components → src/components}/AmapText/index.d.ts +0 -0
- /package/dist/{components → src/components}/Gmap/Gmap.css.d.ts +0 -0
- /package/dist/{components → src/components}/Gmap/Gmap.d.ts +0 -0
- /package/dist/{components → src/components}/Gmap/index.d.ts +0 -0
- /package/dist/{components → src/components}/GmapAdvancedMarkerView/GmapAdvancedMarkerView.d.ts +0 -0
- /package/dist/{components → src/components}/GmapAdvancedMarkerView/index.d.ts +0 -0
- /package/dist/{components → src/components}/GmapInfoWindow/GmapInfoWindow.d.ts +0 -0
- /package/dist/{components → src/components}/GmapInfoWindow/index.d.ts +0 -0
- /package/dist/{components → src/components}/GmapLoader/GmapLoader.d.ts +0 -0
- /package/dist/{components → src/components}/GmapLoader/index.d.ts +0 -0
- /package/dist/{components → src/components}/GmapMarker/GmapMarker.d.ts +0 -0
- /package/dist/{components → src/components}/GmapMarker/index.d.ts +0 -0
- /package/dist/{components → src/components}/GmapPolygon/GmapPolygon.d.ts +0 -0
- /package/dist/{components → src/components}/GmapPolygon/index.d.ts +0 -0
- /package/dist/{components → src/components}/GmapPolyline/GmapPolyline.d.ts +0 -0
- /package/dist/{components → src/components}/GmapPolyline/index.d.ts +0 -0
- /package/dist/{components → src/components}/Loading/Loading.css.d.ts +0 -0
- /package/dist/{components → src/components}/Loading/Loading.d.ts +0 -0
- /package/dist/{components → src/components}/Loading/index.d.ts +0 -0
- /package/dist/{components → src/components}/MapProvider/MapProvider.d.ts +0 -0
- /package/dist/{components → src/components}/MapProvider/index.d.ts +0 -0
- /package/dist/{components → src/components}/MapZoom/MapZoom.d.ts +0 -0
- /package/dist/{components → src/components}/MapZoom/index.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useDeviceOrientation.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useDrivingRoute.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useDrivingTrackCorrection.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useGeoLocation.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useHeycarMap.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMap.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMapAngle.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMapDrag.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMapEventSource.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMapGCJ02.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMapGeometry.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMapGestureZoomCenter.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMapInChina.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMapLngLatToVw.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMapLoader.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMapPlace.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMapSupplier.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMapTouchStartCenter.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMapWheelZoomCenter.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMapZoom.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useOverlay.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/usePlacesLabelDirection.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useResizeObserver.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useUdate.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useVisibilityState.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useWaitTimer.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useWalkingRoute.d.ts +0 -0
- /package/dist/{hooks-business → src/hooks-business}/useBusinessAlarm.d.ts +0 -0
- /package/dist/{main.d.ts → src/main.d.ts} +0 -0
- /package/dist/{types → src/types}/amap/marker.d.ts +0 -0
- /package/dist/{types → src/types}/helper.d.ts +0 -0
- /package/dist/{utils → src/utils}/SingleGeoWatch.d.ts +0 -0
- /package/dist/{utils → src/utils}/compare.d.ts +0 -0
- /package/dist/{utils → src/utils}/compatibleWatchPosition.d.ts +0 -0
- /package/dist/{utils → src/utils}/dom.d.ts +0 -0
- /package/dist/{utils → src/utils}/easeAnimate.d.ts +0 -0
- /package/dist/{utils → src/utils}/helper.d.ts +0 -0
- /package/dist/{utils → src/utils}/platform.d.ts +0 -0
- /package/dist/{utils → src/utils}/transform.d.ts +0 -0
- /package/dist/{utils → src/utils}/waitQueue.d.ts +0 -0
package/README.md
CHANGED
|
@@ -16,8 +16,38 @@ npm install @heycar/heycars-map --save
|
|
|
16
16
|
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
### 加载地图样式
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import "@heycar/heycars-map/dist/style.css";
|
|
23
|
+
```
|
|
24
|
+
|
|
19
25
|
### 使用
|
|
20
26
|
|
|
27
|
+
常用数据结构
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
export type Point = [number, number];
|
|
31
|
+
|
|
32
|
+
export type Place = {
|
|
33
|
+
lng: number;
|
|
34
|
+
lat: number;
|
|
35
|
+
name: string;
|
|
36
|
+
displayName: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export interface Zone {
|
|
40
|
+
name: string;
|
|
41
|
+
path: Point[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface RecommendZonePlaces {
|
|
45
|
+
available?: boolean;
|
|
46
|
+
zone?: Zone;
|
|
47
|
+
places?: Place[];
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
21
51
|
#### 在 入口文件添加 `MapProvider`
|
|
22
52
|
|
|
23
53
|
- 对于 jsx/tsx 文件的例子
|
|
@@ -53,42 +83,261 @@ npm install @heycar/heycars-map --save
|
|
|
53
83
|
</MapProvider>
|
|
54
84
|
```
|
|
55
85
|
|
|
56
|
-
####
|
|
86
|
+
#### 在地图里可以使用的组件
|
|
87
|
+
|
|
88
|
+
为了方便集成,已经将常用业务逻辑集成在四个业务组件里面,下面是推荐使用的业务组件
|
|
57
89
|
|
|
58
|
-
-
|
|
90
|
+
- `BusinessRecomendPlaceMap`
|
|
91
|
+
- `BusinessQuotingMap`
|
|
92
|
+
- `BusinessTaxiServiceMap`
|
|
93
|
+
- `BusinessTaxiEndMap`
|
|
94
|
+
|
|
95
|
+
下面三个是推荐搭配使用的业务 hooks
|
|
96
|
+
|
|
97
|
+
- `useBusinessRecomendPlaceMap`
|
|
98
|
+
- `useBusinessQuotingMap`
|
|
99
|
+
- `useBusinessTaxiServiceMap`
|
|
100
|
+
|
|
101
|
+
#### 选择上车点和推荐点的地图组件 `BusinessRecomendPlaceMap`
|
|
102
|
+
|
|
103
|
+
对于 jsx/tsx 文件的例子
|
|
59
104
|
|
|
60
105
|
```jsx
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
106
|
+
import { defineComponent } from "vue";
|
|
107
|
+
import { BusinessRecomendPlaceMap, useBusinessRecomendPlaceMap } from "@heycar/heycars-map";
|
|
108
|
+
|
|
109
|
+
export default defineComponent({
|
|
110
|
+
setup() {
|
|
111
|
+
const {
|
|
112
|
+
centerPlace,
|
|
113
|
+
mapContext,
|
|
114
|
+
setCenterPlaceByUserSpecified,
|
|
115
|
+
setCenterPlaceByUserSpecifiedInZone,
|
|
116
|
+
} = useBusinessRecomendPlaceMap();
|
|
117
|
+
// 演示 setCenterPlaceByUserSpecifiedInZone 的用法
|
|
118
|
+
const demoForUsage = () => {
|
|
119
|
+
setCenterPlaceByUserSpecifiedInZone({
|
|
120
|
+
// 期望的地图中心点
|
|
121
|
+
place: {
|
|
122
|
+
lng: 139.56,
|
|
123
|
+
lat: 35.56,
|
|
124
|
+
name: "user specified place in zone",
|
|
125
|
+
displayName: "user specified place in zone",
|
|
126
|
+
},
|
|
127
|
+
// 推荐点和绿区信息
|
|
128
|
+
recommends: {
|
|
129
|
+
// 绿区
|
|
130
|
+
zone: {
|
|
131
|
+
name: "zone 1",
|
|
132
|
+
path: [
|
|
133
|
+
[139.569, 35.555],
|
|
134
|
+
[139.558, 35.55],
|
|
135
|
+
[139.56, 35.565],
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
// 绿区内的推荐点列表
|
|
139
|
+
places: [
|
|
140
|
+
{
|
|
141
|
+
lng: 139.56,
|
|
142
|
+
lat: 35.56,
|
|
143
|
+
name: "user specified place in zone",
|
|
144
|
+
displayName: "user specified place in zone",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
lng: 139.562,
|
|
148
|
+
lat: 35.562,
|
|
149
|
+
name: "recommend place 2",
|
|
150
|
+
displayName: "recommend place 2",
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
return () => (
|
|
157
|
+
<BusinessRecomendPlaceMap
|
|
158
|
+
class={"demo"}
|
|
159
|
+
geoLoadingTitle={"正在获取您当前的位置"}
|
|
160
|
+
unavailableTitle={"当前区域暂未开通服务"}
|
|
161
|
+
recomendDescription={"您将在此处上车"}
|
|
162
|
+
geoDefaultPosition={[139.777777, 35.777777]}
|
|
163
|
+
mapContext={mapContext}
|
|
164
|
+
getRecomendPlace={async ({ lng, lat }) => {
|
|
165
|
+
// 向后端获取推荐点信息
|
|
166
|
+
return {
|
|
167
|
+
// 服务是否可用
|
|
168
|
+
available: true,
|
|
169
|
+
// 绿区
|
|
170
|
+
zone: {
|
|
171
|
+
name: "绿区名称",
|
|
172
|
+
path: [
|
|
173
|
+
[lng - 0.001, lat + 0.001],
|
|
174
|
+
[lng, lat - 0.001],
|
|
175
|
+
[lng + 0.001, lat + 0.0005],
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
// 推荐点列表
|
|
179
|
+
places: [
|
|
180
|
+
{ lat: lat - 0.00001, lng: lng + 0.0001, name: "place 1", displayName: "place 1" },
|
|
181
|
+
{ lat: lat - 0.0002, lng: lng + 0.0002, name: "place 2", displayName: "place 2" },
|
|
182
|
+
{ lat: lat - 0.0002, lng: lng - 0.0001, name: "place 3", displayName: "place 3" },
|
|
183
|
+
],
|
|
184
|
+
};
|
|
185
|
+
}}
|
|
186
|
+
getDefaultCenterPlace={async () => {
|
|
187
|
+
// 获取最后一次上车点
|
|
188
|
+
return {
|
|
189
|
+
lng: 139,
|
|
190
|
+
lat: 35,
|
|
191
|
+
name: "user last pickup place",
|
|
192
|
+
displayName: "user last pickup place",
|
|
193
|
+
};
|
|
194
|
+
}}
|
|
195
|
+
onChangeRecomandPlace={({ place, inputPlace, isInZone }) => {
|
|
196
|
+
console.log("用户操作地图,计算推荐点后得出的最终位置时触发,此时可以向后端查询城市信息");
|
|
197
|
+
console.log(
|
|
198
|
+
"计算推荐点之前的地址是: ",
|
|
199
|
+
inputPlace,
|
|
200
|
+
" 最终的地址是: ",
|
|
201
|
+
place,
|
|
202
|
+
" 是否在绿区内: ",
|
|
203
|
+
isInZone
|
|
204
|
+
);
|
|
205
|
+
}}
|
|
206
|
+
onClickLocator={() =>
|
|
207
|
+
console.log("用户点击了蓝色光标触发,此时可以执行用户点击起点输入框相同的逻辑")
|
|
208
|
+
}
|
|
209
|
+
onGeoError={() => {
|
|
210
|
+
console.log("获取GPS失败时触发,此时可以弹框告诉用户");
|
|
211
|
+
}}
|
|
212
|
+
/>
|
|
213
|
+
);
|
|
214
|
+
},
|
|
215
|
+
});
|
|
74
216
|
```
|
|
75
217
|
|
|
76
|
-
|
|
218
|
+
#### 询价业务的地图组件 `BusinessQuotingMap`
|
|
77
219
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
220
|
+
对于 jsx/tsx 文件的例子
|
|
221
|
+
|
|
222
|
+
```jsx
|
|
223
|
+
import { defineComponent } from "vue";
|
|
224
|
+
import { BusinessQuotingMap, useBusinessQuotingMap } from "@heycar/heycars-map";
|
|
225
|
+
|
|
226
|
+
export default defineComponent({
|
|
227
|
+
setup() {
|
|
228
|
+
const { setMap, registerFitVeiw } = useBusinessQuotingMap();
|
|
229
|
+
return () => (
|
|
230
|
+
<BusinessQuotingMap
|
|
231
|
+
class={"demo"}
|
|
232
|
+
from={{
|
|
233
|
+
displayName: "ARTS LINK零创国际艺术教育长宁区创业园区",
|
|
234
|
+
name: "上海市长宁区华阳路街道ARTS LINK零创国际艺术教育长宁区创业园区",
|
|
235
|
+
lat: 1.311295,
|
|
236
|
+
lng: 103.841974,
|
|
237
|
+
}}
|
|
238
|
+
to={{
|
|
239
|
+
displayName: "ARTS LINK零创国际艺术教育长宁区创业园区",
|
|
240
|
+
name: "上海市长宁区华阳路街道ARTS LINK零创国际艺术教育长宁区创业园区",
|
|
241
|
+
lat: 1.2966426,
|
|
242
|
+
lng: 103.7763939,
|
|
243
|
+
}}
|
|
244
|
+
fromDescription={"您将在此上车"}
|
|
245
|
+
renderDescription={({ distance, duration }) =>
|
|
246
|
+
`全程 *${distance / 1000}公里* 约行驶 *${duration}*`
|
|
247
|
+
}
|
|
248
|
+
mapRef={setMap}
|
|
249
|
+
registerOverlay={registerFitVeiw}
|
|
250
|
+
/>
|
|
251
|
+
);
|
|
252
|
+
},
|
|
253
|
+
});
|
|
84
254
|
```
|
|
85
255
|
|
|
86
|
-
####
|
|
256
|
+
#### 打车状态流转业务的地图组件 `BusinessTaxiServiceMap`
|
|
257
|
+
|
|
258
|
+
对于 jsx/tsx 文件的例子
|
|
87
259
|
|
|
88
|
-
|
|
260
|
+
```jsx
|
|
261
|
+
import { defineComponent } from "vue";
|
|
262
|
+
import { BusinessTaxiServiceMap, useBusinessTaxiServiceMap } from "@heycar/heycars-map";
|
|
263
|
+
|
|
264
|
+
export default defineComponent({
|
|
265
|
+
setup() {
|
|
266
|
+
const { setMap, registerFitVeiw } = useBusinessTaxiServiceMap();
|
|
267
|
+
return () => (
|
|
268
|
+
<BusinessTaxiServiceMap
|
|
269
|
+
class={css.adjustedDemo}
|
|
270
|
+
from={{
|
|
271
|
+
displayName: "ARTS LINK零创国际艺术教育长宁区创业园区",
|
|
272
|
+
name: "上海市长宁区华阳路街道ARTS LINK零创国际艺术教育长宁区创业园区",
|
|
273
|
+
lat: 1.311295,
|
|
274
|
+
lng: 103.841974,
|
|
275
|
+
}}
|
|
276
|
+
to={{
|
|
277
|
+
displayName: "ARTS LINK零创国际艺术教育长宁区创业园区",
|
|
278
|
+
name: "上海市长宁区华阳路街道ARTS LINK零创国际艺术教育长宁区创业园区",
|
|
279
|
+
lat: 1.2966426,
|
|
280
|
+
lng: 103.7763939,
|
|
281
|
+
}}
|
|
282
|
+
driverStatus={"driverArrived"}
|
|
283
|
+
bookDispatchingTitle="2月14日 11:00 用车"
|
|
284
|
+
dispatchingTitle="正在为您搜索附近司机"
|
|
285
|
+
driverArrivedTitle="司机已等待 00:35"
|
|
286
|
+
renderStartSerivceTitle={({ distance, duration }) =>
|
|
287
|
+
`距你*${distance}*公里, *${duration}*分钟`
|
|
288
|
+
}
|
|
289
|
+
renderInServiceTitle={({ distance, duration }) =>
|
|
290
|
+
`距离终点*${distance}*公里, 预计*${duration}*分钟`
|
|
291
|
+
}
|
|
292
|
+
getDriverPosition={async () => {
|
|
293
|
+
// 向后端请求司机位置和车头方向
|
|
294
|
+
return { position: [121.4036983, 31.216324], angle: 30 };
|
|
295
|
+
}}
|
|
296
|
+
interval={5000}
|
|
297
|
+
mapRef={setMap}
|
|
298
|
+
registerOverlay={registerFitVeiw}
|
|
299
|
+
/>
|
|
300
|
+
);
|
|
301
|
+
},
|
|
302
|
+
});
|
|
303
|
+
```
|
|
89
304
|
|
|
90
|
-
|
|
91
|
-
|
|
305
|
+
#### 服务结束的地图组件
|
|
306
|
+
|
|
307
|
+
对于 jsx/tsx 文件的例子
|
|
308
|
+
|
|
309
|
+
```jsx
|
|
310
|
+
import { defineComponent } from "vue";
|
|
311
|
+
import { BusinessTaxiEndMap } from "@heycar/heycars-map";
|
|
312
|
+
|
|
313
|
+
export default defineComponent({
|
|
314
|
+
setup() {
|
|
315
|
+
return () => (
|
|
316
|
+
<BusinessTaxiEndMap
|
|
317
|
+
class={"demo"}
|
|
318
|
+
from={{
|
|
319
|
+
displayName: "ARTS LINK零创国际艺术教育长宁区创业园区",
|
|
320
|
+
name: "上海市长宁区华阳路街道ARTS LINK零创国际艺术教育长宁区创业园区",
|
|
321
|
+
lat: 1.311295,
|
|
322
|
+
lng: 103.841974,
|
|
323
|
+
}}
|
|
324
|
+
to={{
|
|
325
|
+
displayName: "ARTS LINK零创国际艺术教育长宁区创业园区",
|
|
326
|
+
name: "上海市长宁区华阳路街道ARTS LINK零创国际艺术教育长宁区创业园区",
|
|
327
|
+
lat: 1.2966426,
|
|
328
|
+
lng: 103.7763939,
|
|
329
|
+
}}
|
|
330
|
+
/>
|
|
331
|
+
);
|
|
332
|
+
},
|
|
333
|
+
});
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
#### 下面是基础业务组件的使用方法,但是目前阶段不推荐使用
|
|
337
|
+
|
|
338
|
+
下列是一些更加基础的业务组件, 虽然导出了,但是目前阶段不推荐使用
|
|
339
|
+
|
|
340
|
+
- `AbsoluteAddressBox`
|
|
92
341
|
- `DrivingLine`
|
|
93
342
|
- `PassengerCircle`
|
|
94
343
|
- `PlaceCircle`
|
|
@@ -98,40 +347,7 @@ npm install @heycar/heycars-map --save
|
|
|
98
347
|
- `WaveCircle`
|
|
99
348
|
- `DrivingRoute`
|
|
100
349
|
- `WalkingRoute`
|
|
101
|
-
|
|
102
|
-
目前有下列组件可以使用下列 hooks
|
|
103
|
-
|
|
104
|
-
- `useBusinessMapRecomendPlace`
|
|
105
|
-
- `useBusinessMapAutoComplete`
|
|
106
|
-
|
|
107
|
-
目前有下列常用数据结构
|
|
108
|
-
|
|
109
|
-
```typescript
|
|
110
|
-
export type Point = [number, number];
|
|
111
|
-
|
|
112
|
-
export type Place = {
|
|
113
|
-
lng: number;
|
|
114
|
-
lat: number;
|
|
115
|
-
name: string;
|
|
116
|
-
cityName?: string;
|
|
117
|
-
cityId?: string;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export interface AutoCompletePlace extends Place {
|
|
121
|
-
placeId?: string;
|
|
122
|
-
description: string;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export type Region = {
|
|
126
|
-
bound?: {
|
|
127
|
-
east: number;
|
|
128
|
-
north: number;
|
|
129
|
-
south: number;
|
|
130
|
-
west: number;
|
|
131
|
-
};
|
|
132
|
-
name: string;
|
|
133
|
-
};
|
|
134
|
-
```
|
|
350
|
+
- `PickupPoints`
|
|
135
351
|
|
|
136
352
|
#### 在地图里使用 `AddressBox` ,需要放在 `HeycarMap` 内部
|
|
137
353
|
|
|
@@ -155,3 +371,33 @@ export type Region = {
|
|
|
155
371
|
...
|
|
156
372
|
</HeycarMap>
|
|
157
373
|
```
|
|
374
|
+
|
|
375
|
+
#### `HeycarMap` 的基本用法
|
|
376
|
+
|
|
377
|
+
- 对于 jsx/tsx 文件的例子
|
|
378
|
+
|
|
379
|
+
```jsx
|
|
380
|
+
<HeycarMap
|
|
381
|
+
class="any class name"
|
|
382
|
+
// 地图加载失败要显示的内容
|
|
383
|
+
fallback={() => <div>error</div>}
|
|
384
|
+
// 地图还没有加载完成时要显示的内容
|
|
385
|
+
loading={() => <div>loading</div>}
|
|
386
|
+
// 地图中心点
|
|
387
|
+
center={[0, 0]}
|
|
388
|
+
// 地图放缩
|
|
389
|
+
zoom={3}
|
|
390
|
+
>
|
|
391
|
+
...
|
|
392
|
+
</HeycarMap>
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
- 对于 vue 文件的例子
|
|
396
|
+
|
|
397
|
+
```vue
|
|
398
|
+
<HeycarMap :center="[0, 0]" class="any class name" :zoom="3">
|
|
399
|
+
<template #fallback>error</template>
|
|
400
|
+
<template #loading>loading</template>
|
|
401
|
+
...
|
|
402
|
+
</HeycarMap>
|
|
403
|
+
```
|