|
@@ -4,7 +4,7 @@
|
|
<div class="filter-container">
|
|
<div class="filter-container">
|
|
<span>视频标题:</span>
|
|
<span>视频标题:</span>
|
|
<el-input
|
|
<el-input
|
|
- v-model="listQuery.articleTitle"
|
|
|
|
|
|
+ v-model="listQuery.videoTitle"
|
|
placeholder="视频标题"
|
|
placeholder="视频标题"
|
|
style="width: 200px"
|
|
style="width: 200px"
|
|
class="filter-item"
|
|
class="filter-item"
|
|
@@ -12,7 +12,7 @@
|
|
/>
|
|
/>
|
|
<span>审核状态:</span>
|
|
<span>审核状态:</span>
|
|
<el-select
|
|
<el-select
|
|
- v-model="listQuery.lowerAuditStatus"
|
|
|
|
|
|
+ v-model="listQuery.auditStatus"
|
|
placeholder="审核状态"
|
|
placeholder="审核状态"
|
|
clearable
|
|
clearable
|
|
style="width: 200px"
|
|
style="width: 200px"
|
|
@@ -53,12 +53,28 @@
|
|
cell-class-name="table-cell"
|
|
cell-class-name="table-cell"
|
|
>
|
|
>
|
|
<el-table-column label="序号" type="index" width="80" align="center" />
|
|
<el-table-column label="序号" type="index" width="80" align="center" />
|
|
- <el-table-column label="视频标题" prop="articleTitle" align="center" />
|
|
|
|
|
|
+ <el-table-column label="视频标题" prop="videoTitle" align="center" />
|
|
<el-table-column label="审核状态" width="180px" align="center">
|
|
<el-table-column label="审核状态" width="180px" align="center">
|
|
<template slot-scope="{ row }">
|
|
<template slot-scope="{ row }">
|
|
- <el-tag v-if="row.auditStatus === 0" size="small" type="danger">审核未通过</el-tag>
|
|
|
|
- <el-tag v-if="row.auditStatus === 1" size="small" type="success">审核通过</el-tag>
|
|
|
|
<el-tag v-if="row.auditStatus === 2" size="small" type="warning">待审核</el-tag>
|
|
<el-tag v-if="row.auditStatus === 2" size="small" type="warning">待审核</el-tag>
|
|
|
|
+ <el-tag v-if="row.auditStatus === 1" size="small" type="success">审核通过</el-tag>
|
|
|
|
+ <!-- 未通过原因展示 -->
|
|
|
|
+ <template v-if="row.auditStatus === 0">
|
|
|
|
+ <!-- <span class="status danger">审核未通过 </span> -->
|
|
|
|
+ <el-popover
|
|
|
|
+ placement="top-start"
|
|
|
|
+ title="审核说明"
|
|
|
|
+ width="400"
|
|
|
|
+ trigger="hover"
|
|
|
|
+ :content="row.invalidReason"
|
|
|
|
+ >
|
|
|
|
+ <el-tag slot="reference" size="small" type="danger" class="reason">
|
|
|
|
+ <span>审核未通过</span>
|
|
|
|
+ <span class="el-icon-question status danger " />
|
|
|
|
+ </el-tag>
|
|
|
|
+ </el-popover>
|
|
|
|
+ <!-- 未通过原因展示END -->
|
|
|
|
+ </template>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="上线状态" width="180px" align="center">
|
|
<el-table-column label="上线状态" width="180px" align="center">
|
|
@@ -80,42 +96,51 @@
|
|
</template>
|
|
</template>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="审核时间" width="240px" align="center">
|
|
|
|
|
|
+ <el-table-column label="创建时间" width="240px" align="center">
|
|
<template slot-scope="{row}">
|
|
<template slot-scope="{row}">
|
|
- <span v-if="row.auditStatus!==2">{{ row.auditTime | formatTime }}</span>
|
|
|
|
- <span v-else>—</span>
|
|
|
|
|
|
+ {{ row.createTime | formatTime }}
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="操作" width="240px" align="center">
|
|
<el-table-column label="操作" width="240px" align="center">
|
|
- <template>
|
|
|
|
- <el-button type="primary" size="mini" style="margin-right:5px" icon="el-icon-edit" @click="handleShowDialog('edit')">编辑</el-button>
|
|
|
|
- <el-button type="danger" size="mini" style="margin-right:5px" icon="el-icon-s-check">删除</el-button>
|
|
|
|
|
|
+ <template slot-scope="{row}">
|
|
|
|
+ <el-button type="primary" size="mini" style="margin-right:5px" icon="el-icon-edit" @click="handleShowDialog('edit',row)">编辑</el-button>
|
|
|
|
+ <el-button type="danger" size="mini" style="margin-right:5px" icon="el-icon-s-check" @click="handleRemoveVideo(row)">删除</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
<!-- 表格区域END -->
|
|
<!-- 表格区域END -->
|
|
|
|
+ <pagination v-show="total>0" :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="getList(listQuery)" />
|
|
<!-- 视频预览对话框 -->
|
|
<!-- 视频预览对话框 -->
|
|
<el-dialog
|
|
<el-dialog
|
|
:title="dialogTitle"
|
|
:title="dialogTitle"
|
|
:visible.sync="dialogVisible"
|
|
:visible.sync="dialogVisible"
|
|
width="40%"
|
|
width="40%"
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
+ :close-on-press-escape="false"
|
|
@closed="dialogColosed"
|
|
@closed="dialogColosed"
|
|
>
|
|
>
|
|
<el-form ref="formRef" :model="dialogData" label-width="110px" :rules="dialogFormRules">
|
|
<el-form ref="formRef" :model="dialogData" label-width="110px" :rules="dialogFormRules">
|
|
- <el-form-item label="标题:" prop="title">
|
|
|
|
- <el-input v-model="dialogData.title" maxlength="50" show-word-limit />
|
|
|
|
|
|
+ <el-form-item label="标题:" prop="videoTitle">
|
|
|
|
+ <el-input v-model="dialogData.videoTitle" maxlength="50" show-word-limit />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="视频链接:" prop="url">
|
|
|
|
- <div class="clearfix">
|
|
|
|
- <el-input v-model="dialogData.url" style="width:80%" class="fl" />
|
|
|
|
|
|
+ <el-form-item ref="formVideoUrlRef" label="视频链接:" prop="videoUrl">
|
|
|
|
+ <div class="clearfix video-upload-box" :class="{hasBottom:hasVideo}">
|
|
|
|
+ <el-input v-model="dialogData.videoUrl" style="width:80%" class="fl" :disabled="hasVideo" />
|
|
<el-upload
|
|
<el-upload
|
|
- style="width:18%"
|
|
|
|
|
|
+ ref="uploadRef"
|
|
class="upload-demo fr"
|
|
class="upload-demo fr"
|
|
accept=".mp4"
|
|
accept=".mp4"
|
|
|
|
+ :limit="1"
|
|
|
|
+ :auto-upload="false"
|
|
|
|
+ :show-file-list="true"
|
|
:headers="headers"
|
|
:headers="headers"
|
|
:action="action"
|
|
:action="action"
|
|
|
|
+ :file-list="fileList"
|
|
|
|
+ :on-success="handleUploadSuccess"
|
|
|
|
+ :on-change="handleUploadChange"
|
|
|
|
+ :on-remove="handleFileRemove"
|
|
>
|
|
>
|
|
- <el-button type="primary" style="width:100%">上传视频</el-button>
|
|
|
|
|
|
+ <el-button :disabled="hasVideo" type="primary" style="width:100%">选择视频</el-button>
|
|
</el-upload>
|
|
</el-upload>
|
|
</div>
|
|
</div>
|
|
<span style="color:#999;font-size:12px">如果没有链接,可以点击右侧的上传视频,视频大小不能超过<i style="color:red">*50MB*</i></span>
|
|
<span style="color:#999;font-size:12px">如果没有链接,可以点击右侧的上传视频,视频大小不能超过<i style="color:red">*50MB*</i></span>
|
|
@@ -123,7 +148,7 @@
|
|
</el-form>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
- <el-button type="primary" @click="handleAuditStatus">提 交</el-button>
|
|
|
|
|
|
+ <el-button type="primary" :loading="submitLoading" @click="handleSubmit">提 交</el-button>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
<!-- 视频预览对话框END -->
|
|
<!-- 视频预览对话框END -->
|
|
@@ -131,11 +156,13 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import Mock from 'mockjs'
|
|
|
|
|
|
+import Pagination from '@/components/Pagination' // secondary package based on el-pagination
|
|
import { formatDate } from '@/utils'
|
|
import { formatDate } from '@/utils'
|
|
import { mapGetters } from 'vuex'
|
|
import { mapGetters } from 'vuex'
|
|
import { getToken } from '@/utils/auth'
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
+import { changeVideoStatus, getVideoList, removeVideo, saveVideo } from '@/api/doc'
|
|
export default {
|
|
export default {
|
|
|
|
+ components: { Pagination },
|
|
filters: {
|
|
filters: {
|
|
formatTime(time) {
|
|
formatTime(time) {
|
|
if (!time) {
|
|
if (!time) {
|
|
@@ -147,25 +174,34 @@ export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
listLoading: false,
|
|
listLoading: false,
|
|
|
|
+ submitLoading: false,
|
|
dialogVisible: false,
|
|
dialogVisible: false,
|
|
dialogTitle: '添加视频',
|
|
dialogTitle: '添加视频',
|
|
|
|
+ total: 0,
|
|
|
|
+ hasVideo: false,
|
|
|
|
+ chooseNewVideo: false,
|
|
|
|
+ fileList: [],
|
|
|
|
+ uploadVideoUrl: '',
|
|
listQuery: {
|
|
listQuery: {
|
|
- pageNum: 0, // 页码
|
|
|
|
- pageSize: 20, // 分页大小
|
|
|
|
- articleTitle: '', // 供应商类型
|
|
|
|
- lowerAuditStatus: '', // 审核状态
|
|
|
|
- status: ''
|
|
|
|
|
|
+ authUserId: '', // 供应商用户id
|
|
|
|
+ listType: 1, // 列表类型:1视频列表,2视频审核列表
|
|
|
|
+ videoTitle: '', // 供应商类型
|
|
|
|
+ auditStatus: '', // 审核状态:0审核未通过,1审核通过,2待审核
|
|
|
|
+ status: '', // 视频状态:0已下线,1已上线,2待上线
|
|
|
|
+ pageNum: 1, // 页码
|
|
|
|
+ pageSize: 10 // 分页大小
|
|
},
|
|
},
|
|
dialogData: {
|
|
dialogData: {
|
|
- title: '',
|
|
|
|
- url: ''
|
|
|
|
|
|
+ videoId: '',
|
|
|
|
+ authUserId: '',
|
|
|
|
+ videoTitle: '',
|
|
|
|
+ videoUrl: ''
|
|
},
|
|
},
|
|
dialogFormRules: {
|
|
dialogFormRules: {
|
|
- title: [{ required: true, message: '标题不能为空', trigger: 'blur' }],
|
|
|
|
- url: [{ required: true, message: '链接不能为空', trigger: 'blur' }]
|
|
|
|
|
|
+ videoTitle: [{ required: true, message: '标题不能为空', trigger: 'blur' }],
|
|
|
|
+ videoUrl: [{ required: true, message: '链接不能为空', trigger: ['change', 'blur'] }]
|
|
},
|
|
},
|
|
- list: [],
|
|
|
|
- srcList: []
|
|
|
|
|
|
+ list: []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -176,7 +212,7 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
action() {
|
|
action() {
|
|
- return `${process.env.VUE_APP_UPLOAD_API}/upload/image`
|
|
|
|
|
|
+ return `${process.env.VUE_APP_UPLOAD_API}/upload/file`
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
@@ -185,35 +221,157 @@ export default {
|
|
methods: {
|
|
methods: {
|
|
// 获取列表数据
|
|
// 获取列表数据
|
|
getList() {
|
|
getList() {
|
|
- const count = 10
|
|
|
|
- const list = []
|
|
|
|
-
|
|
|
|
- for (let i = 0; i < count; i++) {
|
|
|
|
- list.push(Mock.mock({
|
|
|
|
- articleId: '@natural',
|
|
|
|
- articleTitle: '@ctitle(20,30)',
|
|
|
|
- articleCover: '@image("100x100")',
|
|
|
|
- auditStatus: '@natural(0,2)',
|
|
|
|
- auditTime: '@date("yy-MM-dd hh:mm:ss")',
|
|
|
|
- auditBy: '@cname(2,6)',
|
|
|
|
- status: '@natural(0,1)'
|
|
|
|
- }))
|
|
|
|
- }
|
|
|
|
- this.list = list
|
|
|
|
- this.initPreviewList(list)
|
|
|
|
|
|
+ this.listLoading = true
|
|
|
|
+ this.listQuery.authUserId = this.authUserId
|
|
|
|
+ getVideoList(this.listQuery)
|
|
|
|
+ .then(res => {
|
|
|
|
+ if (res.code !== 0) return
|
|
|
|
+ this.list = res.data.list
|
|
|
|
+ this.total = res.data.total
|
|
|
|
+ console.log(res)
|
|
|
|
+ })
|
|
|
|
+ .finally(() => {
|
|
|
|
+ this.listLoading = false
|
|
|
|
+ })
|
|
},
|
|
},
|
|
// 初始化预览图片列表
|
|
// 初始化预览图片列表
|
|
initPreviewList(list) {
|
|
initPreviewList(list) {
|
|
list.forEach(item => this.srcList.push(item.articleCover))
|
|
list.forEach(item => this.srcList.push(item.articleCover))
|
|
},
|
|
},
|
|
- handleAuditStatus() {
|
|
|
|
|
|
+ // 提交
|
|
|
|
+ handleSubmit() {
|
|
|
|
+ // 对标题字段进行规则校验
|
|
|
|
+ this.$refs.formRef.validateField('videoTitle', (error) => {
|
|
|
|
+ if (!error) {
|
|
|
|
+ /**
|
|
|
|
+ * 保存判定
|
|
|
|
+ * 1:videoUrl 为空 选择了视频
|
|
|
|
+ * 2:videoUrl 不为空 选择了视频
|
|
|
|
+ * 3:videoUrl 不为空 未选择视频
|
|
|
|
+ * */
|
|
|
|
+ this.submitLoading = true;
|
|
|
|
+ (this.dialogData.videoUrl && (!this.hasVideo || (this.hasVideo && !this.chooseNewVideo))) ? this.save() : this.$refs.uploadRef.submit()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
- handleShowDialog() {
|
|
|
|
- this.dialogVisible = true
|
|
|
|
|
|
+ // 保存视频
|
|
|
|
+ save() {
|
|
|
|
+ this.$refs.formRef.validate(valide => {
|
|
|
|
+ if (!valide) return
|
|
|
|
+ this.dialogData.authUserId = this.authUserId
|
|
|
|
+ if (this.uploadVideoUrl) {
|
|
|
|
+ this.dialogData.videoUrl = this.uploadVideoUrl
|
|
|
|
+ }
|
|
|
|
+ console.log('保存')
|
|
|
|
+ saveVideo(this.dialogData)
|
|
|
|
+ .then(res => {
|
|
|
|
+ console.log(res)
|
|
|
|
+ if (res.code !== 0) return
|
|
|
|
+ this.dialogVisible = false
|
|
|
|
+ this.getList()
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'success',
|
|
|
|
+ message: res.data,
|
|
|
|
+ duration: 500
|
|
|
|
+ })
|
|
|
|
+ }).finally(() => {
|
|
|
|
+ this.submitLoading = false
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ // 设置表单初始值
|
|
|
|
+ setDialogData(row) {
|
|
|
|
+ if (!row) return
|
|
|
|
+ console.log(row)
|
|
|
|
+ for (const key in this.dialogData) {
|
|
|
|
+ if (Object.hasOwnProperty.call(this.dialogData, key)) {
|
|
|
|
+ this.dialogData[key] = row[key]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (this.dialogData.videoUrl) {
|
|
|
|
+ this.fileList.push({ name: `删除当前视频后可上传新视频`, url: row.videoUrl })
|
|
|
|
+ this.hasVideo = true
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 删除视频
|
|
|
|
+ async handleRemoveVideo(row) {
|
|
|
|
+ const text = await this.$confirm('视频删除后不可恢复,确认删除该视频吗?', '提示', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ }).catch(() => {
|
|
|
|
+ this.$message.info('已取消操作')
|
|
|
|
+ })
|
|
|
|
+ if (text !== 'confirm') return
|
|
|
|
+ removeVideo({ videoId: row.videoId })
|
|
|
|
+ .then(res => {
|
|
|
|
+ if (res.code !== 0) return
|
|
|
|
+ this.$message.success(res.data)
|
|
|
|
+ this.getList()
|
|
|
|
+ })
|
|
},
|
|
},
|
|
- dialogColosed(type) {
|
|
|
|
|
|
+ // 显示对话框
|
|
|
|
+ handleShowDialog(type, row) {
|
|
this.dialogTitle = type === 'add' ? '添加视频' : '修改视频'
|
|
this.dialogTitle = type === 'add' ? '添加视频' : '修改视频'
|
|
- this.$refs.formRef.resetFields()
|
|
|
|
|
|
+ this.setDialogData(row)
|
|
|
|
+ this.dialogVisible = true
|
|
|
|
+ this.$refs?.formRef?.clearValidate()
|
|
|
|
+ },
|
|
|
|
+ // 对话框关闭的回调
|
|
|
|
+ dialogColosed() {
|
|
|
|
+ this.fileList = []
|
|
|
|
+ this.hasVideo = false
|
|
|
|
+ this.dialogData.videoId = ''
|
|
|
|
+ this.dialogData.authUserId = ''
|
|
|
|
+ this.dialogData.videoTitle = ''
|
|
|
|
+ this.dialogData.videoUrl = ''
|
|
|
|
+ this.chooseNewVideo = false
|
|
|
|
+ this.uploadVideoUrl = ''
|
|
|
|
+ },
|
|
|
|
+ // 视频上传成功
|
|
|
|
+ handleUploadSuccess(response, file, fileList) {
|
|
|
|
+ console.log(response)
|
|
|
|
+ // this.dialogData.videoUrl = response.fileUrl
|
|
|
|
+ this.uploadVideoUrl = response.fileUrl
|
|
|
|
+ this.save()
|
|
|
|
+ },
|
|
|
|
+ // 选添加文件、上传成功和上传失败时都会被调用
|
|
|
|
+ handleUploadChange(file, fileList) {
|
|
|
|
+ console.log(file)
|
|
|
|
+ this.chooseNewVideo = true
|
|
|
|
+ this.hasVideo = fileList.length > 0
|
|
|
|
+ this.dialogData.videoUrl = '-'
|
|
|
|
+ },
|
|
|
|
+ // 移除视频
|
|
|
|
+ handleFileRemove(file, fileList) {
|
|
|
|
+ this.hasVideo = fileList.length > 0
|
|
|
|
+ this.dialogData.videoUrl = ''
|
|
|
|
+ },
|
|
|
|
+ // 状态改变
|
|
|
|
+ handleChangeStatus(item) {
|
|
|
|
+ this.listLoading = true
|
|
|
|
+ // const params = {
|
|
|
|
+ // authId: item.authId,
|
|
|
|
+ // status: item.status ? 1 : 0
|
|
|
|
+ // }
|
|
|
|
+ console.log(item)
|
|
|
|
+ const params = {
|
|
|
|
+ videoId: item.videoId,
|
|
|
|
+ status: item.status === 1 ? 0 : 1
|
|
|
|
+ }
|
|
|
|
+ changeVideoStatus(params).then(res => {
|
|
|
|
+ // this.$message.success(res.data)
|
|
|
|
+ this.$message({
|
|
|
|
+ message: res.data,
|
|
|
|
+ duration: 500,
|
|
|
|
+ type: 'success'
|
|
|
|
+ })
|
|
|
|
+ this.getList()
|
|
|
|
+ }).catch(err => {
|
|
|
|
+ console.log(err)
|
|
|
|
+ }).finally(() => {
|
|
|
|
+ this.listLoading = false
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -244,4 +402,7 @@ export default {
|
|
.el-badge{
|
|
.el-badge{
|
|
margin: 0 6px;
|
|
margin: 0 6px;
|
|
}
|
|
}
|
|
|
|
+.hasBottom{
|
|
|
|
+ padding-bottom: 40px;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|