锦水居民端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

50 lines
1.7 KiB

App({
onLaunch: function (options) {
// 判断是否由分享进入小程序
if (options.scene == 1007 || options.scene == 1008) {
this.globalData.share = true
} else {
this.globalData.share = false
};
//获取设备顶部窗口的高度(不同设备窗口高度不一样,根据这个来设置自定义导航栏的高度)
//这个最初我是在组件中获取,但是出现了一个问题,当第一次进入小程序时导航栏会把
//页面内容盖住一部分,当打开调试重新进入时就没有问题,这个问题弄得我是莫名其妙
//虽然最后解决了,但是花费了不少时间
const menuButtonInfo = wx.getMenuButtonBoundingClientRect()
wx.getSystemInfo({
success: (res) => {
this.globalData.height = res.statusBarHeight
this.globalData.deviceInfo.statusHeight = res.statusBarHeight
this.globalData.deviceInfo.navigationHeight = menuButtonInfo.height + (menuButtonInfo.top - res.statusBarHeight) * 2
}
})
},
globalData: {
flag: false,
exitApp: false,
userInfo: null,
accountState: 0, // 未注册
share: false, // 分享默认为false
height: 0,
infoCompleted: 0, // 0-未完善 1,2,3...-已完善
tempGridId: '',
userInfo : { // 当前登陆的用户信息
userId: '',
username: '',
userMobile: '',
partyFlag: ''
},
groupInfo: { // 友邻社群-当前展示的社群信息
groupAvatar: '',
groupLeader: '',
groupName:'',
groupId: '',
lordFlag: ''
},
previewImage: false, // 预览图片后会触发onShow,加个状态区分一下
deviceInfo: {
statusHeight: 20,
navigationHeight: 40
}
}
})