logins.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. </template>
  3. <script>
  4. // 工作台过来的登录
  5. import user from '@/http/api/user'
  6. import { setToken,getToken } from '@/utils/auth'
  7. export default {
  8. data() {
  9. return {}
  10. },
  11. mounted() {
  12. this.GetUserInfo()
  13. },
  14. methods: {
  15. //获取用户信息
  16. GetUserInfo() {
  17. const token=localStorage.getItem('token');//获取token
  18. console.log("打印获取的token",token);
  19. setToken(token);
  20. alert(token);
  21. this.$store.dispatch('user/getUserInfoByToken').then(user => {
  22. sessionStorage.setItem('schoolType', 2) //1:单校 2:联校// 暂时写死单校 线上还是单校的
  23. // let userInfos = this.$store.state.user.userInfo
  24. // if (userInfos.phone) {
  25. // const directUrl = '/jointStudentAnalysisReport/list'
  26. // this.$router.push({ path: directUrl })
  27. // } else {
  28. // this.$router.push({ path: '/userInfo/personInfo' })
  29. // }
  30. }) //获取用户登录信息
  31. }
  32. }
  33. }
  34. </script>
  35. <style lang="scss">
  36. @use '@/styles/login.scss';
  37. </style>