微信小程序注册
来源:互联网 发布:吉田のしる知る 番号 编辑:程序博客网 时间:2024/05/17 09:10
就给一个View,其他的自己体会。。。。。。。。。。。。。。其他获取值一样
.xml中
<view class="input-pnone">手机号<input class="phoneInput" name='phoneInput' placeholder=" 请输入手机号" type="text" bindinput='photoClick' value="{{phoneInput}}" /></view>
.js中
data: { phoneInput: '', passWInput: '', TpassWInput: '', secretInput: '', answerInput: '' },// 获取手机号 photoClick: function (e) { this.setData({ phoneInput: e.detail.value }) }, // 首次输入密码 passWClick: function (e) { this.setData({ passWInput: e.detail.value }) }, // 再次确定密码 TpassWClick: function (e) { this.setData({ TpassWInput: e.detail.value }) }, //设置密保问题 secretClick: function (e) { this.setData({ secretInput: e.detail.value }) }, //设置密保答案 answerClick: function (e) { this.setData({ answerInput: e.detail.value }) }, reginzeClick: function () { //判断手机号 var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/; //判断字母加数字 var reg = /^[\u4E00-\u9FA5]{2,4}$/; // 判断输入的内容不能为空 if (this.data.phoneInput.length == 0 || this.data.passWInput.length == 0 || this.data.TpassWInput.length == 0 || this.data.secretInput.length == 0 || this.data.answerInput.length == 0) { wx.showToast({ title: '内容不能为空!', icon: 'success', duration: 1500 }) return false; } else if (this.data.phoneInput.length < 11) { wx.showToast({ title: '手机号长度有误!', icon: 'success', duration: 1500 }) return false; } else if (!myreg.test(this.data.phoneInput)) { wx.showToast({ title: '手机号有误!', icon: 'success', duration: 1500 }) return false; } else if (reg.test(this.data.passWInput) || this.data.TpassWInput.length < 6) { wx.showToast({ title: '密码仅限数字+字母且密码不能小于六位', icon: 'success', duration: 1500 }) return false; } else if (reg.test(this.data.TpassWInput) || this.data.TpassWInput.length < 6) { wx.showToast({ title: '密码仅限数字+字母', icon: 'success', duration: 1500 }) return false; } else if (this.data.passWInput != this.data.TpassWInput) { wx.showToast({ title: '两次输入的密码不同!', icon: 'success', duration: 1500 }) return false; } else { wx.setStorageSync('phoneInput', this.data.phoneInput); wx.request({ url: '公司提供的接口', data: { username: this.data.phoneInput, password: this.data.passWInput, pwdQuestion: this.data.secretInput, pwdAnswer: this.data.answerInput }, method: 'GET', success: function (res) { console.log('注册成功!!!!!!!!!!!!!!!') console.log(res); //注册成功 if (res.data.code == 119) { wx.redirectTo({ //---------------------------------------跳到成功页面 url: '../zcSuccess/zcSuccess', }) //执行失败 } else if (res.data.code == 106) { wx.showToast({ title: res.data.message, icon: 'success', duration: 1500 }) return false; // 注册用户名已存在,请直接登录 } else if (res.data.code == 117) { wx.showToast({ title: res.data.message, icon: 'success', duration: 1500 }) return false; // 昵称已存在 } else if (res.data.code == 118) { wx.showToast({ title: res.data.message, icon: 'success', duration: 1500 }) return false; // 已经执行过此操作 } else if (res.data.code == 113) { wx.showToast({ title: res.data.message, icon: 'success', duration: 1500 }) return false; } }, fail: function (res) { }, complete: function (res) { } }) } },
阅读全文
0 0
- 微信小程序注册流程
- 微信小程序注册
- 微信小程序注册
- 微信小程序注册
- 微信小程序注册知识
- 微信小程序注册
- 微信小程序之注册配置
- 微信小程序个人号注册
- 微信小程序注册流程详解
- 微信小程序注册和发布
- 微信小程序注册相关资料
- 【微信小程序 二】用户注册
- 【微信小程序】注册一个微信小程序
- 微信小程序之如何注册微信小程序
- 微信小程序注册教程-详细图文教程
- 微信小程序开发-短信注册功能
- 微信小程序注册开发教程(入门)
- 微信小程序-从注册到上架
- 小程序坑及案例
- markdown编辑器
- android 7.0 浏览器 拦截适配 shouldOverrideUrlLoading
- HAWQ + MADlib 玩转数据挖掘之(九)——回归方法之Logistic回归
- memcached全面剖析–3. memcached的删除机制和发展方向
- 微信小程序注册
- leetcode 236. Lowest Common Ancestor of a Binary Tree
- SSL P1255 佳佳的魔法照片
- python学习问题记录
- java动态代理(JDK和cglib)
- openCV图片显示到Qt控件QLabel
- 天气插件
- 阶段性总结面试产品经理
- 第三部分 数据结构(二)