Forráskód Böngészése

考试界面添加跳转功能

ChengYuXuan 5 éve
szülő
commit
03465bceac
1 módosított fájl, 17 hozzáadás és 7 törlés
  1. 17 7
      src/views/exam/ExamPane.vue

+ 17 - 7
src/views/exam/ExamPane.vue

@@ -322,7 +322,12 @@ export default Vue.extend({
     },
     leaveExam() {
       this.exitDialog = false
-      this.$router.push('/')
+      let redirect_uri = this.$route.query.redirect_uri ?? ''
+      if (redirect_uri) {
+        window.location.href = decodeURI(redirect_uri as string)
+      } else {
+        this.$router.push('/')
+      }
     },
     submitAnswer() {
       this.submitDialog = false
@@ -340,12 +345,17 @@ export default Vue.extend({
       objectiveJudge(this.examId, mapObj)
         .then(() => {
           setTimeout(() => {
-            this.$router.push({
-              name: 'result',
-              params: {
-                examId: this.examId.toString()
-              }
-            })
+            let redirect_uri = this.$route.query.redirect_uri ?? ''
+            if (redirect_uri) {
+              window.location.href = decodeURIComponent(redirect_uri as string)
+            } else {
+              this.$router.push({
+                name: 'result',
+                params: {
+                  examId: this.examId.toString()
+                }
+              })
+            }
           }, 1000)
         })
         .catch(() => {