<template>
  <div class="plate">
    <div>
      <ul>
        <li app-border dir-bottom>
          <div class="preview-con">
            <div class="preview">
              <img v-if="!info.bgm.url" :src="require('@/assets/images/default/img_bgm_default.png')" alt="" />
              <div v-else>
                <span class="delname">{{info.bgm.name}}</span>
                <div class="del">
                  <span @click="del" class="ui-button submit">删除</span>
                </div>
              </div>
            </div>

            <div class="upload-con">
              <button class="ui-button submit" @click="$emit('openMaterial','bgm')">上传</button>
              <div class="ui-remark">背景音乐（&lt;20M）</div>
            </div>
          </div>
        </li>
        <li></li>
      </ul>
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex";

export default {
  props: ["select"],

  computed: {
    ...mapGetters({
      info: "info",
    }),
  },
  data() {
    return {
      img: "",
      param: "",
      isShow: false
    };
  },
  methods: {
    del() {
      this.info.bgm = {
        url:'',
        name:''
      };
    },
    onFileChange() {}
  },
};
</script>
<style lang="less" src="./style.less"></style>

<style lang="less" scoped>
.preview-con {
  display: flex;
  .preview {
    width: 90px;
    height: 90px;
    overflow: hidden;
    margin-right: 10px;
    position: relative;
    & > div {
      position: relative;
      width: 100%;
      height: 100%;
      .delname {
        z-index: 8;
        position: absolute;
        transform: translate(-50%, -50%);
        top: 50%;
        left: 50%;
        width: 90%;
        text-align: center;
        color: @color;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
      }
      .del {
        display: none;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        z-index: 9;
        background: rgba(0, 0, 0, 0.5);
        > .ui-button {
          display: flex;
          align-items: center;
          justify-content: center;
          width: 60%;
          min-width:unset;
          padding: 0 10px;
          margin: 0;
          line-height: 24px;
          height: 24px;
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
        }
      }
      &:hover{
        .del{
          display: block;
        }
      }
    }
  }
  .upload-con {
    flex: 1;
    .ui-button {
      width: 100%;
    }
    .ui-remark {
      margin-top: 10px;
      width: 100%;
      word-break: keep-all;
    }
  }
  .bars {
  }
}
</style>
