Commit 5757ab1d by liimin

修改获取验证码连续点击问题

1 parent 441a7275
......@@ -4,7 +4,7 @@
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2022-11-10 17:07:01
* @LastEditTime: 2022-11-15 17:17:35
*/
// 根据环境引入不同配置 process.env.VUE_APP_ENV
let cfg = require('./conf.js')
......
......@@ -4,9 +4,17 @@
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-11-16 21:30:32
* @FilePath: \scrm\scrm-base\src\filters\filter.js
* @LastEditTime: 2022-11-14 10:09:19
* @FilePath: \scrm-base\src\filters\filter.js
*/
export function accountLevel(value) {
return ['-', '工厂', '省代', '市代', '门店'][value]
}
/**
* 手机号码脱敏处理(150****7717)
* @param {*} mobile
*/
export function encodeMobile(mobile) {
if (!mobile) return ''
return mobile.replace(mobile.substring(3, 7), '****')
}
......@@ -2,17 +2,17 @@
* @Author: limin
* @Date: 2022-11-07 11:16:08
* @LastEditors: limin
* @LastEditTime: 2022-11-08 14:36:39
* @LastEditTime: 2022-11-14 16:27:22
* @Description:
-->
<template>
<div class="com-login-sms-code-check">
<el-dialog title="手机号验证" :visible.sync="dialogVisible" top="32vh" width="576px" height="292px" :destroy-on-close="true" :close-on-click-modal="false">
<span class="notify">为了您的账号安全,请输入发送至 +86 {{ checkProps.mobile }} 的4位验证码</span>
<span class="notify">为了您的账号安全,请输入发送至 +86 {{ checkProps.mobile | encodeMobile }} 的4位验证码</span>
<el-form :model="smsCodeCheckForm" :validate-on-rule-change="true" @keyup.enter.native="submitForm" :rules="rules" ref="smsCodeCheckForm" class="smsCodeCheckForm">
<el-form-item prop="code">
<el-input v-model.trim="smsCodeCheckForm.code" autocomplete="off" placeholder="请输入短信验证码" maxlength="4" @input="onInput" :validate-event="false"></el-input>
<el-button type="text" @click="getSmsCode" v-show="!isShowtimeCounter">获取验证码</el-button>
<el-button type="text" @click="getSmsCode" v-show="!isShowtimeCounter" :disabled="isShowtimeCounter">获取验证码</el-button>
<span class="time-counter" v-show="isShowtimeCounter">{{ counter }}s</span>
</el-form-item>
</el-form>
......@@ -86,7 +86,7 @@ export default {
/**
* 获取短信验证码
*/
async getSmsCode() {
getSmsCode: utils.debounce(async function () {
try {
//打开计时器倒计时60秒
this.startTimer()
......@@ -100,7 +100,7 @@ export default {
} catch (error) {
Message.error(`获取短信验证码失败:${error.message}`)
}
},
}, 1000),
/**
* 异步验证短信验证码
* callback
......@@ -134,6 +134,7 @@ export default {
* 开启定时器 计时60秒
*/
startTimer() {
if (this.isShowtimeCounter) return
this.isShowtimeCounter = true
this.timer = setInterval(() => {
this.counter--
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!