提交 75cfd951 编写于 作者: A Anne_LXM

修复 重置密码时提示未同意隐私政策的问题

上级 2c87cbbf
......@@ -34,7 +34,7 @@
},
methods: {
sendSmsCode() {
this.smsCodeRef!.$callMethod('sendSmsCode');
this.smsCodeRef!.$callMethod('sendSmsCode',true);
},
smsCodeInput(param : UTSJSONObject) {
// console.log('smsCodeInput param', param);
......
......@@ -6,7 +6,7 @@
<text class="sms-code-tip">短信验证码已发送至{{mobile}}</text>
<view class="code-input-list">
<template v-for="(_,i) in smsCodeList" :key="i">
<!-- TODO APP :value="item" -->
<!-- TODO APP :value="item" 第一次不触发@input -->
<input @input="setSmsCode(i,$event as InputEvent)" type="number" ref="code-input"
class="code-input" maxlength="7" @focus="onFocus(i)" />
</template>
......@@ -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'
}
......
......@@ -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({
......
......@@ -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: '重置成功',
......
......@@ -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',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册