//app.js import { guid } from '/utils/util.js' App({ onLaunch: function() { /** 检查版本更新 */ const updateManager = wx.getUpdateManager(); updateManager.onCheckForUpdate(function (res) { if (res.hasUpdate) wx.clearStorageSync(); }) updateManager.onUpdateReady(function () { wx.showModal({ title: '更新提示', content: '新版本已经准备好,是否重启应用?', success: function (res) { if (res.confirm) { // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 updateManager.applyUpdate() } } }) }) //加载本地存储数据 this.globalData.authorInfo = wx.getStorageSync('authorInfo') this.globalData.sellerUser = wx.getStorageSync('sellerUser') this.globalData.sellerShop = wx.getStorageSync('sellerShop') // 检查uuid参数,生成一个并写入本地存储 var uuid = wx.getStorageSync('uuid') if (!uuid) { uuid = guid() this.globalData.uuid = uuid wx.setStorageSync('uuid', uuid) } else{ this.globalData.uuid=uuid } }, onShow(){ //加载本地存储数据 this.globalData.authorInfo = wx.getStorageSync('authorInfo') this.globalData.sellerUser = wx.getStorageSync('sellerUser') this.globalData.sellerShop = wx.getStorageSync('sellerShop') // 检查uuid参数,生成一个并写入本地存储 var uuid = wx.getStorageSync('uuid') if (!uuid) { uuid = guid() this.globalData.uuid = uuid wx.setStorageSync('uuid', uuid) } else{ this.globalData.uuid=uuid } }, globalData: { /** 小程序类型 */ miniProgramType:'miniprogramo2oseller', /** 用户uuid */ uuid: null, /** 登陆授权信息 */ authorInfo:null, /** 卖家用户 */ sellerUser: null, /** 卖家店铺 */ sellerShop: null, /** 待处理订单角标 */ orderNum:0, /** 今日订单数 */ todayOrderNum:0, /** 今日订单金额 */ todayOrderTotal:0, /** api 模式 */ api_mode: 'prod', /** api域名 */ // api_domain:{ // api_base: 'https://api.base.wdklian.com/',//''https://dev.base.wdklian.com/',//, // api_buyer: 'https://api.buyer.wdklian.com/',//'http://127.0.0.1:7002/',// // api_seller: 'https://api.seller.wdklian.com/',//'http://127.0.0.1:7003/',// // api_admin: 'https://api.admin.wdklian.com/', //'http://127.0.0.1:7004/',// // } api_domain:{ api_base: 'https://api.base.wdklian.com/',//''https://dev.base.wdklian.com/',//, api_buyer: 'https://api.buyer.wdklian.com/',//'http://127.0.0.1:7002/',// api_seller: 'https://api.seller.wdklian.com/',//'http://127.0.0.1:7003/',// api_admin: 'https://api.admin.wdklian.com/', //'http://127.0.0.1:7004/',// } } })