|
@@ -284,16 +284,15 @@ export default {
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
const { uploadId, file } = uploadResult
|
|
const { uploadId, file } = uploadResult
|
|
|
- // 自动截取视频封面
|
|
|
|
|
- this.generateLocalCover(file.file)
|
|
|
|
|
-
|
|
|
|
|
addVideoFile({
|
|
addVideoFile({
|
|
|
videoFileId: uploadId,
|
|
videoFileId: uploadId,
|
|
|
filename: file.name
|
|
filename: file.name
|
|
|
}).then(resp => {
|
|
}).then(resp => {
|
|
|
if (resp.code === 0) {
|
|
if (resp.code === 0) {
|
|
|
this.form.videoId = resp.data
|
|
this.form.videoId = resp.data
|
|
|
- this.$message.info('视频处理完成')
|
|
|
|
|
|
|
+ this.$message.info('视频文件已上传')
|
|
|
|
|
+ // 自动截取视频封面
|
|
|
|
|
+ this.generateLocalCover(file.file)
|
|
|
} else {
|
|
} else {
|
|
|
this.$message.warning(resp.msg)
|
|
this.$message.warning(resp.msg)
|
|
|
}
|
|
}
|
|
@@ -340,6 +339,16 @@ export default {
|
|
|
if (json.code === 0) {
|
|
if (json.code === 0) {
|
|
|
this.form.coverFileId = json.data.uploadId
|
|
this.form.coverFileId = json.data.uploadId
|
|
|
this.coverUrl = URL.createObjectURL(blobFile)
|
|
this.coverUrl = URL.createObjectURL(blobFile)
|
|
|
|
|
+
|
|
|
|
|
+ const videoCover = {
|
|
|
|
|
+ videoId: this.form.videoId,
|
|
|
|
|
+ coverFileId: this.form.coverFileId
|
|
|
|
|
+ }
|
|
|
|
|
+ updateVideoCover(videoCover).then(res => {
|
|
|
|
|
+ this.$message.success('视频封面已上传')
|
|
|
|
|
+ }).catch(error => {
|
|
|
|
|
+ this.$message.error(error.message)
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
@@ -360,22 +369,22 @@ export default {
|
|
|
|
|
|
|
|
handleManualCoverSuccess(res, file) {
|
|
handleManualCoverSuccess(res, file) {
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
|
|
|
+ var videoCover = {}
|
|
|
|
|
+ videoCover.coverFileId = res.data.uploadId
|
|
|
if (this.isEdit) {
|
|
if (this.isEdit) {
|
|
|
- const videoCover = {
|
|
|
|
|
- videoId: this.videoInfo.videoId,
|
|
|
|
|
- coverUrl: res.data.url,
|
|
|
|
|
- coverFileId: res.data.uploadId
|
|
|
|
|
- }
|
|
|
|
|
- updateVideoCover(videoCover).then(res => {
|
|
|
|
|
- this.$message.info(res.msg)
|
|
|
|
|
- }).catch(error => {
|
|
|
|
|
- this.$message.error(error.message)
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ videoCover.videoId = this.videoInfo.videoId
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ videoCover.videoId = this.form.videoId
|
|
|
|
|
+
|
|
|
this.form.coverFileId = res.data.uploadId
|
|
this.form.coverFileId = res.data.uploadId
|
|
|
this.coverUrl = URL.createObjectURL(file.raw)
|
|
this.coverUrl = URL.createObjectURL(file.raw)
|
|
|
- this.$message.success('封面上传成功')
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ updateVideoCover(videoCover).then(res => {
|
|
|
|
|
+ this.$message.success('视频封面已上传')
|
|
|
|
|
+ }).catch(error => {
|
|
|
|
|
+ this.$message.error(error.message)
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|