Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

verify_token.vue 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <div>
  3. <h2 style="text-align:center;">加载中...</h2>
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. created() {
  9. // alert(this.$route.query.token)
  10. this.$store.dispatch('VerifyToken', this.$route.query.token).then(() => {
  11. this.$store.dispatch('xt_GenerateRoutes', this.$store.getters.current_role_urls).then(() => {
  12. this.$store.dispatch('VerifyConfigList').then(() => {
  13. // alert('token 验证成功')
  14. // console.log(this.$store.getters.xt_permission.addRouters)
  15. this.$router.addRoutes(this.$store.getters.xt_permission.addRouters) // 动态添加可访问路由表
  16. // next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
  17. if(this.$store.getters.current_role_urls.includes('/dialysis/dialysisrecord')){
  18. this.$router.replace({ path: '/dialysis/dialysisrecord' })
  19. }else{
  20. this.$router.replace({ path: '/home' })
  21. }
  22. })
  23. })
  24. }).catch((error) => {
  25. // alert('token 验证失败' + error)
  26. if (error.code == 6016 || error.code == 6017) {
  27. window.location.href = process.env.BASE_API + "/handle_error?code=" + error.code
  28. } else if (error.code == 6008) { // 令牌无效
  29. window.location.href = process.env.BASE_API + '/login?relogin=true'
  30. } else {
  31. this.$message.error("token 验证失败: " + error.msg)
  32. // alert('token 验证失败' + error.msg)
  33. // window.location.href = process.env.BASE_API + '/login'
  34. }
  35. })
  36. }
  37. }
  38. </script>