|
|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<el-row class="movie-list">
|
|
|
<el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
- <el-col :md="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
+ <el-col :md="18" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
<el-card class="box-card">
|
|
|
<div slot="header" class="clearfix">
|
|
|
<span>上传视频文件</span>
|
|
|
@@ -27,13 +27,15 @@
|
|
|
</div>
|
|
|
</el-card>
|
|
|
</el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
<el-col :md="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
<el-card class="box-card">
|
|
|
<div slot="header" class="clearfix">
|
|
|
<span>上传视频封面</span>
|
|
|
</div>
|
|
|
<div class="text item">
|
|
|
- <el-tooltip class="item" effect="dark" content="点击上传图片" placement="top-end">
|
|
|
+ <el-tooltip class="item" effect="dark" content="点击上传视频封面" placement="top-end">
|
|
|
<el-upload
|
|
|
class="avatar-uploader"
|
|
|
:action="imgOssUrl"
|
|
|
@@ -53,8 +55,6 @@
|
|
|
</div>
|
|
|
</el-card>
|
|
|
</el-col>
|
|
|
- </el-row>
|
|
|
- <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
<el-col :md="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
|
|
|
<el-card class="box-card">
|
|
|
<div slot="header" class="clearfix">
|
|
|
@@ -62,15 +62,15 @@
|
|
|
<el-button style="float: right; padding: 3px 0" type="text" @click="onSubmit">发布</el-button>
|
|
|
</div>
|
|
|
<div class="text item">
|
|
|
- <el-form ref="form" :model="form" label-width="80px">
|
|
|
+ <el-form ref="videoPostForm" :model="videoPostForm" label-width="80px">
|
|
|
<el-form-item label="标题">
|
|
|
- <el-input v-model="form.title" style="padding-right: 1px" placeholder="标题不能超过 50 个字符" />
|
|
|
+ <el-input v-model="videoPostForm.title" style="padding-right: 1px" placeholder="标题不能超过 50 个字符" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="描述">
|
|
|
- <el-input v-model="form.description" type="textarea" autosize style="padding-right: 1px;" />
|
|
|
+ <el-input v-model="videoPostForm.description" type="textarea" autosize style="padding-right: 1px;" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="分区">
|
|
|
- <el-select v-model="form.categoryPid" placeholder="请选择分区" @change="getCategory">
|
|
|
+ <el-select v-model="videoPostForm.categoryPid" placeholder="请选择分区" @change="getCategory">
|
|
|
<el-option
|
|
|
v-for="item in pCategoryList"
|
|
|
:key="item.value"
|
|
|
@@ -78,7 +78,7 @@
|
|
|
:value="item.value"
|
|
|
/>
|
|
|
</el-select>
|
|
|
- <el-select v-model="form.categoryId" placeholder="请选择子分区">
|
|
|
+ <el-select v-model="videoPostForm.categoryId" placeholder="请选择子分区">
|
|
|
<el-option
|
|
|
v-for="item in categoryList"
|
|
|
:key="item.value"
|
|
|
@@ -88,12 +88,12 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="标签">
|
|
|
- <el-select v-model="form.tags" style="padding-right: 1px" placeholder="输入标签,用回车添加" clearable multiple filterable allow-create default-first-option @change="getRecommendTags">
|
|
|
+ <el-select v-model="videoPostForm.tags" style="padding-right: 1px" placeholder="输入标签,用回车添加" clearable multiple filterable allow-create default-first-option @change="getRecommendTags">
|
|
|
<el-option v-for="item in rcmdTags" :key="item.value" :label="item.label" :value="item.label" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="可见范围">
|
|
|
- <el-select v-model="form.scope" placeholder="选择稿件的可见范围">
|
|
|
+ <el-select v-model="videoPostForm.scope" placeholder="选择稿件的可见范围">
|
|
|
<el-option label="本人可见" value="1" />
|
|
|
<el-option label="所有人可见" value="2" />
|
|
|
<el-option label="VIP 可见" value="3" />
|
|
|
@@ -116,7 +116,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { videoRegion } from '@/api/video'
|
|
|
+import { addVideoFile, videoRegion } from '@/api/video'
|
|
|
import { getVideoChannelInfo, getVideoCoverChannelInfo } from '@/api/file'
|
|
|
import { hashFile } from '@/utils/functions'
|
|
|
|
|
|
@@ -150,11 +150,11 @@ export default {
|
|
|
rcmdTags: [
|
|
|
/* { label: "知识点1" }*/
|
|
|
],
|
|
|
- form: {
|
|
|
- videoFileId: null,
|
|
|
- channelCode: 0,
|
|
|
+ videoChannelCode: 0,
|
|
|
+ videoPostForm: {
|
|
|
+ videoId: null,
|
|
|
coverFileId: null,
|
|
|
- coverChannelId: 0,
|
|
|
+ coverChannelCode: 0,
|
|
|
title: null,
|
|
|
description: null,
|
|
|
categoryPid: null,
|
|
|
@@ -170,7 +170,8 @@ export default {
|
|
|
getVideoChannelInfo().then(res => {
|
|
|
if (res.code === 0) {
|
|
|
const resData = res.data
|
|
|
- this.form.channelCode = resData.channelCode
|
|
|
+ this.videoChannelCode = resData.channelCode
|
|
|
+ this.videoPostForm.channelCode = resData.channelCode
|
|
|
this.options = {
|
|
|
target: resData.ossUrl,
|
|
|
// 分块大小 10MB
|
|
|
@@ -219,7 +220,7 @@ export default {
|
|
|
getVideoCoverChannelInfo().then(res => {
|
|
|
if (res.code === 0) {
|
|
|
const resData = res.data
|
|
|
- this.form.coverChannelId = resData.channelCode
|
|
|
+ this.videoPostForm.coverChannelCode = resData.channelCode
|
|
|
this.imgData.channelCode = resData.channelCode
|
|
|
this.imgOssUrl = resData.ossUrl
|
|
|
this.imgHeaders.Authorization = 'Bearer ' + resData.token
|
|
|
@@ -274,12 +275,21 @@ export default {
|
|
|
const res = JSON.parse(response)
|
|
|
if (res.code === 0) {
|
|
|
const resData = res.data
|
|
|
- this.form.videoFileId = resData.uploadId
|
|
|
- this.$notify({
|
|
|
- title: '提示',
|
|
|
- message: '视频已上传',
|
|
|
- type: 'warning',
|
|
|
- duration: 3000
|
|
|
+ const videoFileForm = {
|
|
|
+ videoFileId: resData.uploadId,
|
|
|
+ channelCode: this.videoChannelCode,
|
|
|
+ filename: file.file.name
|
|
|
+ }
|
|
|
+ addVideoFile(videoFileForm).then(resp => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.videoPostForm.videoId = resp.data
|
|
|
+ this.$notify({
|
|
|
+ title: '提示',
|
|
|
+ message: '视频已上传',
|
|
|
+ type: 'warning',
|
|
|
+ duration: 3000
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
} else {
|
|
|
this.$notify({
|
|
|
@@ -326,9 +336,9 @@ export default {
|
|
|
// 视频视频分辨率
|
|
|
const videoWidth = videoElem.videoWidth
|
|
|
const videoHeight = videoElem.videoHeight
|
|
|
- this.form.width = videoWidth
|
|
|
- this.form.height = videoHeight
|
|
|
- this.form.duration = videoElem.duration
|
|
|
+ this.videoPostForm.width = videoWidth
|
|
|
+ this.videoPostForm.height = videoHeight
|
|
|
+ this.videoPostForm.duration = videoElem.duration
|
|
|
|
|
|
videoElem.pause()
|
|
|
// 设置画布尺寸
|
|
|
@@ -374,7 +384,7 @@ export default {
|
|
|
if (json.code === 0) {
|
|
|
this.coverUrl = URL.createObjectURL(coverFile)
|
|
|
const resData = json.data
|
|
|
- this.form.coverFileId = resData.uploadId
|
|
|
+ this.videoPostForm.coverFileId = resData.uploadId
|
|
|
} else {
|
|
|
this.$notify({
|
|
|
title: '提示',
|
|
|
@@ -407,7 +417,7 @@ export default {
|
|
|
if (res.code === 0) {
|
|
|
const resData = res.data
|
|
|
this.coverUrl = URL.createObjectURL(file.raw)
|
|
|
- this.form.coverFileId = resData.uploadId
|
|
|
+ this.videoPostForm.coverFileId = resData.uploadId
|
|
|
} else {
|
|
|
this.$notify({
|
|
|
title: '提示',
|
|
|
@@ -430,10 +440,10 @@ export default {
|
|
|
// ****************************************************************************************************************
|
|
|
setTitle(title) {
|
|
|
if (title.length > 50) {
|
|
|
- this.form.title = title.substring(0, 50)
|
|
|
- this.form.description = title
|
|
|
+ this.videoPostForm.title = title.substring(0, 50)
|
|
|
+ this.videoPostForm.description = title
|
|
|
} else {
|
|
|
- this.form.title = title
|
|
|
+ this.videoPostForm.title = title
|
|
|
}
|
|
|
},
|
|
|
getVideoCategory() {
|
|
|
@@ -477,7 +487,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
onSubmit() {
|
|
|
- if (!this.form.videoFileId) {
|
|
|
+ if (!this.videoPostForm.videoId) {
|
|
|
this.$notify({
|
|
|
title: '提示',
|
|
|
message: '你还没有上传视频',
|
|
|
@@ -488,7 +498,7 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if (!this.form.coverFileId) {
|
|
|
+ if (!this.videoPostForm.coverFileId) {
|
|
|
this.$notify({
|
|
|
title: '提示',
|
|
|
message: '你还没有上传视频封面',
|
|
|
@@ -499,7 +509,7 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if (this.form.title === '' || this.form.categoryId === -1) {
|
|
|
+ if (this.videoPostForm.title === '' || this.videoPostForm.categoryId === -1) {
|
|
|
this.$notify({
|
|
|
title: '提示',
|
|
|
message: '分区和稿件标题不能为空',
|
|
|
@@ -510,7 +520,7 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if (this.form.tags.length === 0 || this.form.tags.length > 10) {
|
|
|
+ if (this.videoPostForm.tags.length === 0 || this.videoPostForm.tags.length > 10) {
|
|
|
this.$notify({
|
|
|
title: '提示',
|
|
|
message: '标签最少 1 个, 最多 10 个',
|
|
|
@@ -522,7 +532,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
if (this.scheduledPubDate !== null) {
|
|
|
- this.form.scheduledTime = Date.parse(this.scheduledPubDate)
|
|
|
+ this.videoPostForm.scheduledTime = Date.parse(this.scheduledPubDate)
|
|
|
/* this.$notify({
|
|
|
title: '提示',
|
|
|
message: '定时发布的时间必须在当前时间之后',
|
|
|
@@ -530,7 +540,7 @@ export default {
|
|
|
duration: 3000
|
|
|
})*/
|
|
|
}
|
|
|
- this.$emit('video-publish', this.form)
|
|
|
+ this.$emit('video-publish', this.videoPostForm)
|
|
|
}
|
|
|
}
|
|
|
}
|