授权登录

getUserInfoFun: function (e) {
if (e == undefined) {
} else {
if (e.detail.errMsg == "getUserInfo:ok") {
var S = this;
wx.getUserInfo({
success: function (res) {
app.information.personInfo = res;
S.showPrePage();
}
【授权登录】})
app.information.userInfo = e.detail.userInfo
} else {
}
}
},
showPrePage: function (e) {
var utilMd5 = require('../../utils/util.js');
var that = this;
var timestamp = Date.parse(new Date());
timestamp = timestamp / 1000;
var password = utilMd5.hexMD5(app.information.code + timestamp);
wx.request({
url: '' + app.information.host + '/api/json/member/member.ashx?action=otherlogin&companyid=' + app.information.companyid+'&code=' + password + '×tamp=' + timestamp + '&type=wxlogin&openid=' + app.information.openid + '&nickname=' + app.information.userInfo.nickName + '&sex=' + app.information.userInfo.gender + '&headimgurl= ' + app.information.userInfo.avatarUrl,
header: {
'content-type': 'application/json',
},
//存储cookie
success: res => {
console.log(res)
if (res.header["Set-Cookie"].length > 200) {
app.information.cookie = res.header["Set-Cookie"];
that.setData({
eye: "0",
})
var e={id:that.data.id}
that.onLoad(e),
wx.showToast({
// 提示内容
title: "登录成功",
icon: "none",
duration: 2000,
mask: false,
})
} else {
wx.showToast({
// 提示内容
title: "登录失败",
icon: "none",
duration: 2000,
mask: false,
})
}
},
});
},



.jiazai{width: 100vw; height: 100vh; position: fixed; z-index: 99; background: rgba(0,0,0,0)}
.jiazai button{border-radius: 0; border: none; width: 80vw; height: 13.33vw; position: fixed; bottom: 0; right: 0; background: #FF302D; line-height: 14vw; color: #fff; font-size: 4vw; font-weight: 600}

    推荐阅读