|
@@ -58,18 +58,20 @@
|
|
|
>新增</el-button
|
|
|
>
|
|
|
</el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="primary" size="mini" :disabled="multiple" @click="putShelf" v-hasPermi="['system:role:remove']">批量上架</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="primary" size="mini" :disabled="multiple" @click="offShelf" v-hasPermi="['system:role:remove']">批量下架</el-button>
|
|
|
+ </el-col>
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
|
|
|
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
<el-table-column label="视频id" align="center" prop="id" />
|
|
|
<el-table-column label="视频标题" align="center" prop="title" />
|
|
|
<el-table-column label="视频描述" align="center" prop="videoDescribe" />
|
|
|
- <!-- <el-table-column label="视频预览" align="center" width="300px">
|
|
|
- <template slot-scope="scope">
|
|
|
- <video :src="scope.row.fileUrl" class="videoPreview" :poster="scope.row.coverFileUrl" controls preload="meta"></video>
|
|
|
- </template>
|
|
|
- </el-table-column> -->
|
|
|
<el-table-column label="视频封面" align="center" width="200px">
|
|
|
<template slot-scope="scope">
|
|
|
<div>
|
|
@@ -187,7 +189,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listUser, getUser, delVideo, addUser, updateUser, changeUserStatus, uploadCover } from '@/api/teachingVideo/index'
|
|
|
+import { listUser, getUser, delVideo, addUser, updateUser, changeUserStatus, uploadCover, offShelf, putShelf } from '@/api/teachingVideo/index'
|
|
|
import { treeselect } from '@/api/videoType'
|
|
|
import Treeselect from '@riophae/vue-treeselect'
|
|
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|
@@ -237,39 +239,38 @@ export default {
|
|
|
form: {},
|
|
|
defaultProps: {
|
|
|
children: 'children',
|
|
|
- label: 'typeName'
|
|
|
+ label: 'typeName',
|
|
|
},
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
- pageSize: 10
|
|
|
+ pageSize: 10,
|
|
|
},
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
- userName: [{ required: true, message: '用户名称不能为空', trigger: 'blur' }]
|
|
|
- }
|
|
|
+ userName: [{ required: true, message: '用户名称不能为空', trigger: 'blur' }],
|
|
|
+ },
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
// 根据名称筛选部门树
|
|
|
deptName(val) {
|
|
|
this.$refs.tree.filter(val)
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
async created() {
|
|
|
this.tcVod = new TcVod({
|
|
|
- getSignature: vodSignature
|
|
|
+ getSignature: vodSignature,
|
|
|
})
|
|
|
this.getList()
|
|
|
this.getTreeselect()
|
|
|
- this.getDicts('sys_normal_disable').then(response => {
|
|
|
+ this.getDicts('sys_normal_disable').then((response) => {
|
|
|
this.statusOptions = response.data
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
|
- videoPreview(videoSrc) {
|
|
|
- VideoPreview(videoSrc)
|
|
|
- },
|
|
|
+ /**视频预览 */
|
|
|
+ videoPreview: VideoPreview,
|
|
|
//上传视频
|
|
|
fileUpload(e) {
|
|
|
this.mediaFile = e.target.files[0]
|
|
@@ -279,12 +280,12 @@ export default {
|
|
|
}
|
|
|
this.videoPercentage = 0
|
|
|
const uploader = this.tcVod.upload({
|
|
|
- mediaFile: this.mediaFile // 媒体文件(视频或音频或图片),类型为 File
|
|
|
+ mediaFile: this.mediaFile, // 媒体文件(视频或音频或图片),类型为 File
|
|
|
})
|
|
|
- uploader.on('media_progress', info => {
|
|
|
+ uploader.on('media_progress', (info) => {
|
|
|
this.videoPercentage = Math.floor(info.percent * 100 * 100) / 100
|
|
|
})
|
|
|
- uploader.done().then(doneResult => {
|
|
|
+ uploader.done().then((doneResult) => {
|
|
|
this.$set(this.form, 'vodVideoFileId', doneResult.fileId)
|
|
|
})
|
|
|
},
|
|
@@ -299,7 +300,7 @@ export default {
|
|
|
let formData = new FormData()
|
|
|
formData.append('coverFile', this.coverFile)
|
|
|
formData.append('fileId', this.form.vodVideoFileId)
|
|
|
- let { data } = await uploadCover(formData, e => {
|
|
|
+ let { data } = await uploadCover(formData, (e) => {
|
|
|
this.imagePercentage = Math.floor((e.loaded / e.total) * 100 * 100) / 100
|
|
|
})
|
|
|
this.$set(this.form, 'coverFileId', data.fileId)
|
|
@@ -307,7 +308,7 @@ export default {
|
|
|
/** 查询用户列表 */
|
|
|
getList() {
|
|
|
this.loading = true
|
|
|
- listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
|
|
+ listUser(this.addDateRange(this.queryParams, this.dateRange)).then((response) => {
|
|
|
this.userList = response.rows
|
|
|
this.total = response.total
|
|
|
this.loading = false
|
|
@@ -315,7 +316,7 @@ export default {
|
|
|
},
|
|
|
/** 查询部门下拉树结构 */
|
|
|
getTreeselect() {
|
|
|
- treeselect().then(response => {
|
|
|
+ treeselect().then((response) => {
|
|
|
this.deptOptions = response.data
|
|
|
})
|
|
|
},
|
|
@@ -337,7 +338,7 @@ export default {
|
|
|
this.$confirm('确认要"' + text + '""' + row.title + '"视频吗?', '警告', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
+ type: 'warning',
|
|
|
})
|
|
|
.then(() => {
|
|
|
return changeUserStatus(row.id, row.shelfStatus)
|
|
@@ -376,7 +377,7 @@ export default {
|
|
|
},
|
|
|
// 多选框选中数据
|
|
|
handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map(item => item.userId)
|
|
|
+ this.ids = selection.map((item) => item.id)
|
|
|
this.single = selection.length != 1
|
|
|
this.multiple = !selection.length
|
|
|
},
|
|
@@ -392,14 +393,14 @@ export default {
|
|
|
this.reset()
|
|
|
this.getTreeselect()
|
|
|
const userId = row.id || this.ids
|
|
|
- getUser(userId).then(response => {
|
|
|
+ getUser(userId).then((response) => {
|
|
|
this.form = response.data
|
|
|
this.open = true
|
|
|
this.title = '修改视频信息'
|
|
|
})
|
|
|
},
|
|
|
/**校验form */
|
|
|
- validate: function(form) {
|
|
|
+ validate: function (form) {
|
|
|
console.log(form)
|
|
|
if (!form.title) {
|
|
|
this.msgError('标题必填')
|
|
@@ -416,7 +417,7 @@ export default {
|
|
|
return true
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
- submitForm: function() {
|
|
|
+ submitForm: function () {
|
|
|
if (this.form.id != undefined) {
|
|
|
let data = {
|
|
|
teachingVideoTypeId: this.form.teachingVideoTypeId,
|
|
@@ -425,9 +426,9 @@ export default {
|
|
|
sort: this.form.sort,
|
|
|
videoDescribe: this.form.videoDescribe,
|
|
|
videoFileId: this.form.vodVideoFileId,
|
|
|
- coverFileId: this.form.coverFileId
|
|
|
+ coverFileId: this.form.coverFileId,
|
|
|
}
|
|
|
- updateUser(data).then(response => {
|
|
|
+ updateUser(data).then((response) => {
|
|
|
this.msgSuccess('修改成功')
|
|
|
this.open = false
|
|
|
this.getList()
|
|
@@ -440,9 +441,9 @@ export default {
|
|
|
sort: this.form.sort,
|
|
|
videoDescribe: this.form.videoDescribe,
|
|
|
videoFileId: this.form.vodVideoFileId,
|
|
|
- coverFileId: this.form.coverFileId
|
|
|
+ coverFileId: this.form.coverFileId,
|
|
|
}
|
|
|
- addUser(data).then(response => {
|
|
|
+ addUser(data).then((response) => {
|
|
|
this.msgSuccess('新增成功')
|
|
|
this.open = false
|
|
|
this.getList()
|
|
@@ -456,9 +457,9 @@ export default {
|
|
|
this.$confirm('是否确认删除id为"' + userIds + '"的数据项?', '警告', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
+ type: 'warning',
|
|
|
})
|
|
|
- .then(function() {
|
|
|
+ .then(function () {
|
|
|
console.log('确定')
|
|
|
return delVideo(userIds)
|
|
|
})
|
|
@@ -466,8 +467,35 @@ export default {
|
|
|
this.getList()
|
|
|
this.msgSuccess('删除成功')
|
|
|
})
|
|
|
- }
|
|
|
- }
|
|
|
+ },
|
|
|
+ /**批量下架 */
|
|
|
+ async offShelf() {
|
|
|
+ try {
|
|
|
+ const ids = this.ids
|
|
|
+ await this.$confirm(`是否下架ID为${ids}的短视频`, '警告', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ await offShelf(ids)
|
|
|
+ this.getList()
|
|
|
+ } catch (error) {}
|
|
|
+ },
|
|
|
+ /**批量上架 */
|
|
|
+ async putShelf() {
|
|
|
+ try {
|
|
|
+ const ids = this.ids
|
|
|
+ console.log(ids)
|
|
|
+ await this.$confirm(`是否上架ID为${ids}的短视频`, '警告', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ await putShelf(ids)
|
|
|
+ this.getList()
|
|
|
+ } catch (error) {}
|
|
|
+ },
|
|
|
+ },
|
|
|
}
|
|
|
</script>
|
|
|
|