//app.js var util = require('utils/util.js') var api = require('utils/service-api.js'); App({ baseUrl: "https://xcxhive2.jyymatrix.cc", // baseUrl : "http://localhost:8080", //登录后获得的token loginToken: "", //判断用户是否登录 isLogin: false, //最近门店 shopInfo: {}, //所有门店 shopList: [], onLaunch: function(options) { this.getShop(); if (options.scene == 1044) { wx.getShareInfo({ shareTickets: options.shareTickets, success: function(res) { console.log("onLaunchoptions转发成功") console.log(res) var encryptedData = res.encryptedData; var iv = res.iv } }) } }, /** * 获取门店 */ getShop: function() { const app = this; wx.getLocation({ type: 'wgs84', success(res) { const latitude = res.latitude; const longitude = res.longitude; app.doGgetShopList(longitude, latitude); }, fail(res) { console.log("用户拒绝授权"); app.doGgetShopList(0, 0); } }) }, doGgetShopList: function(longitude, latitude) { util.request({ api: api.yuyue.getShopList + "/" + longitude + "/" + latitude, callback: function(data) { let shopInfo = data.mapInfo.shopInfo; if (getApp().shopInfo.id == null) { getApp().shopInfo = shopInfo; wx.setNavigationBarTitle({ title: shopInfo.shopShortName }); } getApp().shopList = data.rows; }, }); }, checkAuthorize(scope) { wx.getSetting({ success: (res) => { console.log(res.authSetting[scope]) if (!res.authSetting[scope]) { wx.showModal({ title: '用户未授权', content: '拒绝授权将不能体验小程序完整功能,点击确定开启授权', success: (res) => { console.log(res) if (res.confirm) { wx.openSetting({}) } } }) } } }) } })