<template>
    <router-view/>
</template>
<script>
import { projectName } from "./config";
import { getUrlValue,getUrlSearch } from "./utils/index";
import merge from 'lodash/merge';
export default {
  components: {},
  data() {
    return {
      
    };
  },
  computed: {
    
  },
  async created() {
    let _pt=window.__loginCfg&&window.__loginCfg.pageType;
    let _red=window.__loginCfg&&window.__loginCfg.redirect;
    let _param=this.getParam();
    let urlPn=getUrlValue(location.href,"pn")
    if(urlPn){
      if(!getUrlValue(window.HIVUI_SETTING.loginUrl,"pn")){
          window.HIVUI_SETTING.loginUrl+="?pn="+urlPn;
      }
      if(!getUrlValue(window.HIVUI_SETTING.mainPageUrl,"pn")){
          window.HIVUI_SETTING.mainPageUrl+="?pn="+urlPn;
      }
    }
    if(_pt){
        switch(_pt){
            case "mini":
              this.$router.replace({
                  name:"miniLogin",
                  params:_param,
              });
              break;
            case "middle":
              this.$router.replace({
                  name:"middlePage",
                  params:_param,
              });
              break;
            case "sso-middle":
              this.$router.replace({
                  name:"ssoMiddlePage",
                  params:_param,
              });
              break;
        }
    }
    await this.$store.dispatch('user/getProjectDefValue',{
      key:"checkPhone",
      defaultValue:true,
    }).then((res)=>{
      if(typeof(res)!="undefined" && window.customSysCofig){
        window.customSysCofig.__checkPhone=res;
      }
    });
  },
  mounted(){
    //window.customSysCofig=merge(window.default_customSysCfg,window.customSysCofig||{});
  },
  methods: {
    getParam(){
      let hash=location.hash;
      let result={};
      result=getUrlSearch("?"+hash.substring(2));
      return result;
    },
  },
};
</script>
<style lang="scss">
</style>

