phoneValidation.vue 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. this.$route.query.token ? this.step = 'new' : this.step = 'select'
  67. if (this.$route.query.token) {
  68. this.$router.push('/validation/phoneValidation?token=' + this.$route.query.token)
  69. }
  70. },
  71. methods: {
  72. setStep (type) {
  73. this.step = type
  74. },
  75. setInfo (style) {
  76. this.info = style
  77. },
  78. loadToken (token) {
  79. this.tokenId = token
  80. },
  81. setStepLast (type) {
  82. this.stepLast = type
  83. }
  84. }
  85. }
  86. </script>