mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/student-h5.git
synced 2025-12-06 09:26:46 +08:00
fix:评估提交增加二次提示
This commit is contained in:
@@ -192,7 +192,7 @@
|
||||
new Date().getTime()
|
||||
"
|
||||
class="submit"
|
||||
@click="submit"
|
||||
@click="emptyValuePromp"
|
||||
:style="{ background: data.isSubmit ? '#999' : '#2478ff' }"
|
||||
>
|
||||
提交
|
||||
@@ -204,7 +204,7 @@
|
||||
>
|
||||
<div
|
||||
class="submit"
|
||||
@click="submit"
|
||||
@click="emptyValuePromp"
|
||||
:style="{ background: data.isSubmit ? '#999' : '#2478ff' }"
|
||||
>
|
||||
提交
|
||||
@@ -215,6 +215,24 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 提示用户有未填选项 -->
|
||||
<el-dialog v-model="isEmptyValue" title="" width="70%" center :show-close="false" :align-center="true">
|
||||
<div style="text-align: center;font-size:12px;"> <span style="color:black">
|
||||
您还有未完成的评估题目,您确认提交么?
|
||||
</span></div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button class="cancel"
|
||||
style="color: #387DF7; border: 1px solid #387DF7;padding: 8px 32px; border-radius: 4px;"
|
||||
@click="isEmptyValue = false">取消</el-button>
|
||||
<el-button class="back"
|
||||
style="background: #387DF7;box-shadow: 1px 2px 15px 1px rgba(56,125,247,0.34);border: 0px;padding: 8px 32px;"
|
||||
type="primary" @click="submit">
|
||||
确定
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -354,59 +372,40 @@ const centerDialogVisible = ref(false);
|
||||
const open = () => {
|
||||
centerDialogVisible.value = true;
|
||||
};
|
||||
|
||||
const isEmptyValue = ref(false);
|
||||
function emptyValuePromp() {
|
||||
if (data.value.isSubmit) {
|
||||
return;
|
||||
}
|
||||
if (data.value.singleStemVoList?.some(t=>t?.assessmentSingleChoiceVoList?.every(s => !s?.select))) {
|
||||
isEmptyValue.value = true;
|
||||
// return ElMessage.warning("您有未填写的单选评估题干");
|
||||
}
|
||||
if (data.value.multipleStemVoList?.some(t=>t?.multipleChoiceVoList?.every(s => !s?.select))) {
|
||||
isEmptyValue.value = true;
|
||||
// return ElMessage.warning("您有未填写的多选评估题干");
|
||||
}
|
||||
if (data.value.scoringQuestionVoList?.some(s => !s?.selectAnswer)) {
|
||||
isEmptyValue.value = true;
|
||||
// return ElMessage.warning("您有未填写的评分评估题干");
|
||||
}
|
||||
if (data.value.essayQuestionVoList?.some(s => !s?.content)) {
|
||||
isEmptyValue.value = true;
|
||||
// return ElMessage.warning("您有未填写的简答评估题干");
|
||||
}
|
||||
if(!isEmptyValue.value){
|
||||
submit()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function submit() {
|
||||
console.log("录入首次进入页面时间", answerTime);
|
||||
if (1 > 0) {
|
||||
console.log(data);
|
||||
console.log("我是提交的数据", {
|
||||
targetId: infoId ? infoId : 0, // 项目、路径图或开课的Id
|
||||
chapterOrStageId: chapterOrStageId ? chapterOrStageId : 0, // 关卡或者阶段Id 关卡Id不允许为空
|
||||
assessmentId: courseId,
|
||||
taskId: taskId ? taskId : 0,
|
||||
type,
|
||||
result: JSON.stringify(data.value),
|
||||
});
|
||||
}
|
||||
if (data.value.isSubmit) {
|
||||
return;
|
||||
}
|
||||
console.log("data.value", data.value);
|
||||
let list1 = data.value.assessmentEssayQuestionDtoList;
|
||||
if (list1 && list1.length > 0) {
|
||||
list1.forEach((item) => {
|
||||
if (item && !item.content) {
|
||||
return ElMessage.warning("您有未填写的评估题干");
|
||||
}
|
||||
});
|
||||
}
|
||||
let list2 = data.value.assessmentScoringQuestionDtoList;
|
||||
if (list2 && list2.length > 0) {
|
||||
list2.forEach((item) => {
|
||||
if (item && !item.selectAnswer) {
|
||||
return ElMessage.warning("您有未填写的评估题干");
|
||||
}
|
||||
});
|
||||
}
|
||||
let list3 = data.value.assessmentSingleChoiceDtoList;
|
||||
if (list3 && list3.length > 0) {
|
||||
let flag = 0;
|
||||
list3.forEach((item) => {
|
||||
flag = flag + item.select ? 1 : 0;
|
||||
});
|
||||
if (flag == 0) {
|
||||
return ElMessage.warning("您有未填写的评估题干");
|
||||
}
|
||||
}
|
||||
let list4 = data.value.assessmentMultipleChoiceDtoList;
|
||||
if (list4 && list4.length > 0) {
|
||||
let flag = 0;
|
||||
list4.forEach((item) => {
|
||||
flag = flag + item.select ? 1 : 0;
|
||||
});
|
||||
if (flag == 0) {
|
||||
return ElMessage.warning("您有未填写的评估题干");
|
||||
}
|
||||
}
|
||||
|
||||
data.value.isSubmit = !data.value.isSubmit;
|
||||
ElMessage.success("提交成功");
|
||||
@@ -419,6 +418,7 @@ function submit() {
|
||||
result: JSON.stringify(data.value),
|
||||
beginTime: answerTime,
|
||||
}).then(() => {
|
||||
isEmptyValue.value = false;
|
||||
open();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user