<template>
  <div class="ex-content">
    <div class="con-left">
      <div class="head">
        <div class="letter">
          <span>{{ titleN }}</span>
        </div>
        <div class="jg"></div>
        <div class="txt">
          <h3>{{ title }}</h3>
          <span></span>
          <h4>{{ titleEN }}</h4>
        </div>
      </div>
      <div class="body">
        <div
          class="body-tip"
          v-for="(item, index) in bodyList"
          :key="item.title"
          @click="tipClick(index)"
          :class="{ action: current === index }"
        >
          {{ item.title }}
        </div>
      </div>
    </div>
    <div class="con-main">
      <div>
        <slot></slot>
      </div>
    </div>
  </div>
</template>

<script>
import {mapState, mapMutations } from 'vuex'
export default {
    name: 'Xhcontent',
    props: {
        titleN: {
            type: String,
            default: 'A'
        },
        title: {
            type: String,
            default: '关于本会'
        },
        titleEN: {
            type: String,
            default: 'BOUT US'
        },
        bodyList: {
            type: Array,
            default: []
        }
    },
    data() {
      return {
        // current: 0
      }
    },
    computed: {
      ...mapState(['current'])
    },
    methods: {
        ...mapMutations(['changeCurrent']),
        tipClick(index) {
          this.changeCurrent(index)
          console.log(this.current)
          this.$router.push(this.bodyList[index]).catch(err => { return})

        }
    },
};
</script>

<style lang="scss" scoped>
.ex-content {
  width: 1234px;
  margin: 0 auto;
  background-color: #f5f5f5;
  display: flex;
  justify-content: space-between;
  .con-left {
    width: 265px;
    background-color: #f5f5f5;
    min-height: 400px;
  }
  .head {
    background: url("../assets/guoqi.jpg") no-repeat;
    width: 265px;
    height: 137px;
    margin: 0 0 20px;
    padding: 35px 0 0;
    background-color: #cb3301;
    display: flex;
    justify-content: center;
    .letter {
      width: 56px;
      height: 106px;
      color: white;
      font-size: 80px;
      line-height: 80px;
      display: flex;
      justify-content: end;
      span {
        padding-top: 30px;
      }
      margin-right: 10px;
    }
    .txt {
      width: 120px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      color: white;
      h3 {
        font-size: 20px;
        margin: 0;
      }
      span {
        height: 10px;
      }
      h4 {
        font-size: 24px;
        margin: 0;
      }
    }
  }
  .body {
    width: 263px;
    .body-tip {
      height: 50px;
      line-height: 50px;
      font-size: 16px;
      background-color: #fff;
      padding: 0 0 0 67px;
      margin-bottom: 5px;
      position: relative;
      box-shadow: 0px 0px 2px #ebebeb;
      cursor: pointer;
    }
    .action {
      background-color: #96311c;
      font-weight: bold;
      color: #fff;
    }
  }
  .con-main {
    width: 858px;
    // min-height: 700px;
    background-color: #fff;
    padding: 15px 40px;
  }
}
</style>