|
|
@@ -33,6 +33,16 @@
|
|
|
v-hasPermi="['course:userCourseVideo:batchAdd']">批量添加
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
+ <el-col v-if="usePublicVideoLibrary" :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ size="mini"
|
|
|
+ :disabled="!ids || ids.length <= 0"
|
|
|
+ v-hasPermi="['course:userCourseVideo:edit']"
|
|
|
+ @click="openBatchWatchIntegralDialog"
|
|
|
+ >批量修改</el-button>
|
|
|
+ </el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="primary" plain size="mini" @click="updateRedPageckeOpen"
|
|
|
v-hasPermi="['course:userCourseVideo:updateRed']">修改红包
|
|
|
@@ -100,6 +110,8 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="红包金额" align="center" prop="redPacketMoney"/>
|
|
|
<el-table-column label="排序" align="center" prop="courseSort"/>
|
|
|
+ <el-table-column v-if="usePublicVideoLibrary" label="观看时长(分钟)" align="center" width="120" prop="watchDurationMinutes"/>
|
|
|
+ <el-table-column v-if="usePublicVideoLibrary" label="积分奖励" align="center" width="100" prop="integralReward"/>
|
|
|
<el-table-column label="上传时间" align="center" prop="createTime"/>
|
|
|
<el-table-column label="是否上架" align="center" prop="isOnPut">
|
|
|
<template slot-scope="{ row }">
|
|
|
@@ -139,6 +151,7 @@
|
|
|
<el-form-item label="课程排序" prop="courseSort">
|
|
|
<el-input-number v-model="form.courseSort" :min="1"></el-input-number>
|
|
|
</el-form-item>
|
|
|
+
|
|
|
|
|
|
<el-form-item label="视频缩略图" prop="thumbnail">
|
|
|
<el-upload v-model="form.thumbnail" class="avatar-uploader" :action="uploadUrl" :show-file-list="false"
|
|
|
@@ -147,7 +160,7 @@
|
|
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
</el-upload>
|
|
|
</el-form-item>
|
|
|
- <video-upload :type="1" :isPrivate="isPrivate" :fileKey.sync="form.fileKey" :fileSize.sync="form.fileSize"
|
|
|
+ <video-upload :type="1" :isPrivate="isPrivate" :use-public-video-library="usePublicVideoLibrary" :fileKey.sync="form.fileKey" :fileSize.sync="form.fileSize"
|
|
|
:videoUrl.sync="videoUrl" :fileName.sync="form.fileName" :line_1.sync="form.lineOne"
|
|
|
:line_2.sync="form.lineTwo" :line_3.sync="form.lineThree" :thumbnail.sync="form.thumbnail"
|
|
|
:uploadType.sync="form.uploadType" :isTranscode.sync="form.isTranscode"
|
|
|
@@ -359,6 +372,32 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+ <el-form-item v-if="usePublicVideoLibrary" label="观看时长" prop="watchDurationMinutes">
|
|
|
+ <el-input-number
|
|
|
+ v-model="form.watchDurationMinutes"
|
|
|
+ :min="0"
|
|
|
+ :precision="0"
|
|
|
+ :step="1"
|
|
|
+ controls-position="right"
|
|
|
+ placeholder="请输入"
|
|
|
+ class="input-num-fixed"
|
|
|
+ style="width: 200px"
|
|
|
+ />
|
|
|
+ <span class="form-unit">分钟</span>
|
|
|
+ <span class="form-hint">注释:用户在页面的停留时间</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="usePublicVideoLibrary" label="积分奖励" prop="integralReward">
|
|
|
+ <el-input-number
|
|
|
+ v-model="form.integralReward"
|
|
|
+ :min="0"
|
|
|
+ :precision="0"
|
|
|
+ :step="1"
|
|
|
+ controls-position="right"
|
|
|
+ placeholder="请输入"
|
|
|
+ class="input-num-fixed"
|
|
|
+ style="width: 200px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
@@ -385,6 +424,38 @@
|
|
|
<el-button @click="updateBatchData.open = false">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <el-dialog title="批量修改观看时长与积分" :visible.sync="batchWatchIntegral.open" width="520px" append-to-body>
|
|
|
+ <p class="batch-watch-tip">已选 <strong>{{ ids.length }}</strong> 条课节,将统一更新为下方数值(仅本课程下已选中的记录)。</p>
|
|
|
+ <el-form label-width="120px">
|
|
|
+ <el-form-item label="观看时长">
|
|
|
+ <el-input-number
|
|
|
+ v-model="batchWatchIntegral.form.watchDurationMinutes"
|
|
|
+ :min="0"
|
|
|
+ :precision="0"
|
|
|
+ :step="1"
|
|
|
+ controls-position="right"
|
|
|
+ style="width: 200px"
|
|
|
+ />
|
|
|
+ <span class="form-unit">分钟</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="积分奖励">
|
|
|
+ <el-input-number
|
|
|
+ v-model="batchWatchIntegral.form.integralReward"
|
|
|
+ :min="0"
|
|
|
+ :precision="0"
|
|
|
+ :step="1"
|
|
|
+ controls-position="right"
|
|
|
+ style="width: 200px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="batchWatchIntegral.open = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="submitBatchWatchIntegral">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
<el-dialog :title="questionBank.title" :visible.sync="questionBank.open" width="1000px" append-to-body>
|
|
|
<question-bank ref="questionBank" @questionBankResult="questionBankResult"></question-bank>
|
|
|
</el-dialog>
|
|
|
@@ -557,22 +628,30 @@ import {
|
|
|
sortCourseVideo,
|
|
|
updates,
|
|
|
updateUserCourseVideo,
|
|
|
+ batchUpdateWatchIntegral,
|
|
|
syncTemplate, batchDownUserCourseVideo, batchEditCover, batchUpUserCourseVideo
|
|
|
} from '@/api/course/userCourseVideo'
|
|
|
// import {syncTemplate} from '@/api/course/userCourse'
|
|
|
import QuestionBank from "@/views/course/courseQuestionBank/QuestionBank.vue";
|
|
|
import CourseProduct from "@/views/course/fsCourseProduct/CourseProduct.vue";
|
|
|
import VideoUpload from "@/components/VideoUpload/index.vue";
|
|
|
-import {listVideoResource} from '@/api/course/videoResource';
|
|
|
+import {listVideoResource, listPublicVideoResource} from '@/api/course/videoResource';
|
|
|
import {getByIds} from '@/api/course/courseQuestionBank'
|
|
|
import CourseWatchComment from "./courseWatchComment.vue";
|
|
|
-import {getCateListByPid, getCatePidList} from '@/api/course/userCourseCategory'
|
|
|
+import {getCateListByPid, getCatePidList, getPublicCateListByPid, getPublicCatePidList} from '@/api/course/userCourseCategory'
|
|
|
import draggable from 'vuedraggable'
|
|
|
import { getConfigByKey } from '@/api/system/config'
|
|
|
|
|
|
export default {
|
|
|
name: "userCourseCatalog",
|
|
|
components: {VideoUpload, QuestionBank, CourseWatchComment, CourseProduct, draggable},
|
|
|
+ props: {
|
|
|
+ /** 为 true 时「视频库选择」使用公域分类 + 公域素材接口;默认 false 走原 list / 原分类下拉 */
|
|
|
+ usePublicVideoLibrary: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ }
|
|
|
+ },
|
|
|
watch:{
|
|
|
// 深度监听 rules 数组的变化,以更新总权重
|
|
|
"form.randomRedPacketRulesArr": {
|
|
|
@@ -695,6 +774,13 @@ export default {
|
|
|
open: false,
|
|
|
form: {}
|
|
|
},
|
|
|
+ batchWatchIntegral: {
|
|
|
+ open: false,
|
|
|
+ form: {
|
|
|
+ watchDurationMinutes: 0,
|
|
|
+ integralReward: 0
|
|
|
+ }
|
|
|
+ },
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
title: [
|
|
|
@@ -996,6 +1082,8 @@ export default {
|
|
|
isOnPut: 0,
|
|
|
listingStartTime: null,
|
|
|
listingEndTime: null,
|
|
|
+ watchDurationMinutes: null,
|
|
|
+ integralReward: null,
|
|
|
randomRedPacketRules:null,
|
|
|
randomRedPacketRulesArr:[
|
|
|
{
|
|
|
@@ -1248,8 +1336,43 @@ export default {
|
|
|
this.addBatchData.select = [];
|
|
|
this.resourceList();
|
|
|
},
|
|
|
+ openBatchWatchIntegralDialog() {
|
|
|
+ if (!this.ids || this.ids.length === 0) {
|
|
|
+ this.$message.warning('请先勾选要修改的课节');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.batchWatchIntegral.form = {
|
|
|
+ watchDurationMinutes: 0,
|
|
|
+ integralReward: 0
|
|
|
+ };
|
|
|
+ this.batchWatchIntegral.open = true;
|
|
|
+ },
|
|
|
+ submitBatchWatchIntegral() {
|
|
|
+ const w = this.batchWatchIntegral.form.watchDurationMinutes;
|
|
|
+ const i = this.batchWatchIntegral.form.integralReward;
|
|
|
+ if (w === null || w === undefined || i === null || i === undefined) {
|
|
|
+ this.$message.warning('请填写观看时长与积分奖励');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const videoIds = (this.ids || []).map(id => (typeof id === 'string' ? parseInt(id, 10) : id));
|
|
|
+ batchUpdateWatchIntegral({
|
|
|
+ courseId: this.courseId,
|
|
|
+ videoIds: videoIds,
|
|
|
+ watchDurationMinutes: w,
|
|
|
+ integralReward: i
|
|
|
+ }).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.msgSuccess('修改成功');
|
|
|
+ this.batchWatchIntegral.open = false;
|
|
|
+ this.getList();
|
|
|
+ } else {
|
|
|
+ this.$message.error(response.msg || '修改失败');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
getRootTypeList() {
|
|
|
- getCatePidList().then(response => {
|
|
|
+ const req = this.usePublicVideoLibrary ? getPublicCatePidList() : getCatePidList()
|
|
|
+ req.then(response => {
|
|
|
this.addBatchData.typeOptions = response.data
|
|
|
});
|
|
|
},
|
|
|
@@ -1259,13 +1382,15 @@ export default {
|
|
|
if (!val) {
|
|
|
return
|
|
|
}
|
|
|
- await getCateListByPid(val).then(response => {
|
|
|
+ const subReq = this.usePublicVideoLibrary ? getPublicCateListByPid(val) : getCateListByPid(val)
|
|
|
+ await subReq.then(response => {
|
|
|
this.addBatchData.typeSubOptions = response.data
|
|
|
})
|
|
|
},
|
|
|
resourceList() {
|
|
|
this.addBatchData.loading = true;
|
|
|
- listVideoResource(this.addBatchData.queryParams).then(response => {
|
|
|
+ const api = this.usePublicVideoLibrary ? listPublicVideoResource : listVideoResource
|
|
|
+ api(this.addBatchData.queryParams).then(response => {
|
|
|
this.addBatchData.loading = false;
|
|
|
this.addBatchData.list = response.rows;
|
|
|
this.addBatchData.total = response.total;
|
|
|
@@ -1531,6 +1656,20 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
<style scoped>
|
|
|
+.form-unit {
|
|
|
+ margin-left: 8px;
|
|
|
+ color: #606266;
|
|
|
+}
|
|
|
+.form-hint {
|
|
|
+ margin-left: 12px;
|
|
|
+ color: #909399;
|
|
|
+ font-size: 12px;
|
|
|
+}
|
|
|
+.batch-watch-tip {
|
|
|
+ margin: 0 0 16px 0;
|
|
|
+ color: #606266;
|
|
|
+ font-size: 13px;
|
|
|
+}
|
|
|
.avatar-uploader-icon {
|
|
|
display: flex;
|
|
|
align-items: center;
|