<template>
  <div class="menu">
    <div class="nav-left">
      <div class="logo-box">
        <img class="bank-logol" src="@/assets/images/bank-logo1.png" alt="logo" />
        <img class="bank-logor" src="@/assets/images/bank-logo2.png" alt="logo" />
      </div>
    </div>
    <div class="bank-title" @click="setStatus">高级财富管理师·在线学习系统</div>
    <!-- <s-language></s-language> -->
    <div class="right">
      <div class="logo-name">{{ name }},欢迎您回到在线学习系统</div>
      <div class="notify" @click="goNotify()">公告
        <div class="num" v-if="this.$store.getters.myMsg !=0">{{ this.$store.getters.myMsg }}</div>
      </div>
    </div>
  </div>
</template>

<script>
// import sLanguage from '@/components/languageSwitch/index.vue'
import cAction from '../../action'
export default {
  components: {},
  data () {
    return {
      name: ''
    }
  },
  mounted () {
    const userInfo = window.G.UserInfo
    this.name = userInfo !== undefined ? userInfo.student_info.personal_name : '' || userInfo !== undefined ? userInfo.nickname : '' || '你好'
    cAction.Other.getMyMsg().then(json => {
      this.$store.commit('myMsg', json.countNum)
    }).catch(e => { this.$message.error(e.message) }).finally(() => { })
  },
  methods: {
    goNotify () {
      this.$router.push({ path: '/app/other/message' })
    },
    setStatus () {
      if (this.status) {
        this.status = false
      } else {
        this.status = true
      }
      this.$root.$emit('updateStatus', this.status)
    }
  }
}
</script>

<style scoped lang="scss">
.menu {
  width: 100%;
  height: 100%;
  color: #ffffff;
  display: flex;
  align-items: center;
  position: relative;
  .nav-left {
    width: 30%;
    display: flex;
    position: relative;
    height: 100%;
    align-items: center;
    img.logo {
      position: absolute;
      left: 0;
      top: 50%;
      height: 37%;
      width: auto;
      transform: translateY(-50%);
    }
    .text-title {
      float: left;
      margin-left: 190px;
      line-height: 60px;
      font-size: 16px;
    }
  }
  .bank-title{
    position: absolute;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%,-50%);
    transform: translate(-50%,-50%);
    -o-transform: translate(-50%,-50%);
    -ms-transform: translate(-50%,-50%);
    font-size:.24rem;
    color:rgba(102,102,102,1);
  }
  .right{
    display: flex;
    color:#333333;
    margin-left: auto;
    font-size:.18rem;
    .logo-name{
      font-size: .18rem;
      line-height: 60px;
    }
  }
  .notify {
    position: relative;
    padding: 0 20px;
    line-height: 60px;
    font-size: .18rem;
    color: #000;
    cursor: pointer;
    .num {
      position: absolute;
      top: 9px;
      left: 50px;
      padding: 1px 5px 2px 4px;
      font-size: 12px;
      line-height: 14px;
      color: #ffffff;
      background: #fb2121;
      border-radius: 50%;
    }
  }
}
.logo-box{
  display: flex;
  .bank-logor{
    margin-left: auto;
  }
  .bank-logol{
    width: 52%;;
  }
  img{
    width: 46%;
  }
}

@media (max-width: 767px) {
  .menu {
    .nav-left {
      img.logo {
        display: none;
      }
      .text-title {
        margin-left: 0;
      }
    }
  }
}
</style>
