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

در پرسشنامه‌ی رویداد،‌ . پاسخ به سوالات اجباری باشد(ستاره دار). و بدون پاسخ به سوال فعلی امکان رفتن به سوال قبلی باشد.

hgh 1 éve
szülő
commit
e9d2563896

+ 4 - 4
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)
         })
@@ -180,12 +180,12 @@ export default {
         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) {
+        if (!skipValidation && !answerText && !hasChoise) {
           this.$q.notify({
             type: 'negative',
             message: 'لطفا متن پاسخ را کامل کنید.'
@@ -193,7 +193,7 @@ export default {
           reject()
           return
         }
-        if (hasChoise && isNaN(answerSheetItem.answer_choice_index)) {
+        if (!skipValidation && hasChoise && isNaN(answerSheetItem.answer_choice_index)) {
           this.$q.notify({
             type: 'negative',
             message: 'لطفا یک گزینه را انتخاب.'