Browse Source

短信发送,增加读秒限制

origin/sync_user
zhangyongzhangyong 4 years ago
parent
commit
6fcd58a04b
  1. 20
      src/views/modules/epidemic/epidemicreportuserinfo.vue

20
src/views/modules/epidemic/epidemicreportuserinfo.vue

@ -518,8 +518,8 @@
<el-form-item> <el-form-item>
<span style="display:inline-block">验证码将下发到 {{this.checkMobile}} 请注意查收</span> <span style="display:inline-block">验证码将下发到 {{this.checkMobile}} 请注意查收</span>
</el-form-item> </el-form-item>
<el-input v-model="smsCode" placeholder="请输入验证码" style="width:76%; padding-right:10px;"></el-input> <el-input v-model="smsCode" placeholder="请输入验证码" style="width:62%; padding-right:10px;"></el-input>
<el-button type="primary" @click="sendSMS()" style="width:24%">获取验证码</el-button> <el-button type="primary" @click="sendSMS()" style="width:36%" :disabled="this.isDisabled">{{this.buttonName}}</el-button>
</el-form> </el-form>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -656,7 +656,10 @@ export default {
detailVisible: false, detailVisible: false,
dialogVisibleSMS: false, dialogVisibleSMS: false,
smsCode: '', smsCode: '',
checkMobile: '' checkMobile: '',
isDisabled: false,
buttonName: "发送验证码",
buttonTime: 60
} }
}, },
created: function () { created: function () {
@ -996,6 +999,17 @@ export default {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
var countDown = setInterval(() => {
if (this.buttonTime < 1) {
this.isDisabled = false
this.buttonName = '获取验证码'
this.buttonTime = 60
clearInterval(countDown)
} else {
this.isDisabled = true
this.buttonName = '(' + --this.buttonTime + '秒)后重新发送'
}
}, 1000)
}) })
.catch(() => { }) .catch(() => { })
}, },

Loading…
Cancel
Save