2317关注8668浏览
客户端
getPhoneNumber: function (e) {
let that=this;
wx.login({
success: function (res) {
if (e.detail.errMsg == 'getPhoneNumber:fail user deny') {
wx.navigateTo({
url: '../../pages/userLogin/userLogin',
});
} else {
if (e.detail.errMsg == 'getPhoneNumber:fail:cancel to confirm login') {
wx.navigateTo({
url: '../../pages/userLogin/userLogin?url='+that.data.url
});
}
else {
//console.log(res.code);
wx.request({
url: api.AESdecrypt,
data: {
'encryptedDataStr': e.detail.encryptedData,
'code': res.code,
'iv': e.detail.iv
},
method: 'post',
header: { 'content-type': 'application/x-www-form-urlencoded' },
success: function (data) {
console.log(data);
app.globalData.userInfo = data.data.data;
setTimeout(function(){
wx.navigateBack({ changed: true });//返回上一页
},500);
},
error: function () {
tip.showToast('error');
},
fail: function (err) {
tip.showToast(err);
}
})
}
}
}
});
},
服务端
try
{
string encryptedDataStr = System.Web.HttpContext.Current.Request["encryptedDataStr"],
code = System.Web.HttpContext.Current.Request["code"],
iv = System.Web.HttpContext.Current.Request["iv"];
ReturnData resultMsg = new ReturnData();
resultMsg.state = (int)StatusCodeEnum.Success;
resultMsg.message = StatusCodeEnum.Success.GetEnumText();
string strresult = "";
string Appid = "Appid";
string Secret = "Secret ";
string grant_type = "authorization_code";
GetU
-
至过去的我
2044人对此回答表示赞同
我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>