const app = getApp() var util = require("../../utils/util.js") Page({ data: { duration: 500, latitude: undefined, longitude: undefined, name: undefined, address: undefined, arr: [], mktarr: [], mktList: [ "https://api.zhumi.tech/MiniProgram/mkt/mkt1.png", "https://api.zhumi.tech/MiniProgram/mkt/mkt2.png", "https://api.zhumi.tech/MiniProgram/mkt/mkt3.png", "https://api.zhumi.tech/MiniProgram/mkt/mkt4.png", "https://api.zhumi.tech/MiniProgram/mkt/mkt5.png", "https://api.zhumi.tech/MiniProgram/mkt/mkt6.png", "https://api.zhumi.tech/MiniProgram/mkt/mkt7.png" ], mktImgage: "https://api.zhumi.tech/MiniProgram/mkt/mkt1.png", }, onLoad: function(options) { this.init(options) }, init(options) { var that = this util.getData('/getBanners') .then(res => { that.setData({ arr: res }) }) that.setData({ navH: app.globalData.navHeight }) util.getData('/getMktInfos',{ mi_branche_code: 110000 }).then(res => { that.setData({ mktarr: res }) }) that.setData({ navH: app.globalData.navHeight }) }, mktImageChange: function(e) { this.setData({ mktImgage: e.currentTarget.dataset.path }) }, //点击轮播图 BhrefPm: function(e) { var index = e.currentTarget.dataset.index; if (index != null) { if (e.currentTarget.dataset.type == 1) { wx.navigateTo({ url: '/pages/promotion/promotionhref?para=' + index }) } if (e.currentTarget.dataset.type == 2) { wx.navigateTo({ url: index }) } } }, onShareAppMessage: function() { return { title: '科技强国梦 编程向未来', path: '/pages/index/index?id=888' } }, // map 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 }) } }) }, })