<template>
  <div id="liveList">
    <el-row>
      <el-col :span="24" class="info">
        <el-col class="list" :span="12" v-for="(item, index) in list" :key="index">
          <!-- <el-col :span="18" class="left">
            <p class="textOver">{{ item.title }}</p>
            <p>
              举办城市:<span>{{ item.province }}{{ item.places }}</span>
            </p>
            <p>
              直播时间:<span>{{ item.start_time }}</span>
            </p>
          </el-col>
          <el-col :span="6" class="right">
            <p @click="$router.push({ path: '/live/roomDetail', query: { id: item.id, roomname: item.roomname } })" v-if="item.roomname">进入房间</p>
            <p @click="$router.push({ path: '/live/detail', query: { id: item.id } })" v-else>进入房间</p>
            <p @click="$router.push({ path: '/onlive/roomInfo', query: { roomname: item.roomname } })" v-if="item.roomname">房间详情</p>
          </el-col> -->
          <el-col :span="24" class="detail" @click.native="$router.push({ path: '/onlive/roomInfo', query: { id: item.id } })">
            <el-image :src="item.filedir"></el-image>
            <p class="textOver">[房间号:{{ item.name }}]{{ item.title }}</p>
            <van-col :span="24" class="starttime"><van-icon name="underway-o" />开始时间:{{ item.starttime }}</van-col>
          </el-col>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
const { mapActions: room } = createNamespacedHelpers('room');
export default {
  name: 'liveList',
  props: {},
  components: {},
  data: function() {
    return {
      list: [],
    };
  },
  created() {
    this.searchInfo();
  },
  methods: {
    ...room({ roomQuery: 'query' }),
    async searchInfo() {
      let res = await this.roomQuery();
      if (this.$checkRes(res)) {
        this.$set(this, `list`, res.data);
      }
    },
  },
  computed: {
    ...mapState(['user']),
    pageTitle() {
      return `${this.$route.meta.title}`;
    },
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
};
</script>

<style lang="less" scoped>
.info {
  padding: 10px;
}
// .list {
//   background: #fff;
//   padding: 10px;
//   border-radius: 5px;
//   margin: 0 0 10px 0;
//   .left {
//     font-size: 16px;
//     color: #ccc;
//     p {
//       padding: 0 0 10px 0;
//       span {
//         color: #000;
//       }
//     }
//     p:first-child {
//       color: #000;
//     }
//   }
//   .right {
//     text-align: center;
//     p {
//       background: #409eff;
//       color: #fff;
//       padding: 5px 8px;
//       border-radius: 5px;
//       margin: 0 0 10px 0;
//     }
//   }
// }
.list {
  padding: 5px;
  height: 140px;
  margin: 0 0 5px 0;
}
.detail {
  border-radius: 5px;
  height: 140px;
  border: 1px solid #f5f5f5;
}
/deep/.el-image {
  overflow: hidden;
  border-radius: 5px;
  height: 100px;
}
.detail p {
  font-size: 12px;
}
.starttime {
  font-size: 12px;
}
/deep/.van-icon::before {
  font-size: 10px;
  margin-right: 3px;
}
</style>
