<template>
  <div id="list">
    <el-col :span="24" class="main">
      <el-col :span="24" class="info">
        <el-col>
          <el-col :span="24" class="leftTop">
            <span>|</span> <span>{{ menuName }}</span>
          </el-col>
          <el-col class="infoRightList" :span="24" v-for="(item, index) in hangyeList" :key="index">
            <p>
              <span class="textOver" @click="clickhangye(item.id)">{{ item.title }}</span
              ><span class="textOver">
                <el-button type="primary" class="duijie" @click="jinru()">进入对接会</el-button>
                <el-button type="primary" class="duijie" @click="apply(item.id)">申请对接会</el-button></span
              >
            </p>
          </el-col>
        </el-col>

        <el-col class="page">
          <el-pagination
            background
            @current-change="handleCurrentChange"
            :current-page.sync="currentPage"
            :page-size="pageSize"
            layout="total,prev, pager, next, jumper"
            :total="pageTotal"
          >
          </el-pagination>
        </el-col>
      </el-col>
    </el-col>
  </div>
</template>

<script>
import _ from 'lodash';
import { mapState, createNamespacedHelpers } from 'vuex';
const { mapActions: dock } = createNamespacedHelpers('dock');
export default {
  name: 'list',
  props: {},
  components: {},
  data: () => ({
    squareImage: require('@/assets/live/square_big.png'),
    menuIndex: '0',
    menuName: '直播列表',
    menuColor: 'rgb(254, 149, 14)',
    currentPage: 1,
    pageTotal: 0,
    pageSize: 10,
    limit: 10,
    hangyeList: [],
  }),
  created() {
    this.searchList();
  },
  computed: {},
  methods: {
    ...dock({ dockQuery: 'query' }),
    async searchList({ skip = 0, limit = 10, ...info } = {}) {
      console.log('ccc');

      let res = await this.dockQuery({});
      this.$set(this, `pageTotal`, res.total);
      console.log(res.data);

      if (res.errcode === 0) {
        this.$set(this, `hangyeList`, res.data);
      }
    },

    async initList({ name, skip = 0, limit = 10, ...info } = {}) {
      this.$set(this, `pageTotal`, res.total);
    },
    apply(id) {
      this.$router.push({ path: '/live/liveApply', query: { id: id } });
    },

    jinru() {
      window.location.href = '/static/liveIndex.html';
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.limit = 5;
      this.initList({ skip: (val - 1) * this.limit, limit: this.limit });
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  width: 1200px;
  margin: 0 auto;
  float: none;
}
.menu {
  float: left;
  height: 450px;
  width: 20%;
  background: no-repeat bottom right;
  background-image: url(../../assets/live/menu_back.jpg);
  margin: 30px 0;
  padding: 10px 0 0 10px;
  box-sizing: border-box;
  box-shadow: 0 0 10px #bbbaba;
}
.menu .el-image {
  width: 30px;
  display: inline-table;
  margin: 10px 5px;
}
.menu span {
  font-size: 24px;
  color: #92959a;
  font-weight: 600;
  margin-left: 3px;
  position: relative;
  top: 10px;
}
.menuList p {
  line-height: 60px;
  font-size: 18px;
  cursor: pointer;
  border-bottom: 1px solid #2d64b3;
  color: #044b79;
  font-weight: 600;
}
.info {
  width: 100%;
  float: right;
  margin: 30px 0 30px 2px;
  height: 585px;
  box-shadow: 0 0 10px #2d64b3;
  overflow: hidden;
  right: 0px;
  background: #ffffff;
}
.leftInfo {
  height: 500px;
  overflow: hidden;
}
.leftTop {
  font-size: 18px;
  width: 96%;
  height: 41px;
  line-height: 35px;
  border-bottom: 1px solid #e5e5e5;
  position: relative;
  bottom: 1px;
  margin: 10px;
  font-weight: 600;
  color: #22529a;
}
.infoLeftList {
  float: left;
  width: 95%;
  border-bottom: 1px dashed #ccc;
  padding: 10px 0 10px 10px;
  height: 87px;
  margin: 0 0 0 5px;
}

.infoLeftList:hover p:last-child span:first-child {
  -webkit-transform: translateY(-3px);
  -ms-transform: translateY(-3px);
  transform: translateY(-3px);
  -webkit-box-shadow: 0 0 6px #999;
  box-shadow: 0 0 6px #999;
  -webkit-transition: all 0.5s ease-out;
  transition: all 0.5s ease-out;
  color: #005293;
  cursor: pointer;
}
/deep/.infoRightList p span[data-v-64e7ce6c]:first-child {
  display: inline-block;
  width: 78%;
  margin: 0 20px 0 10px;
}

/deep/.infoRightList p span[data-v-64e7ce6c]:last-child {
  display: inline-block;
  width: 19%;
  text-align: center;
  font-size: 16px;
}

.infoLeftList p:first-child {
  float: left;
  width: 20%;
  font-size: 15px;
  background: #044b79;
  text-align: center;
  color: #fff;
  font-weight: bold;
  padding: 4px 0px;
  margin: 0 0 0 5px;
}
.infoLeftList p:last-child {
  float: right;
  width: 70%;
  padding: 0 0 0 10px;
}
.infoLeftList p:last-child span:first-child {
  float: left;
  width: 90%;
  font-size: 18px;
}
.infoLeftList p:last-child span:last-child {
  float: left;
  width: 90%;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 2;
  word-break: break-all;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  margin: 5px 0 0 0;
  color: #666;
}
.page {
  text-align: center;
  margin: 10px 0;
}
.infoRightList {
  float: left;
  width: 95%;
  padding: 7px 0;
  margin: 0 0 0 5px;
}

.infoRightList:hover p span:first-child {
  -webkit-transform: translateY(-3px);
  -ms-transform: translateY(-3px);
  transform: translateY(-3px);
  -webkit-box-shadow: 0 0 6px #999;
  box-shadow: 0 0 6px #999;
  -webkit-transition: all 0.5s ease-out;
  transition: all 0.5s ease-out;
  color: #005293;
  cursor: pointer;
}
.infoRightList p {
  font-size: 18px;
}
.infoRightList p span:first-child {
  display: inline-block;
  width: 60%;
  margin: 0 20px 0 10px;
}
.infoRightList p span:last-child {
  display: inline-block;
  width: 15%;
  text-align: center;
  font-size: 16px;
}
.duijie {
  color: #fff;
  background-color: #ff8500;
  text-align: center;
  padding: 10px 15px 10px 15px;
  margin: 10px 0 0 10px;
}
.duijie:hover {
  background-color: #0279d5;
}
</style>
