dedsudiyu 1 周之前
父節點
當前提交
2252cdc596

+ 2 - 2
src/api/safetyEducationExaminationNew/index.js

@@ -910,9 +910,9 @@ export function examUserPracticeSummary(query) {
 
 
 //二次确认考试是否已结束
-export function examAttemptFinished(data) {
+export function examUserExamAttemptFinished(data) {
   return request({
-    url: '/exam/attempt/finished',
+    url: '/exam/user/exam/attempt/finished',
     method: 'post',
     data: data
   })

+ 83 - 23
src/views/safetyEducationExaminationNew/safetyTest/mockExam/index.vue

@@ -82,7 +82,10 @@
   //import { getInfo } from "@/api/basicsModules/index";
   //import addPage from "./addPage.vue";
   import { Encrypt,Decrypt} from '@/utils/secret'
-  import { examUserExamMockList,examUserExamTypeSelectExamType,examUserExamStart,examAttemptFinished, } from "@/api/safetyEducationExaminationNew/index";
+  import {
+    examUserExamMockList,examUserExamTypeSelectExamType,
+    examUserExamStart,examUserExamAttemptFinished,
+  } from "@/api/safetyEducationExaminationNew/index";
   export default {
     name: 'index',
     data() {
@@ -211,27 +214,16 @@
         }else if(type == 3){
           //模拟考试
           if(item.attemptId){
-            this.$router.push({
-              path: '/mockExam',
-              query: {
-                examId: item.examId,
-                attemptId: item.attemptId,
-              }
-            })
+            let obj = {
+              examId: item.examId,
+              attemptId: item.mockExamId,
+            };
+            this.examUserExamAttemptFinished(2,obj);
           }else{
-            examUserExamStart({examId:item.examId,examScene:2,}).then(response => {
-              if(response.data.attemptId){
-                this.$router.push({
-                  path: '/mockExam',
-                  query: {
-                    examId: item.examId,
-                    attemptId: response.data.attemptId,
-                  }
-                })
-              }else{
-                this.msgError(response.message)
-              }
-            })
+            let obj = {
+              examId: item.examId,
+            };
+            this.examUserExamStartPlay(2,obj);
           }
         }else if (type == 6) {
           //返回并刷新
@@ -240,8 +232,76 @@
         }
       },
       //二次验证考试是否已结束
-      examAttemptFinished(type,item){
-
+      examUserExamAttemptFinished(type,item){
+        examUserExamAttemptFinished({attemptId:item.attemptId}).then(response => {
+          if(response.data){
+            //已结束
+            if(type == 1){
+              //在线考试
+              if(item.attemptLimit == 0 || item.attemptCount < item.attemptLimit){
+                //获取新试卷
+                this.examUserExamStartPlay(type,item)
+              }else{
+                //无可用次数 提示并刷新数据列表
+                this.msgError('当前考试已结束')
+                this.handleQuery();
+              }
+            }else if(type == 2){
+              //模拟考试-获取新试卷
+              this.examUserExamStartPlay(type,item)
+            }
+          }else{
+            //未结束
+            this.confirmTitle(type,item);
+          }
+        })
+      },
+      //获取考试试卷
+      examUserExamStartPlay(type,item){
+        examUserExamStart({examId:item.examId,examScene:type,}).then(response => {
+          if(response.data.attemptId){
+            let obj = {
+              examId: item.examId,
+              attemptId: response.data.attemptId,
+            };
+            if(type == 1){
+              obj.type = 1;
+              obj.examKind = item.examKind;
+            }
+            this.confirmTitle(type,obj);
+          }else{
+            this.msgError(response.message)
+          }
+        })
+      },
+      //提示与跳转
+      confirmTitle(type,obj){
+        let self = this;
+        this.$confirm(
+          '考试期间未完成答题请勿离开页面,离开后倒计时仍会继续,超时将自动交卷并记录成绩,扣除 1 次考试机会。',
+          '进入考试页面',
+          {
+            confirmButtonText: '确定进入',
+            cancelButtonText: '取消',
+            type: 'warning',
+            closeOnClickModal: false,
+            closeOnPressEscape: false
+          }
+        ).then(() => {
+          if(type == 1){
+            //在线考试
+            this.$router.push({
+              path: '/startTheExam',
+              query: obj
+            })
+          }else if(type == 2){
+            //模拟考试
+            self.$router.push({
+              path: '/mockExam',
+              query: obj
+            })
+          }
+        }).catch(() => {})
       },
       examUserExamTypeSelectExamType(){
         let self = this;

+ 94 - 65
src/views/safetyEducationExaminationNew/safetyTest/onlineExam/index.vue

@@ -99,7 +99,11 @@
   //import { systemUserSelect } from "@/api/commonality/permission";
   //import { getInfo } from "@/api/basicsModules/index";
   //import addPage from "./addPage.vue";
-  import { examUserExamList,examUserExamTypeSelectExamType,examUserExamStart,examUserExamCommitmentConfirm,examAttemptFinished, } from "@/api/safetyEducationExaminationNew/index";
+  import {
+    examUserExamList,examUserExamTypeSelectExamType,
+    examUserExamStart,examUserExamCommitmentConfirm,
+    examUserExamAttemptFinished,
+  } from "@/api/safetyEducationExaminationNew/index";
   import richTextPdf from '@/views/safetyEducationExaminationNew/components/richTextPdf.vue';
   export default {
     name: 'index',
@@ -214,26 +218,15 @@
       },
       examUserExamCommitmentConfirm(type,attemptId){
         examUserExamCommitmentConfirm({attemptId:attemptId}).then(response => {
-          if(type == 1){
-            this.$router.push({
-              path: '/startTheExam',
-              query: {
-                attemptId: attemptId,
-                type: '1',
-                examKind:this.preData.examKind,
-              }
-            })
-          }else if(type == 2){
-            this.$router.push({
-              path: '/startTheExam',
-              query: {
-                examId: this.preData.examId,
-                attemptId: attemptId,
-                type: '1',
-                examKind:this.preData.examKind,
-              }
-            })
+          let obj = {
+            examId: this.preData.examId,
+            attemptId: attemptId,
+            type: '1',
+            examKind:this.preData.examKind,
+            attemptLimit:this.preData.attemptLimit,
+            attemptCount:this.preData.attemptCount,
           }
+          this.examUserExamAttemptFinished(1,obj);
         })
       },
       //开始考试判断是否有承诺书
@@ -245,30 +238,9 @@
           this.$set(this,'preExamDialogType',true);
         }else{
           if(item.attemptId){
-            this.$router.push({
-              path: '/startTheExam',
-              query: {
-                attemptId: item.attemptId,
-                type: '1',
-                examKind:item.examKind,
-              }
-            })
+            this.examUserExamAttemptFinished(1,item);
           }else{
-            examUserExamStart({examId:item.examId,examScene:1,}).then(response => {
-              if(response.data.attemptId){
-                this.$router.push({
-                  path: '/startTheExam',
-                  query: {
-                    examId: item.examId,
-                    attemptId: response.data.attemptId,
-                    type: '1',
-                    examKind:item.examKind,
-                  }
-                })
-              }else{
-                this.msgError(response.message)
-              }
-            })
+            this.examUserExamStartPlay(1,item);
           }
         }
       },
@@ -313,27 +285,16 @@
         }else if(type == 3){
           //模拟考试
           if(item.mockExamId){
-            this.$router.push({
-              path: '/mockExam',
-              query: {
-                examId: item.examId,
-                attemptId: item.mockExamId,
-              }
-            })
+            let obj = {
+              examId: item.examId,
+              attemptId: item.mockExamId,
+            };
+            this.examUserExamAttemptFinished(2,obj);
           }else{
-            examUserExamStart({examId:item.examId,examScene:2,}).then(response => {
-              if(response.data.attemptId){
-                this.$router.push({
-                  path: '/mockExam',
-                  query: {
-                    examId: item.examId,
-                    attemptId: response.data.attemptId,
-                  }
-                })
-              }else{
-                this.msgError(response.message)
-              }
-            })
+            let obj = {
+              examId: item.examId,
+            };
+            this.examUserExamStartPlay(2,obj);
           }
         }else if(type == 4){
           //在线考试//补考
@@ -345,8 +306,76 @@
         }
       },
       //二次验证考试是否已结束
-      examAttemptFinished(type,item){
-
+      examUserExamAttemptFinished(type,item){
+        examUserExamAttemptFinished({attemptId:item.attemptId}).then(response => {
+          if(response.data){
+            //已结束
+            if(type == 1){
+              //在线考试
+              if(item.attemptLimit == 0 || item.attemptCount < item.attemptLimit){
+                //获取新试卷
+                this.examUserExamStartPlay(type,item)
+              }else{
+                //无可用次数 提示并刷新数据列表
+                this.msgError('当前考试已结束')
+                this.handleQuery();
+              }
+            }else if(type == 2){
+              //模拟考试-获取新试卷
+              this.examUserExamStartPlay(type,item)
+            }
+          }else{
+            //未结束
+            this.confirmTitle(type,item);
+          }
+        })
+      },
+      //获取考试试卷
+      examUserExamStartPlay(type,item){
+        examUserExamStart({examId:item.examId,examScene:type,}).then(response => {
+          if(response.data.attemptId){
+            let obj = {
+              examId: item.examId,
+              attemptId: response.data.attemptId,
+            };
+            if(type == 1){
+              obj.type = 1;
+              obj.examKind = item.examKind;
+            }
+            this.confirmTitle(type,obj);
+          }else{
+            this.msgError(response.message)
+          }
+        })
+      },
+      //提示与跳转
+      confirmTitle(type,obj){
+        let self = this;
+        this.$confirm(
+          '考试期间未完成答题请勿离开页面,离开后倒计时仍会继续,超时将自动交卷并记录成绩,扣除 1 次考试机会。',
+          '进入考试页面',
+          {
+            confirmButtonText: '确定进入',
+            cancelButtonText: '取消',
+            type: 'warning',
+            closeOnClickModal: false,
+            closeOnPressEscape: false
+          }
+        ).then(() => {
+          if(type == 1){
+            //在线考试
+            this.$router.push({
+              path: '/startTheExam',
+              query: obj
+            })
+          }else if(type == 2){
+            //模拟考试
+            self.$router.push({
+              path: '/mockExam',
+              query: obj
+            })
+          }
+        }).catch(() => {})
       },
       examUserExamTypeSelectExamType(){
         let self = this;

+ 65 - 110
src/views/safetyEducationExaminationNew/workbench/TaskCard.vue

@@ -142,7 +142,7 @@
   import {
     examUserCoursewareLearningRestart,examElLabEduRelationAcademicYearProgress,
     examUserExamStudyTaskList,examUserExamStart,examUserPracticeSummary,
-    examUserExamCommitmentConfirm,examAttemptFinished,
+    examUserExamCommitmentConfirm,examUserExamAttemptFinished,
   } from "@/api/safetyEducationExaminationNew/index";
   import richTextPdf from '@/views/safetyEducationExaminationNew/components/richTextPdf.vue';
 export default {
@@ -201,28 +201,18 @@ export default {
         })
       }
     },
+    //确认考试承诺书
     examUserExamCommitmentConfirm(type,attemptId){
       examUserExamCommitmentConfirm({attemptId:attemptId}).then(response => {
-        if(type == 1){
-          this.$router.push({
-            path: '/startTheExam',
-            query: {
-              attemptId: attemptId,
-              type: '1',
-              examKind:this.preData.examKind,
-            }
-          })
-        }else if(type == 2){
-          this.$router.push({
-            path: '/startTheExam',
-            query: {
-              examId: this.preData.examId,
-              attemptId: attemptId,
-              type: '1',
-              examKind:this.preData.examKind,
-            }
-          })
+        let obj = {
+          examId: this.preData.examId,
+          attemptId: attemptId,
+          type: '1',
+          examKind:this.preData.examKind,
+          attemptLimit:this.preData.attemptLimit,
+          attemptCount:this.preData.attemptCount,
         }
+        this.examUserExamAttemptFinished(1,obj);
       })
     },
     //开始考试判断是否有承诺书
@@ -234,30 +224,9 @@ export default {
         this.$set(this,'preExamDialogType',true);
       }else{
         if(item.attemptId){
-          this.$router.push({
-            path: '/startTheExam',
-            query: {
-              attemptId: item.attemptId,
-              type: '1',
-              examKind:item.examKind,
-            }
-          })
+          this.examUserExamAttemptFinished(1,item);
         }else{
-          examUserExamStart({examId:item.examId,examScene:1,}).then(response => {
-            if(response.data.attemptId){
-              this.$router.push({
-                path: '/startTheExam',
-                query: {
-                  examId: item.examId,
-                  attemptId: response.data.attemptId,
-                  type: '1',
-                  examKind:item.examKind,
-                }
-              })
-            }else{
-              this.msgError(response.message)
-            }
-          })
+          this.examUserExamStartPlay(1,item);
         }
       }
     },
@@ -309,27 +278,16 @@ export default {
       }else if(type == 3){
         //模拟考试
         if(item.mockExamId){
-          this.$router.push({
-            path: '/mockExam',
-            query: {
-              examId: item.examId,
-              attemptId: item.mockExamId,
-            }
-          })
+          let obj = {
+            examId: item.examId,
+            attemptId: item.mockExamId,
+          };
+          this.examUserExamAttemptFinished(2,obj);
         }else{
-          examUserExamStart({examId:item.examId,examScene:2,}).then(response => {
-            if(response.data.attemptId){
-              this.$router.push({
-                path: '/mockExam',
-                query: {
-                  examId: item.examId,
-                  attemptId: response.data.attemptId,
-                }
-              })
-            }else{
-              this.msgError(response.message)
-            }
-          })
+          let obj = {
+            examId: item.examId,
+          };
+          this.examUserExamStartPlay(2,obj);
         }
       }else if(type == 4){
         //在线考试//补考
@@ -377,27 +335,16 @@ export default {
       }else if(type == 3){
         //模拟考试
         if(item.mockExamId){
-          this.$router.push({
-            path: '/mockExam',
-            query: {
-              examId: item.examId,
-              attemptId: item.mockExamId,
-            }
-          })
+          let obj = {
+            examId: item.examId,
+            attemptId: item.mockExamId,
+          };
+          this.examUserExamAttemptFinished(2,obj);
         }else{
-          examUserExamStart({examId:item.examId,examScene:2,}).then(response => {
-            if(response.data.attemptId){
-              this.$router.push({
-                path: '/mockExam',
-                query: {
-                  examId: item.examId,
-                  attemptId: response.data.attemptId,
-                }
-              })
-            }else{
-              this.msgError(response.message)
-            }
-          })
+          let obj = {
+            examId: item.examId,
+          };
+          this.examUserExamStartPlay(2,obj);
         }
       }else if(type == 4){
         //在线考试//补考
@@ -405,38 +352,46 @@ export default {
       }
     },
     //二次验证考试是否已结束
-    examAttemptFinished(type,item){
-      examAttemptFinished({attemptId:item.attemptId}).then(response => {
+    examUserExamAttemptFinished(type,item){
+      examUserExamAttemptFinished({attemptId:item.attemptId}).then(response => {
         if(response.data){
-          //已完成
-          if(item.attemptLimit ==0||item.attemptCount<item.attemptLimit){
-            //获取新试卷
-            if(type == 1){
-              //在线考试
-              examUserExamStart({examId:item.examId,examScene:1,}).then(response => {
-                if(response.data.attemptId){
-                  this.$router.push({
-                    path: '/startTheExam',
-                    query: {
-                      examId: item.examId,
-                      attemptId: response.data.attemptId,
-                      type: '1',
-                      examKind:item.examKind,
-                    }
-                  })
-                }else{
-                  this.msgError(response.message)
-                }
-              })
+          //已结束
+          if(type == 1){
+            //在线考试
+            if(item.attemptLimit == 0 || item.attemptCount < item.attemptLimit){
+              //获取新试卷
+              this.examUserExamStartPlay(type,item)
             }else{
-              //模拟考试
-
+              //无可用次数 提示并刷新数据列表
+              this.msgError('当前考试已结束')
+              this.examUserExamStudyTaskList();
+              this.examUserExamStudyTaskList2();
             }
-          }else{
-            //无可用次数 提示并刷新数据列表
+          }else if(type == 2){
+            //模拟考试-获取新试卷
+            this.examUserExamStartPlay(type,item)
+          }
+        }else{
+          //未结束
+          this.confirmTitle(type,item);
+        }
+      })
+    },
+    //获取考试试卷
+    examUserExamStartPlay(type,item){
+      examUserExamStart({examId:item.examId,examScene:type,}).then(response => {
+        if(response.data.attemptId){
+          let obj = {
+            examId: item.examId,
+            attemptId: response.data.attemptId,
+          };
+          if(type == 1){
+            obj.type = 1;
+            obj.examKind = item.examKind;
           }
+          this.confirmTitle(type,obj);
         }else{
-          //未完成
+          this.msgError(response.message)
         }
       })
     },