var util = require('./utils/util.js'); var api = require('./config/api.js'); var user = require('./utils/user.js'); App({ onLaunch: function () { const updateManager = wx.getUpdateManager(); wx.getUpdateManager().onUpdateReady(function () { wx.showModal({ title: '更新提示', content: '新版本已经准备好,是否重启应用?', success: function (res) { if (res.confirm) { // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 updateManager.applyUpdate() } } }) }) /*网络状态 wx.onNetworkStatusChange(function (res) { if (res.networkType === 'none') { wx.showToast({ title: '网络已断开', icon: 'none' }) } else if (res.networkType === "2g" || res.networkType === "3g") wx.showToast({ title: '您的网络状态不佳,' + res.networkType + ',建议使用wifi', icon: 'none' }); })*/ //初始化小程序云开发 //wx.cloud.init(); }, onShow: function (options) { /*是否授权登录*/ user.checkLogin().then(res => { this.globalData.hasLogin = true; if (this.checkLoginReadyCallback) { this.checkLoginReadyCallback(); } }).catch(() => { this.globalData.hasLogin = false; }); //购物车数据显示 //user.cartcount(); //获取其他小程序传过来的参数 console.info(options) let query = options.query || {} if (query.orderId) { wx.navigateTo({ url: 'pages/ucenter/serviceDetail/serviceDetail?orderId='+query.orderId, }) } }, checkLoginReadyCallback: function () { //是否登录 this.globalData.hasLogin = true; }, globalData: { shopId:'', hasLogin: false, //是否授权登录 isMember:false,//是否是会员 userInfo: {}, r_userid: 0, //推荐人id iscert: false, //是否注册过 mapKey:'JA2BZ-XGOEU-UNZVD-46G64-S6MYJ-6BBF4', currentLocationName:"位置获取中", rId:'',//引荐人ID shareImage:'', recommend:{ //引荐人信息 userName:'', avatarUrl:'', bCode:'', phone:'', unionId:'', openId:'', sessionKey:"" }, infoGoods:{ picUrl:'', name:'', brief:"", type:'0' },//信息收集, infoAddress:{ addressId:'', addressDetail:'' }, memberUserInfo:{ nickName: '', avatarUrl: '/static/images/new/icon-user.png' } } }) //购物车隐藏 // { // "pagePath": "pages/tabBar/cart/cart", // "iconPath": "static/images/cart.png", // "selectedIconPath": "static/images/cart@selected.png", // "text": "购物车" // },