<template>
  <div id="index">
    <el-row>
      <el-col :span="24" class="style">
        <el-col :span="24" class="top">
          <top></top>
        </el-col>
        <el-col :span="24" class="menu">
          <div class="w_1200">
            <menus></menus>
          </div>
        </el-col>
        <el-col :span="24" class="main">
          <div class="w_1200">
            <el-col :span="5" class="left">
              <el-col :span="24" class="leftone">
                <seminar @leftdaohang="leftdaohang"></seminar>
              </el-col>
              <el-col :span="24" class="lefttwo">
                <cooperation @leftdaohang="leftdaohang"> </cooperation>
              </el-col>
            </el-col>
            <el-col :span="19" class="context">
              <el-col :span="18" class="right">
                <span v-if="displays == '0'">
                  <el-col :span="24" class="one">
                    <span></span>
                    <span>{{ columnName }}</span>
                  </el-col>
                  <el-col :span="24" class="list">
                    <span v-if="columnName == '平台建设'">
                      <achievementsList :list="list" :total="total" @detailBtn="detailBtn"></achievementsList>
                    </span>
                    <span v-else-if="columnName == '项目成果'">
                      <projectList :list="list" :total="total" @detailBtn="detailBtn"></projectList>
                    </span>
                    <span v-else-if="columnName == '知识产权'">
                      <knowledgeList :list="list" :total="total" @detailBtn="detailBtn"></knowledgeList>
                    </span>
                    <span v-else-if="columnName == '科技支撑'">
                      <technologyList :list="list" :total="total" @detailBtn="detailBtn"></technologyList>
                    </span>
                    <span v-else-if="columnName == '超算联盟'">
                      <supercomputingList :list="list" :total="total" @detailBtn="detailBtn"></supercomputingList>
                    </span>
                    <span v-else-if="columnName == '国家网格'">
                      <countryList :list="list" :total="total" @detailBtn="detailBtn"></countryList>
                    </span>
                    <span v-else-if="columnName == '教学中心'">
                      <teachingList :list="list" :total="total" @detailBtn="detailBtn"></teachingList>
                    </span>
                    <span v-else-if="columnName == '创业基地'">
                      <entrepreneurshipList :list="list" :total="total" @detailBtn="detailBtn"></entrepreneurshipList>
                    </span>
                    <span v-else-if="columnName == '软件中心'">
                      <softwareList :list="list" :total="total" @detailBtn="detailBtn"></softwareList>
                    </span>
                  </el-col>
                </span>
                <span v-else>
                  <achievementsDetail :details="details">
                    <span v-if="columnName == '平台建设'">
                      <achievementsDetail :details="details"></achievementsDetail>
                    </span>
                    <span v-else-if="columnName == '项目成果'">
                      <projectDetail :details="details"></projectDetail>
                    </span>
                    <span v-else-if="columnName == '知识产权'">
                      <knowledgeDetail :details="details"></knowledgeDetail>
                    </span>
                    <span v-else-if="columnName == '科技支撑'">
                      <technologyDetail :details="details"></technologyDetail>
                    </span>
                    <span v-else-if="columnName == '超算联盟'">
                      <supercomputingDetail :details="details"></supercomputingDetail>
                    </span>
                    <span v-else-if="columnName == '国家网格'">
                      <countryDetail :details="details"></countryDetail>
                    </span>
                    <span v-else-if="columnName == '教学中心'">
                      <teachingDetail :details="details"></teachingDetail>
                    </span>
                    <span v-else-if="columnName == '创业基地'">
                      <entrepreneurshipDetail :details="details"></entrepreneurshipDetail>
                    </span>
                    <span v-else-if="columnName == '软件中心'">
                      <softwareDetail :details="details"></softwareDetail>
                    </span>
                  </achievementsDetail>
                </span>
              </el-col>
            </el-col>
          </div>
        </el-col>
        <el-col :span="24" class="foot">
          <div class="w_1200">
            <foot></foot>
          </div>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import top from '@/layout/common/top.vue';
import menus from '@/layout/common/menus.vue';
import foot from '@/layout/common/foot.vue';
import seminar from '@/layout/achievement/seminar.vue';
import achievementsDetail from './parts/achievementsDetail.vue';
import achievementsList from './parts/achievementsList.vue';
import knowledgeDetail from './parts/knowledgeDetail.vue';
import knowledgeList from './parts/knowledgeList.vue';
import projectList from './parts/projectList.vue';
import projectDetail from './parts/projectDetail.vue';
import technologyList from './parts/technologyList.vue';
import technologyDetail from './parts/technologyDetail.vue';
import supercomputingList from './parts/supercomputingList.vue';
import supercomputingDetail from './parts/supercomputingDetail.vue';
import countryList from './parts/countryList.vue';
import countryDetail from './parts/countryDetail.vue';

import teachingList from './parts/teachingList.vue';
import teachingDetail from './parts/teachingDetail.vue';

import entrepreneurshipList from './parts/entrepreneurshipList.vue';
import entrepreneurshipDetail from './parts/entrepreneurshipDetail.vue';
import softwareList from './parts/softwareList.vue';
import softwareDetail from './parts/softwareDetail.vue';
import cooperation from '@/layout/achievement/cooperation.vue';

export default {
  name: 'index',
  props: {},
  components: {
    top,
    menus,
    foot,
    seminar,
    achievementsList,
    cooperation,
    achievementsDetail,
    projectList,
    projectDetail,
    knowledgeList,
    knowledgeDetail,
    technologyList,
    technologyDetail,
    supercomputingList,
    supercomputingDetail,
    countryList,
    countryDetail,
    teachingList,
    teachingDetail,
    entrepreneurshipList,
    entrepreneurshipDetail,
    softwareList,
    softwareDetail,
  },
  data: () => ({
    displays: '0',
    columnName: '平台建设',
    total: 1,
    details: {},
    list: [
      {
        title: '标题',
        date: '2020-02-02',
      },
      {
        title: '16条数据',
        date: '2020-02-02',
      },
    ],
    details: {
      title: '信息标题',
      source: '信息部',
      date: '2020-02-02',
      content: '信息内容',
    },
  }),
  created() {
    this.search();
  },
  computed: {
    col_name() {
      return this.$route.query.col_name;
    },
  },
  methods: {
    async search() {
      this.columnName = this.col_name;
      console.log(this.columnName);
    },

    async detailBtn(id) {
      console.log(id);

      this.$set(this, `displays`, 1);
    },
    async leftdaohang(title) {
      this.$set(this, `displays`, 0);
      this.$set(this, `columnName`, title);
    },
  },
};
</script>

<style lang="less" scoped>
.w_1200 {
  width: 1200px;
  margin: 0 auto;
}
.main {
  min-height: 670px;
  overflow: hidden;
  margin: 10px 0;
  .left {
    margin: 0 10px 0 0;
    .leftone {
      background: #fff;
    }
    .lefttwo {
      background-color: #fff;
    }
  }

  .right {
    width: 100%;
    min-height: 600px;
    background: #fff;
    padding: 0 20px;
    .one {
      height: 35px;
      margin: 20px 0;
      border-bottom: 1px dashed #ccc;
      span:first-child {
        display: inline-block;
        width: 4px;
        height: 20px;
        background: #005293;
        margin: 0 10px -3px 0;
      }
      span:nth-child(2) {
        font-size: 20px;
        color: #005293;
        font-weight: bold;
      }
    }
  }

  .context {
    width: 78%;
    min-height: 670px;
    background: #fff;
  }
}
</style>
