phoneValidation.vue 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. logged () {
  65. return this.$store.state.option.isLogin.data.content
  66. }
  67. },
  68. mounted () {
  69. if (this.$route.query.token) {
  70. this.step = 'new'
  71. } else {
  72. if (this.logged.isLogin) {
  73. this.step = 'select'
  74. } else {
  75. this.$router.push('/')
  76. }
  77. }
  78. },
  79. methods: {
  80. setStep (type) {
  81. this.step = type
  82. },
  83. setInfo (style) {
  84. this.info = style
  85. },
  86. loadToken (token) {
  87. this.tokenId = token
  88. },
  89. setStepLast (type) {
  90. this.stepLast = type
  91. }
  92. }
  93. }
  94. </script>