Pārlūkot izejas kodu

Merge branch 'master' of http://git.hghweb.ir/ali.s/palizvani-front-vite into production

hgh 1 gadu atpakaļ
vecāks
revīzija
58c9e29741

+ 1 - 1
src/components/FormBuilderCustumComponents/QuestionChoices/QuestionChoices.vue

@@ -141,7 +141,7 @@ export default {
     FormBuilderAssist.setAttributeByName(this.inputs, 'source_type', 'value', this.sourceType)
     this.inputData = this.value
     if (this.participateMode) {
-      this.localCorrectChoiceIndex = this.value || 0
+      this.localCorrectChoiceIndex = this.value
     } else {
       this.localCorrectChoiceIndex = this.correctChoiceIndex
     }

+ 2 - 0
src/components/Widgets/Classroom/AdminClassroomAnswerBookList/AdminClassroomAnswerBookList.vue

@@ -125,6 +125,8 @@ export default {
           name: 'status',
           options: [
             { label: 'در انتظار تصحیح', value: 'WAITING_FOR_GRADING' },
+            { label: 'تایید شده و در انتظار تصحیح', value: 'SUBMITTED' },
+            { label: 'اتمام زمان پاسخ گویی و در انتظار تصحیح', value: 'PASSED_DURATION_DEADLINE' },
             { label: 'در حال تصحیح', value: 'GRADING' },
             { label: 'تصحیح شده', value: 'GRADED' },
             {

+ 2 - 0
src/components/Widgets/Classroom/ClassroomAnswerBookList/ClassroomAnswerBookList.vue

@@ -66,6 +66,8 @@ export default {
           clearable: false,
           options: [
             { label: 'در انتظار تصحیح', value: 'WAITING_FOR_GRADING' },
+            { label: 'تایید شده و در انتظار تصحیح', value: 'SUBMITTED' },
+            { label: 'اتمام زمان پاسخ گویی و در انتظار تصحیح', value: 'PASSED_DURATION_DEADLINE' },
             { label: 'در حال تصحیح', value: 'GRADING' },
             { label: 'تصحیح شده', value: 'GRADED' },
             {

+ 12 - 7
src/components/Widgets/Other/Shop/ShopCompleteInfo/components/AllQuestions.vue

@@ -106,7 +106,7 @@ export default {
         .catch(() => {})
     },
     prevQuestion () {
-      this.sendAnswer(this.questionPanel - 1)
+      this.sendAnswer(this.questionPanel - 1, true)
         .then(() => {
           this.changeQuestion(this.questionPanel - 1)
         })
@@ -127,7 +127,7 @@ export default {
             type: BtnControlComp,
             name: 'btn',
             responseKey: 'btn',
-            label: 'ثبت پاسخ',
+            label: 'تایید و ادامه',
             placeholder: ' ',
             atClick: () => {
               this.sendAnswer(answerSheetIndex)
@@ -172,28 +172,33 @@ export default {
               canEdit: false,
               canDelete: false,
               choicesInfo: answerSheetItem.test_question_info.question_info.choices_info,
-              value: !answerSheetItem.answer_choice_index || isNaN(answerSheetItem.answer_choice_index) ? 0 : parseInt(answerSheetItem.answer_choice_index),
+              value: !answerSheetItem.answer_choice_index || isNaN(answerSheetItem.answer_choice_index) ? null : parseInt(answerSheetItem.answer_choice_index),
               col: 'col-12 flex justify-end'
             })
         }
+        if (answerSheetIndex < this.answerBook.answer_sheet_info.list.length - 1) {
+          inputs[inputs.length - 1].type = 'hidden'
+          inputs[inputs.length - 1].value = null
+        }
 
         this.questionInputs.push(inputs)
       })
     },
-    sendAnswer (answerSheetIndex) {
+    sendAnswer (answerSheetIndex, skipValidation = false) {
       return new Promise((resolve, reject) => {
         const answerSheetItem = this.answerBook.answer_sheet_info.list[answerSheetIndex]
         const hasChoise = Array.isArray(answerSheetItem.test_question_info.question_info.choices) && answerSheetItem.test_question_info.question_info.choices.length > 0
         const answerText = FormBuilderAssist.getInputsByName(this.questionInputs[answerSheetIndex], 'answer_text').value
-        if (!answerText && !hasChoise) {
+        const answerAttachment = FormBuilderAssist.getInputsByName(this.questionInputs[answerSheetIndex], 'answer_attachment').value
+        if (!skipValidation && !answerAttachment && !answerText && !hasChoise) {
           this.$q.notify({
             type: 'negative',
-            message: 'لطفا متن پاسخ را کامل کنید.'
+            message: 'لطفا متن پاسخ یا پیوست را کامل کنید.'
           })
           reject()
           return
         }
-        if (hasChoise && isNaN(answerSheetItem.answer_choice_index)) {
+        if (!skipValidation && hasChoise && (!answerSheetItem.answer_choice_index || isNaN(answerSheetItem.answer_choice_index))) {
           this.$q.notify({
             type: 'negative',
             message: 'لطفا یک گزینه را انتخاب.'

+ 5 - 1
src/models/AnswerBook.js

@@ -93,9 +93,13 @@ class AnswerBook extends Model {
             value: 'FETCHED'
           },
           {
-            label: 'در انتظار تصحیح',
+            label: 'تایید شده و در انتظار تصحیح',
             value: 'SUBMITTED'
           },
+          {
+            label: 'اتمام زمان پاسخ گویی و در انتظار تصحیح',
+            value: 'PASSED_DURATION_DEADLINE'
+          },
           {
             label: 'در حال تصحیح',
             value: 'GRADING'