<template>
  <div>
    <banner-tab
      :data="bannerTabData"
      @changeTab="changeTab"
    ></banner-tab>
    <div class="cont-mian center97">
      <div class="module" v-if="activeIndex == 0">
        <news :data="newsData"></news>
      </div>
      <div class="module wid" v-if="activeIndex !== 0">
        <div class="no-data">暂无数据</div>
      </div>
    </div>
  </div>
</template>
<script>
import news from '@/components/news/news.vue'
import bannerTab from '@/components/news/tab/bannerTab.vue'
import cAction from '@action'
export default {
  components: {
    bannerTab,
    news
  },
  data() {
    return {
      bannerTabData: {
        menu: ['项目介绍', '宣传片', '教授采访', '学生风采'],
        imgUrl: 'https://zws-imgs-pub.ezijing.com/static/public/24c97bb61b77949b415adcb06c7e43b1.png'
      },
      newsData: [
        {
          id: 0,
          title: '宣讲会实录',
          content: '',
          image: 'https://zws-imgs-pub.ezijing.com/static/build/learn-mba/resources/m2-r-img.b002ecd2.png'
        },
        {
          id: 1,
          title: '项目介绍',
          content: '',
          image: 'https://zws-imgs-pub.ezijing.com/static/build/learn-mba/resources/m2-r-img.b002ecd2.png'
        }
      ],
      activeIndex: 0,
      tabMenu: ['宣讲会实录', '项目介绍'],
      childActiveIndex: 0,
      requestParam: {
        page: 1,
        per_page: 100,
        type: 50,
        project_id: 1007
      }
    }
  },
  methods: {
    changeTab(index) {
      this.activeIndex = index
    },
    changeChildTab(index) {
      this.childActiveIndex = index
    },
    request(n) {
      this.requestParam.type = n
      cAction.reportAction.getNews(this.requestParam).then(json => {
        this.listData = json
      }).catch(e => { this.$message.error(e.message) }).finally(() => {})
    }
  },
  mounted() {
    // this.request(50)
  }
}
</script>
<style lang="scss" scoped>
.no-data{
  width: 100%;
  text-align: center;
  color: #999;
  font-size: 26px;
}
.cont-mian{
  .module{
    width: 100%;
    padding-top: 30px;
    padding-bottom: 60px;
    display: flex;
    .left-txt{
      // width: 670px;
    }
    img{
      margin-left: auto;
      // display: block;
      width: 235px;
      height: 300px;
    }
    &.wid{
      width: 100%;
    }
  }
}
.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>
