phoneValidation.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div>
  3. <template v-if="isMobile">
  4. <validationPhone-stepSelect v-if="step === 'select'" @stepEvent="setStep" @setDataEvent="setInfo"/>
  5. <validationPhone-stepMobile v-if="step === 'mobile'" @stepEvent="setStep" @tokenEvent="loadToken" :info="info"/>
  6. <validationPhone-stepEmail v-if="step === 'email'" @stepEvent="setStep" :info="info"/>
  7. <validationPhone-stepSecurity v-if="step === 'questions'" @stepEvent="setStep" @tokenEvent="loadToken"/>
  8. <validationPhone-stepNew v-if="step === 'new'" @stepEvent="setStep" @lastEvent="setStepLast" :stepLast="stepLast" :tokenId="tokenId"/>
  9. <validationPhone-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. <phone-stepSelect v-if="step === 'select'" @stepEvent="setStep" @setDataEvent="setInfo"/>
  15. <phone-stepMobile v-if="step === 'mobile'" @stepEvent="setStep" @tokenEvent="loadToken" :info="info"/>
  16. <phone-stepEmail v-if="step === 'email'" @stepEvent="setStep" :info="info"/>
  17. <phone-stepSecurity v-if="step === 'questions'" @stepEvent="setStep" @tokenEvent="loadToken" :info="info"/>
  18. <phone-stepNew v-if="step === 'new'" @stepEvent="setStep" @lastEvent="setStepLast" :tokenId="tokenId"/>
  19. <phone-stepSuccess v-if="step === 'last'" @stepEvent="setStep"/>
  20. </template>
  21. </div>
  22. </template>
  23. <script>
  24. import AccountCenterHeader from '~components/default/AccountCenterHeader.vue'
  25. import { PhoneStepSelect, PhoneStepMobile, PhoneStepEmail, PhoneStepSecurity, PhoneStepNew, PhoneStepSuccess } from '~components/validation'
  26. import {ValidationPhoneStepSelect, ValidationPhoneStepMobile, ValidationPhoneStepEmail, ValidationPhoneStepSecurity, ValidationPhoneStepNew, ValidationPhoneStepSuccess, StepAppeal} from '~components/mobile/validation'
  27. export default {
  28. layout (context) {
  29. return context.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: 'new'
  42. }
  43. },
  44. components: {
  45. AccountCenterHeader,
  46. PhoneStepSelect,
  47. PhoneStepMobile,
  48. PhoneStepEmail,
  49. PhoneStepSecurity,
  50. PhoneStepNew,
  51. PhoneStepSuccess,
  52. ValidationPhoneStepSelect,
  53. ValidationPhoneStepMobile,
  54. ValidationPhoneStepEmail,
  55. ValidationPhoneStepSecurity,
  56. ValidationPhoneStepNew,
  57. ValidationPhoneStepSuccess,
  58. StepAppeal
  59. },
  60. computed: {
  61. isMobile () {
  62. return this.$store.state.option.isMobile
  63. }
  64. },
  65. mounted () {
  66. if (!this.$route.query.token) {
  67. if (this.logged.isLogin) {
  68. this.step = 'select'
  69. } else {
  70. this.$router.push('/')
  71. }
  72. } else {
  73. if (!this.logged.isLogin) {
  74. this.$route.query.token ? this.step = 'new' : this.step = 'select'
  75. }
  76. }
  77. },
  78. methods: {
  79. setStep (type) {
  80. this.step = type
  81. },
  82. setInfo (style) {
  83. this.info = style
  84. },
  85. loadToken (token) {
  86. this.tokenId = token
  87. },
  88. setStepLast (type) {
  89. this.stepLast = type
  90. }
  91. }
  92. }
  93. </script>