// GET请求
wx.request({
url: 'con.theme_user',
method: 'GET',
data: {
act: 'getUserInfo',
wxappid: confirm.wyy_user_wxappid,
openid: resizeBy.data.openid
},
header: {
"Content-Type": "application/json"
},
success: (res) => {
console.log(res.data);
// 存放用户基本信息
this.setData({
userInfo: res.data.userInfo,
hasUserInfo: true,
canIUse: true
})
}
})
// POST请求
wx.request({
header: {
"content-type": "application/json"
},
method: "POST",
url: `${this.globalData.api}login/token`,
data: {
code: code
},
success: res => {
var token = res.data.data
console.log(token);
wx.setStorageSync('token', token);
// 设置完token之后获取首页数据
// resolve()
}
})
网友评论