Ver código fonte

对接题库

chenxiong 3 anos atrás
pai
commit
6d4ef6013a

+ 10 - 2
src/apis/bank.js

@@ -28,8 +28,8 @@ export default {
   examRecordGroupList(data) {
 		return request({
 			url: '/exam/record/group_list',
-			data:data,
-			params: 'GET',
+			params:data,
+			method: 'GET',
 		})
 	},
 
@@ -269,4 +269,12 @@ export default {
 			method: 'GET',
 		})
 	},
+
+  examRecordList(data) {
+		return request({
+			url: '/exam/record/list',
+			params:data,
+			method: 'GET',
+		})
+	},
 }

Diferenças do arquivo suprimidas por serem muito extensas
+ 66 - 862
src/pages/bank-exam-explain/index.vue


+ 6 - 8
src/pages/bank-exam/index.vue

@@ -1875,16 +1875,14 @@ export default {
           });
 
           setTimeout(() => {
-            let result = {
-              chapterId: this.chapterId,
-              moduleId: this.moduleId,
-              examId: this.examId,
-              recordId: this.recordId,
-            };
-
-            this.setExamResult(result);
             this.$router.push({
               path: "/bank-report/" + this.goodsId,
+              query: {
+                chapterId: this.chapterId,
+                moduleId: this.moduleId,
+                examId: this.examId,
+                recordId: this.recordId,
+              },
             });
           }, 1000);
         });

+ 1 - 0
src/pages/bank-list/index.vue

@@ -119,6 +119,7 @@
               layout="prev, pager, next"
               :total="total"
               :pager-count="5"
+              :page-size="param.pageSize"
             >
             </el-pagination>
           </div>

+ 22 - 20
src/pages/bank-report/index.vue

@@ -5,7 +5,7 @@
       <div class="container">
         <div
           class="section__header section__header--warm"
-          v-if="!reportdata.reportStatus"
+          v-if="examData.doType == 2 && reportdata.reportStatus !== null"
         >
           <div class="title">
             <span class="icon">X</span>
@@ -18,7 +18,7 @@
         </div>
         <div
           class="section__header section__header--success"
-          v-if="reportdata.reportStatus"
+          v-if="examData.doType == 2 && reportdata.reportStatus !== null"
         >
           <div class="title">
             <span class="icon">✔</span>
