stepEmail.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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>183****08@qq.com</strong> 进行验证,有效期7天</span>
  10. </div>
  11. <div class="page-part">
  12. <mt-button size="large" type="primary" @click="sureAccount('select')">发送验证请求</mt-button>
  13. </div>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. export default {
  19. name: 'step-email',
  20. data () {
  21. return {
  22. state: {
  23. mobile: 'error',
  24. captcha: 'error'
  25. },
  26. valid: {
  27. mobile: '',
  28. captcha: ''
  29. },
  30. imgSrc: ''
  31. }
  32. },
  33. methods: {
  34. jump (type) {
  35. this.$emit('stepEvent', type)
  36. },
  37. sureAccount (type) {
  38. if (this.state.mobile !== 'success' && this.state.captcha !== 'success') {
  39. this.downToast('请确认填写部分是否有误')
  40. } else {
  41. this.$indicator.open('验证过程中...')
  42. let param = new FormData()
  43. param.append('mobile', this.valid.mobile)
  44. param.append('captcha', this.valid.captcha)
  45. let config = {
  46. headers: {'Content-Type': 'multipart/form-data'}
  47. }
  48. this.$http.post(`/sso/resetPwd/checkCaptcha`, param, config)
  49. .then(response => {
  50. this.$indicator.close()
  51. if (response.data.success) {
  52. this.$emit('stepEvent', type)
  53. } else {
  54. this.getCode()
  55. this.downToast(response.data.errMsg)
  56. }
  57. }).catch(() => {
  58. this.$indicator.close()
  59. this.downToast('请检查网络是否正常或联系服务商')
  60. })
  61. }
  62. },
  63. getCode () {
  64. this.imgSrc = '/sso/resetPwd/checkCaptcha?timestamp=' + (new Date()).valueOf()
  65. }
  66. }
  67. }
  68. </script>