浏览代码

fixed #324

ali 2 年之前
父节点
当前提交
7d73aed6d7
共有 1 个文件被更改,包括 32 次插入 和 0 次删除
  1. 32 0
      src/components/Widgets/Test/TestParticipation/TestParticipation.vue

+ 32 - 0
src/components/Widgets/Test/TestParticipation/TestParticipation.vue

@@ -35,6 +35,13 @@
                          @sending="onSingleQuestionsSending"
                          @sentSuccess="onSingleQuestionsSentSuccess"
                          @sentFailed="onSingleQuestionsSentFailed" />
+        <div class="flex justify-end q-pa-lg">
+          <q-btn color="primary"
+                 outline
+                 @click="confirmAnswers">
+            اتمام آزمون
+          </q-btn>
+        </div>
       </template>
     </q-card>
     <div v-else>
@@ -152,6 +159,31 @@ export default {
     startTest () {
       this.$router.push({ name: this.participateType, params: { question_number: 1 } })
     },
+    confirmAnswers () {
+      this.$q.dialog({
+        title: 'اتمام آزمون',
+        message: 'آیا از اتمام آزمون و تایید پاسخ های خود اطمینان دارید؟',
+        cancel: true,
+        persistent: true
+      }).onOk(() => {
+        APIGateway.answerBook.confirmAnswers(this.answerBook.id)
+          .then(() => {
+            this.$q.notify({
+              message: 'تایید آزمون با موفقیت انجام شد.',
+              type: 'positive'
+            })
+            this.$router.push({
+              name: 'UserPanel.Test.AnswerBook.Participate.SingleQuestion',
+              params: {
+                test_id: this.$route.params.test_id,
+                answer_book_id: this.$route.params.answer_book_id,
+                question_number: 'complete'
+              }
+            })
+          })
+          .catch(() => {})
+      }).onCancel(() => {})
+    },
     getRemainingTimeInSeconds (serverTimeStr, attendingStartTimeStr, durationInMinutes) {
       // Convert the strings to Date objects
       const serverTime = new Date(serverTimeStr)