// pages/index/moreshop/moreshop.js const app = getApp() Page({ /** * 页面的初始数据 */ data: { trafficList: [] }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { const that = this let branche_code = wx.getStorageSync('branche_code'); wx.request({ url: app.globalData.url + '/getMktInfos', method: 'get', data: { mi_branche_code: branche_code }, success: function(res) { // console.log(res.data) that.setData({ trafficList: res.data, // map: res.data[0].mi_mapurl, // mktnum: res.data[0].id, // latitude: res.data[0].mi_latitude, // longitude: res.data[0].mi_longitude, // name: res.data[0].mi_mktname, // address: res.data[0].mi_mktaddress }) }, fail() { app.timeOut() } }) let _this = this; _this.setData({ navH: app.globalData.navHeight }) }, markertap: function(e) { wx.getLocation({ type: 'gcj02', //返回可以用于wx.openLocation的经纬度 success: function(res) { var latitude = e.currentTarget.dataset.latitude var longitude = e.currentTarget.dataset.longitude wx.openLocation({ //出发wx.openLocation API latitude: Number(latitude), //坐标纬度(从地图获取坐标) longitude: Number(longitude), //坐标经度(从地图获取坐标) name: e.currentTarget.dataset.name, //打开后显示的地址名称 address: e.currentTarget.dataset.address, //打开后显示的地址汉字 scale: 17 }) }, fail() { app.timeOut() } }) }, goback() { wx.navigateBack({ delta: 1 }) }, /** * 用户点击右上角分享 */ onShareAppMessage: function() { } })