|
|
|
@ -109,6 +109,7 @@ Page({
|
|
|
|
* 注册/登录按钮
|
|
|
|
* 注册/登录按钮
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
handleLoginOrRegister() {
|
|
|
|
handleLoginOrRegister() {
|
|
|
|
|
|
|
|
const that = this
|
|
|
|
if (!this.data.userName.trim()) {
|
|
|
|
if (!this.data.userName.trim()) {
|
|
|
|
wx.showToast({
|
|
|
|
wx.showToast({
|
|
|
|
title: '请输入用户名',
|
|
|
|
title: '请输入用户名',
|
|
|
|
@ -132,10 +133,23 @@ Page({
|
|
|
|
},
|
|
|
|
},
|
|
|
|
callBack: (res) => {
|
|
|
|
callBack: (res) => {
|
|
|
|
wx.setStorageSync('token', res.accessToken)
|
|
|
|
wx.setStorageSync('token', res.accessToken)
|
|
|
|
|
|
|
|
if(this.data.isRegister) {
|
|
|
|
|
|
|
|
that.setData({
|
|
|
|
|
|
|
|
userName: '',
|
|
|
|
|
|
|
|
password: '',
|
|
|
|
|
|
|
|
isRegister: !that.data.isRegister
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
wx.showToast({
|
|
|
|
|
|
|
|
title: '注册成功,请登录',
|
|
|
|
|
|
|
|
icon: 'none'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}else {
|
|
|
|
wx.switchTab({
|
|
|
|
wx.switchTab({
|
|
|
|
url: '/pages/index/index',
|
|
|
|
url: '/pages/index/index',
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
http.request(params);
|
|
|
|
http.request(params);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|