emailValidation.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <div>
  3. <template v-if="isMobile">
  4. <validationEmail-stepSelect v-if="step === 'select'" @stepEvent="setStep" @setDataEvent="setInfo"/>
  5. <validationEmail-stepMobile v-if="step === 'mobile'" @stepEvent="setStep" @tokenEvent="loadToken" :info="info"/>
  6. <validationEmail-stepEmail v-if="step === 'email'" @stepEvent="setStep" :info="info"/>
  7. <validationEmail-stepSecurity v-if="step === 'questions'" @stepEvent="setStep" @tokenEvent="loadToken"/>
  8. <validationEmail-stepNew v-if="step === 'new'" @stepEvent="setStep" :tokenId="tokenId"/>
  9. <validationEmail-stepSuccess v-if="step === 'last'" @stepEvent="setStep" :stepLast="stepLast"/>
  10. <step-appeal v-if="step === 'appeal'" @stepEvent="setStep" @lastEvent="setStepLast"/>
  11. </template>
  12. <template v-else>
  13. <accountCenter-header/>
  14. <email-stepSelect v-if="step === 'select'" @stepEvent="setStep" @setDataEvent="setInfo"/>
  15. <email-stepMobile v-if="step === 'mobile'" @stepEvent="setStep" @tokenEvent="loadToken" :info="info"/>
  16. <email-stepEmail v-if="step === 'email'" @stepEvent="setStep" :info="info"/>
  17. <email-stepSecurity v-if="step === 'questions'" @stepEvent="setStep" @tokenEvent="loadToken" :info="info"/>
  18. <email-stepNew v-if="step === 'new'" @stepEvent="setStep" :tokenId="tokenId"/>
  19. <email-stepSuccess v-if="step === 'last'" @stepEvent="setStep" :stepLast="stepLast"/>
  20. </template>
  21. </div>
  22. </template>
  23. <script>
  24. import AccountCenterHeader from '~components/default/AccountCenterHeader.vue'
  25. import { EmailStepSelect, EmailStepMobile, EmailStepEmail, EmailStepSecurity, EmailStepNew, EmailStepSuccess } from '~components/validation'
  26. import {ValidationEmailStepSelect, ValidationEmailStepMobile, ValidationEmailStepEmail, ValidationEmailStepSecurity, ValidationEmailStepNew, ValidationEmailStepSuccess, StepAppeal} from '~components/mobile/validation'
  27. export default {
  28. layout (content) {
  29. return content.store.state.option.isMobile ? 'mobile' : 'default'
  30. },
  31. middleware: 'authenticated',
  32. transition: {
  33. name: 'fade',
  34. mode: 'out-in'
  35. },
  36. data () {
  37. return {
  38. step: 'select',
  39. info: '',
  40. tokenId: '',
  41. stepLast: 'last'
  42. }
  43. },
  44. components: {
  45. AccountCenterHeader,
  46. EmailStepSelect,
  47. EmailStepMobile,
  48. EmailStepEmail,
  49. EmailStepSecurity,
  50. EmailStepNew,
  51. EmailStepSuccess,
  52. ValidationEmailStepSelect,
  53. ValidationEmailStepMobile,
  54. ValidationEmailStepEmail,
  55. ValidationEmailStepSecurity,
  56. ValidationEmailStepNew,
  57. ValidationEmailStepSuccess,
  58. StepAppeal
  59. },
  60. mounted () {
  61. if (!this.$route.query.token) {
  62. if (this.logged.isLogin) {
  63. this.step = 'select'
  64. } else {
  65. this.$router.push('/')
  66. }
  67. } else {
  68. if (this.$route.query.step === '2') {
  69. this.$router.push('/validation/emailValidation?token=' + this.$route.query.token + '&step=2')
  70. this.step = 'new'
  71. } else if (this.$route.query.step === '3') {
  72. this.$router.push('/validation/emailValidation?token=' + this.$route.query.token + '&step=3')
  73. this.step = 'last'
  74. this.stepLast = 'last'
  75. }
  76. }
  77. },
  78. computed: {
  79. logged () {
  80. return this.$store.state.option.isLogin.data.content
  81. },
  82. isMobile () {
  83. return this.$store.state.option.isMobile
  84. }
  85. },
  86. methods: {
  87. setStepLast (type) {
  88. this.stepLast = type
  89. },
  90. setStep (step) {
  91. this.step = step
  92. },
  93. setInfo (info) {
  94. this.info = info
  95. },
  96. loadToken (token) {
  97. this.tokenId = token
  98. }
  99. }
  100. }
  101. </script>