<template>
  <div>
    <dm-layout :projectName="projectName" v-if="!isQianKun">
      <keep-alive>
        <router-view v-if="$route.meta.keepAlive" />
      </keep-alive>
      <router-view v-if="!this.$route.meta.keepAlive" />
    </dm-layout>
    <div v-else>
      <keep-alive>
        <router-view v-if="$route.meta.keepAlive" />
      </keep-alive>
      <router-view v-if="!this.$route.meta.keepAlive" />
    </div>
  </div>
</template>
<script>
import description from '@/views/ecm/touch-components/description.vue';
export default {
  components: {
    description
  },
  data() {
    return {
      collapseFlag: false,
      projectName: 'marketing',
      leftModulesName: '公众号配置',
      bodyHeight: 0,
      drawer: false,
      isQianKun: window.hasOwnProperty('__POWERED_BY_QIANKUN__'),
      direction: 'rtl'
    };
  },
  mounted() {
    this.bodyHeight = document.body.clientHeight || document.documentElement.clientHeight;
  },
  computed: {
    contentTitle() {
      const name = (this.$route.meta && this.$route.meta.aliasName) || this.$route.name; // 有些params跳转的需要用到route.name 这种情况如果meta中有aliasName，优先aliasName
      return name;
    },
    showDescription() {
      return (this.$route.path.indexOf('ecm/list') >= 0 && this.$store.state.marketing.xsxsFlag) || this.$route.path.indexOf('ecm/touch') >= 0;
    }
  },
  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>
