From def880ebc059cca3b1087204f1ee4a23f62ed799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=B0=8F?= <736883394@qq.com> Date: Thu, 22 May 2025 11:28:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AB=AF=EF=BC=9A=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=81=9C=E8=BD=A6=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ebike-user/pages/user/home/home.css | 4 +-- ebike-user/pages/user/home/home.vue | 44 +++++++++++++++++++++++------ ebike-user/utils/usermap.js | 14 +++++++-- 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/ebike-user/pages/user/home/home.css b/ebike-user/pages/user/home/home.css index 6fe0a1b..8bd9133 100644 --- a/ebike-user/pages/user/home/home.css +++ b/ebike-user/pages/user/home/home.css @@ -116,11 +116,11 @@ } .divOrderCell { - width: 50vw; + width: 100vw; } .divOrderCell2 { - width: 40vw; + width: 100vw; } .divOrderImg { diff --git a/ebike-user/pages/user/home/home.vue b/ebike-user/pages/user/home/home.vue index 94f083f..c19e7a3 100644 --- a/ebike-user/pages/user/home/home.vue +++ b/ebike-user/pages/user/home/home.vue @@ -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); + } + }) + }