From 0d9c13a852145079d836dc4a559c205a778eb25e Mon Sep 17 00:00:00 2001 From: lancer <1905818361@qq.com> Date: Mon, 24 Jan 2022 15:23:18 +0800 Subject: [PATCH] init --- pages/login/Setthepassword.vue | 88 ++++++++++++++++++++++++++++++---- pages/login/Verification.vue | 66 +++++++++++++++++++++++-- pages/login/index.vue | 5 +- utils/domain.js | 15 +++--- 4 files changed, 155 insertions(+), 19 deletions(-) diff --git a/pages/login/Setthepassword.vue b/pages/login/Setthepassword.vue index e818f21..88ca652 100644 --- a/pages/login/Setthepassword.vue +++ b/pages/login/Setthepassword.vue @@ -1,17 +1,38 @@ @@ -24,14 +45,22 @@ data() { return { username: '', //获取到的密码 - phone: '' + phone: '', + auth_time: 0, + sendAuthCode: true, + msg: '', + code:'' } }, onLoad: function(options) { - this.phone = options.username + // this.phone = options.username }, methods: { bindWxBLogin() { + if(this.code!=this.msg){ + util.showNone("验证码错误"); + return false; + } if (this.username.length < 6) { util.showNone("密码小于6位,请重试"); return false; @@ -40,6 +69,7 @@ username: this.phone, //手机号 newpassword: this.username, //密码 } + uni.request({ url: config.service.forgotPassword, header: { @@ -61,7 +91,45 @@ } - } + }, + //获取验证码 + getAuthCode() { + if (this.phone == '') { + uni.showToast({ + title: '手机号不能为空', + icon: 'none' + }); + return + } + this.code='' + uni.request({ + url: config.service.sendCode + "/" + this.phone, + method: "GET", + header: { + 'content-type': 'application/json', + }, + success: (data) => { + console.log(data) + // 成功地响应会话信息 + if (data.data.code == 0) { + util.showSuccess('发送成功'); + this.code=data.data.data + this.sendAuthCode = false; + this.auth_time = 60; + var auth_timetimer = setInterval(() => { + this.auth_time--; + if (this.auth_time <= 0) { + this.sendAuthCode = true; + clearInterval(auth_timetimer); + } + }, 1000); + } else { + util.showNone(data.data.msg); + return false; + } + }, + }) + }, } }; @@ -116,8 +184,10 @@ margin: 0 auto; height: 88rpx; overflow: hidden; - border-bottom: 1rpx solid #BFC7D3; + border: 1rpx solid #BFC7D3; position: relative; + border-radius: 12rpx; + padding-left: 20rpx; } .center { diff --git a/pages/login/Verification.vue b/pages/login/Verification.vue index da5f875..c49d503 100644 --- a/pages/login/Verification.vue +++ b/pages/login/Verification.vue @@ -46,6 +46,7 @@