-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathapp.js
More file actions
30 lines (27 loc) · 662 Bytes
/
app.js
File metadata and controls
30 lines (27 loc) · 662 Bytes
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
// app.js
App({
onLaunch() {
wx.cloud.init({
env: 'cloud1-3gdctq584a67ea27',
traceUser: true,
});
wx.cloud.callFunction({ name: 'getUser' })
.then(res => {
if (res.result.data.length > 0) {
this.globalData.userInfo = res.result.data[0].userInfo;
}
console.log("when app launch:", this.globalData.userInfo);
});
const db = wx.cloud.database();
db.collection('config').limit(1).get()
.then(res => {
this.globalData.publishButton = res.data[0].publishButton;
}).catch(err => {
console.error(err);
})
},
globalData: {
userInfo: null,
publishButton: 0,
}
})