浏览代码

add:开始做题调整需求

Tang 3 年之前
父节点
当前提交
6e2bf1f47c

+ 2 - 1
src/axios.js

@@ -3,7 +3,8 @@ import store from './store'
 // export const BASE_URL = 'https://api.xyyxt.net'   //release
 // export const BASE_URL = 'https://api.xyyxt.net'   //release
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test
 // export const BASE_URL = 'http://42.192.164.187:19005'    //test
 // export const BASE_URL = 'https://test.xyyxt.net'   //预发布
 // export const BASE_URL = 'https://test.xyyxt.net'   //预发布
-export const BASE_URL = 'http://192.168.1.222: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 tenantId = '867735392558919680'
 export const tenantId = '867735392558919680'
 
 
 
 

+ 7 - 4
src/pages/bank-report/index.vue

@@ -202,11 +202,14 @@ export default {
   },
   },
   methods: {
   methods: {
     back() {
     back() {
+      // this.$router.replace({
+      //   path: "/person-center/my-bank/bank-detail/" + this.goodsId,
+      //   query: {
+      //     orderGoodsId: this.orderGoodsId,
+      //   },
+      // });
       this.$router.replace({
       this.$router.replace({
-        path: "/person-center/my-bank/bank-detail/" + this.goodsId,
-        query: {
-          orderGoodsId: this.orderGoodsId,
-        },
+        path: "/person-center/my-bank/index"
       });
       });
     },
     },
     /**
     /**

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

@@ -26,7 +26,7 @@
                     icon="el-icon-sort"
                     icon="el-icon-sort"
                     style="margin-left: 14px"
                     style="margin-left: 14px"
                     @click="openChangeCourseBoxs"
                     @click="openChangeCourseBoxs"
-                    >切换科目</el-button
+                    >切换课程</el-button
                   >
                   >
                 </div>
                 </div>
                 <div
                 <div

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

@@ -53,6 +53,13 @@
                                     >●</span
                                     >●</span
                                   >
                                   >
                                   {{ section.examName }}
                                   {{ section.examName }}
+                                  <el-button
+                                    size="mini"
+                                    type="primary"
+                                    plain
+                                    v-if="section.newRecordStatus"
+                                    >上次做到</el-button
+                                  >
                                 </div>
                                 </div>
                                 <div class="btn_div">
                                 <div class="btn_div">
                                   <!-- 正确率
                                   <!-- 正确率
@@ -163,6 +170,13 @@
                                     >●</span
                                     >●</span
                                   >
                                   >
                                   {{ section.examName }}
                                   {{ section.examName }}
+                                  <el-button
+                                    size="mini"
+                                    type="primary"
+                                    plain
+                                    v-if="section.newRecordStatus"
+                                    >上次做到</el-button
+                                  >
                                 </div>
                                 </div>
                                 <div
                                 <div
                                   style="width: auto; padding: 0px 14px"
                                   style="width: auto; padding: 0px 14px"
@@ -233,6 +247,13 @@
                                 >●</span
                                 >●</span
                               >
                               >
                               {{ item.name }}
                               {{ item.name }}
+                              <el-button
+                                size="mini"
+                                type="primary"
+                                plain
+                                v-if="item.newRecordStatus"
+                                >上次做到</el-button
+                              >
                             </div>
                             </div>
                             <div
                             <div
                               style="width: auto; padding: 0px 14px"
                               style="width: auto; padding: 0px 14px"
@@ -306,6 +327,13 @@
                     <div class="bank-section__item__text">
                     <div class="bank-section__item__text">
                       <span style="margin-right: 8px; color: #a7b0b8">●</span>
                       <span style="margin-right: 8px; color: #a7b0b8">●</span>
                       {{ item.examName }}
                       {{ item.examName }}
+                      <el-button
+                        size="mini"
+                        type="primary"
+                        plain
+                        v-if="item.newRecordStatus"
+                        >上次做到</el-button
+                      >
                     </div>
                     </div>
                     <div style="width: auto; padding: 0px 14px" class="btn_div">
                     <div style="width: auto; padding: 0px 14px" class="btn_div">
                       <!-- 正确率
                       <!-- 正确率
@@ -750,6 +778,7 @@ export default {
       wrongTotal: 0,
       wrongTotal: 0,
       recommendList: [],
       recommendList: [],
       needOpen: true, //是否需要打开第一章节
       needOpen: true, //是否需要打开第一章节
+      recordItem: null,
     };
     };
   },
   },
   mounted() {},
   mounted() {},
@@ -778,21 +807,173 @@ export default {
     },
     },
   },
   },
   methods: {
   methods: {
-    async initData(data) {
+    async initData(data, recordItem) {
+      this.recordItem = recordItem;
       this.orderGoodsId = data.orderGoodsId;
       this.orderGoodsId = data.orderGoodsId;
       this.goodsId = data.goodsId;
       this.goodsId = data.goodsId;
       await this.getExamType(data.goodsId);
       await this.getExamType(data.goodsId);
       this.goodsBankQuestionNum();
       this.goodsBankQuestionNum();
-      this.goodsBank();
+      if (this.recordItem) {
+        this.getRecordItem();
+      } else {
+        await this.goodsBank();
+      }
       this.getDetail();
       this.getDetail();
       this.examaperList();
       this.examaperList();
     },
     },
+    getRecordItem() {
+      this.$request
+        .goodsBank({
+          orderGoodsId: this.recordItem.orderGoodsId,
+          goodsId: this.recordItem.goodsId,
+        })
+        .then(async (res) => {
+          res.data.forEach((item) => {
+            if (item.type == 2 || item.type == 1) {
+              item.showList = false;
+              item.list = [];
+            }
+          });
+          this.bankList = res.data;
+          // for (let i = 0; i < this.bankList.length; i++) {
+          //   if (this.bankList[i].type == 1) {
+          //     await this.moduleExam(this.bankList[i]);
+          //     break;
+          //   } else if (this.bankList[i].type == 2) {
+          //     this.needOpen = false;
+          //     await this.chapterExam(this.bankList[i], 0);
+          //     break;
+          //   }
+          // }
+          const DW = this.bankList.findIndex((item) => {
+            if (
+              item.type == 1 &&
+              this.recordItem.moduleExamId > 0 &&
+              this.recordItem.moduleExamId == item.majorId
+            ) {
+              return item;
+            } else if (
+              item.type == 2 &&
+              !this.recordItem.moduleExamId &&
+              this.recordItem.chapterExamId == item.majorId
+            ) {
+              return item;
+            } else if (
+              item.type == 3 &&
+              !this.recordItem.moduleExamId &&
+              !this.recordItem.chapterExamId &&
+              this.recordItem.examId == item.majorId
+            ) {
+              return item;
+            }
+          });
+          if (DW != -1) {
+            if (this.bankList[DW].type == 1) {
+              
+              console.log(1)
+              this.$request
+                .goodsChapterList({
+                  orderGoodsId: this.orderGoodsId,
+                  moduleExamId: this.recordItem.moduleExamId,
+                  goodsId: this.goodsId,
+                })
+                .then(async (res) => {
+                  res.data.forEach((item) => {
+                    item.showList = false;
+                    item.list = [];
+                  });
+                  this.$set(
+                    this.bankList[DW],
+                    "showList",
+                    !this.bankList[DW].showList
+                  );
+                  this.$set(this.bankList[DW], "list", res.data);
+                  const DWChapter = this.bankList[DW].list.findIndex(
+                    (items) => {
+                      return (
+                        items.chapterExamId == this.recordItem.chapterExamId
+                      );
+                    }
+                  );
+                  if (DWChapter != -1) {
+                    this.$request
+                      .bankExamExamList({
+                        orderGoodsId: this.orderGoodsId,
+                        moduleExamId: this.bankList[DW].majorId,
+                        chapterExamId:
+                          this.bankList[DW].list[DWChapter].chapterExamId,
+                        goodsId: this.goodsId,
+                      })
+                      .then((res) => {
+                        this.$set(
+                          this.bankList[DW].list[DWChapter],
+                          "showList",
+                          !this.bankList[DW].list[DWChapter].showList
+                        );
+                        this.$set(
+                          this.bankList[DW].list[DWChapter],
+                          "list",
+                          res.data
+                        );
+                        const DWChapters = this.bankList[DW].list[
+                          DWChapter
+                        ].list.findIndex((itemsy) => {
+                          return itemsy.examId == this.recordItem.examId;
+                        });
+                        if (DWChapters != -1) {
+                          this.$set(
+                            this.bankList[DW].list[DWChapter].list[DWChapters],
+                            "newRecordStatus",
+                            true
+                          );
+                        }
+                      });
+                  }
+                });
+            } else if (this.bankList[DW].type == 2) {
+              console.log(2)
+              this.$request
+                .bankExamExamList({
+                  orderGoodsId: this.orderGoodsId,
+                  moduleExamId: 0,
+                  chapterExamId: this.bankList[DW].majorId,
+                  goodsId: this.goodsId,
+                })
+                .then((res) => {
+                  this.$set(
+                    this.bankList[DW],
+                    "showList",
+                    !this.bankList[DW].showList
+                  );
+                  this.$set(this.bankList[DW], "list", res.data);
+                  const DWChapter = this.bankList[DW].list.findIndex(
+                    (items) => {
+                      return items.examId == this.recordItem.examId;
+                    }
+                  );
+                  if (DWChapter != -1) {
+                    this.$set(
+                      this.bankList[DW].list[DWChapter],
+                      "newRecordStatus",
+                      true
+                    );
+                  }
+                });
+            } else if (this.bankList[DW].type == 3) {
+              console.log(3)
+              this.$set(this.bankList[DW], "newRecordStatus", true);
+            }
+          }
+          console.log("DW", DW,this.bankList);
+          
+        });
+    },
     getExamType(id) {
     getExamType(id) {
       return new Promise((resolve, reject) => {
       return new Promise((resolve, reject) => {
         this.$request.exampapergoodsExamPaper(id).then((res) => {
         this.$request.exampapergoodsExamPaper(id).then((res) => {
           this.newList = res.data;
           this.newList = res.data;
-          if(parseInt(this.activeName) > 0){
-            this.tabChange({name:this.activeName})
+          if (parseInt(this.activeName) > 0) {
+            this.tabChange({ name: this.activeName });
           }
           }
           resolve();
           resolve();
         });
         });
@@ -876,81 +1057,90 @@ export default {
      * 获取课程目录
      * 获取课程目录
      */
      */
     goodsBank() {
     goodsBank() {
-      this.$request
-        .goodsBank({
-          orderGoodsId: this.orderGoodsId,
-          goodsId: this.goodsId,
-        })
-        .then((res) => {
-          res.data.forEach((item) => {
-            if (item.type == 2 || item.type == 1) {
-              item.showList = false;
-              item.list = [];
+      return new Promise((resolve, reject) => {
+        this.$request
+          .goodsBank({
+            orderGoodsId: this.orderGoodsId,
+            goodsId: this.goodsId,
+          })
+          .then(async (res) => {
+            res.data.forEach((item) => {
+              if (item.type == 2 || item.type == 1) {
+                item.showList = false;
+                item.list = [];
+              }
+            });
+            this.bankList = res.data;
+            for (let i = 0; i < this.bankList.length; i++) {
+              if (this.bankList[i].type == 1) {
+                await this.moduleExam(this.bankList[i]);
+                break;
+              } else if (this.bankList[i].type == 2) {
+                this.needOpen = false;
+                await this.chapterExam(this.bankList[i], 0);
+                break;
+              }
             }
             }
+            resolve();
           });
           });
-          this.bankList = res.data;
-
-          for (let i = 0; i < this.bankList.length; i++) {
-            if (this.bankList[i].type == 1) {
-              this.moduleExam(this.bankList[i]);
-              break;
-            } else if (this.bankList[i].type == 2) {
-              this.needOpen = false;
-              this.chapterExam(this.bankList[i], 0);
-              break;
-            }
-          }
-        });
+      });
     },
     },
 
 
     /**
     /**
      * 展开模块卷
      * 展开模块卷
      */
      */
     moduleExam(Module) {
     moduleExam(Module) {
-      if (Module.list.length) {
-        Module.showList = !Module.showList;
-        return;
-      }
-      this.$request
-        .goodsChapterList({
-          orderGoodsId: this.orderGoodsId,
-          moduleExamId: Module.majorId,
-          goodsId: this.goodsId,
-        })
-        .then((res) => {
-          res.data.forEach((item) => {
-            item.showList = false;
-            item.list = [];
-          });
+      return new Promise((resolve, reject) => {
+        if (Module.list.length) {
           Module.showList = !Module.showList;
           Module.showList = !Module.showList;
-          Module.list = res.data;
+          return;
+        }
+        this.$request
+          .goodsChapterList({
+            orderGoodsId: this.orderGoodsId,
+            moduleExamId: Module.majorId,
+            goodsId: this.goodsId,
+          })
+          .then(async (res) => {
+            console.log(res, "resresres");
+            res.data.forEach((item) => {
+              item.showList = false;
+              item.list = [];
+            });
+            Module.showList = !Module.showList;
+            Module.list = res.data;
 
 
-          if (this.needOpen) {
-            this.needOpen = false;
-            this.chapterExam(Module.list[0], Module.majorId);
-          }
-        });
+            if (this.needOpen) {
+              this.needOpen = false;
+              await this.chapterExam(Module.list[0], Module.majorId);
+            }
+            resolve();
+          });
+      });
     },
     },
     /**
     /**
      * 展开章卷
      * 展开章卷
      */
      */
     chapterExam(chapter, moduleId = 0) {
     chapterExam(chapter, moduleId = 0) {
-      if (chapter.list.length) {
-        chapter.showList = !chapter.showList;
-        return;
-      }
-      this.$request
-        .bankExamExamList({
-          orderGoodsId: this.orderGoodsId,
-          moduleExamId: moduleId,
-          chapterExamId: chapter.chapterExamId || chapter.majorId,
-          goodsId: this.goodsId,
-        })
-        .then((res) => {
-          console.log(res,"res")
+      return new Promise((resolve, reject) => {
+        if (chapter.list.length) {
           chapter.showList = !chapter.showList;
           chapter.showList = !chapter.showList;
-          chapter.list = res.data;
-        });
+          return;
+        }
+        this.$request
+          .bankExamExamList({
+            orderGoodsId: this.orderGoodsId,
+            moduleExamId: moduleId,
+            chapterExamId: chapter.chapterExamId || chapter.majorId,
+            goodsId: this.goodsId,
+          })
+          .then((res) => {
+            console.log(res, "res");
+            chapter.showList = !chapter.showList;
+            chapter.list = res.data;
+            resolve();
+          });
+      });
     },
     },
 
 
     /**
     /**
@@ -1177,7 +1367,11 @@ export default {
     tabChange(e) {
     tabChange(e) {
       if (parseInt(e.name) > 0) {
       if (parseInt(e.name) > 0) {
         this.$request
         this.$request
-          .bankexamgetPaperExamList({ goodsId: this.goodsId, paperId: e.name,orderGoodsId:this.orderGoodsId })
+          .bankexamgetPaperExamList({
+            goodsId: this.goodsId,
+            paperId: e.name,
+            orderGoodsId: this.orderGoodsId,
+          })
           .then((res) => {
           .then((res) => {
             console.log(res, "resssssss");
             console.log(res, "resssssss");
             this.examListNew = res.data;
             this.examListNew = res.data;

+ 29 - 10
src/pages/person-center/my-bank/index/index.vue

@@ -3,7 +3,8 @@
     <div class="no-data" v-if="!bankData.goodsName">暂无可以学习的题库哦~</div>
     <div class="no-data" v-if="!bankData.goodsName">暂无可以学习的题库哦~</div>
     <div v-else>
     <div v-else>
       <h4 class="headerTitle">
       <h4 class="headerTitle">
-        <span v-if="bankData.subjectNames">【{{bankData.subjectNames}}】</span>{{ bankData.goodsName
+        <span v-if="bankData.subjectNames">【{{ bankData.subjectNames }}】</span
+        >{{ bankData.goodsName
         }}<el-button
         }}<el-button
           size="mini"
           size="mini"
           type="primary"
           type="primary"
@@ -50,17 +51,35 @@ export default {
     this.getList();
     this.getList();
   },
   },
   methods: {
   methods: {
+    getInfoData(data) {
+      return new Promise((resolve, reject) => {
+        this.$request.goodsDetail(data.goodsId).then((res) => {
+          res.data.orderGoodsId = data.orderGoodsId;
+          resolve(res.data);
+        });
+      });
+    },
     getList() {
     getList() {
-      this.$request
-        .listGoodsUserQuestion({ pageNum: 1, pageSize: 1 })
-        .then((res) => {
-          if (res.rows.length > 0) {
-            this.bankData = res.rows[0];
-            this.$nextTick(() => {
-              this.$refs.bankDetailCopy.initData(this.bankData);
+      this.$request.examrecordgetUserDoLast().then(async (res) => {
+        if (res.data.goodsId) {
+          const result = await this.getInfoData(res.data);
+          this.bankData = result;
+          this.$nextTick(() => {
+            this.$refs.bankDetailCopy.initData(this.bankData,res.data);
+          });
+        } else {
+          this.$request
+            .listGoodsUserQuestion({ pageNum: 1, pageSize: 1 })
+            .then((res) => {
+              if (res.rows.length > 0) {
+                this.bankData = res.rows[0];
+                this.$nextTick(() => {
+                  this.$refs.bankDetailCopy.initData(this.bankData);
+                });
+              }
             });
             });
-          }
-        });
+        }
+      });
     },
     },
     /**
     /**
      * 切换题库
      * 切换题库