transitionPage.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <script setup>
  2. import { useRouter} from 'vue-router';
  3. import {onUnmounted, ref} from 'vue'
  4. const router = useRouter()
  5. /**
  6. * register - 注册成功
  7. * bindPhone - 绑定手机号
  8. */
  9. const transitionType=ref()
  10. let timer=null
  11. const time = ref(5)
  12. const bindPhonePageGo=()=>{
  13. router.replace('/bindPhoneNo')
  14. }
  15. const ybPageGo=()=>{
  16. let redirectPath=sessionStorage.getItem('login_redirect') || '/'
  17. sessionStorage.removeItem('login_redirect')
  18. router.replace(redirectPath)
  19. }
  20. onUnmounted(()=>{
  21. clearInterval(timer)
  22. })
  23. // -------------------created
  24. transitionType.value = sessionStorage.getItem('transitionPageMessage')
  25. // console.log(transitionType.value);
  26. // 判断是否是正常操作后的跳转,而不是人工在地址栏做的跳转
  27. if(!transitionType.value){
  28. router.replace('/')
  29. }else{
  30. if(transitionType.value =='bindPhone'){
  31. // 设置定时器
  32. timer=setInterval(()=>{
  33. if(time.value==1){
  34. ybPageGo()
  35. return
  36. }
  37. time.value--
  38. },1000)
  39. }
  40. }
  41. // 清除
  42. sessionStorage.removeItem('transitionPageMessage')
  43. </script>
  44. <template>
  45. <div class="hint-box" v-show="transitionType">
  46. <div class="fixed-header">
  47. <span @click="$router.replace('/')" style="cursor: pointer;">
  48. HORIZON INSIGHTS
  49. </span>
  50. </div>
  51. <img src="@/assets/icons/transition-success.svg" class="success-svg" />
  52. <p v-if="transitionType=='register'" class="transitioin-text">You have successfully registered</p>
  53. <p v-else-if="transitionType=='bindPhone'" class="transitioin-text">Registration succeeded. You will be automatically redirected in {{ time }} seconds.</p>
  54. <div class="register-buttons" v-if="transitionType=='register'" >
  55. <el-button type="primary" class="transitioin-button" @click="bindPhonePageGo"
  56. style="background-color: #1856A7;">Add a phone number to your account</el-button>
  57. <el-button class="transitioin-button" @click="ybPageGo" style="margin-left: 0;margin-top: 20px;">Skip</el-button>
  58. </div>
  59. <el-button type="primary" class="transitioin-button" @click="ybPageGo"
  60. v-else-if="transitionType=='bindPhone'" style="background-color: #1856A7;">Got it</el-button>
  61. </div>
  62. </template>
  63. <style lang="scss" scoped>
  64. .hint-box{
  65. display: flex;
  66. align-items: center;
  67. justify-content: center;
  68. flex-direction: column;
  69. padding: 120px 30px;
  70. .success-svg{
  71. height: 60px;
  72. }
  73. .transitioin-text{
  74. margin: 20px 0 40px;
  75. font-weight: 400;
  76. font-size: 18px;
  77. line-height: 25px;
  78. color: #333333;
  79. }
  80. .register-buttons{
  81. display: flex;
  82. flex-direction: column;
  83. align-items: center;
  84. width: 100%;
  85. }
  86. .transitioin-button{
  87. width: 360px;
  88. height: 40px;
  89. }
  90. }
  91. @media screen and (max-width: 768px) {
  92. .hint-box{
  93. padding: 100px 30px;
  94. .success-svg{
  95. height: 100px;
  96. }
  97. .transitioin-text{
  98. font-size: 15px;
  99. }
  100. .transitioin-button{
  101. width: 100%;
  102. }
  103. }
  104. }
  105. </style>