SendVerifyCode.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  5. // +----------------------------------------------------------------------
  6. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  7. // +----------------------------------------------------------------------
  8. // | Author: CRMEB Team <admin@crmeb.com>
  9. // +----------------------------------------------------------------------
  10. export default {
  11. data() {
  12. return {
  13. disabled: false,
  14. text: this.$t('验证码'),
  15. runTime: undefined,
  16. captchaType: 'clickWord'
  17. };
  18. },
  19. methods: {
  20. sendCode() {
  21. console.log('sendcode');
  22. if (this.disabled) return;
  23. this.disabled = true;
  24. let n = 60;
  25. this.text = this.$t('剩余') + n + "s";
  26. this.runTime = setInterval(() => {
  27. n = n - 1;
  28. if (n < 0) {
  29. clearInterval(this.runTime);
  30. this.disabled = false;
  31. this.text = this.$t('重新获取');
  32. return
  33. }
  34. this.text = this.$t('剩余') + n + "s";
  35. }, 1000);
  36. }
  37. },
  38. onHide() {
  39. clearInterval(this.runTime);
  40. }
  41. };