...
|
...
|
@@ -10,7 +10,7 @@ Page({ |
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function(options) {
|
|
|
onLoad: function (options) {
|
|
|
this.getCodeFun();
|
|
|
|
|
|
},
|
...
|
...
|
@@ -19,7 +19,7 @@ Page({ |
|
|
getCodeFun() {
|
|
|
let that = this;
|
|
|
wx.login({
|
|
|
success: function(r) {
|
|
|
success: function (r) {
|
|
|
that.setData({
|
|
|
code: r.code
|
|
|
})
|
...
|
...
|
@@ -32,7 +32,7 @@ Page({ |
|
|
iv: reg.iv,
|
|
|
encryptedData: reg.encryptedData
|
|
|
})
|
|
|
if(that.data.iv){
|
|
|
if (that.data.iv) {
|
|
|
that.get_token()
|
|
|
}
|
|
|
|
...
|
...
|
@@ -49,12 +49,16 @@ Page({ |
|
|
// 立即授权
|
|
|
get_info(e) {
|
|
|
let that = this
|
|
|
if (e.detail.errMsg == 'getUserInfo:ok'){
|
|
|
wx.getUserProfile({
|
|
|
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
|
|
success: (res) => {
|
|
|
console.log(res.iv)
|
|
|
that.setData({
|
|
|
iv: e.detail.iv,
|
|
|
encryptedData: e.detail.encryptedData
|
|
|
iv: res.iv,
|
|
|
encryptedData: res.encryptedData
|
|
|
})
|
|
|
if(that.data.iv){
|
|
|
|
|
|
wx.login({
|
|
|
success: function(r) {
|
|
|
that.setData({
|
...
|
...
|
@@ -67,11 +71,36 @@ Page({ |
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
fail() {
|
|
|
wx.navigateBack({
|
|
|
delta: 0,
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
// if (e.detail.errMsg == 'getUserInfo:ok') {
|
|
|
// that.setData({
|
|
|
// iv: e.detail.iv,
|
|
|
// encryptedData: e.detail.encryptedData
|
|
|
// })
|
|
|
// if (that.data.iv) {
|
|
|
// wx.login({
|
|
|
// success: function (r) {
|
|
|
// that.setData({
|
|
|
// code: r.code
|
|
|
// })
|
|
|
// that.get_token()
|
|
|
// }
|
|
|
// })
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
},
|
|
|
|
|
|
// 获取登录注册信息
|
|
|
get_token(){
|
|
|
// 获取登录注册信息
|
|
|
get_token() {
|
|
|
wx.showLoading({
|
|
|
title: '加载中',
|
|
|
})
|
...
|
...
|
@@ -94,6 +123,12 @@ Page({ |
|
|
wx.setStorageSync('login', r.new_login);
|
|
|
wx.setStorageSync('gh_login', r.gh_login);
|
|
|
wx.setStorageSync('cb_login', r.cb_login);
|
|
|
wx.setStorageSync('sq', JSON.parse(r.sq1.msg).data)
|
|
|
wx.setStorageSync('gh_sq', JSON.parse(r.sq2.msg).data)
|
|
|
wx.setStorageSync('cb_sq', JSON.parse(r.sq3.msg).data)
|
|
|
wx.navigateBack({
|
|
|
delta: 0,
|
|
|
})
|
|
|
// wx.setStorageSync('tel', r.tel);
|
|
|
// wx.reLaunch({
|
|
|
// url: '/pages/index/index'
|
...
|
...
|
@@ -101,9 +136,7 @@ Page({ |
|
|
// wx.reLaunch({
|
|
|
// url: '/pages/index/index'
|
|
|
// })
|
|
|
wx.navigateBack({
|
|
|
delta: 0,
|
|
|
})
|
|
|
|
|
|
// if (r.new_login == 0) {
|
|
|
// // 未绑定手机号
|
|
|
// wx.redirectTo({
|
...
|
...
|
@@ -137,49 +170,49 @@ Page({ |
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
onReady: function() {
|
|
|
onReady: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function() {
|
|
|
onShow: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide: function() {
|
|
|
onHide: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload: function() {
|
|
|
onUnload: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
onPullDownRefresh: function() {
|
|
|
onPullDownRefresh: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom: function() {
|
|
|
onReachBottom: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
onShareAppMessage: function() {
|
|
|
onShareAppMessage: function () {
|
|
|
|
|
|
}
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|