|
@@ -108,11 +108,6 @@
|
|
|
<el-input v-model="form.title" placeholder="请输入视频标题" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <!-- <el-col :span="12">
|
|
|
- <el-form-item label="视频类别" prop="teachingVideoTypeId">
|
|
|
- <treeselect v-model="form.teachingVideoTypeId" :options="deptOptions" :show-count="true" placeholder="请选择视频分类" />
|
|
|
- </el-form-item>
|
|
|
- </el-col> -->
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
@@ -258,7 +253,7 @@ export default {
|
|
|
let { data } = await uploadCover(formData, e => {
|
|
|
this.imagePercentage = Math.floor((e.loaded / e.total) * 100 * 100) / 100
|
|
|
})
|
|
|
- this.form.coverFileId = data.fileId
|
|
|
+ this.$set(this.form, 'coverFileId', data.fileId)
|
|
|
},
|
|
|
/** 查询用户列表 */
|
|
|
getList() {
|
|
@@ -295,13 +290,13 @@ export default {
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
- .then(function() {
|
|
|
+ .then(() => {
|
|
|
return changeUserStatus(row.id, row.shelfStatus)
|
|
|
})
|
|
|
.then(() => {
|
|
|
this.msgSuccess(text + '成功')
|
|
|
})
|
|
|
- .catch(function() {
|
|
|
+ .catch(() => {
|
|
|
row.shelfStatus = row.shelfStatus === '0' ? '1' : '0'
|
|
|
})
|
|
|
},
|
|
@@ -354,41 +349,56 @@ export default {
|
|
|
this.title = '修改视频信息'
|
|
|
})
|
|
|
},
|
|
|
+ /**校验form */
|
|
|
+ validate: function(form) {
|
|
|
+ console.log(form)
|
|
|
+ if (!form.title) {
|
|
|
+ this.msgError('标题必填')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!form.vodVideoFileId) {
|
|
|
+ this.msgError('视频未上传成功')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!form.coverFileId) {
|
|
|
+ this.msgError('封面未上传成功')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ },
|
|
|
/** 提交按钮 */
|
|
|
submitForm: function() {
|
|
|
- this.$refs['form'].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- if (this.form.id != undefined) {
|
|
|
- let data = {
|
|
|
- teachingVideoTypeId: this.form.teachingVideoTypeId,
|
|
|
- id: this.form.id,
|
|
|
- title: this.form.title,
|
|
|
- videoDescribe: this.form.videoDescribe,
|
|
|
- videoFileId: this.form.vodVideoFileId,
|
|
|
- coverFileId: this.form.coverFileId
|
|
|
- }
|
|
|
- updateUser(data).then(response => {
|
|
|
- this.msgSuccess('修改成功')
|
|
|
- this.open = false
|
|
|
- this.getList()
|
|
|
- })
|
|
|
- } else {
|
|
|
- let data = {
|
|
|
- teachingVideoTypeId: this.teachingVideoTypeId,
|
|
|
- id: this.form.id,
|
|
|
- title: this.form.title,
|
|
|
- videoDescribe: this.form.videoDescribe,
|
|
|
- videoFileId: this.form.vodVideoFileId,
|
|
|
- coverFileId: this.form.coverFileId
|
|
|
- }
|
|
|
- addUser(data).then(response => {
|
|
|
- this.msgSuccess('新增成功')
|
|
|
- this.open = false
|
|
|
- this.getList()
|
|
|
- })
|
|
|
+ if (this.validate(this.form)) {
|
|
|
+ if (this.form.id != undefined) {
|
|
|
+ let data = {
|
|
|
+ teachingVideoTypeId: this.form.teachingVideoTypeId,
|
|
|
+ id: this.form.id,
|
|
|
+ title: this.form.title,
|
|
|
+ videoDescribe: this.form.videoDescribe,
|
|
|
+ videoFileId: this.form.vodVideoFileId,
|
|
|
+ coverFileId: this.form.coverFileId
|
|
|
+ }
|
|
|
+ updateUser(data).then(response => {
|
|
|
+ this.msgSuccess('修改成功')
|
|
|
+ this.open = false
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ let data = {
|
|
|
+ teachingVideoTypeId: this.teachingVideoTypeId,
|
|
|
+ id: this.form.id,
|
|
|
+ title: this.form.title,
|
|
|
+ videoDescribe: this.form.videoDescribe,
|
|
|
+ videoFileId: this.form.vodVideoFileId,
|
|
|
+ coverFileId: this.form.coverFileId
|
|
|
}
|
|
|
+ addUser(data).then(response => {
|
|
|
+ this.msgSuccess('新增成功')
|
|
|
+ this.open = false
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
}
|
|
|
- })
|
|
|
+ }
|
|
|
},
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|