luobisheng
2022-11-29 4641a877cd6a94e4d35dca7f7f14bc1443e2d2ad
src/views/operate/video/updateInterface/index.vue
@@ -22,15 +22,22 @@
        <el-input v-model="videoData.id"></el-input>
      </el-form-item>
      <el-form-item prop="url" label="视频" min-width="8">
        <template v-if="videoList" >
          <div class="video-cover" v-for="video in videoList" :key="video">
            <i v-if="isUpdate" @click="handleDelete(video)" class="el-icon-delete video-delete-icon"></i>
            <video controls :src="video" width="100%" height="100%"/>
          </div>
        </template>
        <el-upload
            v-if="isUpdate"
            class="avatar-uploader"
            action=""
            ref="image"
            :limit="4"
            :show-file-list="false"
            :auto-upload="true"
            :http-request="videoUpload">
          <video controls v-if="videoData.url" :src="videoData.url" width="300px" height="200px" />
          <i v-else class="el-icon-plus avatar-uploader-icon"></i>
            <el-button size="small" type="primary">上传视频<i class="el-icon-upload el-icon--right"></i></el-button>
        </el-upload>
      </el-form-item>
        <el-button v-if="!isDisabled" class="submit-button" type="primary" @click.native.prevent="onSubmit">提交</el-button>
@@ -66,18 +73,21 @@
        belongToId: [{ required: true, trigger: 'blur', message: '请输入所属事件编号' }],
        eventSource: [{ required: true, trigger: 'blur', message: '请输入事件来源' }],
        regionName: [{ required: true, trigger: 'blur', message: '请输入社区名称' }],
        id: [{ required: true, trigger: 'blur', message: '请输入图片Id' }],
        id: [{ required: true, trigger: 'blur', message: '请输入视频Id' }],
        category: [{ required: true, trigger: 'blue', message: '请输入问题类型' }],
        url: [{ required: true, validator: validateVideoUrl }],
        type: [{ required: true, trigger: ['blur', 'change'], message: '请选择类型' }]
      },
      isDisabled: false
      isDisabled: false,
      videoList: []
    }
  },
  created() {
    this.videoData = deepClone(this.dialogData);
    this.videoData.url = this.videoData.url ? this.videoData.url.split(',')[0] : '';
    if (this.videoData.url) {
      this.videoList = this.videoData.url.split(',');
    }
    this.isDisabled = !this.isUpdate;
  },
  methods: {
@@ -115,8 +125,10 @@
      formData.append('file', file.file);
      imageManagement.importImage(formData)
          .then(res => {
            this.$refs.image.clearFiles();
            this.$set(this.videoData, 'url', FILE_ORIGINAL_URL + res.url1);
            const url = res.url1 ?? res.url2 ?? res.url3 ?? res.url4;
            const videoUrl = FILE_ORIGINAL_URL + url;
            this.videoList.push(videoUrl);
            this.$set(this.videoData, 'url', this.videoList.join(','));
            this.$message.success('上传成功');
          })
          .catch(err => {
@@ -124,6 +136,12 @@
            this.$refs.image.clearFiles();
          })
    },
    handleDelete(data) {
      this.videoList = this.videoList.filter(item => item !== data);
      this.videoData.url = this.videoList.join(',');
    },
    getResourceType(value) {
      return value ? RESOURCE_TYPE.find(item => item.value === value) : RESOURCE_TYPE;
    }
@@ -147,6 +165,31 @@
  display: flex;
  justify-content: center;
  align-items: center;
  .video-cover {
    height: 169px;
    display: flex;
  }
  .video-cover:hover {
    background-color: #ffffff;
    opacity: .6;
    .video-delete-icon {
      display: block;
      opacity: 1;
    }
  }
  .video-delete-icon {
    position: absolute;
    color: red;
    left: calc(100% - 160px);
    top: calc(100% - 150px);
    z-index: 2;
    height: 14px;
    font-size: 24px;
    display: none;
  }
  .submit-button {
    margin-left: 200px;
@@ -190,58 +233,6 @@
  width: 36px;
  height: 36px;
  border-radius: 50%;
}
.card {
  position: absolute;
  z-index: 2000;
  right: 0;
  .box-card {
    min-height: 240px;
    max-height: 260px;
    overflow: hidden;
    background-color: #09152f;
    position: relative;
    max-width: 220px;
    .scrollWrap {
      overflow: scroll;
      height: 180px;
      position: relative;
      color: #4b9bb7;
      .el-checkbox-group {
        display: flex;
        flex-direction: column;
        .el-checkbox {
          line-height: 20px;
        }
      }
    }
    .myclear {
      width: 100%;
      line-height: 20px;
      color: #4b9bb7;
      display: flex;
      justify-content: space-between;
    }
    .hidebar {
      position: absolute;
      top: 77px;
      right: 20px;
      width: 20px;
      height: 180px;
      background-color: #09152f;
    }
    .item {
      line-height: 40px;
    }
  }
}
.leader {