用户端:增加停车点

This commit is contained in:
小小 2025-05-22 11:28:43 +08:00
parent 506e98ffa3
commit def880ebc0
3 changed files with 50 additions and 12 deletions

View File

@ -116,11 +116,11 @@
}
.divOrderCell {
width: 50vw;
width: 100vw;
}
.divOrderCell2 {
width: 40vw;
width: 100vw;
}
.divOrderImg {

View File

@ -184,6 +184,9 @@
let arrBikeData = [];
const showBikeInfo = ref(false);
const bikeData = ref({});
let ismount=false;
let arrSiteData=[]
//
function getLoalcationData() {
@ -225,6 +228,7 @@
})
markers.value = arrData;
});
getSiteList(longitude,latitude);
})
// uni.getLocation({
// type: 'gcj02',
@ -363,7 +367,6 @@
const intervalId = setInterval(() => {
//
order.value.time = timeDifference(createdAt);
console.log(order.value.time); //
if (!showOrder.value) { // showOrder false
clearInterval(intervalId); // 使 intervalId
}
@ -619,19 +622,21 @@
oMap = uni.createMapContext("mapRef", {
this: instance.proxy
});
ismount=true;
getLoalcationData();
})
onShow(() => {
if (uni.getStorageSync("wechat_user")) {
oUser = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
const {
userId
} = oUser;
if (userId) {
getOrder();
}
}
const {
userId
} = oUser;
if (userId) {
getOrder();
}
if(ismount) getLoalcationData();
});
onUnload(() => {
@ -667,6 +672,29 @@
const diffInDays = Math.floor(diffInHours / 24);
return `${diffInDays}${diffInHours % 24}小时 ${diffInMinutes % 60}分钟 ${diffInSeconds % 60}`;
}
function getSiteList(lng,lat){
const params={
longitude:lng,
latitude:lat
}
callOrdereApi("userOrders/siteRegionList",params,"post").then(res=>{
const{code,data,message}=res;
const arrData=[];
if(code==200&&data&&data.length>0){
data.map(item=>{
const{shapeType,points}=item;
if(shapeType=="2"){
arrData.push(map.addPolygon("#578FD4","#c0daf54d",points));
}
});
polygons.value=arrData;
}
else{
console.log("userOrders/siteRegionList",res);
}
})
}
</script>
<style scoped>

View File

@ -101,7 +101,6 @@ function saveRide(params, icnt, callback) {
code,
message
} = res;
console.log("33333333333333333333333","userOrders/saveRide",res);
if (code != 200) {
if (icnt <= 3) {
saveRide(params, icnt + 1, callback);
@ -119,4 +118,15 @@ function saveRide(params, icnt, callback) {
}, 1000)
})
}
}
//添加面
export function addPolygon (scolor, fcolor, arrPoints) {
return {
points: arrPoints,
fillColor: fcolor,
strokeWidth: 3,
strokeColor: scolor,
zIndex: 11
}
}