<template>
    <div>
        <!-- <div>{{msg}}</div> -->
    </div>
</template>
<script>
import { projectName } from "../config";
export default {
    components: {
        
    },
    data(){
        return {
            msg:"这是单点登录中间页"
        }
    },
    mounted(){
        console.log(this.$route.params);
        this.getReturnUrl();
    },
    methods: {
        getReturnUrl(){
            let params="";
            for(let i in this.$route.params){
                params+="&"+i+"="+this.$route.params[i];
            }
            // if(this.$route.params.access_token){
            //     this.$store.dispatch('user/setToken',this.$route.params.access_token);
            // }
            if(this.$route.params.redirect){
                location=this.$route.params.redirect;
            }else{
                if(window.HIVUI_SETTING.mainPageUrl){
                    if(window.HIVUI_SETTING.mainPageUrl.indexOf("?")==-1){
                        params="?"+params.substring(1);
                    }
                    location=window.HIVUI_SETTING.mainPageUrl+params;
                }else{
                    params="?"+params.substring(1);
                    location="/" + projectName +  "/hivuiMain/index.html"+params+"#/";
                }
            }
        },
    },
};
</script>