From 75cfd95119f3c9adf50e0d6297015e470b2983b3 Mon Sep 17 00:00:00 2001
From: Anne_LXM <54163582+anne-lxm@users.noreply.github.com>
Date: Tue, 30 Jan 2024 16:28:33 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E9=87=8D=E7=BD=AE?=
=?UTF-8?q?=E5=AF=86=E7=A0=81=E6=97=B6=E6=8F=90=E7=A4=BA=E6=9C=AA=E5=90=8C?=
=?UTF-8?q?=E6=84=8F=E9=9A=90=E7=A7=81=E6=94=BF=E7=AD=96=E7=9A=84=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../uni-id-pages-x-loginBySmsCode.uvue | 2 +-
.../fab-sms-code-input.uvue | 9 ++------
.../uni-id-pages-x-smsCode.uvue | 21 ++++++-------------
.../pages/retrieve/retrieve.uvue | 4 +---
.../pages/userinfo/bindMobile/bindMobile.uvue | 8 ++-----
5 files changed, 12 insertions(+), 32 deletions(-)
diff --git a/uni_modules/uni-id-pages-x/components/uni-id-pages-x-loginBySmsCode/uni-id-pages-x-loginBySmsCode.uvue b/uni_modules/uni-id-pages-x/components/uni-id-pages-x-loginBySmsCode/uni-id-pages-x-loginBySmsCode.uvue
index 981f8bd..0a5ca6a 100644
--- a/uni_modules/uni-id-pages-x/components/uni-id-pages-x-loginBySmsCode/uni-id-pages-x-loginBySmsCode.uvue
+++ b/uni_modules/uni-id-pages-x/components/uni-id-pages-x-loginBySmsCode/uni-id-pages-x-loginBySmsCode.uvue
@@ -34,7 +34,7 @@
},
methods: {
sendSmsCode() {
- this.smsCodeRef!.$callMethod('sendSmsCode');
+ this.smsCodeRef!.$callMethod('sendSmsCode',true);
},
smsCodeInput(param : UTSJSONObject) {
// console.log('smsCodeInput param', param);
diff --git a/uni_modules/uni-id-pages-x/components/uni-id-pages-x-smsCode/fab-sms-code-input.uvue b/uni_modules/uni-id-pages-x/components/uni-id-pages-x-smsCode/fab-sms-code-input.uvue
index 786e509..62e6114 100644
--- a/uni_modules/uni-id-pages-x/components/uni-id-pages-x-smsCode/fab-sms-code-input.uvue
+++ b/uni_modules/uni-id-pages-x/components/uni-id-pages-x-smsCode/fab-sms-code-input.uvue
@@ -6,7 +6,7 @@
短信验证码已发送至{{mobile}}
-
+
@@ -71,7 +71,6 @@
hide() {
(this.$refs['popup'] as UniPopupComponentPublicInstance).close();
this.isOpen = false
- // console.log('hide success');
},
clear() {
this.smsCodeList = ["\u200b", "\u200b", "\u200b", "\u200b", "\u200b", "\u200b"];
@@ -83,14 +82,12 @@
}
},
setSmsCode(i : number, e : InputEvent) {
- // console.log('setSmsCode--',e);
const { value } = e.detail
- console.log('~~',value,value.length);
+ // console.log('~~',value,value.length);
// 已满6位数就直接调登录
let $value = value.replace(/\u200b/g, '')
if ($value.length == 6) {
// (this.$refs["code-input"] as Element[])[0].focus();
- // console.log('~~~~~', $value, $value.split(''));
$value.split('').forEach((item : string, index : number) => {
this.smsCodeList[index] = "\u200b" + item
})
@@ -100,7 +97,6 @@
if (value.length > 2) {
this.$nextTick(() => {
let newValue = value.slice(value.length - 1)
- // console.log('newValue', newValue);
this.smsCodeList[i] = newValue
})
}
@@ -124,7 +120,6 @@
}
},
onFocus(i : number) {
- // console.log("onFocus",i);
if (this.smsCodeList[i].length == 0) {
this.smsCodeList[i] = '\u200b'
}
diff --git a/uni_modules/uni-id-pages-x/components/uni-id-pages-x-smsCode/uni-id-pages-x-smsCode.uvue b/uni_modules/uni-id-pages-x/components/uni-id-pages-x-smsCode/uni-id-pages-x-smsCode.uvue
index 24d20c5..58a7ce9 100644
--- a/uni_modules/uni-id-pages-x/components/uni-id-pages-x-smsCode/uni-id-pages-x-smsCode.uvue
+++ b/uni_modules/uni-id-pages-x/components/uni-id-pages-x-smsCode/uni-id-pages-x-smsCode.uvue
@@ -61,7 +61,7 @@
sendSmsCaptcha() {
this.emitInput()
if (this.autoSend && this.sendSmsCaptcha.length == 4 && this.mobile.length == 11) {
- this.sendSmsCode()
+ this.sendSmsCode(true)
}
},
smsCode() {
@@ -71,7 +71,6 @@
mounted() {
this.fabSmsCodeInputEl = this.$refs["fab-sms-code-input"] as ComponentPublicInstance;
this.sendSmsCaptchaCP = this.$refs["sendSmsCaptcha"] as UniCaptchaComponentPublicInstance;
-
// 加载好,手机号码输入框就自动获取焦点
// TO 临时方案解决 this.$nextTick 无效,由setTimeout 300 代替
setTimeout(() => {
@@ -130,14 +129,13 @@
this.sendSmsCaptcha = ""
this.clearCodeInput()
this.hideCodeInput()
- // console.log('reset');
},
- sendSmsCode() {
- console.log("state.pendingAgreements", state.pendingAgreements);
- if (state.pendingAgreements) {
+ sendSmsCode(needAgreements:boolean) {
+ // console.log("state.pendingAgreements", state.pendingAgreements,needAgreements);
+ if (needAgreements && state.pendingAgreements) {
// uni.hideKeyboard();
this.sendSmsCaptchaCP!.setFocus(false);
- // web端有问题
+ // TODO web端有问题
// (this.$parent as ComponentPublicInstance).$callMethod("showPopupCaptcha", () => {
// if (!state.pendingAgreements) {
// this.sendSmsCode()
@@ -146,7 +144,7 @@
// 临时方案
uni.$emit('uni-id-pages-x-loginBySmsCode-showPopupCaptcha',()=>{
if (!state.pendingAgreements) {
- this.sendSmsCode()
+ this.sendSmsCode(false)
}
})
uni.showToast({
@@ -155,12 +153,10 @@
});
return
}
- // console.log('sendSmsCode');
// 如果还在倒计时就显示出来输入框,阻止发送
if (this.reverseNumber != 0) {
return this.showCodeInput()
}
-
let reg_mobile = /^1\d{10}$/;
if (!reg_mobile.test(this.mobile)) {
(this.$refs['mobileInput'] as UniIdPagesXInputComponentPublicInstance).setFocus(true)
@@ -171,7 +167,6 @@
})
return
}
-
if (this.sendSmsCaptcha.length != 4) {
this.sendSmsCaptchaCP!.setFocus(true)
uni.showToast({
@@ -181,14 +176,12 @@
});
return
}
-
// const param : UTSJSONObject
// console.log('sendSmsCode',{
// "mobile": this.mobile,
// "scene": "login-by-sms",
// "captcha": this.sendSmsCaptcha
// });
-
uni.showLoading({ "title": "发送中" })
const uniIdCo = uniCloud.importObject("uni-id-co", { "customUI": true })
uniIdCo.sendSmsCode({
@@ -205,14 +198,12 @@
icon: 'none',
duration: 3000
});
- // console.log('result', result);
this.showCodeInput()
})
.catch((err : any | null) : void => {
const error = err as UniCloudError
// console.error(error.message)
// console.error(error.code)
-
switch (error.code) {
case "uni-captcha-verify-fail":
uni.showToast({
diff --git a/uni_modules/uni-id-pages-x/pages/retrieve/retrieve.uvue b/uni_modules/uni-id-pages-x/pages/retrieve/retrieve.uvue
index 32ed41a..b4e1b84 100644
--- a/uni_modules/uni-id-pages-x/pages/retrieve/retrieve.uvue
+++ b/uni_modules/uni-id-pages-x/pages/retrieve/retrieve.uvue
@@ -84,7 +84,7 @@
}
});
}
- this.smsCodeRef!.sendSmsCode();
+ this.smsCodeRef!.sendSmsCode(false);
},
resetPwdBySms(param : UTSJSONObject) {
uni.showLoading({ "title": "请求中" })
@@ -95,8 +95,6 @@
uni.hideLoading()
})
.then((_ : UTSJSONObject) : void => {
- // console.log('then');
- // console.log(e);
this.smsCodeRef!.hideCodeInput();
uni.showToast({
title: '重置成功',
diff --git a/uni_modules/uni-id-pages-x/pages/userinfo/bindMobile/bindMobile.uvue b/uni_modules/uni-id-pages-x/pages/userinfo/bindMobile/bindMobile.uvue
index 96d3058..f82f6c2 100644
--- a/uni_modules/uni-id-pages-x/pages/userinfo/bindMobile/bindMobile.uvue
+++ b/uni_modules/uni-id-pages-x/pages/userinfo/bindMobile/bindMobile.uvue
@@ -23,16 +23,12 @@
captcha: ""
}
},
- computed: {
- },
- watch: {
- },
mounted() {
this.smsCodeEl = (this.$refs["smsCode"] as UniIdPagesXSmsCodeComponentPublicInstance)
},
methods: {
sendSmsCode() {
- this.smsCodeEl!.sendSmsCode();
+ this.smsCodeEl!.sendSmsCode(false);
},
smsCodeInput(param : UTSJSONObject) {
// console.log('smsCodeInput param', param);
@@ -70,7 +66,7 @@
uni.hideLoading()
})
.then((e : UTSJSONObject) : void => {
- console.log(e,"-----------");
+ // console.log(e);
uni.showToast({
title: '绑定成功',
icon: 'none',
--
GitLab