Эх сурвалжийг харах

feat: 1、视频试卷做题报告页 2、做题记录页面 3、收藏集和错题集调整位置

xuqiaoying 3 жил өмнө
parent
commit
5a55c2409c

+ 7 - 1
src/apis/bank.js

@@ -73,7 +73,12 @@ export default {
 		})
 	},
 
-
+	bankReportData(data) {
+		return request({
+			url: '/bank/record/' + data,
+			method: 'get',
+		})
+	},
 	studyExamPhotoRecord(data) {
 		return request({
 			url: '/bank/record/addPhoto',
@@ -151,6 +156,7 @@ export default {
 		})
 	},
 
+
 	examaperList(data) {
 		return request({
 			url: '/exam/paper/list',

+ 2 - 2
src/axios.js

@@ -4,9 +4,9 @@ import { Message } from 'element-ui'
 // export const BASE_URL = 'https://api.xyyxt.net'   //release
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test
 // export const BASE_URL = 'https://test.xyyxt.net'   //预发布
-// export const BASE_URL = 'http://192.168.1.7:5055'    //dev
+export const BASE_URL = 'http://192.168.1.7:5055'    //dev
 // export const BASE_URL = 'http://192.168.1.24:5055'    //dev
-export const BASE_URL = 'http://120.79.166.78:19012'    //测试-外网
+// export const BASE_URL = 'http://120.79.166.78:19012'    //测试-外网
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test
 // export const BASE_URL = 'http://192.168.1.222:5055'    //测试
 export const tenantId = '867735392558919680'

+ 13 - 3
src/pages/bank-exam-all-explain/index.vue

@@ -824,6 +824,7 @@ export default {
       moduleId: 0,
       chapterId: 0,
       current: 0,
+      courseType: 1, //1题库,2视频 商品类型
     };
   },
   async mounted() {
@@ -832,6 +833,7 @@ export default {
     this.moduleId = this.$route.query.moduleId;
     this.chapterId = this.$route.query.chapterId;
     this.goodsId = this.$route.query.goodsId;
+    this.courseType = this.$route.query.courseType
     this.goodsQuestionList();
   },
   methods: {
@@ -858,9 +860,17 @@ export default {
      * 请求题目列表
      */
     goodsQuestionList() {
-      this.$request.examReport(this.recordId).then(async (res) => {
-        this.questionList = JSON.parse(res.data.historyExamJson);
-      });
+      if(this.courseType == 2){
+        this.$request.bankReportData(this.recordId).then(async (res) => {
+          this.questionList = res.data.historyExamJson ? JSON.parse(res.data.historyExamJson) : [];
+        });
+        
+      }else{
+        this.$request.examReport(this.recordId).then(async (res) => {
+          this.questionList = JSON.parse(res.data.historyExamJson);
+        });
+      }
+      
     },
 
     nextQuestion() {

+ 19 - 6
src/pages/bank-exam-wrong-explain/index.vue

@@ -825,6 +825,7 @@ export default {
       chapterId: 0,
       current: 0,
       orderGoodsId: 0,
+      courseType: 1, //1题库,2视频 商品类型
     };
   },
   async mounted() {
@@ -834,6 +835,7 @@ export default {
     this.chapterId = this.$route.query.chapterId;
     this.goodsId = this.$route.query.goodsId;
     this.orderGoodsId = this.$route.query.orderGoodsId;
+    this.courseType = this.$route.query.courseType
     this.goodsQuestionList();
   },
   methods: {
@@ -860,10 +862,23 @@ export default {
      * 请求题目列表
      */
     goodsQuestionList() {
-      this.$request.examReport(this.recordId).then(async (res) => {
-        let questionList = JSON.parse(res.data.historyExamJson);
+      if (this.courseType == 2) {
+        this.$request.bankReportData(this.recordId).then(async (res) => {
+          let questionList = JSON.parse(res.data.historyExamJson);
 
-        questionList.forEach((json) => {
+          this.listForEach(questionList)
+        });
+        
+      } else {
+        this.$request.examReport(this.recordId).then(async (res) => {
+          let questionList = JSON.parse(res.data.historyExamJson);
+
+          this.listForEach(questionList)
+        });
+      }
+    },
+    listForEach(questionList) {
+      questionList.forEach((json) => {
           //只获取类型1,2,3 单选,多选,判断 ,主观题灭有对错
           if (json.type == 1 || json.type == 3) {
             //单选判断
@@ -889,10 +904,8 @@ export default {
           }
         });
 
-        console.log(this.questionList);
-      });
+        // console.log(this.questionList);
     },
-
     nextQuestion() {
       if (this.current >= this.questionList.length - 1) {
         this.$message({

+ 40 - 9
src/pages/course-exam/index.vue

@@ -1213,12 +1213,15 @@ export default {
       isTaking: true, //是否正在拍照
       stream: null,
       loading: false,
-      type: 0, //type:1章卷,2节卷,3模
+      type: 0, //type:1章卷,2节卷,3模
       bankType: 0,
       compareFaceData: 0, // 拍照匹配相似度
+      answerNum: 0, // 总次数
     };
   },
   async mounted() {
+    const {answerNum, num} = this.$route.query
+    this.answerNum = answerNum
     this.goodsId = this.$route.params.goodsId;
     this.examId = this.$route.query.examId;
     this.type = this.$route.query.type;
@@ -1704,6 +1707,7 @@ export default {
             gradeId: this.gradeId,
             totalQuestionNum: questionList,
             allQuestionNum: this.questionList.length,
+            orderGoodsId: this.orderGoodsId,
           })
           .then((res) => {
             this.recordId = res.data;
@@ -2407,30 +2411,31 @@ export default {
       }
 
       clearInterval(this.timer);
-      //交卷
+      //交卷 /bank/record/edit
       this.$request
         .bankRecordEdit({
           moduleId: this.moduleId || 0,
           chapterId: this.chapterId || 0,
           sectionId: this.sectionId || 0,
           gradeId: this.gradeId,
+          courseId: this.courseId,
+          orderGoodsId: this.orderGoodsId,
+          type: this.type, //题卷类型 1章卷 2节卷 3模块卷	
           examId: this.examId,
-          type: this.type,
           goodsId: this.goodsId,
           reportStatus: reportStatus,
           recordId: this.recordId,
-          courseId: this.courseId,
           rightQuestionNum: number,
           lessQuestionNum: lessQuestionNum,
           status: 1,
           doQuestionIds: doQuestionIds.join(","),
-          // rightQuestionIds:rightQuestionIds.join(','),
-          // doQuestionNum: doQuestionNum,
+          rightQuestionIds:rightQuestionIds.join(','),
+          doQuestionNum: doQuestionNum,
           performance: score,
           totalScore: allScore,
-          // examTime: parseInt(this.allTimes),
-          // doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
-          // historyExamJson: JSON.stringify(this.questionList)
+          examTime: parseInt(this.allTimes),
+          doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
+          historyExamJson: JSON.stringify(this.questionList)
         })
         .then((res) => {
           this.isSubmit = true;
@@ -2453,12 +2458,38 @@ export default {
             this.setExamResult(result);
             this.$router.replace({
               path: "/course-report",
+              query: {
+                // orderGoodsId: this.orderGoodsId,
+                // chapterId: this.chapterId,
+                // moduleId: this.moduleId,
+                examId: this.examId,
+                recordId: this.recordId,
+                type: this.type,
+                answerNum: this.answerNum,
+              },
             });
           }, 1000);
         })
         .catch((err) => {
           console.log(err, "err");
         });
+
+        //错题集id提交(客观题)/exam/wwrong/record
+      this.$request.examWrongRecord({
+          moduleId: this.moduleId || 0,
+          chapterId: this.chapterId || 0,
+          sectionId: this.sectionId || 0,
+          gradeId: this.gradeId,
+          courseId: this.courseId,
+          orderGoodsId: this.orderGoodsId,
+          examId: this.examId,
+          goodsId: this.goodsId,
+          questionIds: doWrongQuestionIds,
+          recordId: this.recordId,
+          type: 2, // 视频课程的传2
+        })
+        .then((res) => {})
+        .catch((err) => {});
     },
   },
 };

+ 134 - 8
src/pages/course-report/index.vue

@@ -94,13 +94,13 @@
           </div>
         </div>
 
-        <!-- <div class="section__footer">
-          <el-button type="primary" class="btn">返回列表</el-button>
-          <el-button type="primary" class="btn">练习下一节</el-button>
-          <el-button type="primary" class="btn">重新做题</el-button>
-          <el-button type="primary" class="btn">错题解析</el-button>
-          <el-button type="primary" class="btn">全部解析</el-button>
-        </div> -->
+        <div class="section__footer">
+          <el-button type="primary" class="btn"  @click="backList()">返回列表</el-button>
+          <!-- <el-button type="primary" class="btn">练习下一节</el-button> -->
+          <el-button type="primary" class="btn" @click="doRepeat(reportdata)">重新做题</el-button>
+          <el-button type="primary" class="btn" @click="wrongExplain(reportdata)">错题解析</el-button>
+          <el-button type="primary" class="btn" @click="allExplain(reportdata)">全部解析</el-button>
+        </div>
 
         <div v-if="courseList.length" class="course_list">
           <div class="course__header">
@@ -163,19 +163,26 @@ export default {
 			pageNum: 1,
 			pageSize: 10,
 			total: 0,
+      recordId: '',
+      type: 0, //type:1章卷,2节卷,3模考卷
     };
   },
   computed: {
     ...mapGetters(["examResult"]),
   },
   created() {
-    this.examId = this.$route.query.examId
+    const { examId, recordId, type } = this.$route.query
+    this.examId = examId
+    this.recordId = recordId
+    this.type = type
     this.getcourList()
+    this.bankReport()
   },
   mounted() {
     if (JSON.stringify(this.examResult) == "{}") {
       this.$router.back(-1);
     }
+    console.log('examResult:', this.examResult)
   },
   methods: {
     getcourList() {
@@ -195,10 +202,129 @@ export default {
             }
         })
     },
+    bankReport() {
+      this.$request.bankReportData(this.recordId).then((res) => {
+        this.reportdata = res.data
+        console.log('reportdata:', this.reportdata)
+      });
+    },
     currentChangeCou(val) {
       this.pageNum = val
       this.getcourList()
     },
+    backList() {
+      this.$router.go(-1)
+    },
+    /**
+     * 去做题
+     */
+    async doRepeat(reportdata) {
+      // /bank/record/doNum
+      let count = await this.bankRecordDoNum()
+      console.log('已做的次数', count)
+      let answerNum = await this.getExamDetail(this.reportdata.examId)
+      console.log('全部的次数', answerNum)
+      //超过答题次数
+      if (answerNum > 0 && count >= answerNum) {
+        this.$message({
+          type: "warning",
+          message: "该试卷只能答题" + answerNum + "次!",
+        });
+        return;
+      }
+      // answerNum==0没有答题次数限制
+      if (answerNum == 0 || (answerNum - count > 0 && answerNum > 0)) {
+        this.$router.push({
+          path: "/course-exam/" + this.reportdata.goodsId,
+          query: {
+            courseId: this.reportdata.courseId,
+            gradeId: this.reportdata.gradeId || 0,
+            moduleId: this.reportdata.moduleId || 0,
+            sectionId: this.reportdata.sectionId || 0,
+            examId: this.reportdata.examId,
+            type: this.type,
+            chapterId: this.reportdata.chapterId || 0,
+            orderGoodsId: this.reportdata.orderGoodsId,
+          },
+        })
+      }
+
+      // this.studyLog()
+    },
+    /**
+     * 获取试卷已做的次数
+     */
+    bankRecordDoNum() {
+      return new Promise((resolve) => {
+        this.$request
+          .bankRecordDoNum({
+            goodsId: this.reportdata.goodsId,
+            gradeId: this.reportdata.gradeId,
+            chapterId: this.reportdata.chapterId || 0,
+            courseId: this.reportdata.courseId,
+            moduleId: this.reportdata.moduleId || 0,
+            examId: this.reportdata.examId,
+          })
+          .then((res) => {
+            resolve(res.data);
+          });
+      });
+    },
+    /**
+     * @param {Object} exam_id
+     * 获取试卷可以做的次数
+     */
+    getExamDetail(exam_id) {
+      return new Promise((resolve) => {
+        this.$request.getExamDetail(exam_id).then((res) => {
+          resolve(res.data.answerNum);
+        });
+      });
+    },
+    // 新增用户视频学习日志
+    studyLog() {
+      this.$axios({
+        url: "/user/study/log",
+        method: "post",
+        data: {
+          goodsId: this.reportdata.goodsId,
+          courseId: this.reportdata.courseId,
+          moduleId: this.reportdata.moduleId || 0,
+          chapterId: this.reportdata.chapterId || 0,
+          sectionId: this.reportdata.sectionId || 0,
+          fromPlat: 2, //来源平台 1小程序 2PC网站
+          goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
+          orderGoodsId: this.reportdata.orderGoodsId,
+        },  
+      }).then((res) => {
+      });
+    },
+    wrongExplain(reportdata) {
+      this.$router.push({
+        path: "/bank-exam-wrong-explain/" + reportdata.recordId,
+        query: {
+          examId: reportdata.examId,
+          moduleId: reportdata.moduleId || 0,
+          chapterId: reportdata.chapterId || 0,
+          goodsId: reportdata.goodsId,
+          orderGoodsId: reportdata.orderGoodsId,
+          courseType: 2,
+        },
+      });
+    },
+
+    allExplain(reportdata) {
+      this.$router.push({
+        path: "/bank-exam-all-explain/" + reportdata.recordId,
+        query: {
+          examId: reportdata.examId,
+          moduleId: reportdata.moduleId || 0,
+          chapterId: reportdata.chapterId || 0,
+          goodsId: reportdata.goodsId,
+          courseType: 2,
+        },
+      });
+    },
   },
 };
 </script>

+ 79 - 12
src/pages/person-center/bank-record/index.vue

@@ -111,14 +111,7 @@
                       </div>
                       <div
                         class="btn-line__in"
-                        @click="
-                          go('/person-center/record-list/' + record.goodsId, {
-                            examId: record.examId,
-                            chapterId: record.chapterExamId,
-                            moduleId: record.moduleExamId,
-                            recordId: record.recordId,
-                          })
-                        "
+                        @click="moreRecords(record)"
                       >
                         <div>更多记录</div>
                       </div>
@@ -157,7 +150,7 @@ export default {
       list: [],
       param: {
         pageNum: 1,
-        pageSize: 10,
+        pageSize: 5,
         goodsId: "",
         paperId: "",
       },
@@ -200,6 +193,37 @@ export default {
         query,
       });
     },
+    moreRecords(record) {
+      let queryData = {}
+      if (record.courseType == 2) {
+        queryData = {
+          examId: record.examId,
+          gradeId: record.gradeId,
+          chapterId: record.chapterId,
+          moduleId: record.moduleId,
+          courseId: record.courseId,
+          sectionId: record.sectionId,
+          courseType: record.courseType,
+        }
+        this.$router.push({
+          path: '/person-center/record-list/' + record.goodsId, 
+          query: queryData
+        })
+
+      } else {
+        queryData = {
+          examId: record.examId,
+          chapterId: record.chapterExamId,
+          moduleId: record.moduleExamId,
+          recordId: record.recordId,
+          courseType: record.courseType,
+        }
+        this.$router.push({
+          path: '/person-center/record-list/' + record.goodsId, 
+          query: queryData
+        })
+      }
+    },
     currentChange(e) {
       this.param.pageNum = e;
       this.getExamRecordList();
@@ -212,7 +236,14 @@ export default {
     },
 
     async doRepeat(section) {
-      let count = await this.examRecordCount(section.examId);
+      console.log('section:', section)
+      let count = 0
+      if (section.courseType == 2) {
+        count = await this.bankRecordDoNum(section)
+      } else {
+        count = await this.examRecordCount(section.examId)
+      }
+      console.log('已做的次数', count)
       let answerNum = await this.getExamDetail(section.examId);
       //超过答题次数
       if (answerNum > 0 && count >= answerNum) {
@@ -232,7 +263,22 @@ export default {
         showClose: false,
       })
         .then((_) => {
-          this.$router.push({
+          if (section.courseType == 2){
+              this.$router.push({
+                path: "/course-exam/" + section.goodsId,
+                query: {
+                  courseId: section.courseId,
+                  gradeId: section.gradeId || 0,
+                  moduleId: section.moduleId || 0,
+                  sectionId: section.sectionId || 0,
+                  examId: section.examId,
+                  type: section.type, // 模块卷类型
+                  chapterId: section.chapterId || 0,
+                  orderGoodsId: section.orderGoodsId,
+                },
+            })
+          } else {
+            this.$router.push({
             path: "/bank-exam/" + section.goodsId,
             query: {
               orderGoodsId: section.orderGoodsId,
@@ -241,6 +287,8 @@ export default {
               chapterId: section.chapterExamId || 0,
             },
           });
+          }
+          
         })
         .catch((_) => {
           this.$router.push({
@@ -251,11 +299,30 @@ export default {
               chapterId: section.chapterExamId || 0,
               goodsId: section.goodsId,
               orderGoodsId: section.orderGoodsId,
+              courseType: section.courseType,
             },
           });
         });
     },
-
+    /**
+     * 获取视频试卷已做的次数
+     */
+    bankRecordDoNum(section) {
+      return new Promise((resolve) => {
+        this.$request
+          .bankRecordDoNum({
+            goodsId: section.goodsId,
+            gradeId: section.gradeId,
+            chapterId: section.chapterId || 0,
+            courseId: section.courseId,
+            moduleId: section.moduleId || 0,
+            examId: section.examId,
+          })
+          .then((res) => {
+            resolve(res.data);
+          });
+      });
+    },
     /**
      * 查询试卷历史做题次数
      */

+ 96 - 6
src/pages/person-center/bank-record/record-list/index.vue

@@ -109,12 +109,20 @@ export default {
     return {
       param: {
         pageNum: 1,
-        pageSize: 10,
+        pageSize: 5,
         moduleExamId: 0,
         chapterExamId: 0,
         examId: 0,
         goodsId: 0,
       },
+      record: {
+        examId: '',
+        gradeId: '',
+        chapterId: '',
+        moduleId: '',
+        courseId: '',
+        sectionId: '',
+      },
       recordList: [],
       total: 0,
     };
@@ -124,7 +132,21 @@ export default {
     this.param.chapterExamId = this.$route.query.chapterId;
     this.param.examId = this.$route.query.examId;
     this.param.goodsId = this.$route.params.goodsId;
-    this.examRecordList();
+    if (this.$route.query.courseType == 2) {
+      const { examId, gradeId, chapterId, moduleId, courseId, sectionId} = this.$route.query
+      this.record = {
+        examId: +examId,
+        gradeId: +gradeId,
+        chapterId: +chapterId,
+        moduleId: +moduleId,
+        courseId: +courseId,
+        sectionId: +sectionId,
+      }
+      this.recordBankList()
+    } else {
+      this.examRecordList();
+    }
+    
   },
   methods: {
     go(path, query) {
@@ -137,7 +159,12 @@ export default {
     },
     currentChange(e) {
       this.param.pageNum = e;
-      this.getExamRecordList();
+      // this.getExamRecordList();
+      if (this.$route.query.courseType == 2) {
+        this.recordBankList()
+      } else {
+        this.examRecordList();
+      }
     },
     examRecordList() {
       this.$request.examRecordList(this.param).then((res) => {
@@ -145,9 +172,37 @@ export default {
         this.total = res.total;
       });
     },
-
+    recordBankList() {
+      let params = {
+          examId: this.record.examId,
+          goodsId: this.param.goodsId,
+          pageNum: this.param.pageNum,
+          pageSize: this.param.pageSize
+        }
+        this.record.gradeId && (params['gradeId'] = this.record.gradeId)
+        this.record.chapterId && (params['chapterId'] = this.record.chapterId)
+        this.record.courseId && (params['courseId'] = this.record.courseId)
+        this.record.moduleId && (params['moduleId'] = this.record.moduleId)
+        this.record.sectionId && (params['sectionId'] = this.record.sectionId)
+        console.log('参数params', params)
+        this.$axios({
+          url: '/bank/record/bankList',
+          method: 'get',
+          params: params
+        }).then((res) => {
+          this.recordList = res.rows || []
+          this.total = res.total
+        })
+    },
     async doRepeat(section) {
-      let count = await this.examRecordCount(section.examId);
+      // let count = await this.examRecordCount(section.examId);
+      let count = 0
+      if (section.courseType == 2) {
+        count = await this.bankRecordDoNum(section)
+      } else {
+        count = await this.examRecordCount(section.examId)
+      }
+      console.log('已做的次数', count)
       let answerNum = await this.getExamDetail(section.examId);
       //超过答题次数
       if (answerNum > 0 && count >= answerNum) {
@@ -167,6 +222,21 @@ export default {
         showClose: false,
       })
         .then((_) => {
+          if (section.courseType == 2){
+              this.$router.push({
+                path: "/course-exam/" + section.goodsId,
+                query: {
+                  courseId: section.courseId,
+                  gradeId: section.gradeId || 0,
+                  moduleId: section.moduleId || 0,
+                  sectionId: section.sectionId || 0,
+                  examId: section.examId,
+                  type: section.type, // 模块卷类型
+                  chapterId: section.chapterId || 0,
+                  orderGoodsId: section.orderGoodsId,
+                },
+            })
+          } else {
           this.$router.push({
             path: "/bank-exam/" + section.goodsId,
             query: {
@@ -176,6 +246,7 @@ export default {
               chapterId: section.chapterExamId || 0,
             },
           });
+          }
         })
         .catch((_) => {
           this.$router.push({
@@ -185,12 +256,31 @@ export default {
               moduleId: section.moduleExamId || 0,
               chapterId: section.chapterExamId || 0,
               goodsId: section.goodsId,
+              courseType: this.$route.query.courseType,
               orderGoodsId: section.orderGoodsId,
             },
           });
         });
     },
-
+    /**
+     * 获取视频试卷已做的次数
+     */
+    bankRecordDoNum(section) {
+      return new Promise((resolve) => {
+        this.$request
+          .bankRecordDoNum({
+            goodsId: section.goodsId,
+            gradeId: section.gradeId,
+            chapterId: section.chapterId || 0,
+            courseId: section.courseId,
+            moduleId: section.moduleId || 0,
+            examId: section.examId,
+          })
+          .then((res) => {
+            resolve(res.data);
+          });
+      });
+    },
     /**
      * 查询试卷历史做题次数
      */

+ 2 - 2
src/pages/person-center/index.vue

@@ -94,12 +94,12 @@
                 <router-link to="/person-center/bank-record">
                   <div class="item">做题记录</div>
                 </router-link>
-                <!-- <router-link to="/person-center/my-collect">
+                <router-link to="/person-center/my-collect">
                   <div class="item">收藏集</div>
                 </router-link>
                 <router-link to="/person-center/my-wrong">
                   <div class="item">错题集</div>
-                </router-link> -->
+                </router-link>
               </div>
             </div>
             <div class="nav__section">

+ 2 - 2
src/pages/person-center/my-bank/bank-detailCopy/index.vue

@@ -398,7 +398,7 @@
                 </div>
               </div>
             </el-tab-pane>
-            <el-tab-pane label="收藏题集" name="-1">
+            <!-- <el-tab-pane label="收藏题集" name="-1">
               <div class="goods-collect">
                 <div class="goods-collect__header">
                   <div class="selects">
@@ -675,7 +675,7 @@
                   </div>
                 </div>
               </div>
-            </el-tab-pane>
+            </el-tab-pane> -->
           </el-tabs>
         </div>
         <div v-if="false" class="right-box">