ValidationEmailStepEmail.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <div class="f-main">
  3. <div class="content-top">
  4. <p>验证邮箱</p>
  5. <a href="javascript:void(0)" class="back" @click="jump('select')"><i class="el-icon-back"></i></a>
  6. </div>
  7. <div class="f-form">
  8. <div class="page-part">
  9. <span>使用电子邮箱 <strong>{{info | hide}}</strong> 进行验证,有效期7天</span>
  10. </div>
  11. <div class="page-part">
  12. <mt-button :disabled="hasSend" size="large"
  13. type="primary"
  14. @click="sureAccount()"
  15. v-text="secretEmail">发送验证请求</mt-button>
  16. </div>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. export default {
  22. name: 'step-email',
  23. props: ['info'],
  24. data () {
  25. return {
  26. secretEmail: '发送验证请求',
  27. hasSend: false
  28. }
  29. },
  30. filters: {
  31. hide: function (value) {
  32. let getEmailIndex = value.indexOf('@')
  33. if (getEmailIndex > 3) {
  34. let len = value.substring(3, getEmailIndex)
  35. value = value.replace(len, '***')
  36. }
  37. return value
  38. }
  39. },
  40. methods: {
  41. jump (type) {
  42. this.$emit('stepEvent', type)
  43. },
  44. // 警告弹窗
  45. downToast (type) {
  46. this.$toast({
  47. message: type,
  48. iconClass: 'el-icon-warning'
  49. })
  50. },
  51. // 发送邮件
  52. sureAccount () {
  53. this.$indicator.open('发送过程中...')
  54. this.$http.get(`/update/user/check/email`, {params: {email: this.info, operate: 'email'}})
  55. .then(response => {
  56. this.$indicator.close()
  57. if (response.data.success) {
  58. this.hasSend = true
  59. this.secretEmail = '已发送验证邮件,请查收'
  60. } else {
  61. this.hasSend = false
  62. this.downToast(response.data.errMsg)
  63. }
  64. }).catch(() => {
  65. this.$indicator.close()
  66. this.downToast('请检查网络是否正常或联系服务商')
  67. })
  68. }
  69. }
  70. }
  71. </script>