-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
50 lines (50 loc) · 1.11 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
//app.js
App({
globalData: {
userInfo: {
userId: 0,
nickname: "",
avatar: "",
gender: "",
province: "",
city: "",
district: "",
location: "",
telephone: "",
email: "",
shipAddress: "",
},
domain: {
// dev: "http://localhost:8081/",
dev: "https://ganzhiqiang.wang/ares/",
qiniuImg: "http://ayy.ganzhiqiang.wang",
tencentMap: "",
imageUpload: "",
}
},
onLaunch: function() {
// 登录
wx.login({
success: function (res) {
if (res.code) { //发起网络请求
var app = getApp()
wx.request({
url: app.globalData.domain.dev + 'people/login/',
data: {
code: res.code
},
success(res) {
app.globalData.userInfo.userId = res.data.data;
console.log(res.data)
},
fail(res) {
console.log("fail---" + res)
}
})
} else {
console.log('获取用户登录态失败!' + res.errMsg)
}
}
});
}
})