<script setup>

</script>

<template>
  <!--storageType:Minio;Qiniu-->
  <div>
    <div v-if="storage === Minio">
      <!--Minio-->
      <!--图片上传的组件是显示URL和上传的ICON-->
      <!--视频上传的组件显示选择视频文件-->
      <el-upload
          v-if="showFlag"
          :action="minioAction"
          :before-upload="handlerBeforeUpload"
          :headers="uploadHeaders"
          :multiple="false"
          :on-change="handleFileChange"
          :on-progress="minioProgressHandler"
          :on-success="handleSuccess"
          :show-file-list="false"
          class="avatar-uploader"
      >
        <!--IMG-->
        <img
            v-if="imageUrl"
            :src="imageUrl"
            alt="课程封面"
            class="avatar"
        />
        <el-icon v-else class="avatar-uploader-icon">
          <Plus />
        </el-icon>
        <!--VIDEO-->
        <template #default>
          <el-tooltip
              class="box-item"
              content="允许上传最大不超过2G的视频文件"
              effect="dark"
              placement="right"
          >
            <el-button
                v-preReClick
                :disabled="uploading"
                type="primary"
            >选择视频文件
            </el-button>
          </el-tooltip>
        </template>
      </el-upload>
    </div>
  </div>
</template>

<style scoped>

</style>