|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<view class="parking-information">
|
|
|
<view class="parking-information-slider">
|
|
|
- <image src="../../static/img/parking-info-bg.png" mode=""></image>
|
|
|
+ <image src="/static/img/parking-info-bg.png" mode=""></image>
|
|
|
</view>
|
|
|
<view class="parking-information-content">
|
|
|
<view class="parking-information-content-title">
|
|
@@ -10,7 +10,7 @@
|
|
|
<view class="subtitle">{{ roadInfo.roadName }}</view>
|
|
|
</view>
|
|
|
<view class="pict-right" @click="navigation(roadInfo.latitude, roadInfo.longitude, roadInfo.areaName)">
|
|
|
- <image src="../../static/img/distance-icon.png" mode=""></image>
|
|
|
+ <image src="/static/img/distance-icon.png" mode=""></image>
|
|
|
<view class="m">{{ roadInfo.distance | kmUnit }}</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -70,14 +70,50 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
onLoad(page) {
|
|
|
- this.roadInfo = JSON.parse(page.roadInfo);
|
|
|
- const { latitude, longitude, roadInfo } = page;
|
|
|
- this.latitude = latitude;
|
|
|
- this.longitude = longitude;
|
|
|
- this.roadInfo = JSON.parse(roadInfo);
|
|
|
- console.log('this.roadInfo', this.roadInfo);
|
|
|
+ const { current, id, longitude, latitude } = page;
|
|
|
+ if (id) {
|
|
|
+ const obj = {
|
|
|
+ 0: 'getNearRoadsl',
|
|
|
+ 1: 'getParkingLotList'
|
|
|
+ };
|
|
|
+ this[obj[current]](id, longitude, latitude);
|
|
|
+ this.latitude = latitude;
|
|
|
+ this.longitude = longitude;
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
+ /**
|
|
|
+ *获取路段列表
|
|
|
+ * @date 2021-08-10
|
|
|
+ * @param {String} longitude
|
|
|
+ * @param {String} latitude
|
|
|
+ * @param {String} id
|
|
|
+ * @returns {any}
|
|
|
+ */
|
|
|
+ async getNearRoadsl(id, longitude, latitude) {
|
|
|
+ try {
|
|
|
+ const { code, data } = await this.$u.api.nearRoadsl({ latitude, longitude });
|
|
|
+ if (code === 200) {
|
|
|
+ this.roadInfo = data.find((item) => item.id === id);
|
|
|
+ }
|
|
|
+ } catch (error) {}
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @description: 获取停车场列表
|
|
|
+ * @param {*} id
|
|
|
+ * @param {*} longitude
|
|
|
+ * @param {*} latitude
|
|
|
+ * @return {*}
|
|
|
+ */
|
|
|
+ async getParkingLotList(id, longitude, latitude) {
|
|
|
+ try {
|
|
|
+ const { code, data } = await this.$u.api.nearParkingLot({ status: 1, latitude, longitude });
|
|
|
+ if (code === 200) {
|
|
|
+ this.roadInfo = data?.rows.find((item) => item.id === id);
|
|
|
+ console.log(this.roadInfo);
|
|
|
+ }
|
|
|
+ } catch (error) {}
|
|
|
+ },
|
|
|
/**
|
|
|
* 跳转停车标准页面
|
|
|
* {roadNo} 路段编码
|
|
@@ -114,14 +150,6 @@ export default {
|
|
|
const name = item[0].label;
|
|
|
switch (name) {
|
|
|
case '腾讯地图':
|
|
|
- // uni.navigateTo({
|
|
|
- // url:
|
|
|
- // '/pages/parkingLists/map_web_view/map_web_view?url=https://3gimg.qq.com/lightmap/v1/marker/?marker=coord:' +
|
|
|
- // this.currentPositionHover.latitude +
|
|
|
- // ',' +
|
|
|
- // this.currentPositionHover.longitude +
|
|
|
- // '&referer=myApp&key=BOGBZ-2BZ33-O4L32-Y3QJR-PGN66-RFFEL'
|
|
|
- // });
|
|
|
location.href = `https://apis.map.qq.com/uri/v1/routeplan?type=drive&from=我的位置&fromcoord=${this.latitude},${this.longitude}&to=${this.currentPositionHover.areaName}&tocoord=${this.currentPositionHover.latitude},${this.currentPositionHover.longitude}&policy=1&referer=BOGBZ-2BZ33-O4L32-Y3QJR-PGN66-RFFEL`;
|
|
|
break;
|
|
|
case '百度地图':
|
|
@@ -130,9 +158,6 @@ export default {
|
|
|
&output=html&src=webapp.baidu.openAPIdemo`;
|
|
|
break;
|
|
|
case '高德地图':
|
|
|
- console.log(this.longitude);
|
|
|
- // const gdurl = `https://uri.amap.com/navigation?from=${this.currentPosition.longitude},${this.currentPosition.latitude},起点&to=${this.currentPositionHover.longitude},${this.currentPositionHover.latitude},终点&mode=car&policy=1&src=mypage&coordinate=gaode&callnative=0`;
|
|
|
- // window.location.href = gdurl;
|
|
|
location.href = `https://uri.amap.com/navigation?from=${this.longitude},${this.latitude},我的位置&to=${this.currentPositionHover.longitude},${this.currentPositionHover.latitude},${this.currentPositionHover.areaName}&mode=car&policy=1&src=mypage&coordinate=gaode&callnative=0`;
|
|
|
break;
|
|
|
}
|