|
|
@@ -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: 'لطفا یک گزینه را انتخاب.'
|