SendVerifyCode.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. if (this.disabled) return;
  22. this.disabled = true;
  23. let n = 60;
  24. this.text = this.$t('剩余') + n + "s";
  25. this.runTime = setInterval(() => {
  26. n = n - 1;
  27. if (n < 0) {
  28. clearInterval(this.runTime);
  29. this.disabled = false;
  30. this.text = this.$t('重新获取');
  31. return
  32. }
  33. this.text = this.$t('剩余') + n + "s";
  34. }, 1000);
  35. }
  36. },
  37. onHide() {
  38. clearInterval(this.runTime);
  39. }
  40. };