|
|
|
|
@@ -24,22 +24,26 @@
|
|
|
|
|
<!-- <img :src="icon" alt="icon" />-->
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="styleInfo.logo_status && styleInfo.logo_url" class="example-logo" :style="[
|
|
|
|
|
{
|
|
|
|
|
'justify-content':
|
|
|
|
|
styleInfo.logo_site === 1
|
|
|
|
|
? 'flex-start'
|
|
|
|
|
: styleInfo.logo_site === 2
|
|
|
|
|
? 'center'
|
|
|
|
|
: 'flex-end'
|
|
|
|
|
},
|
|
|
|
|
{ 'padding-left': styleInfo.logo_site === 1 ? '20px' : '' },
|
|
|
|
|
{ 'padding-right': styleInfo.logo_site === 3 ? '20px' : '' },
|
|
|
|
|
{ position: styleInfo.head_img_status ? 'absolute' : '' },
|
|
|
|
|
!styleInfo.head_img_status && styleInfo.background_status
|
|
|
|
|
? `background-color: ${styleInfo.background_color};background-image: url(${styleInfo.background_url})`
|
|
|
|
|
: ''
|
|
|
|
|
]">
|
|
|
|
|
<div
|
|
|
|
|
v-if="styleInfo.logo_status && styleInfo.logo_url"
|
|
|
|
|
class="example-logo"
|
|
|
|
|
:style="[
|
|
|
|
|
{
|
|
|
|
|
'justify-content':
|
|
|
|
|
styleInfo.logo_site === 1
|
|
|
|
|
? 'flex-start'
|
|
|
|
|
: styleInfo.logo_site === 2
|
|
|
|
|
? 'center'
|
|
|
|
|
: 'flex-end'
|
|
|
|
|
},
|
|
|
|
|
{ 'padding-left': styleInfo.logo_site === 1 ? '20px' : '' },
|
|
|
|
|
{ 'padding-right': styleInfo.logo_site === 3 ? '20px' : '' },
|
|
|
|
|
{ position: styleInfo.head_img_status ? 'absolute' : '' },
|
|
|
|
|
!styleInfo.head_img_status && styleInfo.background_status
|
|
|
|
|
? `background-color: ${styleInfo.background_color};background-image: url(${styleInfo.background_url})`
|
|
|
|
|
: ''
|
|
|
|
|
]"
|
|
|
|
|
>
|
|
|
|
|
<img class="logo" :src="styleInfo.logo_url" alt="logo" />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@@ -47,8 +51,14 @@
|
|
|
|
|
<!-- eslint-disable-next-line -->
|
|
|
|
|
<div class="questions">
|
|
|
|
|
<!-- 提前终止和正常完成 -->
|
|
|
|
|
<q-last v-if="page === pages.length + 1" :code="questionsData?.action?.code" :action="questionsData?.action"
|
|
|
|
|
:survey="questionsData?.survey" :isAnswer="isAnswer" :isTemplate="isTemplate" />
|
|
|
|
|
<q-last
|
|
|
|
|
v-if="page === pages.length + 1"
|
|
|
|
|
:code="questionsData?.action?.code"
|
|
|
|
|
:action="questionsData?.action"
|
|
|
|
|
:survey="questionsData?.survey"
|
|
|
|
|
:isAnswer="isAnswer"
|
|
|
|
|
:isTemplate="isTemplate"
|
|
|
|
|
/>
|
|
|
|
|
<!-- 问卷名和描述 -->
|
|
|
|
|
<!-- <q-first v-else-if="page === 0" isMobile :title="questionsData?.survey?.title"
|
|
|
|
|
:desc="questionsData?.survey?.introduction" :questions="questionsData?.questions" :isAnswer="isAnswer"
|
|
|
|
|
@@ -60,8 +70,13 @@
|
|
|
|
|
:questionType="question.question_type" :questionIndex="question.question_index"
|
|
|
|
|
:showTitle="styleInfo.is_question_number && true" isMobile :isAnswer="isAnswer"> -->
|
|
|
|
|
|
|
|
|
|
<div v-for="question in questions" v-else :id="'questionIndex' + question.question_index"
|
|
|
|
|
:key="question.question_index" class="question">
|
|
|
|
|
<div
|
|
|
|
|
v-for="question in questions"
|
|
|
|
|
v-else
|
|
|
|
|
:id="'questionIndex' + question.question_index"
|
|
|
|
|
:key="question.question_index"
|
|
|
|
|
class="question"
|
|
|
|
|
>
|
|
|
|
|
<!-- <q-radio-->
|
|
|
|
|
<!-- v-if="question.question_type === 1"-->
|
|
|
|
|
<!-- :list="question.list"-->
|
|
|
|
|
@@ -77,17 +92,37 @@
|
|
|
|
|
<!-- :question="question"-->
|
|
|
|
|
<!-- />-->
|
|
|
|
|
<!-- 单选题 -->
|
|
|
|
|
<preview-choice v-if="question.question_type === 1" v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)" :list="question.list"
|
|
|
|
|
:config="question.config" :hideOptions="question.hideOptions" :stem="question.stem"
|
|
|
|
|
:answerSn="questionsData.answer.sn" :answerSurveySn="questionsData.answer.survey_sn" :question="question"
|
|
|
|
|
@previous="previous" @next="next" @change-answer="onRelation($event, question)" />
|
|
|
|
|
<preview-choice
|
|
|
|
|
v-if="question.question_type === 1"
|
|
|
|
|
v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)"
|
|
|
|
|
:list="question.list"
|
|
|
|
|
:config="question.config"
|
|
|
|
|
:hideOptions="question.hideOptions"
|
|
|
|
|
:stem="question.stem"
|
|
|
|
|
:answerSn="questionsData.answer.sn"
|
|
|
|
|
:answerSurveySn="questionsData.answer.survey_sn"
|
|
|
|
|
:question="question"
|
|
|
|
|
@previous="previous"
|
|
|
|
|
@next="next"
|
|
|
|
|
@change-answer="onRelation($event, question)"
|
|
|
|
|
/>
|
|
|
|
|
<!-- 多选题 -->
|
|
|
|
|
<preview-checkbox v-else-if="question.question_type === 2" v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)" :list="question.list"
|
|
|
|
|
:config="question.config" :hideOptions="question.hideOptions" :stem="question.stem"
|
|
|
|
|
:answerSn="questionsData.answer.sn" :answerSurveySn="questionsData.answer.survey_sn" :question="question"
|
|
|
|
|
@change-answer="onRelation($event, question)" @previous="previous" @next="next" />
|
|
|
|
|
<preview-checkbox
|
|
|
|
|
v-else-if="question.question_type === 2"
|
|
|
|
|
v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)"
|
|
|
|
|
:list="question.list"
|
|
|
|
|
:config="question.config"
|
|
|
|
|
:hideOptions="question.hideOptions"
|
|
|
|
|
:stem="question.stem"
|
|
|
|
|
:answerSn="questionsData.answer.sn"
|
|
|
|
|
:answerSurveySn="questionsData.answer.survey_sn"
|
|
|
|
|
:question="question"
|
|
|
|
|
@change-answer="onRelation($event, question)"
|
|
|
|
|
@previous="previous"
|
|
|
|
|
@next="next"
|
|
|
|
|
/>
|
|
|
|
|
<!-- <!– 级联题 –>-->
|
|
|
|
|
<!-- <q-cascader-->
|
|
|
|
|
<!-- v-else-if="question.question_type === 3"-->
|
|
|
|
|
@@ -98,19 +133,43 @@
|
|
|
|
|
<!-- isMobile-->
|
|
|
|
|
<!-- />-->
|
|
|
|
|
<!-- 填空题 -->
|
|
|
|
|
<preview-completion v-else-if="question.question_type === 4" :config="question.config" :answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)" :stem="question.stem"
|
|
|
|
|
:answerSn="questionsData.answer.sn" :answerSurveySn="questionsData.answer.survey_sn" :question="question"
|
|
|
|
|
@previous="previous" @next="next" @change-answer="onRelation($event, question)" />
|
|
|
|
|
<preview-completion
|
|
|
|
|
v-else-if="question.question_type === 4"
|
|
|
|
|
:config="question.config"
|
|
|
|
|
:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)"
|
|
|
|
|
:stem="question.stem"
|
|
|
|
|
:answerSn="questionsData.answer.sn"
|
|
|
|
|
:answerSurveySn="questionsData.answer.survey_sn"
|
|
|
|
|
:question="question"
|
|
|
|
|
@previous="previous"
|
|
|
|
|
@next="next"
|
|
|
|
|
@change-answer="onRelation($event, question)"
|
|
|
|
|
/>
|
|
|
|
|
<!-- 打分题 -->
|
|
|
|
|
<preview-rate v-else-if="question.question_type === 5" v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)" :list="question.list"
|
|
|
|
|
:config="question.config" :question="question" isMobile @change-answer="onRelation($event, question)" />
|
|
|
|
|
<preview-rate
|
|
|
|
|
v-else-if="question.question_type === 5"
|
|
|
|
|
v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)"
|
|
|
|
|
:list="question.list"
|
|
|
|
|
:config="question.config"
|
|
|
|
|
:question="question"
|
|
|
|
|
isMobile
|
|
|
|
|
@change-answer="onRelation($event, question)"
|
|
|
|
|
/>
|
|
|
|
|
<!-- 图文说明题 -->
|
|
|
|
|
<preview-text-with-images :answerIndex="getQuestionIndex(questionsData.questions, question)"
|
|
|
|
|
:stem="question.stem" v-else-if="question.question_type === 6" :config="question.config" @previous="previous"
|
|
|
|
|
@next="next" v-model:answer="question.answer" :answerSn="questionsData.answer.sn"
|
|
|
|
|
:answerSurveySn="questionsData.answer.survey_sn" :question="question" />
|
|
|
|
|
<preview-text-with-images
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)"
|
|
|
|
|
:stem="question.stem"
|
|
|
|
|
v-else-if="question.question_type === 6"
|
|
|
|
|
:config="question.config"
|
|
|
|
|
@previous="previous"
|
|
|
|
|
@next="next"
|
|
|
|
|
v-model:answer="question.answer"
|
|
|
|
|
:answerSn="questionsData.answer.sn"
|
|
|
|
|
:answerSurveySn="questionsData.answer.survey_sn"
|
|
|
|
|
:question="question"
|
|
|
|
|
/>
|
|
|
|
|
<!-- <!– 日期时间题 –>-->
|
|
|
|
|
<!-- <q-date-->
|
|
|
|
|
<!-- v-else-if="question.question_type === 7"-->
|
|
|
|
|
@@ -120,20 +179,45 @@
|
|
|
|
|
<!-- isMobile-->
|
|
|
|
|
<!-- />-->
|
|
|
|
|
<!-- 矩阵填空题 -->
|
|
|
|
|
<preview-matrix-text v-else-if="question.question_type === 8" v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)" :list="question.list"
|
|
|
|
|
:questionIndex="question.question_index" :config="question.config" :stem="question.stem" :question="question"
|
|
|
|
|
@previous="previous" @next="next" @change-answer="onRelation($event, question)" />
|
|
|
|
|
<preview-matrix-text
|
|
|
|
|
v-else-if="question.question_type === 8"
|
|
|
|
|
v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)"
|
|
|
|
|
:list="question.list"
|
|
|
|
|
:questionIndex="question.question_index"
|
|
|
|
|
:config="question.config"
|
|
|
|
|
:stem="question.stem"
|
|
|
|
|
:question="question"
|
|
|
|
|
@previous="previous"
|
|
|
|
|
@next="next"
|
|
|
|
|
@change-answer="onRelation($event, question)"
|
|
|
|
|
/>
|
|
|
|
|
<!-- 矩阵单选题 -->
|
|
|
|
|
<preview-matrix-radio v-else-if="question.question_type === 9" v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)" :list="question.list"
|
|
|
|
|
:questionIndex="question.question_index" :config="question.config" :stem="question.stem"
|
|
|
|
|
:answerSn="questionsData.answer.sn" :answerSurveySn="questionsData.answer.survey_sn" :question="question"
|
|
|
|
|
@change-answer="onRelation($event, question)" @previous="previous" @next="next" />
|
|
|
|
|
<preview-matrix-radio
|
|
|
|
|
v-else-if="question.question_type === 9"
|
|
|
|
|
v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)"
|
|
|
|
|
:list="question.list"
|
|
|
|
|
:questionIndex="question.question_index"
|
|
|
|
|
:config="question.config"
|
|
|
|
|
:stem="question.stem"
|
|
|
|
|
:answerSn="questionsData.answer.sn"
|
|
|
|
|
:answerSurveySn="questionsData.answer.survey_sn"
|
|
|
|
|
:question="question"
|
|
|
|
|
@change-answer="onRelation($event, question)"
|
|
|
|
|
@previous="previous"
|
|
|
|
|
@next="next"
|
|
|
|
|
/>
|
|
|
|
|
<!-- 矩阵多选题 -->
|
|
|
|
|
<preview-matrix-checkbox v-else-if="question.question_type === 10" v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)" :list="question.list"
|
|
|
|
|
:config="question.config" :question="question" @change-answer="onRelation($event, question)" />
|
|
|
|
|
<preview-matrix-checkbox
|
|
|
|
|
v-else-if="question.question_type === 10"
|
|
|
|
|
v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)"
|
|
|
|
|
:list="question.list"
|
|
|
|
|
:config="question.config"
|
|
|
|
|
:question="question"
|
|
|
|
|
@change-answer="onRelation($event, question)"
|
|
|
|
|
/>
|
|
|
|
|
<!-- <!– 矩阵打分题 –>-->
|
|
|
|
|
<!-- <matrix-rate-->
|
|
|
|
|
<!-- v-else-if="question.question_type === 11"-->
|
|
|
|
|
@@ -201,10 +285,16 @@
|
|
|
|
|
<!-- isMobile-->
|
|
|
|
|
<!-- />-->
|
|
|
|
|
<!-- 文件上传题 -->
|
|
|
|
|
<preview-file-upload v-else-if="question.question_type === 18" v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)" :config="question.config"
|
|
|
|
|
:question="question" isMobile :questionIndex="question.question_index"
|
|
|
|
|
@change-answer="onRelation($event, question)" />
|
|
|
|
|
<preview-file-upload
|
|
|
|
|
v-else-if="question.question_type === 18"
|
|
|
|
|
v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)"
|
|
|
|
|
:config="question.config"
|
|
|
|
|
:question="question"
|
|
|
|
|
isMobile
|
|
|
|
|
:questionIndex="question.question_index"
|
|
|
|
|
@change-answer="onRelation($event, question)"
|
|
|
|
|
/>
|
|
|
|
|
<!-- <!– 地理位置题 –>-->
|
|
|
|
|
<!-- <q-map-->
|
|
|
|
|
<!-- v-else-if="question.question_type === 19"-->
|
|
|
|
|
@@ -233,9 +323,14 @@
|
|
|
|
|
<!-- isMobile-->
|
|
|
|
|
<!-- />-->
|
|
|
|
|
<!-- 签名题 -->
|
|
|
|
|
<preview-sign v-else-if="question.question_type === 22" :config="question.config" :question="question"
|
|
|
|
|
v-model:answer="question.answer" :answerIndex="getQuestionIndex(questionsData.questions, question)"
|
|
|
|
|
@change-answer="onRelation($event, question)" />
|
|
|
|
|
<preview-sign
|
|
|
|
|
v-else-if="question.question_type === 22"
|
|
|
|
|
:config="question.config"
|
|
|
|
|
:question="question"
|
|
|
|
|
v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)"
|
|
|
|
|
@change-answer="onRelation($event, question)"
|
|
|
|
|
/>
|
|
|
|
|
<!-- <!– 知情同意书 –>-->
|
|
|
|
|
<!-- <q-consent-->
|
|
|
|
|
<!-- v-else-if="question.question_type === 23"-->
|
|
|
|
|
@@ -359,12 +454,26 @@
|
|
|
|
|
<!-- :question="question"-->
|
|
|
|
|
<!-- />-->
|
|
|
|
|
<!-- <!– 高级题型-NPS –>-->
|
|
|
|
|
<preview-n-p-s v-else-if="question.question_type === 106" v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)" :isPreview="isPreview"
|
|
|
|
|
:title="question.title" :stem="question.stem" :list="question.list" :config="question.config"
|
|
|
|
|
:isAnswer="isAnswer" :questionIndex="question.question_index" :label="question.title" :loading="loading"
|
|
|
|
|
:isTemplate="isTemplate" :showTitle="styleInfo.is_question_number" :question="question" @previous="previous"
|
|
|
|
|
@next="next" @change-answer="onRelation($event, question)" />
|
|
|
|
|
<preview-n-p-s
|
|
|
|
|
v-else-if="question.question_type === 106"
|
|
|
|
|
v-model:answer="question.answer"
|
|
|
|
|
:answerIndex="getQuestionIndex(questionsData.questions, question)"
|
|
|
|
|
:isPreview="isPreview"
|
|
|
|
|
:title="question.title"
|
|
|
|
|
:stem="question.stem"
|
|
|
|
|
:list="question.list"
|
|
|
|
|
:config="question.config"
|
|
|
|
|
:isAnswer="isAnswer"
|
|
|
|
|
:questionIndex="question.question_index"
|
|
|
|
|
:label="question.title"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
:isTemplate="isTemplate"
|
|
|
|
|
:showTitle="styleInfo.is_question_number"
|
|
|
|
|
:question="question"
|
|
|
|
|
@previous="previous"
|
|
|
|
|
@next="next"
|
|
|
|
|
@change-answer="onRelation($event, question)"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- <LangTranslate v-if="isAnswer && styleInfo.is_yip" translate-key="PoweredByDigitalTechnologyCenterYIP"
|
|
|
|
|
@@ -375,14 +484,33 @@
|
|
|
|
|
</div>
|
|
|
|
|
<!-- 分页 -->
|
|
|
|
|
<!-- eslint-disable max-len -->
|
|
|
|
|
<pfe-pagination v-if="isPreview" class="pagination" :isPreview="isPreview" :page="page" :pages="pages.length + 1"
|
|
|
|
|
:min="styleInfo.is_home ? 0 : 1" :loading="loading" :showPrevious="styleInfo.is_up_button"
|
|
|
|
|
:showStart="styleInfo.is_start_button" :startText="styleInfo.start_button_text"
|
|
|
|
|
:showSubmit="styleInfo.is_submit_button" :submitText="localPageTimer.is_show && localPageTimer.short_time
|
|
|
|
|
<pfe-pagination
|
|
|
|
|
v-if="isPreview"
|
|
|
|
|
class="pagination"
|
|
|
|
|
:isPreview="isPreview"
|
|
|
|
|
:page="page"
|
|
|
|
|
:pages="pages.length + 1"
|
|
|
|
|
:min="styleInfo.is_home ? 0 : 1"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
:showPrevious="styleInfo.is_up_button"
|
|
|
|
|
:showStart="styleInfo.is_start_button"
|
|
|
|
|
:startText="styleInfo.start_button_text"
|
|
|
|
|
:showSubmit="styleInfo.is_submit_button"
|
|
|
|
|
:submitText="
|
|
|
|
|
localPageTimer.is_show && localPageTimer.short_time
|
|
|
|
|
? `${localPageTimer.short_time}S`
|
|
|
|
|
: styleInfo.submit_button_text
|
|
|
|
|
" :buttonTextColor="styleInfo.button_text_color" :buttonColor="styleInfo.button_color" :nextText="localPageTimer.is_show && localPageTimer.short_time ? `${localPageTimer.short_time}S` : ''
|
|
|
|
|
" :nextDisabled="localPageTimer.short_time" isMobile @previous="previous" @next="next">
|
|
|
|
|
"
|
|
|
|
|
:buttonTextColor="styleInfo.button_text_color"
|
|
|
|
|
:buttonColor="styleInfo.button_color"
|
|
|
|
|
:nextText="
|
|
|
|
|
localPageTimer.is_show && localPageTimer.short_time ? `${localPageTimer.short_time}S` : ''
|
|
|
|
|
"
|
|
|
|
|
:nextDisabled="localPageTimer.short_time"
|
|
|
|
|
isMobile
|
|
|
|
|
@previous="previous"
|
|
|
|
|
@next="next"
|
|
|
|
|
>
|
|
|
|
|
</pfe-pagination>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- eslint-enable max-len -->
|
|
|
|
|
@@ -444,7 +572,6 @@ questionsData.value?.questions && clearAnswer(questionsData.value.questions);
|
|
|
|
|
page.value = 1;
|
|
|
|
|
// 清空action
|
|
|
|
|
// delete questionsData.value.action;
|
|
|
|
|
console.log(`come in preview`, questionsData.value);
|
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
isTemplate: {
|
|
|
|
|
@@ -460,12 +587,11 @@ const props = defineProps({
|
|
|
|
|
// 初始化 isTemplate
|
|
|
|
|
isTemplate.value = props.isTemplate ? props.isTemplate : route.query.is_template === '1';
|
|
|
|
|
|
|
|
|
|
console.log(`now page is template? ${isTemplate.value}`);
|
|
|
|
|
// 开始更新数据
|
|
|
|
|
getQuestions();
|
|
|
|
|
|
|
|
|
|
// 更新数据
|
|
|
|
|
async function getQuestions () {
|
|
|
|
|
async function getQuestions() {
|
|
|
|
|
let { data } = await AnswerApi.getQuetions({
|
|
|
|
|
id: route.query.sn,
|
|
|
|
|
data: {
|
|
|
|
|
@@ -487,7 +613,7 @@ async function getQuestions () {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 上一页
|
|
|
|
|
async function previous () {
|
|
|
|
|
async function previous() {
|
|
|
|
|
if (prevLoading.value || loading.value) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@@ -510,7 +636,7 @@ async function previous () {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 下一页
|
|
|
|
|
async function next (callbackBeforePage) {
|
|
|
|
|
async function next(callbackBeforePage) {
|
|
|
|
|
// console.log(`click next button`, prevLoading.value || loading.value);
|
|
|
|
|
// if (prevLoading.value || loading.value) {
|
|
|
|
|
// return;
|
|
|
|
|
@@ -531,7 +657,7 @@ async function next (callbackBeforePage) {
|
|
|
|
|
|
|
|
|
|
// 开始答题
|
|
|
|
|
// 答题
|
|
|
|
|
async function answer (callback, callbackBeforePage) {
|
|
|
|
|
async function answer(callback, callbackBeforePage) {
|
|
|
|
|
if ((questions.value.length || !questionsData.value.questions.length) && !props.isTemplate) {
|
|
|
|
|
// 表单验证(当前页)
|
|
|
|
|
const errors = questions.value.filter((question) => {
|
|
|
|
|
@@ -1040,7 +1166,7 @@ async function answer (callback, callbackBeforePage) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 关联引用
|
|
|
|
|
function onRelation (
|
|
|
|
|
function onRelation(
|
|
|
|
|
// 避免出现参数 undefined 情况
|
|
|
|
|
{ options, value, list } = {},
|
|
|
|
|
{ question_type: _questionType, question_index: _questionIndex, related, answer } = {}
|
|
|
|
|
@@ -1156,7 +1282,7 @@ function onRelation (
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function jumpImmediately () {
|
|
|
|
|
function jumpImmediately() {
|
|
|
|
|
const code = questionsData.value.action?.code;
|
|
|
|
|
if (page.value !== pages.value.length + 1 && ![20004, 20011, 20016].includes(code)) {
|
|
|
|
|
return;
|
|
|
|
|
@@ -1209,7 +1335,7 @@ function jumpImmediately () {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 更新答案
|
|
|
|
|
function updateAnswer (auto) {
|
|
|
|
|
function updateAnswer(auto) {
|
|
|
|
|
if (auto) {
|
|
|
|
|
auto.forEach((autoItem) => {
|
|
|
|
|
const question = questionsData.value.questions.find(
|
|
|
|
|
@@ -1232,7 +1358,7 @@ function updateAnswer (auto) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 选项隐藏
|
|
|
|
|
function hideOptions (hide) {
|
|
|
|
|
function hideOptions(hide) {
|
|
|
|
|
const questionIndex = hide?.question_index;
|
|
|
|
|
if (questionIndex) {
|
|
|
|
|
const question = questionsData.value.questions.find(
|
|
|
|
|
@@ -1243,7 +1369,7 @@ function hideOptions (hide) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 要搜索的数组和要查找的连续数字的数量n
|
|
|
|
|
function hasNConsecutiveNumbers (arr, n, onTrue, onFalse) {
|
|
|
|
|
function hasNConsecutiveNumbers(arr, n, onTrue, onFalse) {
|
|
|
|
|
let count = 1;
|
|
|
|
|
let warnStart = 0;
|
|
|
|
|
let prevNum = arr[0];
|
|
|
|
|
@@ -1266,7 +1392,7 @@ function hasNConsecutiveNumbers (arr, n, onTrue, onFalse) {
|
|
|
|
|
|
|
|
|
|
// eslint-disable
|
|
|
|
|
// 跳转链接
|
|
|
|
|
function toUrl (url) {
|
|
|
|
|
function toUrl(url) {
|
|
|
|
|
// 创建一个新的变量来存储修改后的 URL
|
|
|
|
|
let modifiedUrl = url;
|
|
|
|
|
|
|
|
|
|
@@ -1289,7 +1415,7 @@ function toUrl (url) {
|
|
|
|
|
* 清空 answer 答案
|
|
|
|
|
* @param questions
|
|
|
|
|
*/
|
|
|
|
|
function clearAnswer (questions) {
|
|
|
|
|
function clearAnswer(questions) {
|
|
|
|
|
if (!questions) return;
|
|
|
|
|
questions.forEach((question) => {
|
|
|
|
|
if (!question.answer) return;
|
|
|
|
|
|