|
@@ -35,52 +35,40 @@
|
|
|
<pane class="right-container">
|
|
|
<p class="border-title mb20">阅卷试卷</p>
|
|
|
<div style="overflow: hidden; width: 100%; height: 100%; flex: 1">
|
|
|
- <el-row v-loading="state.loading" class="h100 w100">
|
|
|
- <el-col>
|
|
|
- <div class="questionBox" v-if="state.questionDetail">
|
|
|
- <p class="questionTitle">题干:{{ state.questionDetail.title }}</p>
|
|
|
- <div class="questionAnswer">
|
|
|
- <div v-if="[0, 2].includes(state.questionDetail.questionType)">
|
|
|
- <el-radio-group style="display: block" v-model="state.selRadioValue">
|
|
|
- <el-form-item
|
|
|
- :label="item.label + '. '"
|
|
|
- v-for="item in state.questionDetail.practiceQuestionOptionsDtos"
|
|
|
- style="margin-bottom: 10px"
|
|
|
- >
|
|
|
- <el-radio :label="item.content" :value="item.questionOptionId" />
|
|
|
- </el-form-item>
|
|
|
- </el-radio-group>
|
|
|
- </div>
|
|
|
- <div v-else-if="state.questionDetail.questionType == 1">
|
|
|
- <el-checkbox-group v-model="state.selCheckboxValue">
|
|
|
- <el-form-item
|
|
|
- :label="item.label + '. '"
|
|
|
- v-for="item in state.questionDetail.practiceQuestionOptionsDtos"
|
|
|
- style="margin-bottom: 10px"
|
|
|
- >
|
|
|
- <el-checkbox :label="item.content" :value="item.questionOptionId" />
|
|
|
- </el-form-item>
|
|
|
- </el-checkbox-group>
|
|
|
- </div>
|
|
|
- <!-- <div v-else-if="state.questionDetail.questionType == 2"></div> -->
|
|
|
- <!-- <div v-else-if="state.questionDetail.questionType == 3">
|
|
|
- <el-form-item label="答:">
|
|
|
- <el-input type="textarea" v-model="state.answerValue" :rows="3" placeholder="请输入答案,如果有多个请依照顺序用英文 , 隔开" clearable></el-input>
|
|
|
- </el-form-item>
|
|
|
- </div>
|
|
|
- <div v-else-if="state.questionDetail.questionType == 4">
|
|
|
- <el-form-item label="答:">
|
|
|
- <el-input type="textarea" v-model="state.answerValue" :rows="3" placeholder="请输入答案" clearable></el-input>
|
|
|
- </el-form-item>
|
|
|
- </div> -->
|
|
|
+ <el-scrollbar style="height: calc(100% - 32px)" always v-loading="state.loading">
|
|
|
+ <div class="h100 w100 exam-container">
|
|
|
+ <div v-for="item in state.examList" :key="item.id" class="exam-item">
|
|
|
+ <p class="exam-item-questionName">题目:{{ item.title }}</p>
|
|
|
+ <p class="exam-item-answer">回答答案:{{ item.answer }}</p>
|
|
|
+ <el-divider></el-divider>
|
|
|
+ <p class="exam-item-referenceAnswer">参考答案:{{ item.referenceAnswer }}</p>
|
|
|
+ <div class="exam-item-score">
|
|
|
+ 分数:
|
|
|
+ <span v-if="isView">{{ item.score }}</span>
|
|
|
+ <el-input-number
|
|
|
+ v-model="item.score"
|
|
|
+ :step="1"
|
|
|
+ :precision="0"
|
|
|
+ :min="0"
|
|
|
+ :max="100"
|
|
|
+ placeholder="请填写分数"
|
|
|
+ style="width: 200px"
|
|
|
+ v-else
|
|
|
+ ></el-input-number>
|
|
|
</div>
|
|
|
+ <el-divider></el-divider>
|
|
|
</div>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ </div>
|
|
|
+ </el-scrollbar>
|
|
|
</div>
|
|
|
- <div style="text-align: center">
|
|
|
- <el-button type="primary" @click="onSave(ruleFormRef)" :loading="state.loading">保存</el-button>
|
|
|
- <el-button class="default-button" @click="onCancel" :loading="state.loading">关闭 </el-button>
|
|
|
+ <div class="flex-center-between flex-center-align">
|
|
|
+ <el-text type="danger" tag="b" class="mr20" v-if="!isView">温馨提示:保存仅保存当前用户的试卷分数</el-text>
|
|
|
+ <span v-else></span>
|
|
|
+ <div>
|
|
|
+ <el-button type="primary" @click="onSave(ruleFormRef)" :loading="state.loading" v-if="!isView">保存</el-button>
|
|
|
+ <!-- <el-button type="primary" @click="onSubmit" :loading="state.loading">提交</el-button>-->
|
|
|
+ <el-button class="default-button" @click="onCancel" :loading="state.loading">关闭 </el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</pane>
|
|
|
</splitpanes>
|
|
@@ -89,7 +77,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="examTrainExamMarkingEdit">
|
|
|
-import { onMounted, reactive, ref } from 'vue';
|
|
|
+import { computed, onMounted, reactive, ref } from 'vue';
|
|
|
import type { FormInstance } from 'element-plus';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
import mittBus from '@/utils/mitt';
|
|
@@ -100,7 +88,7 @@ import { Local } from '@/utils/storage';
|
|
|
import other from '@/utils/other';
|
|
|
import { throttle, transformFile, guid } from '@/utils/tools';
|
|
|
import { addExamManage, editExamManage, getExamManageDetail, getTestPaperQuestionCount } from '@/api/examTrain/examManage';
|
|
|
-import { getMarkingDetailByUser, getMarkingDetailUser } from '@/api/examTrain/marking';
|
|
|
+import { batchMarking, getMarkingDetailByUser, getMarkingDetailUser } from '@/api/examTrain/marking';
|
|
|
|
|
|
// 定义变量内容
|
|
|
const state = reactive<any>({
|
|
@@ -109,6 +97,7 @@ const state = reactive<any>({
|
|
|
queryParams: {},
|
|
|
userLoading: false,
|
|
|
UserId: null, // 用户ID
|
|
|
+ examList: [], // 试卷列表
|
|
|
});
|
|
|
|
|
|
const route = useRoute(); // 获取路由
|
|
@@ -139,7 +128,7 @@ const getExamManageDetailData = async () => {
|
|
|
state.loading = true;
|
|
|
try {
|
|
|
const { result } = await getMarkingDetailByUser({ ExamId: route.params.examId, UserId: state.UserId });
|
|
|
- console.log(result);
|
|
|
+ state.examList = result ?? [];
|
|
|
state.loading = false;
|
|
|
} catch (error) {
|
|
|
console.error(error);
|
|
@@ -147,62 +136,39 @@ const getExamManageDetailData = async () => {
|
|
|
}
|
|
|
};
|
|
|
// 保存提交
|
|
|
-const onSave = throttle(async (formEl: FormInstance | undefined) => {
|
|
|
- if (!formEl) return;
|
|
|
- await formEl.validate((valid: boolean) => {
|
|
|
- if (!valid) return;
|
|
|
- state.loading = true;
|
|
|
- const submitObj = other.deepClone(state.ruleForm);
|
|
|
- if (submitObj.examType == 0) {
|
|
|
- submitObj.startTime = submitObj.rangeTime[0];
|
|
|
- submitObj.endTime = submitObj.rangeTime[1];
|
|
|
- Reflect.deleteProperty(submitObj, 'rangeTime');
|
|
|
- } else if (submitObj.examType == 1) {
|
|
|
- Reflect.deleteProperty(submitObj, 'rangeTime');
|
|
|
- Reflect.deleteProperty(submitObj, 'startTime');
|
|
|
- Reflect.deleteProperty(submitObj, 'endTime');
|
|
|
- Reflect.deleteProperty(submitObj, 'count');
|
|
|
- Reflect.deleteProperty(submitObj, 'timeSpan');
|
|
|
- }
|
|
|
- if (submitObj.mode == 1) {
|
|
|
- Reflect.deleteProperty(submitObj, 'questionSort');
|
|
|
- }
|
|
|
- console.log(submitObj);
|
|
|
- if (route.params.id) {
|
|
|
- editExamManage(submitObj)
|
|
|
- .then(handleSuccess)
|
|
|
- .catch(() => {
|
|
|
- state.loading = false;
|
|
|
- });
|
|
|
- } else {
|
|
|
- // 新增
|
|
|
- addExamManage(submitObj)
|
|
|
- .then(handleSuccess)
|
|
|
- .catch(() => {
|
|
|
- state.loading = false;
|
|
|
- });
|
|
|
- }
|
|
|
+const onSave = throttle(() => {
|
|
|
+ const request = state.examList.map((item: any) => {
|
|
|
+ return {
|
|
|
+ userExamItemId: item.id,
|
|
|
+ Score: item.score,
|
|
|
+ isCheck: true,
|
|
|
+ };
|
|
|
});
|
|
|
+ batchMarking({items:request})
|
|
|
+ .then(() => {
|
|
|
+ state.loading = false;
|
|
|
+ handleSuccess();
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.error(error);
|
|
|
+ state.loading = false;
|
|
|
+ });
|
|
|
}, 300);
|
|
|
// 取消
|
|
|
const onCancel = () => {
|
|
|
- state.loading = true;
|
|
|
mittBus.emit('onCurrentContextmenuClick', Object.assign({}, { contextMenuClickId: 1, ...route }));
|
|
|
mittBus.emit('clearCache', 'examTrainExamMarking');
|
|
|
router.push({
|
|
|
path: '/examTrain/exam/marking',
|
|
|
});
|
|
|
- state.loading = false;
|
|
|
};
|
|
|
+// 是否查看
|
|
|
+const isView = computed(() => {
|
|
|
+ return route.params.isView === 'true';
|
|
|
+});
|
|
|
const handleSuccess = () => {
|
|
|
state.loading = false;
|
|
|
- ElMessage.success('操作成功');
|
|
|
- // 关闭当前 tagsView
|
|
|
- mittBus.emit('onCurrentContextmenuClick', Object.assign({}, { contextMenuClickId: 1, ...route }));
|
|
|
- mittBus.emit('clearCache', 'examTrainExamMarking');
|
|
|
- router.push({
|
|
|
- path: '/examTrain/exam/marking',
|
|
|
- });
|
|
|
+ ElMessage.success('保存成功');
|
|
|
};
|
|
|
onMounted(() => {
|
|
|
state.queryParams.ExamId = routeParams.examId;
|
|
@@ -224,4 +190,24 @@ onMounted(() => {
|
|
|
:deep(.el-tree-node__content) {
|
|
|
height: 40px;
|
|
|
}
|
|
|
+.exam-container {
|
|
|
+ .exam-item {
|
|
|
+ margin-bottom: 20px;
|
|
|
+ &-questionName {
|
|
|
+ font-size: 16px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+ &-answer {
|
|
|
+ text-indent: 1em;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+ &-referenceAnswer {
|
|
|
+ display: block;
|
|
|
+ background-color: var(--hotline-bg-color);
|
|
|
+ margin: 0 10px 10px 10px;
|
|
|
+ padding: 10px 5px;
|
|
|
+ text-indent: 1em;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|