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

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

上级 2c87cbbf
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
}, },
methods: { methods: {
sendSmsCode() { sendSmsCode() {
this.smsCodeRef!.$callMethod('sendSmsCode'); this.smsCodeRef!.$callMethod('sendSmsCode',true);
}, },
smsCodeInput(param : UTSJSONObject) { smsCodeInput(param : UTSJSONObject) {
// console.log('smsCodeInput param', param); // console.log('smsCodeInput param', param);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<text class="sms-code-tip">短信验证码已发送至{{mobile}}</text> <text class="sms-code-tip">短信验证码已发送至{{mobile}}</text>
<view class="code-input-list"> <view class="code-input-list">
<template v-for="(_,i) in smsCodeList" :key="i"> <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" <input @input="setSmsCode(i,$event as InputEvent)" type="number" ref="code-input"
class="code-input" maxlength="7" @focus="onFocus(i)" /> class="code-input" maxlength="7" @focus="onFocus(i)" />
</template> </template>
...@@ -71,7 +71,6 @@ ...@@ -71,7 +71,6 @@
hide() { hide() {
(this.$refs['popup'] as UniPopupComponentPublicInstance).close(); (this.$refs['popup'] as UniPopupComponentPublicInstance).close();
this.isOpen = false this.isOpen = false
// console.log('hide success');
}, },
clear() { clear() {
this.smsCodeList = ["\u200b", "\u200b", "\u200b", "\u200b", "\u200b", "\u200b"]; this.smsCodeList = ["\u200b", "\u200b", "\u200b", "\u200b", "\u200b", "\u200b"];
...@@ -83,14 +82,12 @@ ...@@ -83,14 +82,12 @@
} }
}, },
setSmsCode(i : number, e : InputEvent) { setSmsCode(i : number, e : InputEvent) {
// console.log('setSmsCode--',e);
const { value } = e.detail const { value } = e.detail
console.log('~~',value,value.length); // console.log('~~',value,value.length);
// 已满6位数就直接调登录 // 已满6位数就直接调登录
let $value = value.replace(/\u200b/g, '') let $value = value.replace(/\u200b/g, '')
if ($value.length == 6) { if ($value.length == 6) {
// (this.$refs["code-input"] as Element[])[0].focus(); // (this.$refs["code-input"] as Element[])[0].focus();
// console.log('~~~~~', $value, $value.split(''));
$value.split('').forEach((item : string, index : number) => { $value.split('').forEach((item : string, index : number) => {
this.smsCodeList[index] = "\u200b" + item this.smsCodeList[index] = "\u200b" + item
}) })
...@@ -100,7 +97,6 @@ ...@@ -100,7 +97,6 @@
if (value.length > 2) { if (value.length > 2) {
this.$nextTick(() => { this.$nextTick(() => {
let newValue = value.slice(value.length - 1) let newValue = value.slice(value.length - 1)
// console.log('newValue', newValue);
this.smsCodeList[i] = newValue this.smsCodeList[i] = newValue
}) })
} }
...@@ -124,7 +120,6 @@ ...@@ -124,7 +120,6 @@
} }
}, },
onFocus(i : number) { onFocus(i : number) {
// console.log("onFocus",i);
if (this.smsCodeList[i].length == 0) { if (this.smsCodeList[i].length == 0) {
this.smsCodeList[i] = '\u200b' this.smsCodeList[i] = '\u200b'
} }
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
sendSmsCaptcha() { sendSmsCaptcha() {
this.emitInput() this.emitInput()
if (this.autoSend && this.sendSmsCaptcha.length == 4 && this.mobile.length == 11) { if (this.autoSend && this.sendSmsCaptcha.length == 4 && this.mobile.length == 11) {
this.sendSmsCode() this.sendSmsCode(true)
} }
}, },
smsCode() { smsCode() {
...@@ -71,7 +71,6 @@ ...@@ -71,7 +71,6 @@
mounted() { mounted() {
this.fabSmsCodeInputEl = this.$refs["fab-sms-code-input"] as ComponentPublicInstance; this.fabSmsCodeInputEl = this.$refs["fab-sms-code-input"] as ComponentPublicInstance;
this.sendSmsCaptchaCP = this.$refs["sendSmsCaptcha"] as UniCaptchaComponentPublicInstance; this.sendSmsCaptchaCP = this.$refs["sendSmsCaptcha"] as UniCaptchaComponentPublicInstance;
// 加载好,手机号码输入框就自动获取焦点 // 加载好,手机号码输入框就自动获取焦点
// TO 临时方案解决 this.$nextTick 无效,由setTimeout 300 代替 // TO 临时方案解决 this.$nextTick 无效,由setTimeout 300 代替
setTimeout(() => { setTimeout(() => {
...@@ -130,14 +129,13 @@ ...@@ -130,14 +129,13 @@
this.sendSmsCaptcha = "" this.sendSmsCaptcha = ""
this.clearCodeInput() this.clearCodeInput()
this.hideCodeInput() this.hideCodeInput()
// console.log('reset');
}, },
sendSmsCode() { sendSmsCode(needAgreements:boolean) {
console.log("state.pendingAgreements", state.pendingAgreements); // console.log("state.pendingAgreements", state.pendingAgreements,needAgreements);
if (state.pendingAgreements) { if (needAgreements && state.pendingAgreements) {
// uni.hideKeyboard(); // uni.hideKeyboard();
this.sendSmsCaptchaCP!.setFocus(false); this.sendSmsCaptchaCP!.setFocus(false);
// web端有问题 // TODO web端有问题
// (this.$parent as ComponentPublicInstance).$callMethod("showPopupCaptcha", () => { // (this.$parent as ComponentPublicInstance).$callMethod("showPopupCaptcha", () => {
// if (!state.pendingAgreements) { // if (!state.pendingAgreements) {
// this.sendSmsCode() // this.sendSmsCode()
...@@ -146,7 +144,7 @@ ...@@ -146,7 +144,7 @@
// 临时方案 // 临时方案
uni.$emit('uni-id-pages-x-loginBySmsCode-showPopupCaptcha',()=>{ uni.$emit('uni-id-pages-x-loginBySmsCode-showPopupCaptcha',()=>{
if (!state.pendingAgreements) { if (!state.pendingAgreements) {
this.sendSmsCode() this.sendSmsCode(false)
} }
}) })
uni.showToast({ uni.showToast({
...@@ -155,12 +153,10 @@ ...@@ -155,12 +153,10 @@
}); });
return return
} }
// console.log('sendSmsCode');
// 如果还在倒计时就显示出来输入框,阻止发送 // 如果还在倒计时就显示出来输入框,阻止发送
if (this.reverseNumber != 0) { if (this.reverseNumber != 0) {
return this.showCodeInput() return this.showCodeInput()
} }
let reg_mobile = /^1\d{10}$/; let reg_mobile = /^1\d{10}$/;
if (!reg_mobile.test(this.mobile)) { if (!reg_mobile.test(this.mobile)) {
(this.$refs['mobileInput'] as UniIdPagesXInputComponentPublicInstance).setFocus(true) (this.$refs['mobileInput'] as UniIdPagesXInputComponentPublicInstance).setFocus(true)
...@@ -171,7 +167,6 @@ ...@@ -171,7 +167,6 @@
}) })
return return
} }
if (this.sendSmsCaptcha.length != 4) { if (this.sendSmsCaptcha.length != 4) {
this.sendSmsCaptchaCP!.setFocus(true) this.sendSmsCaptchaCP!.setFocus(true)
uni.showToast({ uni.showToast({
...@@ -181,14 +176,12 @@ ...@@ -181,14 +176,12 @@
}); });
return return
} }
// const param : UTSJSONObject // const param : UTSJSONObject
// console.log('sendSmsCode',{ // console.log('sendSmsCode',{
// "mobile": this.mobile, // "mobile": this.mobile,
// "scene": "login-by-sms", // "scene": "login-by-sms",
// "captcha": this.sendSmsCaptcha // "captcha": this.sendSmsCaptcha
// }); // });
uni.showLoading({ "title": "发送中" }) uni.showLoading({ "title": "发送中" })
const uniIdCo = uniCloud.importObject("uni-id-co", { "customUI": true }) const uniIdCo = uniCloud.importObject("uni-id-co", { "customUI": true })
uniIdCo.sendSmsCode({ uniIdCo.sendSmsCode({
...@@ -205,14 +198,12 @@ ...@@ -205,14 +198,12 @@
icon: 'none', icon: 'none',
duration: 3000 duration: 3000
}); });
// console.log('result', result);
this.showCodeInput() this.showCodeInput()
}) })
.catch((err : any | null) : void => { .catch((err : any | null) : void => {
const error = err as UniCloudError const error = err as UniCloudError
// console.error(error.message) // console.error(error.message)
// console.error(error.code) // console.error(error.code)
switch (error.code) { switch (error.code) {
case "uni-captcha-verify-fail": case "uni-captcha-verify-fail":
uni.showToast({ uni.showToast({
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
} }
}); });
} }
this.smsCodeRef!.sendSmsCode(); this.smsCodeRef!.sendSmsCode(false);
}, },
resetPwdBySms(param : UTSJSONObject) { resetPwdBySms(param : UTSJSONObject) {
uni.showLoading({ "title": "请求中" }) uni.showLoading({ "title": "请求中" })
...@@ -95,8 +95,6 @@ ...@@ -95,8 +95,6 @@
uni.hideLoading() uni.hideLoading()
}) })
.then((_ : UTSJSONObject) : void => { .then((_ : UTSJSONObject) : void => {
// console.log('then');
// console.log(e);
this.smsCodeRef!.hideCodeInput(); this.smsCodeRef!.hideCodeInput();
uni.showToast({ uni.showToast({
title: '重置成功', title: '重置成功',
......
...@@ -23,16 +23,12 @@ ...@@ -23,16 +23,12 @@
captcha: "" captcha: ""
} }
}, },
computed: {
},
watch: {
},
mounted() { mounted() {
this.smsCodeEl = (this.$refs["smsCode"] as UniIdPagesXSmsCodeComponentPublicInstance) this.smsCodeEl = (this.$refs["smsCode"] as UniIdPagesXSmsCodeComponentPublicInstance)
}, },
methods: { methods: {
sendSmsCode() { sendSmsCode() {
this.smsCodeEl!.sendSmsCode(); this.smsCodeEl!.sendSmsCode(false);
}, },
smsCodeInput(param : UTSJSONObject) { smsCodeInput(param : UTSJSONObject) {
// console.log('smsCodeInput param', param); // console.log('smsCodeInput param', param);
...@@ -70,7 +66,7 @@ ...@@ -70,7 +66,7 @@
uni.hideLoading() uni.hideLoading()
}) })
.then((e : UTSJSONObject) : void => { .then((e : UTSJSONObject) : void => {
console.log(e,"-----------"); // console.log(e);
uni.showToast({ uni.showToast({
title: '绑定成功', title: '绑定成功',
icon: 'none', icon: 'none',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册