epmet 工作端 小程序
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.
 

51 lines
1.9 KiB

// app.js
import {getStaffbasicinfo} from "./utils/api";
import {getOwnedRolesOfStaffId} from "./utils/statisticsApi";
App({
onLaunch: function (options) {
//获取设备顶部窗口的高度(不同设备窗口高度不一样,根据这个来设置自定义导航栏的高度)
//这个最初我是在组件中获取,但是出现了一个问题,当第一次进入小程序时导航栏会把
//页面内容盖住一部分,当打开调试重新进入时就没有问题,这个问题弄得我是莫名其妙
//虽然最后解决了,但是花费了不少时间
let code = [1011, 1017, 1025, 1047, 1124, 1001, 1038, 1041, 1089, 1090, 1104, 1131, 1187];
if (code.includes(options.scene)) {
console.log(options.scene);
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
}
})
wx.hideTabBar()
getStaffbasicinfo().then(res=>{
this.globalData.user = res.data
getOwnedRolesOfStaffId(res.data.id).then(res2 => {
this.globalData.roleList = res2.data
})
}).catch(err=>{
console.log(err);
wx.redirectTo({
url: '/pages/login/login',
})
})
},
globalData: {
userInfo: null,
selected: 0,
deviceInfo: {
statusHeight: 19,
navigationHeight: 40
},
user: {},
share: false,
questionnaireUrl: '',
roleList: []
}
})