// app.js const api = require('./api/index') App({ onLaunch() { wx.setStorageSync('showDialog', true) // 展示本地存储能力 const logs = wx.getStorageSync('logs') || [] logs.unshift(Date.now()) wx.setStorageSync('logs', logs) //获取顶部navBar的信息 const that = this; // 获取系统信息 const systemInfo = wx.getSystemInfoSync(); // 胶囊按钮位置信息 const menuButtonInfo = wx.getMenuButtonBoundingClientRect(); that.globalData.windowWidth = systemInfo.windowWidth that.globalData.windowHeight = systemInfo.windowHeight // 导航栏高度 = 状态栏高度 + 44 that.globalData.navBarHeight = systemInfo.statusBarHeight + 44; that.globalData.menuRight = systemInfo.screenWidth - menuButtonInfo.right; that.globalData.menuTop = menuButtonInfo.top; that.globalData.menuHeight = menuButtonInfo.height; that.globalData.menuWidth = menuButtonInfo.width; wx.setStorageSync('height', that.globalData.navBarHeight) this.getPersonRights() //静态图片地址 var Path = { develop: { localImagePath:'', imghttp:'http://192.168.1.16:8801/fileManager/downloadFile?fileId=' }, // 开发环境地址 trial: { localImagePath:'.', imghttp:'https://www.xsip.cn/fileManager/downloadFile?fileId=' }, // 测试环境地址 release:{ localImagePath:'.', imghttp:'https://www.xsip.cn/fileManager/downloadFile?fileId=' }, // 生产环境地址 } const accountInfo = wx.getAccountInfoSync(); const envVersion = accountInfo.miniProgram.envVersion; that.globalData.localImagePath = Path[envVersion].localImagePath; that.globalData.imghttp = Path[envVersion].imghttp; }, globalData: { userInfo: null, navBarHeight: 0, // 导航栏高度 menuRight: 0, // 胶囊距右方间距(方保持左、右间距一致) menuTop: 0, // 胶囊距顶部间距 menuHeight: 0, // 胶囊高度(自定义内容可与胶囊高度保证一致) menuWidth:0, windowHeight:0, windowWidth:0, phone:'0755-82839168', localImagePath:'',//发布是'.',本地开发是'' imghttp:'https://www.xsip.cn/fileManager/downloadFile?fileId=' }, getPersonRights(){ api.getPersonRights({},false).then(res=>{ if(res.code == 200){ var data = JSON.stringify(res.data.data) wx.setStorageSync('vip', data) } }) }, })