mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-16 22:36:43 +08:00
2022年5月29日从svn移到git
This commit is contained in:
60
src/views/Loading.vue
Normal file
60
src/views/Loading.vue
Normal file
@@ -0,0 +1,60 @@
|
||||
<template>
|
||||
<div>
|
||||
<!--页面加载,加载完成后-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Cookies from 'vue-cookies'
|
||||
import apiLogin from '@/api/login.js'
|
||||
import { getToken,setToken } from '@/utils/token'
|
||||
export default{
|
||||
mounted(){
|
||||
this.toUrl=this.$route.query.returnUrl;
|
||||
let token=getToken();
|
||||
let $this=this;
|
||||
if(!token){
|
||||
//console.log(token,'未获取token');
|
||||
setTimeout(function(){
|
||||
$this.curToken=getToken();
|
||||
if(!$this.curToken){
|
||||
//console.log(token,'第二次未获取token');
|
||||
location.href=this.webBaseUrl+process.env.VUE_APP_LOGIN_URL;
|
||||
}else{
|
||||
$this.boeLogin();
|
||||
}
|
||||
|
||||
},500);
|
||||
}else{
|
||||
this.curToken=token;
|
||||
this.boeLogin();
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
curToken:'',
|
||||
toUrl:''
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
boeLogin(){
|
||||
apiLogin.boeLogin(this.curToken).then(rs=>{
|
||||
if(rs.status==200){
|
||||
//setToken(rs.result.access_token);
|
||||
if(this.toUrl){
|
||||
location.href=this.toUrl;
|
||||
}else{
|
||||
this.$router.push({ path: "/study/index" })
|
||||
}
|
||||
//this.$router.push({ path: "/index" })
|
||||
}else{
|
||||
this.$message.error("转化token失败");
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user