|
@@ -193,6 +193,8 @@
|
|
|
:distance="item.stationLatDistance"
|
|
:distance="item.stationLatDistance"
|
|
|
:latitude="item.location.stationLat"
|
|
:latitude="item.location.stationLat"
|
|
|
:longitude="item.location.stationLng"
|
|
:longitude="item.location.stationLng"
|
|
|
|
|
+ :availableParkingNum="item.availableParkingNum"
|
|
|
|
|
+ :parkingNum="item.parkingNum"
|
|
|
:activity-list="item.activityList"
|
|
:activity-list="item.activityList"
|
|
|
:fromMap="true"
|
|
:fromMap="true"
|
|
|
></charge-station>
|
|
></charge-station>
|
|
@@ -213,6 +215,8 @@
|
|
|
:distance="station[markersIndex].stationLatDistance"
|
|
:distance="station[markersIndex].stationLatDistance"
|
|
|
:latitude="station[markersIndex].location.stationLat"
|
|
:latitude="station[markersIndex].location.stationLat"
|
|
|
:longitude="station[markersIndex].location.stationLng"
|
|
:longitude="station[markersIndex].location.stationLng"
|
|
|
|
|
+ :availableParkingNum="station[markersIndex].availableParkingNum"
|
|
|
|
|
+ :parkingNum="station[markersIndex].parkingNum"
|
|
|
:activity-list="station[markersIndex].activityList"
|
|
:activity-list="station[markersIndex].activityList"
|
|
|
:fromMap="true"
|
|
:fromMap="true"
|
|
|
></charge-station>
|
|
></charge-station>
|
|
@@ -267,7 +271,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import {throttle} from "@/utils/util";
|
|
|
|
|
|
|
+import {debounce, throttle} from "@/utils/util";
|
|
|
|
|
|
|
|
const defaulDistance = 3;
|
|
const defaulDistance = 3;
|
|
|
const defaultScale = 12;
|
|
const defaultScale = 12;
|
|
@@ -294,6 +298,7 @@ import { to } from "@/utils/navigate";
|
|
|
import { onLoad, onShow } from "@dcloudio/uni-app";
|
|
import { onLoad, onShow } from "@dcloudio/uni-app";
|
|
|
import { ref } from "vue";
|
|
import { ref } from "vue";
|
|
|
|
|
|
|
|
|
|
+const currentLocation = ref(null)
|
|
|
const isIOS = ref(false);
|
|
const isIOS = ref(false);
|
|
|
const token = ref<string>();
|
|
const token = ref<string>();
|
|
|
const ready = ref(false);
|
|
const ready = ref(false);
|
|
@@ -410,7 +415,7 @@ const refreshStation = (location: any) => {
|
|
|
}
|
|
}
|
|
|
).then((res) => {
|
|
).then((res) => {
|
|
|
const _markersIndex = stationPage.value.page === 1 ? 0 : markersIndex.value;
|
|
const _markersIndex = stationPage.value.page === 1 ? 0 : markersIndex.value;
|
|
|
- console.log("xxxxx",res)
|
|
|
|
|
|
|
+ // console.log("xxxxx",res)
|
|
|
const _markers: any[] = res.map((item, index) => {
|
|
const _markers: any[] = res.map((item, index) => {
|
|
|
item.totalFee =(Number(item.serviceFee)+Number(item.electricityFee)).toFixed(2)
|
|
item.totalFee =(Number(item.serviceFee)+Number(item.electricityFee)).toFixed(2)
|
|
|
length = 0;
|
|
length = 0;
|
|
@@ -428,10 +433,8 @@ const refreshStation = (location: any) => {
|
|
|
// }
|
|
// }
|
|
|
// });
|
|
// });
|
|
|
// });
|
|
// });
|
|
|
- console.log(item.serviceFee,item.StationID)
|
|
|
|
|
return {
|
|
return {
|
|
|
id: Number(item.StationID),
|
|
id: Number(item.StationID),
|
|
|
- totalFee:"12",
|
|
|
|
|
// (Number()+Number(item.electricityFee)||0).toFixed(2),
|
|
// (Number()+Number(item.electricityFee)||0).toFixed(2),
|
|
|
latitude: item.location.stationLat,
|
|
latitude: item.location.stationLat,
|
|
|
longitude: item.location.stationLng,
|
|
longitude: item.location.stationLng,
|
|
@@ -450,7 +453,8 @@ const refreshStation = (location: any) => {
|
|
|
index === _markersIndex
|
|
index === _markersIndex
|
|
|
? pointSize.currentFontSize
|
|
? pointSize.currentFontSize
|
|
|
: pointSize.fontSize,
|
|
: pointSize.fontSize,
|
|
|
- textAlign: isIOS.value ? "center" : "left",
|
|
|
|
|
|
|
+ textAlign: "center" ,
|
|
|
|
|
+ // textAlign: isIOS.value ? "center" : "left",
|
|
|
anchorX: isIOS.value
|
|
anchorX: isIOS.value
|
|
|
? 0
|
|
? 0
|
|
|
: index === _markersIndex
|
|
: index === _markersIndex
|
|
@@ -481,7 +485,6 @@ const refreshStation = (location: any) => {
|
|
|
stationPage.value.page === 1 ? res : [...station.value, ...res];
|
|
stationPage.value.page === 1 ? res : [...station.value, ...res];
|
|
|
markersIndex.value = _markersIndex;
|
|
markersIndex.value = _markersIndex;
|
|
|
markers.value = _markers;
|
|
markers.value = _markers;
|
|
|
- console.log(">>>>>>>>>>>>>",stationPage.value,station.value,mapMode.value,markersIndex.value)
|
|
|
|
|
return res;
|
|
return res;
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
@@ -682,21 +685,29 @@ const mapChange = (e: any) => {
|
|
|
}
|
|
}
|
|
|
if (e.type === "end" && markers.value.length) {
|
|
if (e.type === "end" && markers.value.length) {
|
|
|
//TODO 防抖500ms触发一次
|
|
//TODO 防抖500ms触发一次
|
|
|
- throttle(()=>{
|
|
|
|
|
- const current = e.target.centerLocation;
|
|
|
|
|
- const { latitude, longitude } = current;
|
|
|
|
|
- stationPage.value.page = 1;
|
|
|
|
|
- refreshStation({
|
|
|
|
|
- latitude,
|
|
|
|
|
- longitude,
|
|
|
|
|
- });
|
|
|
|
|
- },500)
|
|
|
|
|
|
|
+ console.log("throttle")
|
|
|
|
|
+ currentLocation.value = e.target.centerLocation
|
|
|
|
|
+ // throttle(()=>{
|
|
|
|
|
+ //
|
|
|
|
|
+ // },500)
|
|
|
// console.log("map change end", {
|
|
// console.log("map change end", {
|
|
|
// ...e.detail.centerLocation,
|
|
// ...e.detail.centerLocation,
|
|
|
// });
|
|
// });
|
|
|
-
|
|
|
|
|
|
|
+ debounceRefreshStation()
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+const debounceRefreshStation = debounce(() => {
|
|
|
|
|
+ const { latitude, longitude } = currentLocation.value;
|
|
|
|
|
+ stationPage.value.page = 1;
|
|
|
|
|
+ console.log("debounceRefreshStation run...")
|
|
|
|
|
+ refreshStation({
|
|
|
|
|
+ latitude,
|
|
|
|
|
+ longitude,
|
|
|
|
|
+ });
|
|
|
|
|
+}, 500)
|
|
|
|
|
+
|
|
|
const _changeMarker = (current: number) => {
|
|
const _changeMarker = (current: number) => {
|
|
|
const _markers = JSON.parse(JSON.stringify(markers.value));
|
|
const _markers = JSON.parse(JSON.stringify(markers.value));
|
|
|
const markersNewIndex = current;
|
|
const markersNewIndex = current;
|