encryptedSetting.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <div>
  3. <template v-if="isMobile">
  4. <step-select v-if="step === 'select'" @stepEvent="setStep" @setDataEvent="setInfo"/>
  5. <step-mobile v-if="step === 'mobile'" @stepEvent="setStep" @tokenEvent="loadToken" :info="info"/>
  6. <step-email v-if="step === 'email'" @stepEvent="setStep" :info="info"/>
  7. <step-new v-if="step === 'new'" @stepEvent="setStep" :tokenId="tokenId"/>
  8. <step-success v-if="step === 'success'"/>
  9. </template>
  10. <template v-else>
  11. <accountCenter-header/>
  12. <encrypted-select v-if="step === 'select'" @stepEvent="setStep" @setDataEvent="setInfo"/>
  13. <encrypted-mobile v-if="step === 'mobile'" @stepEvent="setStep" @tokenEvent="loadToken" :info="info"/>
  14. <encrypted-email v-if="step === 'email'" @stepEvent="setStep" :info="info"/>
  15. <encrypted-new v-if="step === 'new'" @stepEvent="setStep" :tokenId="tokenId"/>
  16. <encrypted-success v-if="step === 'success'"/>
  17. </template>
  18. </div>
  19. </template>
  20. <script>
  21. import AccountCenterHeader from '~components/default/AccountCenterHeader.vue'
  22. import {EncryptedSelect, EncryptedMobile, EncryptedEmail, EncryptedNew, EncryptedSuccess} from '~components/encrypted-setting'
  23. import {StepSelect, StepMobile, StepEmail, StepNew, StepSuccess} from '~components/mobile/encryptedSetting'
  24. export default {
  25. layout (content) {
  26. return content.store.state.option.isMobile ? 'mobile' : 'default'
  27. },
  28. transition: {
  29. name: 'fade',
  30. mode: 'out-in'
  31. },
  32. data () {
  33. return {
  34. step: 'select',
  35. info: '',
  36. tokenId: ''
  37. }
  38. },
  39. components: {
  40. AccountCenterHeader,
  41. EncryptedSelect,
  42. EncryptedMobile,
  43. EncryptedEmail,
  44. EncryptedNew,
  45. EncryptedSuccess,
  46. StepSelect,
  47. StepMobile,
  48. StepEmail,
  49. StepNew,
  50. StepSuccess
  51. },
  52. mounted () {
  53. if (this.$route.query.token) {
  54. this.step = 'new'
  55. } else {
  56. if (this.$store.state.option.isLogin.data.content.isLogin) {
  57. this.step = 'select'
  58. } else {
  59. this.$router.push('/')
  60. }
  61. }
  62. },
  63. computed: {
  64. isMobile () {
  65. return this.$store.state.option.isMobile
  66. }
  67. },
  68. methods: {
  69. setStep (step) {
  70. this.step = step
  71. },
  72. setInfo (info) {
  73. this.info = info
  74. },
  75. loadToken (token) {
  76. this.tokenId = token
  77. }
  78. }
  79. }
  80. </script>