浏览代码

#2893 学生端--艺术评测,限时作答结束后支持自动交卷

XW 1 年之前
父节点
当前提交
fd7b81668e

+ 16 - 1
TEAMModelOS/ClientApp/src/components/student-web/EventView/EventContentTypeTemplate/PaperViewBox/PaperTest.vue

@@ -99,7 +99,9 @@
                     <h3>{{$t("studentWeb.exam.testpop.submitQuizhint")}}</h3>
                     <h3>{{$t("studentWeb.exam.testpop.submitQuizhint")}}</h3>
                     <svg-icon icon-class="unfinishedTest" class="handOnImg" />
                     <svg-icon icon-class="unfinishedTest" class="handOnImg" />
                     <p>{{$t("studentWeb.exam.testpop.submitQuizhint1")}}</p>
                     <p>{{$t("studentWeb.exam.testpop.submitQuizhint1")}}</p>
-                    <button class="messageCardBtn" @click="closetest()">{{$t("studentWeb.exam.testpop.okSubmit")}}</button>
+                    <button class="messageCardBtn" @click="closetest()">
+                        {{$t("studentWeb.exam.testpop.okSubmit")}}({{ modalSecond }}s)
+                    </button>
                 </div>
                 </div>
             </div>
             </div>
         </div>
         </div>
@@ -565,7 +567,9 @@
                 setTime: false, //评测是否设置时间
                 setTime: false, //评测是否设置时间
                 surplus: "", //倒计时的字符
                 surplus: "", //倒计时的字符
                 diffSeconds: 0, //秒数
                 diffSeconds: 0, //秒数
+                modalSecond: 10, //弹出框秒数
                 interval: undefined, //计时器
                 interval: undefined, //计时器
+                modalInterval: undefined, //弹出框的倒计时(10s)
                 showExam: [],
                 showExam: [],
                 totalScore: 0, //练习总分
                 totalScore: 0, //练习总分
                 showEnd: false, //结束练习
                 showEnd: false, //结束练习
@@ -961,6 +965,9 @@
             },
             },
             //提交作答记录
             //提交作答记录
             closetest() {
             closetest() {
+                if(this.modalInterval) {
+                    clearInterval(this.modalInterval)
+                }
                 this.WarmMessageisOpen = false
                 this.WarmMessageisOpen = false
                 if (this.checkers.length) {
                 if (this.checkers.length) {
                     this.isLoading = true;
                     this.isLoading = true;
@@ -1258,6 +1265,14 @@
                         clearInterval(this.interval)
                         clearInterval(this.interval)
                         this.WarmMessageisOpen = true
                         this.WarmMessageisOpen = true
                         this.showMessageNum = 6
                         this.showMessageNum = 6
+                        // 弹出框倒计时10s,到时间直接交卷
+                        this.modalInterval = setInterval(() => {
+                            if(this.modalSecond > 1) {
+                                this.modalSecond -= 1
+                            } else {
+                                this.closetest()
+                            }
+                        }, 1000)
                         this.$forceUpdate()
                         this.$forceUpdate()
                     } else {
                     } else {
                         // 小时
                         // 小时