微信小程序登录控制esp8266Page({data: {Name: '',Password: '',Emil:''},denglu(){wx.navigateTo({url: '/pages/logs/logs',})},//获取用户名inputName (event) {console.log('获取输入的账号', event.detail.detail.value)this.setData({Name :event.detail.detail.value})},inputPassword (event) {this.setData({Password :event.detail.detail.value})},//inputPhone: function (event) {// this.setData({// Phone :event.detail.detail.value// })//},inputEmil: function (event) {this.setData({Emil :event.detail.detail.value})},//获取用户账号//getZhanghao(event) {// console.log('获取输入的账号', event.detail.value)// this.setData({// zhanghao: event.detail.value// })//},// 获取密码//getMiMa(event) {// console.log('获取输入的密码', event.detail.value)// this.setData({// mima: event.detail.value// })//},
//注册zhuce() {let Name = this.data.Namelet Password = this.data.Passwordlet Emil = this.data.Emilconsole.log("点击了注册")console.log("name", Name)console.log("pass", Password)console.log("emil", Emil)//校验用户名if (Name.length < 11) {wx.showToast({icon: 'none',title: '手机号是11位',})return}if (Name.length > 11) {wx.showToast({icon: 'none',title: '手机号是11位',})return}//校验账号if (Password.length < 4) {wx.showToast({icon: 'none',title: '账号至少4位',})return}//校验密码//if (Phone.length < 11) {// wx.showToast({// icon: 'none',// title: '手机号至少11位',// })// return//}//注册功能的实现wx.cloud.database().collection('user').add({data: {name: Name,pass:Password,yx: Emil},success(res) {console.log('注册成功', res)wx.showToast({title: '注册成功',})wx.navigateTo({url: '../logs/logs',})},fail(res) {console.log('注册失败', res)this.setData({res})}})}})
评论