|
@@ -24,10 +24,12 @@
|
|
|
<v-row justify="center">
|
|
<v-row justify="center">
|
|
|
<v-col cols="5">
|
|
<v-col cols="5">
|
|
|
<v-card outlined>
|
|
<v-card outlined>
|
|
|
- <v-img :src="article.imgUrl" aspect-ratio="1.77" contain max-height="150" alt="封面图,推荐16:9" />
|
|
|
|
|
|
|
+ <v-img :src="videoInfo.coverUrl" aspect-ratio="1.77" contain max-height="150" alt="封面图,推荐16:9" />
|
|
|
</v-card>
|
|
</v-card>
|
|
|
</v-col>
|
|
</v-col>
|
|
|
|
|
|
|
|
|
|
+ <!--
|
|
|
|
|
+ TODO 现阶段由系统生成封面
|
|
|
<v-col cols="5">
|
|
<v-col cols="5">
|
|
|
<v-file-input
|
|
<v-file-input
|
|
|
:rules="rules"
|
|
:rules="rules"
|
|
@@ -40,7 +42,7 @@
|
|
|
<v-btn color="primary" @click="uploadFile">
|
|
<v-btn color="primary" @click="uploadFile">
|
|
|
上传
|
|
上传
|
|
|
</v-btn>
|
|
</v-btn>
|
|
|
- </v-col>
|
|
|
|
|
|
|
+ </v-col>-->
|
|
|
</v-row>
|
|
</v-row>
|
|
|
<v-row justify="center">
|
|
<v-row justify="center">
|
|
|
<v-col cols="5">
|
|
<v-col cols="5">
|
|
@@ -61,18 +63,18 @@
|
|
|
<v-row justify="center">
|
|
<v-row justify="center">
|
|
|
<v-col cols="10">
|
|
<v-col cols="10">
|
|
|
<v-text-field
|
|
<v-text-field
|
|
|
- v-model="article.title"
|
|
|
|
|
|
|
+ v-model="videoInfo.title"
|
|
|
placeholder="标题"
|
|
placeholder="标题"
|
|
|
label="标题(50字以内)"
|
|
label="标题(50字以内)"
|
|
|
clearable
|
|
clearable
|
|
|
- :rules="[() => article.title != null || '标题不能为空']"
|
|
|
|
|
|
|
+ :rules="[() => videoInfo.title != null || '标题不能为空']"
|
|
|
/>
|
|
/>
|
|
|
</v-col>
|
|
</v-col>
|
|
|
</v-row>
|
|
</v-row>
|
|
|
<v-row justify="center">
|
|
<v-row justify="center">
|
|
|
<v-col cols="10">
|
|
<v-col cols="10">
|
|
|
<v-textarea
|
|
<v-textarea
|
|
|
- v-model="article.describe"
|
|
|
|
|
|
|
+ v-model="videoInfo.desc"
|
|
|
label="简介(200字以内)"
|
|
label="简介(200字以内)"
|
|
|
clearable
|
|
clearable
|
|
|
placeholder="填写更全面的视频信息,让更多的人找到你!"
|
|
placeholder="填写更全面的视频信息,让更多的人找到你!"
|
|
@@ -82,7 +84,7 @@
|
|
|
<v-row justify="center">
|
|
<v-row justify="center">
|
|
|
<v-col cols="10">
|
|
<v-col cols="10">
|
|
|
<v-combobox
|
|
<v-combobox
|
|
|
- v-model="article.tag"
|
|
|
|
|
|
|
+ v-model="videoInfo.tags"
|
|
|
label="添加标签让更多人找到你(最多6个)"
|
|
label="添加标签让更多人找到你(最多6个)"
|
|
|
multiple
|
|
multiple
|
|
|
chips
|
|
chips
|
|
@@ -130,14 +132,14 @@ export default {
|
|
|
rules: [
|
|
rules: [
|
|
|
value => !value || value.size < 2000000 || 'Avatar size should be less than 2 MB!'
|
|
value => !value || value.size < 2000000 || 'Avatar size should be less than 2 MB!'
|
|
|
],
|
|
],
|
|
|
- article: {
|
|
|
|
|
|
|
+ videoInfo: {
|
|
|
|
|
+ fileId: '',
|
|
|
title: '',
|
|
title: '',
|
|
|
- describe: '',
|
|
|
|
|
- imgUrl: '',
|
|
|
|
|
|
|
+ desc: '',
|
|
|
|
|
+ coverUrl: '',
|
|
|
|
|
+ duration: 0,
|
|
|
category: -1,
|
|
category: -1,
|
|
|
- tag: [],
|
|
|
|
|
- video: {},
|
|
|
|
|
- imageId: ''
|
|
|
|
|
|
|
+ tags: []
|
|
|
},
|
|
},
|
|
|
categoryMap: {
|
|
categoryMap: {
|
|
|
Set: function(key, value) { this[key] = value },
|
|
Set: function(key, value) { this[key] = value },
|
|
@@ -158,32 +160,32 @@ export default {
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
publis() {
|
|
publis() {
|
|
|
- if (!this.article.video.id) {
|
|
|
|
|
|
|
+ if (!this.videoInfo.fileId) {
|
|
|
this.message = '你还没有上传视频'
|
|
this.message = '你还没有上传视频'
|
|
|
this.showMessage = true
|
|
this.showMessage = true
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- if (this.article.title === '' || this.imgUrl === '' || this.article.tag.length === 0 || this.article.category === -1) {
|
|
|
|
|
|
|
+ if (this.videoInfo.title === '' || this.coverUrl === '' || this.videoInfo.tags.length === 0 || this.videoInfo.category === -1) {
|
|
|
this.message = '标题,封面,标签,分区不能为空'
|
|
this.message = '标题,封面,标签,分区不能为空'
|
|
|
this.showMessage = true
|
|
this.showMessage = true
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- if (this.article.tag.length > 6) {
|
|
|
|
|
|
|
+ if (this.videoInfo.tags.length > 6) {
|
|
|
this.message = '标签超过6个'
|
|
this.message = '标签超过6个'
|
|
|
this.showMessage = true
|
|
this.showMessage = true
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- fetch(`/api/article/video`, {
|
|
|
|
|
|
|
+ fetch(`/api/media/video/submit`, {
|
|
|
headers: {
|
|
headers: {
|
|
|
'Content-Type': 'application/json; charset=UTF-8',
|
|
'Content-Type': 'application/json; charset=UTF-8',
|
|
|
'X-XSRF-TOKEN': this.$cookies.get('XSRF-TOKEN')
|
|
'X-XSRF-TOKEN': this.$cookies.get('XSRF-TOKEN')
|
|
|
},
|
|
},
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
credentials: 'include',
|
|
credentials: 'include',
|
|
|
- body: JSON.stringify(this.article)
|
|
|
|
|
|
|
+ body: JSON.stringify(this.videoInfo)
|
|
|
}).then(response => response.json())
|
|
}).then(response => response.json())
|
|
|
.then(json => {
|
|
.then(json => {
|
|
|
- if (json.status === 200) {
|
|
|
|
|
|
|
+ if (json.code === 0) {
|
|
|
this.message = '投稿成功,等待审核通过后你就可以看到你的视频了'
|
|
this.message = '投稿成功,等待审核通过后你就可以看到你的视频了'
|
|
|
this.showMessage = true
|
|
this.showMessage = true
|
|
|
this.$router.push('/studio')
|
|
this.$router.push('/studio')
|
|
@@ -196,20 +198,19 @@ export default {
|
|
|
.catch(e => {
|
|
.catch(e => {
|
|
|
return null
|
|
return null
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
- console.log(this.article)
|
|
|
|
|
},
|
|
},
|
|
|
setFile(value) {
|
|
setFile(value) {
|
|
|
this.files = []
|
|
this.files = []
|
|
|
this.files.push(value)
|
|
this.files.push(value)
|
|
|
},
|
|
},
|
|
|
videoUploadSuccess(value) {
|
|
videoUploadSuccess(value) {
|
|
|
- // console.log(value)
|
|
|
|
|
- if (value.status === 200) {
|
|
|
|
|
- //
|
|
|
|
|
- this.article.video = value.data[0]
|
|
|
|
|
- this.setTitle(value.data[0].fileOriginalName)
|
|
|
|
|
- this.message = '上传视频成功'
|
|
|
|
|
|
|
+ if (value.code === 0) {
|
|
|
|
|
+ this.videoInfo.fileId = value.data[0].fileId
|
|
|
|
|
+ this.setTitle(value.data[0].filename)
|
|
|
|
|
+ this.videoInfo.duration = value.data[0].duration
|
|
|
|
|
+ this.videoInfo.coverUrl = 'http://localhost:8000' + value.data[0].coverUrl
|
|
|
|
|
+
|
|
|
|
|
+ this.message = '视频上传成功'
|
|
|
this.showMessage = true
|
|
this.showMessage = true
|
|
|
} else {
|
|
} else {
|
|
|
this.message = '上传出现异常,请重试!' + value.message
|
|
this.message = '上传出现异常,请重试!' + value.message
|
|
@@ -218,9 +219,9 @@ export default {
|
|
|
},
|
|
},
|
|
|
setTitle(title) {
|
|
setTitle(title) {
|
|
|
if (title.length > 50) {
|
|
if (title.length > 50) {
|
|
|
- this.article.title = title.substring(0, 50)
|
|
|
|
|
|
|
+ this.videoInfo.title = title.substring(0, 50)
|
|
|
} else {
|
|
} else {
|
|
|
- this.article.title = title
|
|
|
|
|
|
|
+ this.videoInfo.title = title
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
uploadFile() {
|
|
uploadFile() {
|
|
@@ -233,7 +234,7 @@ export default {
|
|
|
for (let i = 0; i < this.files.length; i++) {
|
|
for (let i = 0; i < this.files.length; i++) {
|
|
|
formData.append('file[]', this.files[i])
|
|
formData.append('file[]', this.files[i])
|
|
|
}
|
|
}
|
|
|
- fetch(`/api/upload/photo`, {
|
|
|
|
|
|
|
+ fetch(`/api/file/upload/image`, {
|
|
|
headers: {
|
|
headers: {
|
|
|
'X-XSRF-TOKEN': this.$cookies.get('XSRF-TOKEN')
|
|
'X-XSRF-TOKEN': this.$cookies.get('XSRF-TOKEN')
|
|
|
},
|
|
},
|
|
@@ -242,10 +243,8 @@ export default {
|
|
|
body: formData
|
|
body: formData
|
|
|
}).then(response => response.json())
|
|
}).then(response => response.json())
|
|
|
.then(json => {
|
|
.then(json => {
|
|
|
- if (json.status === 200) {
|
|
|
|
|
- //
|
|
|
|
|
- this.article.imageId = json.data[0].id
|
|
|
|
|
- this.article.imgUrl = json.data[0].fileUrl
|
|
|
|
|
|
|
+ if (json.code === 0) {
|
|
|
|
|
+ this.videoInfo.coverUrl = 'http://localhost:8000' + json.data[0].url
|
|
|
} else {
|
|
} else {
|
|
|
this.message = '上传失败,请重试!' + json.message
|
|
this.message = '上传失败,请重试!' + json.message
|
|
|
this.showMessage = true
|
|
this.showMessage = true
|
|
@@ -256,7 +255,7 @@ export default {
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
getCategory() {
|
|
getCategory() {
|
|
|
- fetch(`/api/category/list`, {
|
|
|
|
|
|
|
+ fetch(`/api/media/video/category`, {
|
|
|
headers: {
|
|
headers: {
|
|
|
'Content-Type': 'application/json; charset=UTF-8',
|
|
'Content-Type': 'application/json; charset=UTF-8',
|
|
|
'X-XSRF-TOKEN': this.$cookies.get('XSRF-TOKEN')
|
|
'X-XSRF-TOKEN': this.$cookies.get('XSRF-TOKEN')
|
|
@@ -279,7 +278,7 @@ export default {
|
|
|
getMainCategory(value) {
|
|
getMainCategory(value) {
|
|
|
this.categoryChildren = []
|
|
this.categoryChildren = []
|
|
|
this.nowCategory = this.categoryMap.Get(value)
|
|
this.nowCategory = this.categoryMap.Get(value)
|
|
|
- this.article.category = this.nowCategory.id
|
|
|
|
|
|
|
+ this.videoInfo.category = this.nowCategory.id
|
|
|
|
|
|
|
|
const c = this.nowCategory.children
|
|
const c = this.nowCategory.children
|
|
|
if (c) {
|
|
if (c) {
|
|
@@ -292,7 +291,7 @@ export default {
|
|
|
const c = this.nowCategory.children
|
|
const c = this.nowCategory.children
|
|
|
for (let i = 0; i < c.length; i++) {
|
|
for (let i = 0; i < c.length; i++) {
|
|
|
if (c[i].name === value) {
|
|
if (c[i].name === value) {
|
|
|
- this.article.category = c[i].id
|
|
|
|
|
|
|
+ this.videoInfo.category = c[i].id
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -301,5 +300,4 @@ export default {
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
<style>
|
|
|
-
|
|
|
|
|
</style>
|
|
</style>
|