<template>
  <div class="layout-container">
    <vue-gic-header class="user-header-pop" style="z-index: 1999;" :projectName="projectName" :collapseFlag="collapseFlag" @collapseTag="collapseTagHandler" @toRouterView="toRouterView"></vue-gic-header>
    <div class="layout">
      <vue-gic-aside-menu v-if="asideShow" :projectName="projectName" :leftModulesName="leftModulesName" :collapseFlag.sync="collapseFlag"></vue-gic-aside-menu>
      <div class="layout-right">
        <div class="layout-title">
          <el-breadcrumb class="dm-breadcrumb" separator="/">
            <el-breadcrumb-item :to="{ path: '' }"><a href="/report/#/memberSummary">首页</a></el-breadcrumb-item>
            <el-breadcrumb-item :class="{'no-link':!v.path}" v-for="(v,i) in breadcrumb" :key="i"  :to="{ path: v.path }">{{v.name}}</el-breadcrumb-item>
          </el-breadcrumb>
          <h3><span>{{contentTitle}}</span></h3>
        </div>
        <div class="layout-content">
          <router-view></router-view>
        </div>
        <vue-gic-footer></vue-gic-footer>
      </div>
    </div>
  </div>
</template>
<script>
  export default {
    data () {
      return {
        collapseFlag: false,
        projectName: "marketing",
        leftModulesName: '公众号配置',
      }
    },
    created(){
      $bus.$on('aside-menu',val => {
        this.leftMenuRouter = val
      })
    },
    destroyed() {
       $bus.$off('aside-menu');
    },
    computed: {
      asideShow() {
        console.log(this.$store.state)
        return this.$store.state.marketing.asideShow;
      },
      contentTitle() {
          return this.$route.name
      },
      breadcrumb() {
        return this.$store.state.marketing.breadcrumb;
      }
    },
    methods: {
      // 处理路由跳转
      toRouterView(val) {
        var that = this;
        // 模拟检查数据
        // //有两个参数
        //{
        //  name:,
        //  path:
        //}
        that.$router.push({
          path: val
        })
      },
      // 处理路由跳转
      toRouterView(val) {
        //有两个参数
        //{
        //  name:,
        //  path:
        //}
        this.$router.push({
          path: val.path
        })
      },
      // 折叠事件
      collapseTagHandler(val){
        this.collapseFlag = val
      }
    }
  }
</script>
<style lang="scss">
  .layout-container{
    height:100%;
    display:flex;
  }
  .layout {
    display: flex;
    flex-direction: row;
    background-color: #f0f2f5;
    height: calc(100% - 64px);
    overflow-x: auto;
    overflow-y: hidden;
    margin-top: 64px;
    width: 100%;
    &-right{
      flex: 1;
      overflow-x:auto;
      transition: width 0.5s;
      -moz-transition: width 0.5s;
      -webkit-transition: width 0.5s;
      -o-transition: width 0.5s;
      height: 100%;
      width: 1200px;
      overflow-y: auto;
    }
    &-title{
      height:85px;
      background:#fff;
      // box-shadow: 0 3px 5px rgba(147,165,184,.13);
      padding:15px 0 0 30px;
      border-bottom: 1px solid #e4e7ed;
      h3 {
        color:#303133;
        font-size:20px;
        padding:24px 0;
        font-weight:600;
        span{
          color:#303133;
          font-size:20px;
          font-weight:600;
        }
        i{
          font-size:20px;
          color:#c0c4ce;
          cursor: pointer;
          &:hover{
            color:#909399;
          }
        }
      }
    }
    &-content {
      min-height: calc(100% - 200px);
    }
  }
  .dm-breadcrumb{
    display: inline-block;
    vertical-align: middle;
  }


.user-header-pop {
  min-width: 95px;
}
.el-popover.user-header-pop {
  min-width: 95px;
}

</style>
