<template>
    <div style="background: #fff;">
        <div style="height:50px;line-height:50px">
            <span :class="informationsClass==1?'information2':'information1'" @click="getInformation(1)" class="cursor">{{$t('common.EssentialInformation')}}</span>
           <span :class="informationsClass==2?'information2':'information1'" @click="getInformation(2)" class="cursor" v-if="!unitEntityId">{{$t('common.PersonalInformation')}}</span>
            <span :class="informationsClass==3?'information2':'information1'" @click="getInformation(3)" class="cursor" v-if="!unitEntityId">{{$t('common.UnitInformation')}}</span>

            <span :class="informationsClass==2?'information2':'information1'" @click="getInformation(2)" class="cursor" v-if="unitEntityId">{{$t('common.UnitInformation')}}</span>
            <span :class="informationsClass==3?'information2':'information1'" @click="getInformation(3)" class="cursor" v-if="unitEntityId">{{$t('common.UnitPersonalInformation')}}</span>
        </div>
        <userCenterEssentialInformation v-if="informationsClass==1"></userCenterEssentialInformation>
       <userCenterPersonalInformation v-if="informationsClass==2"></userCenterPersonalInformation>
        <userCenterUnitInformation v-if="informationsClass==3"></userCenterUnitInformation>
        <userCenterEnterpriseUnitInformation v-if="informationsClass==2 && this.unitEntityId"></userCenterEnterpriseUnitInformation>
        <userCenterUnitPersonnelInformation v-if="informationsClass==3 && this.unitEntityId"></userCenterUnitPersonnelInformation>

    </div>
</template>
<script>
    import userCenterEssentialInformation from './userCenterEssentialInformation' // 基本信息
    import userCenterPersonalInformation from './userCenterPersonalInformation'  // 个人信息
    import userCenterUnitInformation from './userCenterUnitInformation'  // 单位信息

    import userCenterUnitPersonnelInformation from './userCenterUnitPersonnelInformation'  // 单位人员信息
    import userCenterEnterpriseUnitInformation from './userCenterEnterpriseUnitInformation'  // 企业单位信息
    var user = localStorage.getItem('user');
    var userInfo = JSON.parse(user);
    let unitEntityId=userInfo.umsUser.unitEntityId;
    let params = {};
    if(unitEntityId){
        params={
            userCenterEssentialInformation,
            userCenterEnterpriseUnitInformation,
            userCenterUnitPersonnelInformation
        } 
    }else {
        params={
            userCenterEssentialInformation,
            userCenterPersonalInformation,
            userCenterUnitInformation
        } 
    }
    export default {
        name: 'userCenterInformation',
        components:{...params},
        // components:{userCenterEssentialInformation,userCenterEnterpriseUnitInformation,userCenterUnitPersonnelInformation},
        data () {
            return {
                informationsClass:'1',
                unitEntityId:unitEntityId,
                dialogVisible: false,
            }
        },
        methods:{
            getInformation(num){
                this.informationsClass=num
            },
        }
    }
</script>
<style scoped>
   .information1 {
        display: inline-block;
        width: 123px;
        height: 100%;
        border:1px solid rgba(228, 228, 228, 1);
        text-align: center;
        background: #f9f9f9;
        color: #999;
    }
    .information2 {
        display: inline-block;
        width: 123px;
        height: 100%;
        border-top:3px solid #2c5589;
        text-align: center;
        color: #2c5589;
    }
    .information1:hover {
        color: #FF0036;
    }
</style>