|
@@ -49,14 +49,14 @@
|
|
|
<v-select
|
|
<v-select
|
|
|
:items="category"
|
|
:items="category"
|
|
|
label="主分区"
|
|
label="主分区"
|
|
|
- @change="getMainCategory"
|
|
|
|
|
|
|
+ @change="getCategory"
|
|
|
/>
|
|
/>
|
|
|
</v-col>
|
|
</v-col>
|
|
|
<v-col cols="5">
|
|
<v-col cols="5">
|
|
|
<v-select
|
|
<v-select
|
|
|
- :items="categoryChildren"
|
|
|
|
|
|
|
+ :items="childCategory"
|
|
|
label="分区"
|
|
label="分区"
|
|
|
- @change="getVideoCategory"
|
|
|
|
|
|
|
+ @change="getChildCategory"
|
|
|
/>
|
|
/>
|
|
|
</v-col>
|
|
</v-col>
|
|
|
</v-row>
|
|
</v-row>
|
|
@@ -94,7 +94,7 @@
|
|
|
</v-row>
|
|
</v-row>
|
|
|
<v-row justify="center">
|
|
<v-row justify="center">
|
|
|
<v-col cols="10">
|
|
<v-col cols="10">
|
|
|
- <v-btn large color="primary" @click="publis">立即投稿</v-btn>
|
|
|
|
|
|
|
+ <v-btn large color="primary" @click="publish">立即投稿</v-btn>
|
|
|
</v-col>
|
|
</v-col>
|
|
|
</v-row>
|
|
</v-row>
|
|
|
</v-card>
|
|
</v-card>
|
|
@@ -133,13 +133,14 @@ export default {
|
|
|
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!'
|
|
|
],
|
|
],
|
|
|
videoInfo: {
|
|
videoInfo: {
|
|
|
- fileId: '',
|
|
|
|
|
|
|
+ videoInfoId: '',
|
|
|
title: '',
|
|
title: '',
|
|
|
desc: '',
|
|
desc: '',
|
|
|
coverUrl: '',
|
|
coverUrl: '',
|
|
|
duration: 0,
|
|
duration: 0,
|
|
|
- category: -1,
|
|
|
|
|
- tags: []
|
|
|
|
|
|
|
+ categoryId: -1,
|
|
|
|
|
+ tags: [],
|
|
|
|
|
+ fileId: ''
|
|
|
},
|
|
},
|
|
|
categoryMap: {
|
|
categoryMap: {
|
|
|
Set: function(key, value) { this[key] = value },
|
|
Set: function(key, value) { this[key] = value },
|
|
@@ -148,7 +149,7 @@ export default {
|
|
|
Remove: function(key) { delete this[key] }
|
|
Remove: function(key) { delete this[key] }
|
|
|
},
|
|
},
|
|
|
category: [],
|
|
category: [],
|
|
|
- categoryChildren: [],
|
|
|
|
|
|
|
+ childCategory: [],
|
|
|
nowCategory: {},
|
|
nowCategory: {},
|
|
|
files: [],
|
|
files: [],
|
|
|
showMessage: false,
|
|
showMessage: false,
|
|
@@ -156,10 +157,10 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
- this.getCategory()
|
|
|
|
|
|
|
+ this.getCategoryList()
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- publis() {
|
|
|
|
|
|
|
+ publish() {
|
|
|
if (!this.videoInfo.fileId) {
|
|
if (!this.videoInfo.fileId) {
|
|
|
this.message = '你还没有上传视频'
|
|
this.message = '你还没有上传视频'
|
|
|
this.showMessage = true
|
|
this.showMessage = true
|
|
@@ -205,10 +206,11 @@ export default {
|
|
|
},
|
|
},
|
|
|
videoUploadSuccess(value) {
|
|
videoUploadSuccess(value) {
|
|
|
if (value.code === 0) {
|
|
if (value.code === 0) {
|
|
|
- this.videoInfo.fileId = value.data[0].fileId
|
|
|
|
|
|
|
+ this.videoInfo.videoInfoId = value.data[0].videoInfoId
|
|
|
this.setTitle(value.data[0].filename)
|
|
this.setTitle(value.data[0].filename)
|
|
|
this.videoInfo.duration = value.data[0].duration
|
|
this.videoInfo.duration = value.data[0].duration
|
|
|
- this.videoInfo.coverUrl = 'http://localhost:8000' + value.data[0].coverUrl
|
|
|
|
|
|
|
+ this.videoInfo.coverUrl = value.data[0].coverUrl
|
|
|
|
|
+ this.videoInfo.fileId = value.data[0].fileId
|
|
|
|
|
|
|
|
this.message = '视频上传成功'
|
|
this.message = '视频上传成功'
|
|
|
this.showMessage = true
|
|
this.showMessage = true
|
|
@@ -244,7 +246,7 @@ export default {
|
|
|
}).then(response => response.json())
|
|
}).then(response => response.json())
|
|
|
.then(json => {
|
|
.then(json => {
|
|
|
if (json.code === 0) {
|
|
if (json.code === 0) {
|
|
|
- this.videoInfo.coverUrl = 'http://localhost:8000' + json.data[0].url
|
|
|
|
|
|
|
+ this.videoInfo.coverUrl = json.data[0].url
|
|
|
} else {
|
|
} else {
|
|
|
this.message = '上传失败,请重试!' + json.message
|
|
this.message = '上传失败,请重试!' + json.message
|
|
|
this.showMessage = true
|
|
this.showMessage = true
|
|
@@ -254,7 +256,7 @@ export default {
|
|
|
return null
|
|
return null
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- getCategory() {
|
|
|
|
|
|
|
+ getCategoryList() {
|
|
|
fetch(`/api/media/video/category`, {
|
|
fetch(`/api/media/video/category`, {
|
|
|
headers: {
|
|
headers: {
|
|
|
'Content-Type': 'application/json; charset=UTF-8',
|
|
'Content-Type': 'application/json; charset=UTF-8',
|
|
@@ -275,19 +277,19 @@ export default {
|
|
|
return null
|
|
return null
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- getMainCategory(value) {
|
|
|
|
|
- this.categoryChildren = []
|
|
|
|
|
|
|
+ getCategory(value) {
|
|
|
|
|
+ this.childCategory = []
|
|
|
this.nowCategory = this.categoryMap.Get(value)
|
|
this.nowCategory = this.categoryMap.Get(value)
|
|
|
this.videoInfo.category = this.nowCategory.id
|
|
this.videoInfo.category = this.nowCategory.id
|
|
|
|
|
|
|
|
const c = this.nowCategory.children
|
|
const c = this.nowCategory.children
|
|
|
if (c) {
|
|
if (c) {
|
|
|
for (let i = 0; i < c.length; i++) {
|
|
for (let i = 0; i < c.length; i++) {
|
|
|
- this.categoryChildren.push(c[i].name)
|
|
|
|
|
|
|
+ this.childCategory.push(c[i].name)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- getVideoCategory(value) {
|
|
|
|
|
|
|
+ getChildCategory(value) {
|
|
|
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) {
|