<template>
  <div @click="router.push(`/videoPlay?id=${item.id}`)">
    <div
      :class="[
        'status',
        item.liveStatus === $liveStatusObj.InLive ? 'play' : '',
      ]"
    >
      <span v-if="item.liveStatus !== $liveStatusObj.InLive">{{
        dayjs(item.startTime).format("MM-DD")
      }}</span>
      <span>{{
        item.liveStatus === $liveStatusObj.InLive
          ? dayjs(item.startTime).format("HH:mm")
          : dayjs(item.startTime).format("HH:mm")
      }}</span>
      <p v-if="item.liveStatus === $liveStatusObj.InLive">直播中</p>
    </div>
    <div class="content">
      <h4>{{ item.title }}</h4>
      <p>{{ item.viewPoint }}</p>
      <div class="item-footer">
        {{ item.favorUserCount }}点赞 · {{ item.readCount }}次观看
      </div>
    </div>
  </div>
</template>

<script setup>
import { defineProps } from "vue";
import { useRouter } from "vue-router";
import dayjs from "dayjs";
import useGetLiveStatusObj from "@/hooks/useGetLiveStatusObj";
const $liveStatusObj = useGetLiveStatusObj();
defineProps({
  item: {
    type: Object,
    default: () => ({}),
  },
});
const router = useRouter();
</script>
<style scoped lang="scss">
.status {
  display: flex;
  align-items: center;
  background: url(../../../../assets/images/point2.png) no-repeat left center;
  background-size: 20px 20px;
  font-size: 24px;
  padding-left: 32px;
  height: 40px;
  &.play {
    background: url(../../../../assets/images/point1.png) no-repeat left center;
    background-size: 20px 20px;
  }
  span {
    margin-right: 24px;
    color: #666;
  }
  p {
    background: url(../../../../assets/images/play-icon.png) no-repeat left
      center;
    background-size: 24px 24px;
    padding-left: 28px;
    color: #f02e18;
  }
}
.content {
  text-align: left;
  padding: 16px 24px;
  border-left: 1px solid rgba(230, 230, 230, 1);
  margin-left: 8px;
  h4 {
    color: rgb(0, 0, 0);
    font-size: 32px;
    font-style: normal;
    font-weight: 500;
    line-height: 48px;
    margin-bottom: 8px;
  }
  p {
    color: rgb(102, 102, 102);
    font-size: 28px;
    font-style: normal;
    font-weight: 400;
    line-height: 44px;
    margin-bottom: 24px;
  }
  .item-footer {
    text-align: left;
    color: rgb(153, 153, 153);
    font-size: 24px;
    font-style: normal;
    font-weight: 400;
    margin-bottom: 16px;
  }
}
</style>
