<style>
  .Webset_background .webSliderDiv {
    line-height: 0;
    height: 536px;
    border: 1px solid #ccc;
    cursor: pointer;
    position: relative;
  }

  .Webset_background .webSliderDiv .web_imgUrl {
    width: 100%;
    height: 100%;
  }

  .Webset_background .webSliderDiv .el-upload {
    width: 100%;
    height: 100%;
  }

  .Webset_background .webSliderDiv .addIconDiv {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .Webset_background .webSliderDiv i {
    font-size: 50px;
    color: #d1d1d1;
    cursor: pointer;
  }

  .Webset_background .webSliderDiv .addIconDiv:hover {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
  }

  .Webset_background .webSliderDiv>div {
    height: 100%;
  }

</style>
<template>
  <div class="Webset_background">
    <el-form label-width="80px">
      <el-row>
        <el-col :span="24">
          <el-form-item label="標題">
            <el-input type="text" v-model="plugData.Title"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="描述">
            <el-input type="textarea" v-model="plugData.Describe" :rows="4"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item>
            <div class="webSliderDiv">
              <el-upload :http-request="UploadAttachment" :multiple="true" accept="image/jpeg,image/gif,image/png,image/bmp"
                :show-file-list="false" action="">
                <img v-if="plugData.ImageUrl" :src="plugData.ImageUrl" class="web_imgUrl" alt="" />
                <div class="addIconDiv">
                  <i class="web_addImg iconfont icon-img_haha"></i>
                  <i class="web_delImg iconfont icon-img_delete_small" style="margin-left:10px;"
                    @click.stop="plugData.ImageUrl=''"></i>
                </div>
              </el-upload>
            </div>
            <div>圖片尺寸請上傳：1440x900(前台顯示高度隨內容調整)，檔案請小於3M</div>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
  export default {
    props: ["plugData"],
    data() {
      return {

      };
    },
    created() {},
    methods: {
      UploadAttachment(file) {
        let newArr = [];
        newArr.push(file.file);
        let fileName = file.file.name;
        var path = "/Upload/WebSite/";
        this.UploadSelfFileT(path, newArr, x => {
          var str = x.data.FilePath;
          var imgUrl = this.domainManager().ViittoFileUrl + str;
          this.plugData.ImageUrl = imgUrl;
        });
      }
    },
    mounted() {

    },
  };

</script>
