|
|
@@ -48,8 +48,8 @@
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="训练营" prop="courseId">
|
|
|
- <el-select filterable v-model="queryParams.courseId" placeholder="请选择训练营" clearable size="small" @change="handleCourseChange">
|
|
|
+ <el-form-item label="课程" prop="courseId">
|
|
|
+ <el-select filterable v-model="queryParams.courseId" placeholder="请选择课程" clearable size="small" @change="handleCourseChange">
|
|
|
<el-option
|
|
|
v-for="dict in courseLists"
|
|
|
:key="dict.dictValue"
|
|
|
@@ -58,7 +58,8 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="营期" prop="periodId">
|
|
|
+ <!-- 营期:仅在会员方式(sendType=1)时显示 -->
|
|
|
+ <el-form-item label="营期" prop="periodId" v-if="queryParams.sendType == 1">
|
|
|
<el-select filterable v-model="queryParams.periodId" placeholder="请选择营期" clearable size="small" @change="handlePeriodChange" :disabled="!queryParams.courseId">
|
|
|
<el-option
|
|
|
v-for="dict in periodList"
|
|
|
@@ -68,8 +69,10 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <!-- 小节:会员方式依赖营期,企微方式依赖课程 -->
|
|
|
<el-form-item label="小节" prop="videoId">
|
|
|
- <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small" :disabled="!queryParams.periodId">
|
|
|
+ <el-select filterable v-model="queryParams.videoId" placeholder="请选择小节" clearable size="small"
|
|
|
+ :disabled="queryParams.sendType == 1 ? !queryParams.periodId : !queryParams.courseId">
|
|
|
<el-option
|
|
|
v-for="dict in videoList"
|
|
|
:key="dict.dictValue"
|
|
|
@@ -683,7 +686,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { listCourseWatchLog, getCourseWatchLog, delCourseWatchLog, addCourseWatchLog, updateCourseWatchLog, exportCourseWatchLog } from "@/api/course/courseWatchLog";
|
|
|
-import {courseList, listCourseRedPacketLog, videoList, periodList} from '@/api/course/courseRedPacketLog'
|
|
|
+import {courseList, qwCourseList, listCourseRedPacketLog, videoList, qwVideoList, periodList} from '@/api/course/courseRedPacketLog'
|
|
|
import {listLogs} from "@/api/course/courseAnswerlogs";
|
|
|
import {allListTagGroup} from "../../../api/qw/tagGroup";
|
|
|
import {searchTags} from "../../../api/qw/tag";
|
|
|
@@ -903,9 +906,8 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
- courseList().then(response => {
|
|
|
- this.courseLists = response.list;
|
|
|
- });
|
|
|
+ // 初始化时根据默认的sendType加载课程列表
|
|
|
+ this.loadCourseList();
|
|
|
this.getList();
|
|
|
this.getDicts("sys_course_watch_log_type_new").then(response => {
|
|
|
this.logTypeOptions = response.data;
|
|
|
@@ -1086,7 +1088,8 @@ export default {
|
|
|
},
|
|
|
/**
|
|
|
* 课程变更处理
|
|
|
- * 当课程改变时,清空营期和小节的选择和列表
|
|
|
+ * sendType=1(会员): 加载营期列表,清空营期和小节
|
|
|
+ * sendType=2(企微): 直接加载小节列表,清空小节
|
|
|
*/
|
|
|
handleCourseChange(courseId) {
|
|
|
// 清空下级选择和列表
|
|
|
@@ -1095,9 +1098,15 @@ export default {
|
|
|
this.periodList = [];
|
|
|
this.videoList = [];
|
|
|
|
|
|
- // 如果选择了课程,加载营期列表
|
|
|
if (courseId) {
|
|
|
- this.loadPeriodList(courseId);
|
|
|
+ if (this.queryParams.sendType == 1) {
|
|
|
+ // 会员方式:加载营期列表(三级联动:课程->营期->小节)
|
|
|
+ this.loadPeriodList(courseId);
|
|
|
+ } else if (this.queryParams.sendType == 2) {
|
|
|
+ // 企微方式:直接加载小节列表(二级联动:课程->小节)
|
|
|
+ // 调用 /course/courseRedPacketLog/qwvideoList/{courseId}
|
|
|
+ this.loadQwVideoList(courseId);
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
|
|
|
@@ -1131,7 +1140,7 @@ export default {
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
- * 加载视频列表
|
|
|
+ * 加载视频列表(通过营期ID)
|
|
|
* @param {Number} periodId - 营期ID
|
|
|
*/
|
|
|
loadVideoList(periodId) {
|
|
|
@@ -1144,6 +1153,46 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
|
|
|
+ /**
|
|
|
+ * 加载视频列表(通过课程ID)- 企微方式使用
|
|
|
+ * @param {Number} courseId - 课程ID
|
|
|
+ */
|
|
|
+ loadQwVideoList(courseId) {
|
|
|
+ qwVideoList(courseId).then(response => {
|
|
|
+ this.videoList = response.list || [];
|
|
|
+ }).catch(error => {
|
|
|
+ console.error('加载视频列表失败:', error);
|
|
|
+ this.$message.error('加载视频列表失败');
|
|
|
+ this.videoList = [];
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 加载课程列表
|
|
|
+ * 根据sendType加载不同的课程列表
|
|
|
+ */
|
|
|
+ loadCourseList() {
|
|
|
+ if (this.queryParams.sendType == 2) {
|
|
|
+ // 企微方式:调用qwCourseList
|
|
|
+ qwCourseList().then(response => {
|
|
|
+ this.courseLists = response.list || [];
|
|
|
+ }).catch(error => {
|
|
|
+ console.error('加载企微课程列表失败:', error);
|
|
|
+ this.$message.error('加载课程列表失败');
|
|
|
+ this.courseLists = [];
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 会员方式:调用courseList
|
|
|
+ courseList().then(response => {
|
|
|
+ this.courseLists = response.list || [];
|
|
|
+ }).catch(error => {
|
|
|
+ console.error('加载课程列表失败:', error);
|
|
|
+ this.$message.error('加载课程列表失败');
|
|
|
+ this.courseLists = [];
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
// 营期时间
|
|
|
handleScheduleTimeChange(scheduleTime) {
|
|
|
if (scheduleTime && scheduleTime.length >= 2) {
|
|
|
@@ -1482,6 +1531,17 @@ export default {
|
|
|
},
|
|
|
|
|
|
handleSendTypeChange() {
|
|
|
+ // 清空课程、营期、小节相关数据
|
|
|
+ this.queryParams.courseId = null;
|
|
|
+ this.queryParams.periodId = null;
|
|
|
+ this.queryParams.videoId = null;
|
|
|
+ this.periodList = [];
|
|
|
+ this.videoList = [];
|
|
|
+ this.courseLists = [];
|
|
|
+
|
|
|
+ // 重新加载课程列表
|
|
|
+ this.loadCourseList();
|
|
|
+
|
|
|
this.handleQuery(); // 重新查询列表
|
|
|
},
|
|
|
|