<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">
      <aside-menu class="layout-left" v-if="asideShow" :projectName="projectName" :leftModulesName="leftModulesName" :collapseFlag.sync="collapseFlag"></aside-menu>
      <div class="layout-right" :class="[{ asideShow: asideShow }, { collapseFlag: asideShow && collapseFlag }]">
        <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, 'can-link': v.path }" v-for="(v, i) in breadcrumb" :key="i" :to="{ path: v.path }">{{ v.name }}</el-breadcrumb-item>
          </el-breadcrumb>
          <h3>
            <div>
              <span class="content-title">{{ contentTitle }}<span v-if="contentTitle == '触达效果'" class="title_tip">每日上午更新昨日数据</span></span>
              <div v-html="layoutTips" class="layout--tips--wrap"></div>
            </div>
            <div v-if="showDescription" class="intro_wrap"><i class="iconfont icon-zhibiaoshuoming introlIcon" alt="" /><span class="intro" @click="() => (drawer = true)">指标说明</span></div>
          </h3>
        </div>
        <div class="layout-content__wrap">
          <div class="layout-content" :class="[{ asideShow: asideShow }, { collapseFlag: asideShow && collapseFlag }]">
            <router-view></router-view>
          </div>
        </div>
      </div>
    </div>
    <description :drawer.sync="drawer" :direction="direction" :contentTitle="contentTitle" />
  </div> -->
  <div>
    <dm-layout :projectName="projectName"> <router-view /></dm-layout>
  </div>
</template>
<script>
import asideMenu from '../aside-menu';
import description from '@/views/ecm/touch-components/description.vue';
export default {
  components: {
    asideMenu,
    description
  },
  data() {
    return {
      collapseFlag: false,
      projectName: 'marketing',
      leftModulesName: '公众号配置',
      bodyHeight: 0,
      drawer: false,
      direction: 'rtl'
    };
  },
  mounted() {
    this.bodyHeight = document.body.clientHeight || document.documentElement.clientHeight;
  },
  computed: {
    // asideShow() {
    //   return this.$store.state.marketing.asideShow;
    // },
    contentTitle() {
      const name = (this.$route.meta && this.$route.meta.aliasName) || this.$route.name; // 有些params跳转的需要用到route.name 这种情况如果meta中有aliasName，优先aliasName
      return name;
    },
    // breadcrumb() {
    //   return this.$store.state.marketing.breadcrumb;
    // },
    // layoutTips() {
    //   return this.$store.state.marketing.layoutTips;
    // },
    showDescription() {
      return (this.$route.path.indexOf('ecm/list') >= 0 && this.$store.state.marketing.xsxsFlag) || this.$route.path.indexOf('ecm/touch') >= 0;
    }
  },
  // watch:{
  //   asideShow(val) {
  //     this.collapseFlag =  this.asideShow;
  //   }
  // },
  methods: {
    // 处理路由跳转
    toRouterView(val) {
      this.$router.push({
        path: val.path
      });
    },
    // 折叠事件
    collapseTagHandler(val) {
      this.collapseFlag = val;
    }
  },
  watch: {
    $route: {
      handler: function(to) {
        this.drawer = false;
      },
      immediate: true
    }
  }
};
</script>
<style lang="scss">
.layout-container {
  height: 100vh;
  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%;
  &-left {
    width: 200px;
    display: inline-block;
    position: fixed;
    left: 0;
    z-index: 9;
    height: 100%;
  }
  &-right {
    position: relative;
    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%;
    // overflow-y: auto;
    margin-left: 0px;
    min-width: 1400px;
    &.asideShow {
      min-width: 1200px;
      margin-left: 200px;
    }
    &.collapseFlag {
      min-width: 1336px;
      margin-left: 64px;
    }
  }
  &-title {
    background: #fff;
    padding: 15px 0 0 30px;
    border-bottom: 1px solid #e4e7ed;
    h3 {
      color: #303133;
      font-size: 20px;
      padding: 24px 0;
      font-weight: 500;
      display: flex;
      justify-content: space-between;
      .intro_wrap {
        display: flex;
        align-items: center;
        .introlIcon {
          color: #2f54eb;
          font-size: 16px;
          margin-right: 5px;
        }
        .intro {
          width: 64px;
          height: 22px;
          font-size: 14px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #2f54eb;
          line-height: 22px;
          cursor: pointer;
          padding-right: 30px;
        }
      }
    }
  }
  &-content__wrap {
    // overflow-y: auto;
    position: relative;
    top: -1px;
    min-height: calc(100% - 200px);
    &::-webkit-scrollbar {
      display: none;
    }
  }
  &--tips--wrap {
    margin-right: 24px;
  }
  &--tips {
    margin-top: 24px;
    padding: 8px 16px;
    line-height: 1.5;
    font-size: 13px;
    border-radius: 4px;
    color: #606266;
    background-color: #f4f4f5;
    i {
      margin-right: 4px;
      color: #2f54eb;
    }
    &__content {
      display: inline-block;
      vertical-align: middle;
      width: calc(100% - 50px);
      p {
        color: #606266;
      }
    }
  }
}
.dm-breadcrumb {
  display: inline-block;
  vertical-align: middle;
}

.user-header-pop {
  min-width: 95px;
}
.el-popover.user-header-pop {
  min-width: 95px;
}
.content-title {
  font-size: 20px;
  font-family: PingFangSC-Medium, PingFang SC;
  font-weight: 600;
  color: #303133;
  line-height: 28px;
  display: flex;
  align-items: center;
  .title_tip {
    font-size: 14px;
    color: #909399;
    margin-left: 10px;
  }
}
.can-link:hover {
  span:first-child {
    color: #2f54eb !important;
  }
}
</style>
