-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathapp.js
55 lines (55 loc) · 1.23 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
55
//app.js
App({
onLaunch: function () {
},
getUserInfo: function (cb) {
var that = this
if (this.globalData.userInfo) {
typeof cb == "function" && cb(this.globalData.userInfo)
} else {
//调用登录接口
wx.login({
success: function (ress) {
wx.getUserInfo({
success: function (res) {
that.globalData.userInfo = res.userInfo
typeof cb == "function" && cb(that.globalData.userInfo)
}
})
}
})
}
},
globalData: {
prosData: {},
openId: "",
commonPageData: {},
examFinishData: {}
}
,
sendMsg: function (_url, _data, _suc, _fail, _com) {
wx.request({
url: 'https://aopa.shareuavtec.com/' + _url,
data: _data,
method: 'POST', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
header: {
'content-type': 'application/x-www-form-urlencoded'
}, // 设置请求的 header
success: function (res) {
if (_suc)
_suc(res)
// success
},
fail: function () {
if (_fail)
_fail()
// fail
},
complete: function () {
// complete
if (_com)
_com()
}
})
}
})