<template>
  <div id="liveList">
    <el-row>
      <el-col :span="24">
        <el-col :span="8" class="list" v-for="(item, index) in list" :key="index" @click.native="detaiBtn(item)">
          <el-image class="image" :src="item.filedir"></el-image>
          <el-col :span="24" class="info">
            <p>
              <span class="textOver">[房间号:{{ item.name }}]{{ item.title }}</span>
              <span>直播类型:{{ item.type == '0' ? '直播' : '会议' }}</span>
            </p>
            <p>
              <span><i class="iconfont iconicon-person"></i>{{ item.username }}</span>
              <span><i class="iconfont iconzhuangtai"></i>{{ item.status == '0' ? '待开始' : '开始' }}</span>
            </p>
          </el-col>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'liveList',
  props: {
    list: null,
  },
  components: {},
  data: function() {
    return {};
  },
  created() {},
  methods: {
    detaiBtn(item) {
      if (item.status == '1') {
        if (item.type == '0') {
          this.$router.push({ path: '/live/detail', query: { id: item.id, name: item.name } });
        } else {
          this.$router.push({ path: '/live/meetingDetail', query: { id: item.id, name: item.name } });
        }
      } else {
        this.$message({
          message: '直播尚未开始',
          type: 'warning',
        });
      }
    },
  },
  computed: {
    ...mapState(['user']),
    pageTitle() {
      return `${this.$route.meta.title}`;
    },
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
};
</script>

<style lang="less" scoped>
.list {
  width: 30%;
  margin: 0 15px 15px 15px;
  border-radius: 10px;
  box-shadow: 0 0 4px #ccc;
  .info {
    padding: 0 10px;
    p {
      font-size: 14px;
      color: #000;
      span:first-child {
        float: left;
        width: 75%;
        padding: 0 0 10px 0;
      }
      span:last-child {
        float: right;
        color: #888;
      }
    }
    p:last-child {
      color: #888;
      span {
        display: inline-block;
        width: 50%;
        i {
          margin: 0 5px 0 0;
        }
      }
      span:last-child {
        text-align: right;
      }
    }
  }
}
/deep/.el-image {
  width: 100%;
  height: 300px;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}
/deep/.el-image__inner {
  -webkit-transition: all 0.3s linear;
  -moz-transition: all 0.3s linear;
  -o-transition: all 0.3s linear;
  transition: all 0.3s linear;
}
/deep/.el-image:hover {
  cursor: pointer;
}
/deep/.el-image:hover .el-image__inner {
  transform: scale(1.09, 1.09);
  -ms-transform: scale(1.09, 1.09);
  -webkit-transform: scale(1.09, 1.09);
  -o-transform: scale(1.09, 1.09);
  -moz-transform: scale(1.09, 1.09);
}
</style>
