<template>
  <li class="video-item" :class="{'active':currentId === mediaId}" @click="choose">
    <div class="video-item_top clearfix">
      <div>
        <h5 class="ellipsis-100">{{videoData.titleName || '未命名视频'}}</h5>
        <p class="gray fz12 ellipsis-100">{{videoData.createTimeStr}}</p>
      </div>
    </div>
    <div class="video-item_center clearfix">
      <img class="fl" src="../../../assets/img/video_img.jpg" alt="" srcset="">
      <p class="fl gray fz12 ellipsis-100">{{videoData.remark}}</p>
    </div>
    <div class="video-item_bottom" v-if="!chooseFlag">
      <i class="el-icon-edit" @click="edit"></i>
      <i class="el-icon-delete" @click="del"></i>
    </div>
  </li>
</template>

<script>
export default {
  props: {
    videoData: {
      type: Object,
      default: function () {
        return {

        }
      }
    },
    chooseFlag:{
      type:Boolean,
      default:false
    },
    mediaId:String,
  },
  data(){
    return{
      currentId:''
    }
  },
  methods: {
    choose(){
      $bus.$emit('video-temp-choose',this.videoData)
    },
    edit(){
      this.$emit('edit',this.videoData.videoId);
    },
    del() {
      this.$emit('del',{videoId:this.videoData.videoId,videoIdMediaId:this.videoData.videoIdMediaId});
    }
  }
}
</script>
<style lang="scss" scoped>
@import '../../../assets/style/base/var.scss';
.video-item{
  border: 1px solid #e4e7ed;
  width: 290px;
  margin: 10px;
  overflow: hidden;
  cursor: pointer;
  &:hover{
    border: 1px solid #409eff;
  }
  &.active{
    border: 2px solid $danger-color;
  }
  &_top {
    padding: 5px 10px 0 10px;
    line-height: 20px;
  }
  &_center{
    padding:10px;
    height: 180px;
    &>img{
      width: 270px;
      height: 160px;
    }
    &>div{
      padding-left: 15px;
      line-height: 20px;
    }
    &>p {
      line-height: 30px;
    }
  }
  &_bottom {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 30px;
    background: $gray-color;
    border-top: 1px solid $border-color;
    cursor: pointer;
    i{
      font-size: 16px;
      &:hover{
        color: #409eff;
      }
    }
  }
}
</style>
