-
Notifications
You must be signed in to change notification settings - Fork 10
/
app.js
38 lines (36 loc) · 948 Bytes
/
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
import api from './utils/api'
import { Storage, showToast } from './utils/util'
import { request } from './utils/request'
App({
onLaunch() {
// 微信登录换取openId,存储用户信息
wx.login({
success: res => {
request({
url: api.login,
data: {
code: res.code,
companyId: '502565183546195968'
},
header: {
'content-type': 'application/x-www-form-urlencoded'
},
check: false
}).then(res => {
if (res.code === 0 && res.data) {
resolve(res.data)
Storage.setSync('loginInfo', res.data)
} else {
showToast('登录异常,请稍后重试')
console.log(`登录异常:${res.msg}`)
}
})
}
})
// 获取系统信息
this.globalData.systemInfo = wx.getSystemInfoSync()
},
globalData: {
systemInfo: {}
}
})