<template>
  <div>
    <banner-tab
      :data="bannerTabData"
      @changeTab="changeTab"
    ></banner-tab>
    <div class="cont-mian center97">
      <div class="module" v-if="activeIndex == 0">
        <div class="left-txt" v-html="content.module0"></div>
        <img src="../../assets/img/recruitInfo/m1-c1-img2.png" alt="">
      </div>
      <div class="module" v-if="activeIndex == 1">
        <div class="left-txt" v-html="content.module1"></div>
        <img src="../../assets/img/recruitInfo/m1-c1-img2.png" alt="">
      </div>
    </div>
  </div>
</template>
<script>
import cAction from '@action'
import bannerTab from '@/components/news/tab/bannerTab.vue'
export default {
  components: {
    bannerTab
  },
  data() {
    return {
      bannerTabData: {
        menu: ['职业规划', '就业支持'],
        imgUrl: 'https://zws-imgs-pub.ezijing.com/static/public/0527f16306569889a1dbb7bcbbe4d6b3.png'
      },
      activeIndex: 0,
      content: {
        module0: '',
        module1: ''
      }
    }
  },
  mounted() {
    this.getData()
  },
  methods: {
    changeTab(index) {
      this.activeIndex = index
    },
    getData() {
      const requestType = ['职业规划', '就业支持']
      requestType.map((item, index) => {
        this.request(item, index)
      })
    },
    request(name, index) {
      cAction.reportAction.getContent(name).then(json => {
        if (json !== null) {
          this.content[`module${index}`] = json[0].content
        }
      }).catch(e => { this.$message.error(e.message) }).finally(() => {})
    }
  },
}
</script>
<style lang="scss" scoped>
.cont-mian{
  .module{
    padding-top: 30px;
    padding-bottom: 60px;
    display: flex;
    .left-txt{
      width: 670px;
    }
    img{
      margin-left: auto;
      // display: block;
      width: 235px;
      height: 300px;
    }
  }
}
.center97{
  width: 970px;
  margin: 0 auto;
}
.top-nav{
  .center97{
    position: relative;
  }
  img{
    width: 100%;
    display: block;
  }
  .menu{
    position: absolute;
    bottom: 0;
    left: 0;
    display: flex;
    li{
      width: 128px;
      line-height: 36px;
      text-align: center;
      color: #fff;
      font-size: 16px;
      margin-right: 2px;
      cursor: pointer;
      background: #BF0927;
      &.active{
        background: #fff;
        color: #C70025;
      }
    }
  }
}
</style>