@@ -129,16 +129,20 @@ export default {
       examData: {},
       reportdata: {},
       goodsId: 0,
+      chapterId: 0,
+      moduleId: 0,
+      examId: 0,
+      recordId: 0,
     };
   },
   computed: {
     ...mapGetters(["examResult"]),
   },
   async mounted() {
-    if (JSON.stringify(this.examResult) == "{}") {
-      this.$router.back(-1);
-    }
-
+    this.chapterId = this.$route.query.chapterId;
+    this.moduleId = this.$route.query.moduleId;
+    this.examId = this.$route.query.examId;
+    this.recordId = this.$route.query.recordId;
     this.goodsId = this.$route.params.goodsId;
 
     this.examWrongRecordWrongNum();
@@ -218,12 +222,10 @@ export default {
     },
     examWrongRecordWrongNum() {
       return new Promise((resolve) => {
-        this.$request
-          .examWrongRecordWrongNum(this.examResult.recordId)
-          .then((res) => {
-            this.wrongRecordWrongNum = res.data || 0;
-            resolve();
-          });
+        this.$request.examWrongRecordWrongNum(this.recordId).then((res) => {
+          this.wrongRecordWrongNum = res.data || 0;
+          resolve();
+        });
       });
     },
 
@@ -231,9 +233,9 @@ export default {
       this.$router.replace({
         path: "/bank-exam/" + this.nextExamId,
         query: {
-          examId: this.examResult.examId,
-          moduleId: this.examResult.moduleId || 0,
-          chapterId: this.examResult.chapterId || 0,
+          examId: this.examId,
+          moduleId: this.moduleId || 0,
+          chapterId: this.chapterId || 0,
         },
       });
     },
@@ -241,10 +243,10 @@ export default {
     bankExamNextExam() {
       this.$request
         .bankExamNextExam({
-          chapterExamId: this.examResult.chapterId,
-          examId: this.examResult.examId,
+          chapterExamId: this.chapterId,
+          examId: this.examId,
           goodsId: this.goodsId,
-          moduleExamId: this.examResult.moduleId,
+          moduleExamId: this.moduleId,
         })
         .then((res) => {
           this.nextExamId = res.data.examId;
@@ -256,7 +258,7 @@ export default {
 
     bankExam() {
       return new Promise((resolve) => {
-        this.$request.bankExam(this.examResult.examId).then((res) => {
+        this.$request.bankExam(this.examId).then((res) => {
           this.examData = res.data;
           resolve();
         });
@@ -265,7 +267,7 @@ export default {
 
     examReport() {
       return new Promise((resolve) => {
-        this.$request.examReport(this.examResult.recordId).then((res) => {
+        this.$request.examReport(this.recordId).then((res) => {
           this.reportdata = res.data;
           resolve();
         });

+ 1 - 0
src/pages/course-detail/index.vue

@@ -1305,6 +1305,7 @@
                                 background
                                 layout="prev, pager, next"
                                 :total="noteTotal"
+                                :page-size="noteParams.pageSize"
                               >
                               </el-pagination>
                             </div>

+ 1 - 0
src/pages/course-list/index.vue

@@ -119,6 +119,7 @@
               layout="prev, pager, next"
               :total="total"
               :pager-count="5"
+              :page-size="params.pageSize"
             >
             </el-pagination>
           </div>

+ 163 - 38
src/pages/person-center/bank-record/index.vue

@@ -4,7 +4,7 @@
     <div class="bank-record__body">
       <div class="bank-item" v-for="(record, index) in recordList" :key="index">
         <div class="bank-item__header">
-          <div class="note">{{ record.paperName }}</div>
+          <div class="note" v-if="record.paperName">{{ record.paperName }}</div>
           {{ record.examName }}
         </div>
         <div class="bank-item__body">
@@ -26,36 +26,67 @@
                     <el-button
                       type="primary"
                       class="btn"
-                      v-if="record.status == 1"
-                      >重做</el-button
-                    >
-                    <el-button
-                      type="primary"
-                      class="btn"
-                      v-if="record.status == 1"
-                      >解析</el-button
-                    >
-                    <el-button
-                      type="primary"
-                      class="btn"
-                      v-if="record.status == 1"
-                      >报告</el-button
-                    >
-                    <el-button
-                      type="primary"
-                      class="btn"
+                      @click="
+                        go('/bank-exam-continue/' + record.goodsId, {
+                          recordId: record.recordId,
+                          examId: record.examId,
+                          chapterId: record.chapterExamId,
+                          moduleId: record.moduleExamId,
+                        })
+                      "
                       v-if="record.status == 0 && record.historyExamJson"
                       >继续答题</el-button
                     >
-                    <el-button type="primary" class="btn">更多记录</el-button>
 
-                    <!-- <div class="btn-line" v-if="index % 2 != 0">
-                      <div class="btn-line__in">重新做题</div>
-                      <div class="btn-line__in">全部解析</div>
-                      <div class="btn-line__in btn-line__in--noborder">
-                        做题报告
+                    <div class="btn-line">
+                      <div
+                        class="btn-line__in"
+                        @click="doRepeat(record)"
+                        v-if="record.status == 1"
+                      >
+                        <div>重新做题</div>
+                      </div>
+                      <div
+                        class="btn-line__in"
+                        @click="
+                          go('/bank-exam-explain/' + record.goodsId, {
+                            examId: record.examId,
+                            chapterId: record.chapterExamId,
+                            moduleId: record.moduleExamId,
+                          })
+                        "
+                        v-if="record.status == 1"
+                      >
+                        <div>解析</div>
+                      </div>
+                      <div
+                        class="btn-line__in"
+                        v-if="record.status == 1"
+                        @click="
+                          go('/bank-report/' + record.goodsId, {
+                            chapterId: record.chapterExamId,
+                            moduleId: record.moduleExamId,
+                            examId: record.examId,
+                            recordId: record.recordId,
+                          })
+                        "
+                      >
+                        <div>做题报告</div>
                       </div>
-                    </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,
+                          })
+                        "
+                      >
+                        <div>更多记录</div>
+                      </div>
+                    </div>
                   </div>
                 </div>
               </div>
@@ -73,6 +104,7 @@
           layout="prev, pager, next"
           :total="total"
           :pager-count="5"
+          :page-size="param.pageSize"
         >
         </el-pagination>
       </div>
@@ -97,6 +129,12 @@ export default {
     this.getExamRecordList();
   },
   methods: {
+    go(path, query) {
+      this.$router.push({
+        path,
+        query,
+      });
+    },
     currentChange(e) {
       this.param.pageNum = e;
       this.getExamRecordList();
@@ -107,6 +145,76 @@ export default {
         this.total = res.total;
       });
     },
+
+    async doRepeat(section) {
+      let count = await this.examRecordCount(section.examId);
+      let answerNum = await this.getExamDetail(section.examId);
+      //超过答题次数
+      if (answerNum > 0 && count >= answerNum) {
+        this.$message({
+          type: "warning",
+          message: "该试卷只能答题" + answerNum + "次!",
+        });
+        return;
+      }
+
+      this.$confirm(`是否清空答案重做?`, "提示", {
+        confirmButtonText: "重做",
+        cancelButtonText: "查看上次",
+        closeOnClickModal: false,
+        closeOnPressEscape: false,
+        distinguishCancelAndClose: false,
+        showClose: false,
+      })
+        .then((_) => {
+          this.$router.push({
+            path: "/bank-exam/" + section.goodsId,
+            query: {
+              examId: section.examId,
+              moduleId: section.moduleExamId || 0,
+              chapterId: section.chapterExamId || 0,
+            },
+          });
+        })
+        .catch((_) => {
+          this.$router.push({
+            path: "/bank-exam-all-explain/" + section.recordId,
+            query: {
+              examId: section.examId,
+              moduleId: section.moduleExamId || 0,
+              chapterId: section.chapterExamId || 0,
+              goodsId: section.goodsId,
+            },
+          });
+        });
+    },
+
+    /**
+     * 查询试卷历史做题次数
+     */
+    examRecordCount(examId) {
+      return new Promise((resolve) => {
+        this.$request
+          .examRecordCount({
+            examId: examId,
+            goodsId: this.id,
+          })
+          .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);
+        });
+      });
+    },
   },
 };
 </script>
@@ -183,7 +291,6 @@ export default {
 
                   .btn {
                     cursor: pointer;
-                    margin: 2px 0;
                     width: 122px;
                     height: 32px;
                     padding: 0;
@@ -191,30 +298,48 @@ export default {
                     display: inline-block;
                     text-align: center;
                     line-height: 32px;
+                    vertical-align: middle;
+
+                    /deep/ span {
+                      font-size: 16px;
+                    }
                   }
 
                   .btn-line {
-                    width: 309px;
-                    padding: 8px;
+                    margin: 0 10px;
+                    overflow: hidden;
+                    vertical-align: middle;
+                    display: inline-block;
                     background: #ffffff;
                     border: 1px solid #3f8dfd;
-                    border-radius: 16px;
-                    display: table-cell;
+                    border-radius: 30px;
                     font-size: 0;
                     line-height: 0;
 
                     &__in {
                       cursor: pointer;
                       display: inline-block;
-                      padding: 0 15px;
-                      text-align: center;
+                      padding: 7px 0;
                       color: #3f8dfd;
-                      border-right: 1px solid #3f8dfd;
-                      font-size: 16px;
-                      line-height: 16px;
 
-                      &--noborder {
-                        border: 0;
+                      > div {
+                        text-align: center;
+                        font-size: 16px;
+                        line-height: 16px;
+                        width: 96px;
+                        height: 16px;
+                        border-right: 1px solid #3f8dfd;
+                      }
+
+                      &:nth-last-of-type(1) {
+                        > div {
+                          border: 0;
+                        }
+                      }
+
+                      &:hover {
+                        background: #3f8dfd;
+                        color: #fff;
                       }
                     }
                   }

+ 359 - 0
src/pages/person-center/bank-record/record-list/index.vue

@@ -0,0 +1,359 @@
+<template>
+  <div class="bank-record">
+    <div class="bank-record__header">做题记录</div>
+    <div class="bank-record__body">
+      <div class="bank-item" v-for="(record, index) in recordList" :key="index">
+        <div class="bank-item__header">
+          <div class="note" v-if="record.paperName">{{ record.paperName }}</div>
+          {{ record.examName }}
+        </div>
+        <div class="bank-item__body">
+          <div class="list">
+            <div class="exam-item">
+              <div class="exam-item__body">
+                <div class="text">
+                  <span class="title">{{
+                    $tools.timestampToTime(record.updateTime, false)
+                  }}</span>
+                  <span class="desc"
+                    >总{{ record.totalQuestionNum }}题/对{{
+                      record.rightQuestionNum
+                    }}题</span
+                  >
+                </div>
+                <div class="btns-wrap">
+                  <div class="btns">
+                    <el-button
+                      type="primary"
+                      class="btn"
+                      @click="
+                        go('/bank-exam-continue/' + record.goodsId, {
+                          recordId: record.recordId,
+                          examId: record.examId,
+                          chapterId: record.chapterExamId,
+                          moduleId: record.moduleExamId,
+                        })
+                      "
+                      v-if="record.status == 0 && record.historyExamJson"
+                      >继续答题</el-button
+                    >
+
+                    <div class="btn-line">
+                      <div
+                        class="btn-line__in"
+                        @click="doRepeat(record)"
+                        v-if="record.status == 1"
+                      >
+                        <div>重新做题</div>
+                      </div>
+                      <div
+                        class="btn-line__in"
+                        @click="
+                          go('/bank-exam-explain/' + record.goodsId, {
+                            examId: record.examId,
+                            chapterId: record.chapterExamId,
+                            moduleId: record.moduleExamId,
+                          })
+                        "
+                        v-if="record.status == 1"
+                      >
+                        <div>解析</div>
+                      </div>
+                      <div
+                        class="btn-line__in"
+                        v-if="record.status == 1"
+                        @click="
+                          go('/bank-report/' + record.goodsId, {
+                            chapterId: record.chapterExamId,
+                            moduleId: record.moduleExamId,
+                            examId: record.examId,
+                            recordId: record.recordId,
+                          })
+                        "
+                      >
+                        <div>做题报告</div>
+                      </div>
+                    </div>
+                  </div>
+                </div>
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+
+    <div class="bank-record__footer">
+      <div class="pagination">
+        <el-pagination
+          @current-change="currentChange"
+          background
+          layout="prev, pager, next"
+          :total="total"
+          :pager-count="5"
+          :page-size="param.pageSize"
+        >
+        </el-pagination>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "BankRecord",
+  data() {
+    return {
+      param: {
+        pageNum: 1,
+        pageSize: 10,
+        moduleExamId: 0,
+        chapterExamId: 0,
+        examId: 0,
+        goodsId: 0,
+      },
+      recordList: [],
+      total: 0,
+    };
+  },
+  mounted() {
+    this.param.moduleExamId = this.$route.query.moduleId;
+    this.param.chapterExamId = this.$route.query.chapterId;
+    this.param.examId = this.$route.query.examId;
+    this.param.goodsId = this.$route.params.goodsId;
+    this.examRecordList();
+  },
+  methods: {
+    go(path, query) {
+      console.log(path);
+      console.log(query);
+      this.$router.push({
+        path,
+        query,
+      });
+    },
+    currentChange(e) {
+      this.param.pageNum = e;
+      this.getExamRecordList();
+    },
+    examRecordList() {
+      this.$request.examRecordList(this.param).then((res) => {
+        this.recordList = res.rows;
+        this.total = res.total;
+      });
+    },
+
+    async doRepeat(section) {
+      let count = await this.examRecordCount(section.examId);
+      let answerNum = await this.getExamDetail(section.examId);
+      //超过答题次数
+      if (answerNum > 0 && count >= answerNum) {
+        this.$message({
+          type: "warning",
+          message: "该试卷只能答题" + answerNum + "次!",
+        });
+        return;
+      }
+
+      this.$confirm(`是否清空答案重做?`, "提示", {
+        confirmButtonText: "重做",
+        cancelButtonText: "查看上次",
+        closeOnClickModal: false,
+        closeOnPressEscape: false,
+        distinguishCancelAndClose: false,
+        showClose: false,
+      })
+        .then((_) => {
+          this.$router.push({
+            path: "/bank-exam/" + section.goodsId,
+            query: {
+              examId: section.examId,
+              moduleId: section.moduleExamId || 0,
+              chapterId: section.chapterExamId || 0,
+            },
+          });
+        })
+        .catch((_) => {
+          this.$router.push({
+            path: "/bank-exam-all-explain/" + section.recordId,
+            query: {
+              examId: section.examId,
+              moduleId: section.moduleExamId || 0,
+              chapterId: section.chapterExamId || 0,
+              goodsId: section.goodsId,
+            },
+          });
+        });
+    },
+
+    /**
+     * 查询试卷历史做题次数
+     */
+    examRecordCount(examId) {
+      return new Promise((resolve) => {
+        this.$request
+          .examRecordCount({
+            examId: examId,
+            goodsId: this.id,
+          })
+          .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);
+        });
+      });
+    },
+  },
+};
+</script>
+
+<!-- Add "scoped" attribute to limit CSS to this component only -->
+<style scoped lang="scss">
+.bank-record {
+  &__header {
+    height: 56px;
+    line-height: 56px;
+    border-bottom: 1px solid #eee;
+  }
+  &__body {
+    .bank-item {
+      margin-top: 24px;
+
+      &__header {
+        height: 32px;
+        line-height: 32px;
+        .note {
+          display: inline-block;
+          margin-right: 15px;
+          width: 80px;
+          height: 32px;
+          line-height: 32px;
+          background: #3f8dfd;
+          text-align: center;
+          color: #fff;
+          font-size: 16px;
+          border-radius: 8px 0 8px 0;
+        }
+      }
+
+      &__body {
+        .list {
+          .exam-item {
+            height: 65px;
+            background: #fafbfc;
+            border-radius: 8px;
+            overflow: hidden;
+            line-height: 65px;
+            border-top: 1px solid #eee;
+            position: relative;
+
+            &__body {
+              .text {
+                .title {
+                  margin-left: 24px;
+                  font-size: 16px;
+                  font-family: Microsoft YaHei;
+                  font-weight: 400;
+                  color: #333333;
+                }
+
+                .desc {
+                  margin-left: 24px;
+                  color: #666;
+                  font-size: 16px;
+                }
+              }
+
+              .btns-wrap {
+                display: table;
+                position: absolute;
+                right: 0;
+                top: 0;
+                height: 100%;
+                margin-right: 20px;
+
+                .btns {
+                  display: table-cell;
+                  vertical-align: middle;
+                  text-align: center;
+
+                  .btn {
+                    cursor: pointer;
+                    width: 122px;
+                    height: 32px;
+                    padding: 0;
+                    border-radius: 16px;
+                    display: inline-block;
+                    text-align: center;
+                    line-height: 32px;
+                    vertical-align: middle;
+
+                    /deep/ span {
+                      font-size: 16px;
+                    }
+                  }
+
+                  .btn-line {
+                    margin: 0 10px;
+                    overflow: hidden;
+                    vertical-align: middle;
+                    display: inline-block;
+                    background: #ffffff;
+                    border: 1px solid #3f8dfd;
+                    border-radius: 30px;
+                    font-size: 0;
+                    line-height: 0;
+
+                    &__in {
+                      cursor: pointer;
+                      display: inline-block;
+                      padding: 7px 0;
+                      color: #3f8dfd;
+
+                      > div {
+                        text-align: center;
+                        font-size: 16px;
+                        line-height: 16px;
+                        width: 96px;
+                        height: 16px;
+                        border-right: 1px solid #3f8dfd;
+                      }
+
+                      &:nth-last-of-type(1) {
+                        > div {
+                          border: 0;
+                        }
+                      }
+
+                      &:hover {
+                        background: #3f8dfd;
+                        color: #fff;
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
+  &__footer {
+    .pagination {
+      padding: 30px 0;
+      text-align: center;
+    }
+  }
+}
+</style>

+ 1 - 0
src/pages/person-center/my-bank/index/index.vue

@@ -59,6 +59,7 @@
           layout="prev, pager, next"
           :total="total"
           :pager-count="5"
+          :page-size="param.pageSize"
         >
         </el-pagination>
       </div>

+ 2 - 0
src/pages/person-center/my-classhour/index/index.vue

@@ -103,6 +103,7 @@
               layout="prev, pager, next"
               :total="total"
               :pager-count="5"
+              :page-size="param.pageSize"
             >
             </el-pagination>
           </div>
@@ -142,6 +143,7 @@
               layout="prev, pager, next"
               :total="total"
               :pager-count="5"
+              :page-size="param.pageSize"
             >
             </el-pagination>
           </div>

+ 1 - 0
src/pages/person-center/my-course/index.vue

@@ -297,6 +297,7 @@
           layout="prev, pager, next"
           :total="total"
           :pager-count="5"
+          :page-size="param.pageSize"
         >
         </el-pagination>
       </div>

+ 2 - 0
src/pages/person-center/my-examination/index.vue

@@ -131,6 +131,7 @@
               layout="prev, pager, next"
               :total="total"
               :pager-count="5"
+              :page-size="param.pageSize"
             >
             </el-pagination>
           </div>
@@ -279,6 +280,7 @@
               layout="prev, pager, next"
               :total="total"
               :pager-count="5"
+              :page-size="param.pageSize"
             >
             </el-pagination>
           </div>

+ 1 - 0
src/pages/person-center/my-invoice/index/index.vue

@@ -120,6 +120,7 @@
           layout="prev, pager, next"
           :total="total"
           :pager-count="5"
+          :page-size="params.pageSize"
         >
         </el-pagination>
       </div>

+ 1 - 0
src/pages/person-center/my-message/index.vue

@@ -70,6 +70,7 @@
                 layout="prev, pager, next"
                 :total="total"
                 :pager-count="5"
+                :page-size="formData.pageSize"
               >
               </el-pagination>
             </div>

+ 1 - 0
src/pages/person-center/my-order/index.vue

@@ -134,6 +134,7 @@
             layout="prev, pager, next"
             :total="total"
             :pager-count="5"
+            :page-size="formData.pageSize"
           >
           </el-pagination>
         </div>

+ 6 - 0
src/router/index.js

@@ -192,6 +192,12 @@ const router =  new Router({
           component: resolve => require(['@/pages/person-center/bank-record/index'],resolve),
           name: '做题记录'
         },
+        
+        {
+          path: 'record-list/:goodsId',
+          component: resolve => require(['@/pages/person-center/bank-record/record-list/index'],resolve),
+          name: '更多记录'
+        },
         {
           path: 'my-order',
           component: resolve => require(['@/pages/person-center/my-order/index'],resolve),

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff