|
@@ -49,7 +49,7 @@
|
|
|
>{{ item.name }}</el-button
|
|
|
>
|
|
|
</div>
|
|
|
- <div v-for="(item, index) in filterList(courseList)" :key="index">
|
|
|
+ <div v-for="(item, index) in courseList" :key="index" v-show="item.subjectId === newActiveSubjectId || !newActiveSubjectId">
|
|
|
<p class="firstTop hoverStyle" @click="changeStatus(item)">
|
|
|
<span class="iconStyle">课</span
|
|
|
><span class="titles">{{ item.courseName }}</span
|
|
@@ -113,7 +113,11 @@
|
|
|
? "直播"
|
|
|
: is.sectionType === 3
|
|
|
? "回放"
|
|
|
- : "练习"
|
|
|
+ : is.doType == 1
|
|
|
+ ? "练习"
|
|
|
+ : is.doType != 1
|
|
|
+ ? "考试"
|
|
|
+ : ""
|
|
|
}}</span>
|
|
|
<span class="span_style">{{ is.name }}</span>
|
|
|
<span v-if="is.recordStatus" class="upStudyStyle"
|
|
@@ -145,10 +149,27 @@
|
|
|
}}
|
|
|
</span>
|
|
|
</el-col>
|
|
|
+ <el-col :span="2" :offset="1" v-if="!is.sectionType">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ style="width: 90px !important"
|
|
|
+ type="text"
|
|
|
+ v-if="is.doType == 1"
|
|
|
+ @click="getResource(item, is)"
|
|
|
+ >进入学习</el-button
|
|
|
+ ><el-button
|
|
|
+ size="mini"
|
|
|
+ style="width: 90px !important"
|
|
|
+ type="text"
|
|
|
+ v-else
|
|
|
+ @click="getResource(item, is)"
|
|
|
+ >进入考试</el-button
|
|
|
+ >
|
|
|
+ </el-col>
|
|
|
<el-col
|
|
|
:span="2"
|
|
|
:offset="1"
|
|
|
- v-if="is.sectionType != 2"
|
|
|
+ v-else-if="is.sectionType != 2"
|
|
|
>
|
|
|
<el-button
|
|
|
size="mini"
|
|
@@ -254,7 +275,11 @@
|
|
|
? "直播"
|
|
|
: i.sectionType === 3
|
|
|
? "回放"
|
|
|
- : "练习"
|
|
|
+ : i.doType == 1
|
|
|
+ ? "练习"
|
|
|
+ : i.doType != 1
|
|
|
+ ? "考试"
|
|
|
+ : ""
|
|
|
}}</span>
|
|
|
<span class="span_style">
|
|
|
{{ i.name }}
|
|
@@ -288,7 +313,28 @@
|
|
|
}}
|
|
|
</span>
|
|
|
</el-col>
|
|
|
- <el-col :span="2" :offset="1" v-if="i.sectionType != 2">
|
|
|
+ <el-col :span="2" :offset="1" v-if="!i.sectionType">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ style="width: 90px !important"
|
|
|
+ type="text"
|
|
|
+ v-if="i.doType == 1"
|
|
|
+ @click="getResource(item, i)"
|
|
|
+ >进入学习</el-button
|
|
|
+ ><el-button
|
|
|
+ size="mini"
|
|
|
+ style="width: 90px !important"
|
|
|
+ type="text"
|
|
|
+ v-else
|
|
|
+ @click="getResource(item, i)"
|
|
|
+ >进入考试</el-button
|
|
|
+ >
|
|
|
+ </el-col>
|
|
|
+ <el-col
|
|
|
+ :span="2"
|
|
|
+ :offset="1"
|
|
|
+ v-else-if="i.sectionType != 2"
|
|
|
+ >
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
@@ -375,7 +421,11 @@
|
|
|
? "直播"
|
|
|
: items.sectionType === 3
|
|
|
? "回放"
|
|
|
- : "练习"
|
|
|
+ : items.doType == 1
|
|
|
+ ? "练习"
|
|
|
+ : items.doType != 1
|
|
|
+ ? "考试"
|
|
|
+ : ""
|
|
|
}}</span>
|
|
|
<span class="span_style">
|
|
|
{{ items.menuName }}
|
|
@@ -409,7 +459,28 @@
|
|
|
}}
|
|
|
</span>
|
|
|
</el-col>
|
|
|
- <el-col :span="2" :offset="1" v-if="items.sectionType != 2">
|
|
|
+ <el-col :span="2" :offset="1" v-if="!items.sectionType">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ style="width: 90px !important"
|
|
|
+ type="text"
|
|
|
+ v-if="items.doType == 1"
|
|
|
+ @click="getResource(item, items)"
|
|
|
+ >进入学习</el-button
|
|
|
+ ><el-button
|
|
|
+ size="mini"
|
|
|
+ style="width: 90px !important"
|
|
|
+ type="text"
|
|
|
+ v-else
|
|
|
+ @click="getResource(item, items)"
|
|
|
+ >进入考试</el-button
|
|
|
+ >
|
|
|
+ </el-col>
|
|
|
+ <el-col
|
|
|
+ :span="2"
|
|
|
+ :offset="1"
|
|
|
+ v-else-if="items.sectionType != 2"
|
|
|
+ >
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
style="width: 90px !important"
|
|
@@ -563,24 +634,25 @@ export default {
|
|
|
appointModal: false, // 预约考试弹窗
|
|
|
subjectList: [], //当前商品课程科目汇总
|
|
|
newActiveSubjectId: "", //当前选中ID
|
|
|
+ businessData: {},
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters(["userInfo"]),
|
|
|
- filterList:function(){
|
|
|
- return function(item){
|
|
|
- console.log(this.newActiveSubjectId)
|
|
|
- let array = []
|
|
|
- if(this.newActiveSubjectId){
|
|
|
- array = item.filter(items => {
|
|
|
- return items.subjectId === this.newActiveSubjectId
|
|
|
- })
|
|
|
- }else{
|
|
|
- return item
|
|
|
- }
|
|
|
- return array
|
|
|
- }
|
|
|
- }
|
|
|
+ // filterList: function () {
|
|
|
+ // return function (item) {
|
|
|
+ // console.log(this.newActiveSubjectId);
|
|
|
+ // let array = [];
|
|
|
+ // if (this.newActiveSubjectId) {
|
|
|
+ // array = item.filter((items) => {
|
|
|
+ // return items.subjectId === this.newActiveSubjectId;
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // return item;
|
|
|
+ // }
|
|
|
+ // return array;
|
|
|
+ // };
|
|
|
+ // },
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getRecord();
|
|
@@ -615,6 +687,7 @@ export default {
|
|
|
},
|
|
|
backData(item) {
|
|
|
this.goodsData = item;
|
|
|
+ this.courseBusiness();
|
|
|
this.getGoodsCourseList(item);
|
|
|
},
|
|
|
//数组对象去重
|
|
@@ -671,6 +744,7 @@ export default {
|
|
|
let array = result.rows[0];
|
|
|
array.orderGoodsId = res.data.orderGoodsId;
|
|
|
this.goodsData = array;
|
|
|
+ this.courseBusiness();
|
|
|
await this.getGoodsCourseList(array);
|
|
|
resolve();
|
|
|
}
|
|
@@ -876,7 +950,8 @@ export default {
|
|
|
*/
|
|
|
changeChapterStatus(type, item, courseIndex, index, indexs) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- console.log(item,'定位')
|
|
|
+ console.log(item, "定位");
|
|
|
+ console.log(type, item, courseIndex, index, indexs)
|
|
|
if (item.children && item.children.length > 0) {
|
|
|
item.showStatus = !item.showStatus;
|
|
|
return;
|
|
@@ -890,6 +965,19 @@ export default {
|
|
|
orderGoodsId: this.goodsData.orderGoodsId,
|
|
|
})
|
|
|
.then((res) => {
|
|
|
+ let newArr = res.data.filter((item) => {
|
|
|
+ return item.type != 2;
|
|
|
+ });
|
|
|
+ let canLearn = newArr.every((item) => {
|
|
|
+ if (item.learning == 1) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ res.data.forEach((section) => {
|
|
|
+ section.canLearn = canLearn;
|
|
|
+ });
|
|
|
if (type === 1) {
|
|
|
this.$set(
|
|
|
this.courseList[courseIndex].children[index],
|
|
@@ -1076,7 +1164,266 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
+ async getResource(courseLists, section) {
|
|
|
+ console.log(section);
|
|
|
+ if (section.type == 2) {
|
|
|
+ //试卷
|
|
|
+ console.log("试卷");
|
|
|
+ console.log(courseLists, section, this.goodsData);
|
|
|
+ let learnNum = await this.goodsTodayStudySectionNum(section);
|
|
|
+ let hasLearn = await this.gradeCheckGoodsStudy(courseLists, section);
|
|
|
+
|
|
|
+ if (this.goodsData.sectionMaxNum > 0) {
|
|
|
+ if (learnNum >= this.goodsData.sectionMaxNum && !hasLearn) {
|
|
|
+ this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: `每天最多学习${this.goodsData.sectionMaxNum}节`,
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.businessData.goodsLearningOrder == 1) {
|
|
|
+ if (section.canLearn) {
|
|
|
+ let num = await this.bankRecordDoNum(courseLists, section);
|
|
|
+ //有次数限制
|
|
|
+ if (section.answerNum - num > 0 && section.answerNum > 0) {
|
|
|
+ // this.$set(this.list[index],'doNum',(item.doNum+1))
|
|
|
+ this.$router.push({
|
|
|
+ path: "/course-exam/" + this.goodsData.goodsId,
|
|
|
+ query: {
|
|
|
+ courseId: courseLists.courseId,
|
|
|
+ gradeId: this.goodsData.gradeId,
|
|
|
+ moduleId: section.moduleId || 0,
|
|
|
+ examId: section.typeId,
|
|
|
+ chapterId: section.chapterId || 0,
|
|
|
+ orderGoodsId: this.goodsData.orderGoodsId,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ //没有答题次数限制
|
|
|
+ } else if (section.answerNum == 0) {
|
|
|
+ this.$router.push({
|
|
|
+ path: "/course-exam/" + this.goodsData.goodsId,
|
|
|
+ query: {
|
|
|
+ courseId: courseLists.courseId,
|
|
|
+ gradeId: this.goodsData.gradeId,
|
|
|
+ moduleId: section.moduleId || 0,
|
|
|
+ examId: section.typeId,
|
|
|
+ chapterId: section.chapterId || 0,
|
|
|
+ orderGoodsId: this.goodsData.orderGoodsId,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: "该试卷只能答题" + section.answerNum + "次",
|
|
|
+ });
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.studyLog(
|
|
|
+ (section.moduleId = 0),
|
|
|
+ (section.chapterId = 0),
|
|
|
+ section.typeId,
|
|
|
+ courseLists
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: "请按顺序学完视频课程再进行练习和测试",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else if (
|
|
|
+ this.businessData.goodsLearningOrder == 2 &&
|
|
|
+ !section.rebuild
|
|
|
+ ) {
|
|
|
+ let rows = await this.studyRecordMenuAllList(courseLists);
|
|
|
+ let isStop = false;
|
|
|
+ let newRows = [];
|
|
|
+ for (let i = 0; i < rows.length; i++) {
|
|
|
+ let moduleTrue = rows[i].moduleId == section.moduleId;
|
|
|
+ let chapterTrue = rows[i].chapterId == section.chapterId;
|
|
|
+ if (moduleTrue && chapterTrue) {
|
|
|
+ isStop = true;
|
|
|
+ if (rows[i].sectionType != 2) {
|
|
|
+ //忽略直播
|
|
|
+ newRows.push(rows[i]);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!isStop) {
|
|
|
+ if (rows[i].sectionType != 2) {
|
|
|
+ //忽略直播
|
|
|
+ newRows.push(rows[i]);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(newRows);
|
|
|
+ let isAllLearn = newRows.every((item) => {
|
|
|
+ return item.studyStatus == 1;
|
|
|
+ });
|
|
|
+
|
|
|
+ if (isAllLearn) {
|
|
|
+ //之前的都学完了
|
|
|
+
|
|
|
+ // if(canLearn) { //视频的上一节学完
|
|
|
+
|
|
|
+ let num = await this.bankRecordDoNum(courseLists, section);
|
|
|
+ //有次数限制
|
|
|
+ if (section.answerNum - num > 0 && section.answerNum > 0) {
|
|
|
+ console.log(this.list[index]);
|
|
|
+ this.$router.push({
|
|
|
+ path: "/course-exam/" + this.goodsData.goodsId,
|
|
|
+ query: {
|
|
|
+ courseId: courseLists.courseId,
|
|
|
+ gradeId: this.goodsData.gradeId,
|
|
|
+ moduleId: section.moduleId || 0,
|
|
|
+ examId: section.typeId,
|
|
|
+ chapterId: section.chapterId || 0,
|
|
|
+ orderGoodsId: this.goodsData.orderGoodsId,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ //没有答题次数限制
|
|
|
+ } else if (section.answerNum == 0) {
|
|
|
+ this.$router.push({
|
|
|
+ path: "/course-exam/" + this.goodsData.goodsId,
|
|
|
+ query: {
|
|
|
+ courseId: courseLists.courseId,
|
|
|
+ gradeId: this.goodsData.gradeId,
|
|
|
+ moduleId: section.moduleId || 0,
|
|
|
+ examId: section.typeId,
|
|
|
+ chapterId: section.chapterId || 0,
|
|
|
+ orderGoodsId: this.goodsData.orderGoodsId,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: "该试卷只能答题" + section.answerNum + "次",
|
|
|
+ });
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.studyLog(
|
|
|
+ (section.moduleId = 0),
|
|
|
+ (section.chapterId = 0),
|
|
|
+ section.typeId,
|
|
|
+ courseLists
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: "请学完视频课程再进行练习和测试",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ let num = await this.bankRecordDoNum(courseLists, section);
|
|
|
+ //有次数限制
|
|
|
+ if (section.answerNum - section.doNum > 0 && section.answerNum > 0) {
|
|
|
+ // this.$set(this.list[index],'doNum',(item.doNum+1))
|
|
|
+ this.$router.push({
|
|
|
+ path: "/course-exam/" + this.goodsData.goodsId,
|
|
|
+ query: {
|
|
|
+ courseId: courseLists.courseId,
|
|
|
+ gradeId: this.goodsData.gradeId,
|
|
|
+ moduleId: section.moduleId || 0,
|
|
|
+ examId: section.typeId,
|
|
|
+ chapterId: section.chapterId || 0,
|
|
|
+ orderGoodsId: this.goodsData.orderGoodsId,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ //没有答题次数限制
|
|
|
+ } else if (section.answerNum == 0) {
|
|
|
+ this.$router.push({
|
|
|
+ path: "/course-exam/" + this.goodsData.goodsId,
|
|
|
+ query: {
|
|
|
+ courseId: courseLists.courseId,
|
|
|
+ gradeId: this.goodsData.gradeId,
|
|
|
+ moduleId: section.moduleId || 0,
|
|
|
+ examId: section.typeId,
|
|
|
+ chapterId: section.chapterId || 0,
|
|
|
+ orderGoodsId: this.goodsData.orderGoodsId,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: "该试卷只能答题" + section.answerNum + "次",
|
|
|
+ });
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.studyLog(
|
|
|
+ (section.moduleId = 0),
|
|
|
+ (section.chapterId = 0),
|
|
|
+ section.typeId,
|
|
|
+ courseLists
|
|
|
+ );
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 新增用户视频学习日志
|
|
|
+ studyLog(moduleId, chapterId, sectionId, courseLists) {
|
|
|
+ this.$axios({
|
|
|
+ url: "/user/study/log",
|
|
|
+ method: "post",
|
|
|
+ data: {
|
|
|
+ goodsId: this.goodsData.goodsId,
|
|
|
+ courseId: courseLists.courseId,
|
|
|
+ moduleId: moduleId || 0,
|
|
|
+ chapterId: chapterId || 0,
|
|
|
+ sectionId: sectionId || 0,
|
|
|
+ fromPlat: 2, //来源平台 1小程序 2PC网站
|
|
|
+ goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
|
|
|
+ orderGoodsId: this.goodsData.orderGoodsId,
|
|
|
+ },
|
|
|
+ }).then((res) => {
|
|
|
+ console.log("直播的用户学习日志:", res);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 获取培训项目详情
|
|
|
+ */
|
|
|
+ courseBusiness() {
|
|
|
+ this.$request.courseBusiness(this.goodsData.businessId).then((res) => {
|
|
|
+ this.businessData = res.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ bankRecordDoNum(courseLists, section) {
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ this.$request
|
|
|
+ .bankRecordDoNum({
|
|
|
+ goodsId: this.goodsData.goodsId,
|
|
|
+ gradeId: this.goodsData.gradeId,
|
|
|
+ chapterId: section.chapterId,
|
|
|
+ courseId: courseLists.courseId,
|
|
|
+ moduleId: 0,
|
|
|
+ examId: section.typeId,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ resolve(res.data);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
+ studyRecordMenuAllList(courseLists) {
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ this.$request
|
|
|
+ .studyRecordMenuAllList({
|
|
|
+ courseId: courseLists.courseId,
|
|
|
+ gradeId: this.goodsData.gradeId,
|
|
|
+ goodsId: this.goodsData.goodsId,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ resolve(res.data);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
gradeCheckGoodsStudy(courseItem, option) {
|
|
|
return new Promise((resolve) => {
|
|
|
this.$request
|