|
|
@ -12,6 +12,8 @@ Page({ |
|
|
|
thvm:{}, |
|
|
|
account: '', |
|
|
|
password: '', |
|
|
|
code: "", |
|
|
|
tmplIds: [], |
|
|
|
}, |
|
|
|
//密码登录to验证码登录
|
|
|
|
switchTab: function(e) { |
|
|
@ -67,25 +69,47 @@ Page({ |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
wxlogin(){ |
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
*/ |
|
|
|
onLoad(options) { |
|
|
|
this.reloadData() |
|
|
|
}, |
|
|
|
reloadData() { |
|
|
|
var that = this |
|
|
|
wx.login({ |
|
|
|
success: function (res) { |
|
|
|
WXAPI.wxLogin({ |
|
|
|
code: res.code, |
|
|
|
var code = res.code; |
|
|
|
that.setData({ |
|
|
|
code: code, |
|
|
|
}) |
|
|
|
WXAPI.getWXTemplates({ |
|
|
|
code: code, |
|
|
|
storeId: 239, |
|
|
|
}).then(res => { |
|
|
|
if (res.code == 200) { |
|
|
|
var data = res.data |
|
|
|
app.globalData.accessId = data.access_id; |
|
|
|
wx.setStorageSync('accessId', data.access_id) |
|
|
|
wx.setStorageSync('isLogin', true); |
|
|
|
wx.setStorageSync('userInfo', data.user); |
|
|
|
wx.navigateBack() |
|
|
|
wx.setStorageSync('tmplIds', res.data.templates) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
// wxlogin(){
|
|
|
|
// var that = this
|
|
|
|
// WXAPI.wxLogin({
|
|
|
|
// code: that.data.code,
|
|
|
|
// storeId: 239,
|
|
|
|
// }).then(res => {
|
|
|
|
// if (res.code == 200) {
|
|
|
|
// var data = res.data
|
|
|
|
// app.globalData.accessId = data.access_id;
|
|
|
|
// wx.setStorageSync('accessId', data.access_id)
|
|
|
|
// wx.setStorageSync('isLogin', true);
|
|
|
|
// wx.setStorageSync('userInfo', data.user);
|
|
|
|
// wx.navigateBack()
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// },
|
|
|
|
//授权微信手机号
|
|
|
|
bindPhoneNumber: function(e) { |
|
|
|
var that = this; |
|
|
@ -109,16 +133,9 @@ Page({ |
|
|
|
}, |
|
|
|
//微信一键登录
|
|
|
|
tapWeixinLogin : function(e) { |
|
|
|
var code = e.detail.code |
|
|
|
console.log(code) |
|
|
|
wx.showModal({ |
|
|
|
title:'警告', |
|
|
|
content:code, |
|
|
|
showCancel:false, |
|
|
|
confirmText:'返回授权', |
|
|
|
}) |
|
|
|
var that = this |
|
|
|
WXAPI.wxLogin({ |
|
|
|
code: code, |
|
|
|
code: that.data.code, |
|
|
|
storeId: 239, |
|
|
|
}).then(res => { |
|
|
|
if (res.code == 200) { |
|
|
@ -126,10 +143,16 @@ Page({ |
|
|
|
app.globalData.accessId = data.access_id; |
|
|
|
wx.setStorageSync('accessId', data.access_id) |
|
|
|
wx.setStorageSync('isLogin', true); |
|
|
|
wx.setStorageSync('userInfo', data.data); |
|
|
|
wx.setStorageSync('userInfo', data.user); |
|
|
|
wx.navigateBack() |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面显示 |
|
|
|
*/ |
|
|
|
onShow() { |
|
|
|
|
|
|
|
}, |
|
|
|
accountInput: function(e) { |
|
|
|
this.setData({ |
|
|
|