<template>

</template>
<script>
// 工作台过来的登录
import user from '@/http/api/user'
import { setToken,getToken } from '@/utils/auth'

export default {
  data() {
    return {}
  },
  mounted() {

    this.GetUserInfo()
  },
  methods: {


    //获取用户信息
    GetUserInfo() {

          
        const token=localStorage.getItem('token');//获取token
        console.log("打印获取的token",token);
        setToken(token);
        this.$store.commit('user/SET_TOKEN', token); // 同步更新 store 状态，否则请求拦截器中 store.getters.token 为空，不会携带 Authorization 头
        alert(token);
        this.$store.dispatch('user/getUserInfoByToken').then(user => {

         
            sessionStorage.setItem('schoolType', 2) //1:单校 2:联校// 暂时写死单校   线上还是单校的

            // let userInfos = this.$store.state.user.userInfo
            // if (userInfos.phone) {
            //   const directUrl = '/jointStudentAnalysisReport/list'

            //   this.$router.push({ path: directUrl })
            // } else {
            //   this.$router.push({ path: '/userInfo/personInfo' })
            
            // }
        }) //获取用户登录信息
       
    }
  }
}
</script>

<style lang="scss">
@use '@/styles/login.scss';
</style>
