-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
54 lines (52 loc) · 1.72 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
App({
globalData: {
// url: 'http://297mo66766.imdo.co/',
url: 'https://witime.wizzstudio.com/',
owner: 1,
anames: [
{ icon: "/src/image/anameRed.svg", name: "小红" },
{ icon: "/src/image/anameGreen.svg", name: "小绿" },
{ icon: "/src/image/anameYellow.svg", name: "小黄" },
{ icon: "/src/image/anameBlue.svg", name: "小蓝" },
],
userInfo: {
avatarUrl: 'https://s2.loli.net/2022/04/09/uo9KiPVClUSQnps.jpg',
nickname: '帮帮',
}
},
onLaunch() {
// 获取设备相关信息
let menuButtonObject = wx.getMenuButtonBoundingClientRect();
wx.getSystemInfo({
success: res => {
console.log(res)
let statusBarHeight = res.statusBarHeight,
navTop = menuButtonObject.top,
navHeight = statusBarHeight + menuButtonObject.height + (menuButtonObject.top - statusBarHeight)*2;
// 导航栏高度
this.globalData.navHeight = navHeight;
// 导航栏距离顶部距离
this.globalData.navTop = navTop;
// 可使用窗口高度
this.globalData.windowHeight = res.windowHeight;
// 可使用窗口宽度
this.globalData.windowWidth = res.windowWidth;
// 底部“黑线”高度
this.globalData.bottomLineHeight = res.windowHeight - res.safeArea.bottom;
},
fail(err) {
console.error(err);
}
})
// 用户头像和昵称
const userInfo = wx.getStorageSync('userInfo');
if(userInfo) {
this.globalData.userInfo = JSON.parse(userInfo);
}
// 提示用户更新内容
if(!wx.getStorageSync('noticeUpdateContent')) {
wx.setStorageSync('noticeUpdateContent', JSON.stringify(true));
this.globalData.noticeUpdateContent = true;
}
}
})