From 61c10db52aabaaa30d91df9f9f0af9e7aa822e0d Mon Sep 17 00:00:00 2001 From: li Date: Tue, 31 Mar 2026 10:53:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B3=A8=E5=86=8C=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=9B=BE=E5=BD=A2=E9=AA=8C=E8=AF=81=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 移除邮箱/手机OTP发送逻辑 2. 新增算术图形验证码(如 15 + 3 = ?) 3. 点击验证码图片可刷新 4. 注册失败自动刷新验证码 --- pages/login/register.vue | 71 ++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 46 deletions(-) diff --git a/pages/login/register.vue b/pages/login/register.vue index 58ba065..3734ae8 100644 --- a/pages/login/register.vue +++ b/pages/login/register.vue @@ -56,8 +56,9 @@ {{i18n.regist.code}} - - {{codeText}} + + + @@ -93,22 +94,15 @@ code: '', referral_code: '', flag: true, - time: '获取验证码', - timeFlag: true, agreed: false, theme: '', + captchaImg: '', + captchaKey: '', } }, computed: { i18n() { return this.$t('message'); - }, - codeText() { - if (this.time > 0) { - return this.time + " s" - } else { - return this.i18n.regist.get - } } }, onLoad(e) { @@ -116,6 +110,7 @@ if (e && e.code) { this.referral_code = e.code } + this.loadCaptcha() }, onShow() { if (uni.getStorageSync("theme") == "dark") { @@ -163,6 +158,7 @@ email: this.email, password: this.password, code: this.code, + captcha_key: this.captchaKey, referral_code: this.referral_code, } if (this.mobile) { @@ -179,40 +175,17 @@ url: '/pages/login/index?email=' + this.email }) }, 500) + } else { + // 注册失败刷新验证码 + this.loadCaptcha() } }) }, - cutTime() { - if (!this.timeFlag) return - if (this.email == "") { - this.tos(this.i18n.regist.phoneTag) - return - } - uni.showLoading({ - title: this.i18n.regist.loading, - mask: true - }) - this.timeFlag = false - this.post('/ems/send', { - email: this.email, - event: "register", - }).then(res => { - uni.hideLoading() + loadCaptcha() { + this.post('/common/captcha', {}).then(res => { if (res.code == 1) { - this.tos(res.msg) - this.time = 120 - var that = this - let timeName = setInterval(() => { - if (that.time > 0) { - that.time-- - } else { - that.time = 0 - that.timeFlag = true - clearInterval(timeName) - } - }, 1000) - } else { - this.timeFlag = true + this.captchaImg = res.data.captcha_img + this.captchaKey = res.data.captcha_key } }) } @@ -289,13 +262,19 @@ color: #111111; } - .regCodeBtn { - font-size: 26rpx; - font-weight: 700; - color: #1A74FF; + .regCaptchaImg { + width: 200rpx; + height: 60rpx; margin-left: 18rpx; flex: 0 0 auto; - white-space: nowrap; + border-radius: 6rpx; + } + + .regCaptchaRefresh { + font-size: 36rpx; + color: #1A74FF; + margin-left: 12rpx; + flex: 0 0 auto; } .regAgree {