update miniprogram/pages/info/index.js.
Signed-off-by: wulivictor <1351698648@qq.com>
This commit is contained in:
@@ -28,27 +28,9 @@ Page({
|
|||||||
console.log(res);
|
console.log(res);
|
||||||
if (res.code) {
|
if (res.code) {
|
||||||
//发起网络请求
|
//发起网络请求
|
||||||
wx.request({
|
|
||||||
url: 'https://www.xiaomutong.com.cn/web/index.php?r=wechat/getinfo4',
|
console.log(res);
|
||||||
method: 'post',
|
|
||||||
data: {
|
|
||||||
code: res.code
|
|
||||||
},
|
|
||||||
success (res) {
|
|
||||||
console.log(res.data);
|
|
||||||
if(res.data && res.data.code == 0){
|
|
||||||
let result = JSON.parse(res.data.result);
|
|
||||||
console.log(result);
|
|
||||||
_this.Getuserinfobyopenid(result.openid);
|
|
||||||
_this.setData({
|
|
||||||
openid: result.openid
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail (err){
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
console.log('登录失败!' + res.errMsg)
|
console.log('登录失败!' + res.errMsg)
|
||||||
}
|
}
|
||||||
@@ -57,30 +39,6 @@ Page({
|
|||||||
},
|
},
|
||||||
Getuserinfobyopenid: function(openid){
|
Getuserinfobyopenid: function(openid){
|
||||||
let _this = this;
|
let _this = this;
|
||||||
wx.request({
|
|
||||||
url: 'https://www.xiaomutong.com.cn/web/index.php?r=userinfo/getuserinfobyopenid',
|
|
||||||
method: 'post',
|
|
||||||
data: {
|
|
||||||
openid: openid
|
|
||||||
},
|
|
||||||
success (res) {
|
|
||||||
console.log(res.data);
|
|
||||||
if(res.data && res.data.code == 0 && res.data.result){
|
|
||||||
console.log(res.data);
|
|
||||||
let userInfo = JSON.parse(decodeURIComponent(res.data.result.userinfo));
|
|
||||||
let avatarUrl = userInfo.avatarUrl;
|
|
||||||
let nickName = userInfo.nickName;
|
|
||||||
_this.setData({
|
|
||||||
userInfo: userInfo,
|
|
||||||
avatarUrl: avatarUrl,
|
|
||||||
nickName: nickName
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail (err){
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
bindMyHuodong: function(){
|
bindMyHuodong: function(){
|
||||||
let url = '/pages/activity/index';
|
let url = '/pages/activity/index';
|
||||||
|
|||||||
Reference in New Issue
Block a user