操屁眼的视频在线免费看,日本在线综合一区二区,久久在线观看免费视频,欧美日韩精品久久综

新聞資訊

    微信小程序地圖實現展示線路

    本文實例為大家分享了微信小程序地圖實現展示線路的具體代碼,供大家參考,具體內容如下

    效果圖:

    思路:

    1、首先獲取一系列的坐標點微信小程序引入地圖,然后將這些坐標從頭到尾鏈接起來。(參考微信小程序地圖組件屬性)

    2、在獲取的坐標點上標注某一個位置,實現打點。(參考微信小程序地圖組件屬性 )

    3、使用map組件

    微信小程序地圖組件api地址

    下面直接展示代碼:

    wxml:

    
     
     
     
     
     
      預計{{now}}送達
      由藥店提供配送服務
     
     
      
      聯系商家
      
      
      聯系配送員
      
     
    

    js:

    data: {
     longitude: '',
     latitude:'',
    

    微信小程序引入地圖_微信小程序引入js文件_微信小程序引入網絡js

    points: [], polyline: [], markers: [], mapList:'', polylineList:[], }, mapLine(options){ wx.showLoading({ title: '加載中', }) let subOrderNo = options.maporder console.log(subOrderNo) let that=this let token = that.data.storageData.token let url = '接口地址'; let params = { subOrderNo:subOrderNo }; http.getRequest(url, params, token).then(res => { // 地圖打點標記商家和配送員位置 let markers= [ { iconPath: imgUrl+'shoplong.png', id: 0, latitude: that.data.mapList.pharmacyInfo.latitude, longitude: that.data.mapList.pharmacyInfo.longitude, callout: { content: that.data.mapList.pharmacyInfo.pharmacyName+"已接單", name:"商家已接單",

    微信小程序引入網絡js_微信小程序引入js文件_微信小程序引入地圖

    color: "#ff0000", fontSize: "16", borderRadius: "6", bgColor: "#ffffff", padding: "10", display:"ALWAYS" }, width: 50, height: 50 }, { iconPath:imgUrl+ 'maplog.png', id: 1, latitude: that.data.mapList.locationList[0].latitude, longitude: that.data.mapList.locationList[0].longitude, callout: { content: "配送員正在配送", name:"正在配送", color: "#ff0000", fontSize: "16", borderRadius: "6", bgColor: "#ffffff", padding: "10", display:"ALWAYS" }, width: 50, height: 50 }, ]; console.log(markers) let _this=this _this.setData({ markers:markers,

    微信小程序引入地圖_微信小程序引入網絡js_微信小程序引入js文件

    hasMarkers:true, latitude:that.data.mapList.pharmacyInfo.latitude, longitude:that.data.mapList.pharmacyInfo.longitude }) if(orderDeliver.polylineJson!=null){ let mapJson = JSON.parse(orderDeliver.polylineJson); console.log(mapJson) // 計算送達時間 let mapDate=that.data.mapList.updateTime let newsDate=new Date(mapDate) // let h = newsDate.getHours() let m = newsDate.getMinutes() let mapMinte=mapJson.route.paths[0].duration/60 newsDate.setMinutes(m+mapMinte) let dd=newsDate.getMinutes() let hh=newsDate.getHours() if(dd<10){ dd='0'+dd } if(hh<10){ hh='0'+hh } let now=hh +':'+dd; if(newsDate.getMinutes()>=60){ h=h+1; }else{ this.setData({ now:now }) console.log(now) } // 循環數組取快遞員的經緯度 let list = mapJson.route.paths[0].steps;

    微信小程序引入js文件_微信小程序引入網絡js_微信小程序引入地圖

    // console.log(list); let polylineList = []; for(let i =0;i{ let a = items.split(","); polylineList.push({ latitude: a[1], longitude: a[0] }); // console.log(polylineList) }) // polylineList.concat(pList); } } let polyline = [{ points: polylineList, color: "#518FF8", width: 4, dottedLine: false }]; this.setData({ polyline:polyline, points:polylineList, }) } }else if(res.responseCode == 0 && res.responseBody != null && res.responseBody.length != 0 && res.responseBody.deliverType ==2){ let list_di=res.responseBody.deliverType let maplistJson=res.responseBody.polylineJson let listMap=JSON.parse(maplistJson)

    微信小程序引入js文件_微信小程序引入網絡js_微信小程序引入地圖

    console.log(listMap) let logList=listMap.data.reverse() logList.forEach(element => { element.ftime = element.ftime.substring(0,16) }); console.log(logList) this.setData({ mapList:[], hasMarkers:false, logList:logList, list_di:list_di }) // sysMsg.sysMsg("商家還未接單,請稍后查看", 2000, 'none'); }else{ sysMsg.sysMsg("商家還未接單,請稍后查看", 2000, 'none'); } }).catch(err => { console.log(err); sysMsg.sysMsg("請求超時,請稍后再試", 1500, 'none'); }) }, onLoad: function (options) { this.mapLine(options) this.mapHeight() this.mapLog() // this.markers() // console.log(options.maporder) this.getstorageDataToPage() // qq地圖api qqmapsdk = new QQMapWX({ key: '申請的微信小程序地圖key' }); },

    為大家推薦現在關注度比較高的微信小程序教程一篇:《微信小程序開發教程》小編為大家精心整理的微信小程序引入地圖,希望喜歡。

    以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持來客網。

網站首頁   |    關于我們   |    公司新聞   |    產品方案   |    用戶案例   |    售后服務   |    合作伙伴   |    人才招聘   |   

友情鏈接: 餐飲加盟

地址:北京市海淀區    電話:010-     郵箱:@126.com

備案號:冀ICP備2024067069號-3 北京科技有限公司版權所有