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