<template>
  <div style="padding: 2px;">
    <el-input
      class="leftInput"
      clearable
      v-model="videoName"
      placeholder="请输入视频名称"
      @clear="search"
      size="mini"/>
    <el-button size="mini" type="primary" @click="search">搜索</el-button>
    <el-tabs
      v-model="activeName"
      @tab-click="handleClick"
    >
      <el-tab-pane label="华鑫" name="1">
        <el-tree class="leftTree" :data="data">
          <div slot-scope="{ node, data }" @dblclick="handleNodeClick(data)" style="width:100%">
            <div  style="width:100%">
          <span class="tree_span ">
           <i class=" el-icon-video-camera"/>{{data.videoName}}
          </span>
            </div>
          </div>
        </el-tree>
      </el-tab-pane>
      <el-tab-pane label="鸿海" name="2" :lazy="true">
        <el-tree class="leftTree" :data="data">
          <div slot-scope="{ node, data }" @dblclick="handleNodeClick(data)" style="width:100%">
            <div  style="width:100%">
          <span class="tree_span ">
           <i class=" el-icon-video-camera"/>{{data.videoName}}
          </span>
            </div>
          </div>
        </el-tree>
      </el-tab-pane>
    </el-tabs>
  </div>

</template>

<script>
import { videoInfoList } from "@/api/video/manage";
export default {
  name: "left",
  data() {
    return {
      data: [],
      videoName: "",
      params: {
        videoType: "1"
      },
      activeName: "1"
    };
  },
  created(){
    this.getVideoInfo();
  },
  methods: {
    handleNodeClick(data) {
      this.$emit('playVideo',data);
    },
    getVideoInfo(){
      videoInfoList(this.params).then(res =>{
        if(res.code == 200 && res.data){
           this.data = res.data;
        }
      })
    },
    search(){
      this.params.videoName = this.videoName;
      this.getVideoInfo();
    },
    handleClick(tab, event) {
      this.params.videoType = tab.name;
      this.getVideoInfo();
    }
  }
}
</script>

<style scoped lang="scss">
  .leftInput{
    width: 184px;
    margin-right: 15px
  }
  .leftTree{
    height: calc(100vh - 194px);
    overflow-y: auto;
    &::-webkit-scrollbar {
      height: 6px;
      width: 6px;
      background:  #dfe4ed;
      position: absolute;
      top: 0;
    }
    &::-webkit-scrollbar-thumb {
      /*滚动条里面小方块*/
      // border-radius: 10px;
      // box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
      background: #cccccc;
      border-radius: 5px;
    }
  }

</style>
