注册流程

This commit is contained in:
limqhz
2022-12-16 17:32:49 +08:00
parent b746aaaa83
commit eb5c301d00
57 changed files with 1839 additions and 20 deletions

73
pages/login/index.js Normal file
View File

@@ -0,0 +1,73 @@
import Toast from '../../components/toast/index';
Page({
data: {
body:{
userName:'',
password:'',
code:''
}
},
// 输入框输入时
inputChange(event) {
let key = event.currentTarget.dataset.type;
this.data.body[key] = event.detail.value;
},
toast(option) {
Toast({
context: this,
selector: '#t-toast',
...option,
});
},
clickRegister() {
wx.redirectTo({
url:"/pages/register/index"
})
},
longin(){
if (!this.data.body.userName) {
this.toast({
message: '用户名不能为空!',
theme: 'fail',
placement: 'bottom',
direction: 'column'
});
return;
}
if (!this.data.body.password) {
this.toast({
message: '请输入密码!',
theme: 'fail',
placement: 'bottom',
direction: 'column'
});
return;
}
if (!this.data.body.code) {
this.toast({
message: '请输入验证码!',
theme: 'fail',
placement: 'bottom',
direction: 'column'
});
return;
}
if (this.data.body.code != '1') {
this.toast({
message: '验证码不匹配!',
theme: 'fail',
placement: 'bottom',
direction: 'column'
});
return;
}
console.log('登录成功');
wx.setStorageSync('userInfo',this.data.body);
wx.setStorageSync('userToken','123456');
wx.redirectTo({url:'/pages/myself/index'});
}
});