|
@@ -244,7 +244,9 @@
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
style="width: 90px !important"
|
|
|
- @click="getResource(item, is, 2)"
|
|
|
+ @click="
|
|
|
+ handelPracticeOrRxam(is, 2, item.courseId)
|
|
|
+ "
|
|
|
>习题</el-button
|
|
|
>
|
|
|
</el-col>
|
|
@@ -432,7 +434,7 @@
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
style="width: 90px !important"
|
|
|
- @click="getResource(item, i, 2)"
|
|
|
+ @click="handelPracticeOrRxam(i, 2, item.courseId)"
|
|
|
>习题</el-button
|
|
|
>
|
|
|
</el-col>
|
|
@@ -594,7 +596,7 @@
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
style="width: 90px !important"
|
|
|
- @click="getResource(item, items, 2, true)"
|
|
|
+ @click="handelPracticeOrRxam(items, 2, item.courseId)"
|
|
|
>习题</el-button
|
|
|
>
|
|
|
</el-col>
|
|
@@ -1247,21 +1249,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;
|
|
|
- });
|
|
|
- console.log(teacherIndex, "teacherIndex");
|
|
|
- console.log(courseIndex, "courseIndex");
|
|
|
+ // 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.goodsTeacher[teacherIndex].courseList[courseIndex]
|
|
@@ -1329,17 +1329,18 @@ export default {
|
|
|
}
|
|
|
return index === -1;
|
|
|
},
|
|
|
- checkLearnOrder(course) {
|
|
|
- let goodsLearningOrder = 2;
|
|
|
- // 非按顺序学习以及重修
|
|
|
- if (goodsLearningOrder != 2 || course.isRebuild) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- },
|
|
|
async studyFunc(courseItem, items) {
|
|
|
+ console.log(items);
|
|
|
if (!this.checkCanLearn()) {
|
|
|
return false;
|
|
|
}
|
|
|
+ if (!(await this.orderTopTobottom(courseItem, items, 99))) {
|
|
|
+ this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: "请按顺序学习视频课程",
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
let item = this.goodsData;
|
|
|
var confirmDetail = true;
|
|
|
if (item.educationName == "继续教育") {
|
|
@@ -1435,7 +1436,7 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- handelPracticeOrRxam(section, type) {
|
|
|
+ handelPracticeOrRxam(section, type, courseId) {
|
|
|
if (type == 3) {
|
|
|
//节卷
|
|
|
let data = this.sectionExamList.filter(
|
|
@@ -1449,6 +1450,7 @@ export default {
|
|
|
let data = this.sectionExam.filter(
|
|
|
(x) => x.sectionId == section.sectionId
|
|
|
);
|
|
|
+
|
|
|
if (data && data.length > 0) {
|
|
|
section = data[0];
|
|
|
}
|
|
@@ -1456,7 +1458,7 @@ export default {
|
|
|
this.$router.push({
|
|
|
path: "/course-exam/" + this.goodsData.goodsId,
|
|
|
query: {
|
|
|
- courseId: courseLists.courseId,
|
|
|
+ courseId: courseId,
|
|
|
gradeId: this.goodsData.gradeId,
|
|
|
moduleId: section.moduleId || 0,
|
|
|
sectionId: section.sectionId || 0,
|
|
@@ -1468,252 +1470,122 @@ export default {
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
- async getResource(courseLists, section, type, flag) {
|
|
|
- //type:1章卷,2节卷,3模考卷,4习题
|
|
|
- console.log(courseLists, section);
|
|
|
- if (!this.checkCanLearn()) {
|
|
|
- return false;
|
|
|
- }
|
|
|
+ async orderTopTobottom(courseLists, section, type) {
|
|
|
+ let { rebuild, moduleId, chapterId } = section;
|
|
|
|
|
|
- if (flag) {
|
|
|
- let data = this.sectionExamList.filter(
|
|
|
- (x) => (x.sectionId = section.menuId)
|
|
|
+ if (this.goodsData.goodsLearningOrder != 2 || rebuild) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ // 课程顺序
|
|
|
+ if (this.courseList.length > 1) {
|
|
|
+ let index = this.courseList.findIndex(
|
|
|
+ (e) => e.courseId == courseLists.courseId
|
|
|
);
|
|
|
- if (data && data.length > 0) {
|
|
|
- section = data[0];
|
|
|
- } else {
|
|
|
- section.typeId = "";
|
|
|
+ if (index) {
|
|
|
+ let prevItem = this.courseList[index - 1]; //上一课
|
|
|
+ if (prevItem.stuAllNum != prevItem.secAllNum) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
- } else if (type && type == 2) {
|
|
|
- let data = this.sectionExam.filter(
|
|
|
- (x) => (x.sectionId = section.sectionId)
|
|
|
+ }
|
|
|
+ let list = await this.studyRecordMenuAllList(courseLists);
|
|
|
+ if (type == 99) {
|
|
|
+ let index = list.findIndex(
|
|
|
+ (e) =>
|
|
|
+ e.moduleId == moduleId &&
|
|
|
+ e.chapterId == chapterId &&
|
|
|
+ e.id == section.sectionId
|
|
|
+ );
|
|
|
+ list = list.slice(0, index);
|
|
|
+ } else if (type != 3) {
|
|
|
+ list = list.filter(
|
|
|
+ (e) => e.moduleId == moduleId && e.chapterId == chapterId
|
|
|
);
|
|
|
- if (data && data.length > 0) {
|
|
|
- section = data[0];
|
|
|
- } else {
|
|
|
- section.typeId = "";
|
|
|
- }
|
|
|
}
|
|
|
- console.log(courseLists, section);
|
|
|
- return;
|
|
|
- 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;
|
|
|
- }
|
|
|
- }
|
|
|
- console.log(this.businessData, "this.businessData");
|
|
|
- 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,
|
|
|
- sectionId: section.sectionId || 0,
|
|
|
- examId: section.typeId,
|
|
|
- learning: section.learning,
|
|
|
- type: type,
|
|
|
- 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,
|
|
|
- sectionId: section.sectionId || 0,
|
|
|
- examId: section.typeId,
|
|
|
- learning: section.learning,
|
|
|
- type: type,
|
|
|
- chapterId: section.chapterId || 0,
|
|
|
- orderGoodsId: this.goodsData.orderGoodsId,
|
|
|
- },
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.$message({
|
|
|
- type: "warning",
|
|
|
- message: "该试卷只能答题" + section.answerNum + "次",
|
|
|
- });
|
|
|
+ return list.every((item) => item.studyStatus == 1);
|
|
|
+ },
|
|
|
+ async exceedLearnNum(courseLists, section) {
|
|
|
+ let learnNum = await this.goodsTodayStudySectionNum(section);
|
|
|
+ let hasLearn = await this.gradeCheckGoodsStudy(courseLists, section);
|
|
|
|
|
|
- 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 (this.goodsData.sectionMaxNum > 0) {
|
|
|
+ if (learnNum >= this.goodsData.sectionMaxNum && !hasLearn) {
|
|
|
+ this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: `每天最多学习${this.goodsData.sectionMaxNum}节`,
|
|
|
});
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ async getResource(courseLists, section, type) {
|
|
|
+ //type:1章卷,2节卷,3模考卷,4习题
|
|
|
+ if (!this.checkCanLearn()) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 学习次数
|
|
|
+ if (!(await this.exceedLearnNum(courseLists, section))) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
- 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,
|
|
|
- sectionId: section.sectionId || 0,
|
|
|
- examId: section.typeId,
|
|
|
- learning: section.learning,
|
|
|
- type: type,
|
|
|
- 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,
|
|
|
- sectionId: section.sectionId || 0,
|
|
|
- examId: section.typeId,
|
|
|
- learning: section.learning,
|
|
|
- type: type,
|
|
|
- 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,
|
|
|
- sectionId: section.sectionId || 0,
|
|
|
- examId: section.typeId,
|
|
|
- learning: section.learning,
|
|
|
- type: type,
|
|
|
- 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,
|
|
|
- sectionId: section.sectionId || 0,
|
|
|
- examId: section.typeId,
|
|
|
- learning: section.learning,
|
|
|
- type: type,
|
|
|
- chapterId: section.chapterId || 0,
|
|
|
- orderGoodsId: this.goodsData.orderGoodsId,
|
|
|
- },
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.$message({
|
|
|
- type: "warning",
|
|
|
- message: "该试卷只能答题" + section.answerNum + "次",
|
|
|
- });
|
|
|
+ if (!(await this.orderTopTobottom(courseLists, section, type))) {
|
|
|
+ this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: "请学完视频课程再进行练习和测试",
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ //有次数限制
|
|
|
+ let num = await this.bankRecordDoNum(courseLists, section);
|
|
|
+ // section.doNum
|
|
|
+ if (section.answerNum - num > 0 && section.answerNum > 0) {
|
|
|
+ this.$router.push({
|
|
|
+ path: "/course-exam/" + this.goodsData.goodsId,
|
|
|
+ query: {
|
|
|
+ courseId: courseLists.courseId,
|
|
|
+ gradeId: this.goodsData.gradeId,
|
|
|
+ moduleId: section.moduleId || 0,
|
|
|
+ sectionId: section.sectionId || 0,
|
|
|
+ examId: section.typeId,
|
|
|
+ learning: section.learning,
|
|
|
+ type: type,
|
|
|
+ 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,
|
|
|
+ sectionId: section.sectionId || 0,
|
|
|
+ examId: section.typeId,
|
|
|
+ learning: section.learning,
|
|
|
+ type: type,
|
|
|
+ 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;
|
|
|
}
|
|
|
+ this.studyLog(
|
|
|
+ (section.moduleId = 0),
|
|
|
+ (section.chapterId = 0),
|
|
|
+ section.typeId,
|
|
|
+ courseLists
|
|
|
+ );
|
|
|
},
|
|
|
//校验节是否有试卷
|
|
|
checkSection(sectionId, key) {
|
|
@@ -1776,6 +1648,7 @@ export default {
|
|
|
goodsId: this.goodsData.goodsId,
|
|
|
})
|
|
|
.then((res) => {
|
|
|
+ res.data = res.data.filter((e) => e.sectionType != 2);
|
|
|
resolve(res.data);
|
|
|
});
|
|
|
});
|