// pages/demo/demo.js var QQMapWX = require("../../libs/qqmap-wx-jssdk.js"); var util = require("../../utils/util.js"); var qqmapsdk; /** * 页面的初始数据 */ Page({ data: { hiddenLoading: false, resData: [] }, onShow: function (options) { // 实例化腾讯地图API核心类 let that = this; wx.getStorage({ key: "merchantNo", success: function (res) { console.log(res.data); if (res.data == "") { that.queryCartList(); } else { wx.switchTab({ url: "../index/index" }); } that.setData({ merchantNo: res.data }); }, fail: function (res) { console.log(res); that.queryCartList(); } }); }, queryCartList: function () { wx.getLocation({ type: 'wgs84', success: function(res) { //授权了 wx.navigateTo({ url: "../at_present/at_present" }); }, fail:function(error){ console.log(error); wx.navigateTo({ url: '../city/city', }) } }) }, handler: function (e) { var that = this; if (!e.detail.authSetting['scope.userLocation']) { that.setData({ ldata: false }) } else { that.setData({ ldata: true, }) wx.getLocation({ type: 'gcj02', success: function (res) { var latitude = res.latitude var longitude = res.longitude that.setData({ latitude: latitude, longitude: longitude }) wx.openLocation({ latitude: latitude, longitude: longitude, scale: 28 }) } }) } }, btnTap(e) { wx.openLocation({ latitude: this.data.latitude, longitude: this.data.longitude, scale: 28 }) }, });