用户端:增加停车点

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 { .divOrderCell {
width: 50vw; width: 100vw;
} }
.divOrderCell2 { .divOrderCell2 {
width: 40vw; width: 100vw;
} }
.divOrderImg { .divOrderImg {

View File

@ -185,6 +185,9 @@
const showBikeInfo = ref(false); const showBikeInfo = ref(false);
const bikeData = ref({}); const bikeData = ref({});
let ismount=false;
let arrSiteData=[]
// //
function getLoalcationData() { function getLoalcationData() {
map.getLoalcation(res => { map.getLoalcation(res => {
@ -225,6 +228,7 @@
}) })
markers.value = arrData; markers.value = arrData;
}); });
getSiteList(longitude,latitude);
}) })
// uni.getLocation({ // uni.getLocation({
// type: 'gcj02', // type: 'gcj02',
@ -363,7 +367,6 @@
const intervalId = setInterval(() => { const intervalId = setInterval(() => {
// //
order.value.time = timeDifference(createdAt); order.value.time = timeDifference(createdAt);
console.log(order.value.time); //
if (!showOrder.value) { // showOrder false if (!showOrder.value) { // showOrder false
clearInterval(intervalId); // 使 intervalId clearInterval(intervalId); // 使 intervalId
} }
@ -619,19 +622,21 @@
oMap = uni.createMapContext("mapRef", { oMap = uni.createMapContext("mapRef", {
this: instance.proxy this: instance.proxy
}); });
ismount=true;
getLoalcationData(); getLoalcationData();
}) })
onShow(() => { onShow(() => {
if (uni.getStorageSync("wechat_user")) { if (uni.getStorageSync("wechat_user")) {
oUser = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user"))); oUser = JSON.parse(jkcBaseDecode(uni.getStorageSync("wechat_user")));
} const {
const { userId
userId } = oUser;
} = oUser; if (userId) {
if (userId) { getOrder();
getOrder(); }
} }
if(ismount) getLoalcationData();
}); });
onUnload(() => { onUnload(() => {
@ -667,6 +672,29 @@
const diffInDays = Math.floor(diffInHours / 24); const diffInDays = Math.floor(diffInHours / 24);
return `${diffInDays}${diffInHours % 24}小时 ${diffInMinutes % 60}分钟 ${diffInSeconds % 60}`; 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> </script>
<style scoped> <style scoped>

View File

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