-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathapp.js
More file actions
executable file
·76 lines (66 loc) · 1.84 KB
/
app.js
File metadata and controls
executable file
·76 lines (66 loc) · 1.84 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const BASE = require('/utils/base')
const API = require('/utils/api')
App({
onLaunch: function (options) {
// this.globalData.scene = options.scene;
this.getSiteInfo();
this.getCnttype();
// 获取系统状态栏信息
wx.getSystemInfo({
success: e => {
this.globalData.windowHeight = e.windowHeight;
this.globalData.windowWidth = e.windowWidth;
this.globalData.safeinsetbottom = e.safeArea.top > 20 ? 68:0;
this.globalData.StatusBar = e.statusBarHeight;
this.globalData.CustomBar = e.platform == 'android' ? e.statusBarHeight + 50 : e.statusBarHeight + 45;
this.globalData.TitleBar = e.platform == 'android' ? 50 : 45;
console.log(e)
}
})
},
onShow: function () {
this.globalData.user = BASE.getUser();
this.getCnttype();
},
getCnttype: function (){
var that = this
try {
if (wx.getStorageSync('cnttype')) {
var value = wx.getStorageSync('cnttype')
} else {
var value = that.globalData.cnttype
}
if (value) {
that.globalData.cnttype = value
}
// console.log('value1',value)
} catch (e) {
}
},
getSiteInfo: function () {
API.getSiteInfo().then(res => {
this.globalData.siteinfo = res
if (this.siteinfoCallBack) {
this.siteinfoCallBack(res)
}
})
.catch(err => {
console.log(err)
this.globalData.errtext = true
})
},
globalData: {
errtext:false,
user: '',
windowHeight: '',
windowWidth: '',
safeinsetbottom: '',
StatusBar: '',
CustomBar: '',
TitleBar: '',
siteinfo:'',
cnttype:'library',
tabbarStyle: 'simple', //底部主导航,normal图标带文字,simple仅图标
showitemadd: true,//底部主导航是否显示发布按钮,true显示,false隐藏
}
})