|
|
@@ -11,31 +11,48 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="correction-actions">
|
|
|
- <div class="button-with-progress">
|
|
|
- <el-button
|
|
|
- color="#597D3B"
|
|
|
- @click="handleCorrect"
|
|
|
- v-if="!isStudent"
|
|
|
- :loading="submitting"
|
|
|
- >
|
|
|
- 提交批改
|
|
|
- </el-button>
|
|
|
-
|
|
|
- <!-- 批改进度数字显示 -->
|
|
|
- <span class="progress-numbers" v-if="!isStudent">
|
|
|
- {{ correctionStats.correctNumber }}/{{ correctionStats.engageNumber }}
|
|
|
- </span>
|
|
|
+ <div class="button-group">
|
|
|
+ <div class="left-buttons">
|
|
|
+ <el-button
|
|
|
+ color="#597D3B"
|
|
|
+ @click="handleCorrect"
|
|
|
+ v-if="!isStudent"
|
|
|
+ :loading="submitting"
|
|
|
+ >
|
|
|
+ 提交批改
|
|
|
+ </el-button>
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ color="#597D3B"
|
|
|
+ @click="handleNext"
|
|
|
+ v-if="!isStudent"
|
|
|
+ :disabled="isAllCorrected"
|
|
|
+ >
|
|
|
+ 下一个
|
|
|
+ </el-button>
|
|
|
+
|
|
|
+ <!-- 批改进度显示 -->
|
|
|
+ <span class="progress-text" v-if="!isStudent">
|
|
|
+ 已批改/未批改:{{ correctionStats.correctNumber }}/{{ uncorrectedNumber }}
|
|
|
+ </span>
|
|
|
+
|
|
|
+ <!-- 批改进度条显示 -->
|
|
|
+ <div class="correction-progress" v-if="!isStudent">
|
|
|
+ <el-progress
|
|
|
+ :percentage="progressPercentage"
|
|
|
+ :stroke-width="6"
|
|
|
+ color="#597D3B"
|
|
|
+ class="progress-bar"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="right-buttons">
|
|
|
+ <el-button color="#597D3B" @click="goBack">返回</el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
- <!-- 批改进度条显示 -->
|
|
|
- <div class="correction-progress" v-if="!isStudent">
|
|
|
- <el-progress
|
|
|
- :percentage="progressPercentage"
|
|
|
- :stroke-width="6"
|
|
|
- color="#597D3B"
|
|
|
- class="progress-bar"
|
|
|
- />
|
|
|
- </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -83,6 +100,16 @@ export default defineComponent({
|
|
|
return Math.round((correctionStats.value.correctNumber / correctionStats.value.engageNumber) * 100);
|
|
|
});
|
|
|
|
|
|
+ // 计算未批改数量
|
|
|
+ const uncorrectedNumber = computed(() => {
|
|
|
+ return correctionStats.value.engageNumber - correctionStats.value.correctNumber;
|
|
|
+ });
|
|
|
+
|
|
|
+ // 判断是否全部批改完成
|
|
|
+ const isAllCorrected = computed(() => {
|
|
|
+ return uncorrectedNumber.value === 0;
|
|
|
+ });
|
|
|
+
|
|
|
// 获取批改进度统计
|
|
|
const fetchCorrectionStats = async () => {
|
|
|
const apis = useApis();
|
|
|
@@ -118,6 +145,7 @@ export default defineComponent({
|
|
|
const getNextStudentAssignment = async () => {
|
|
|
const apis = useApis();
|
|
|
try {
|
|
|
+ console.log(props.assignmentId, props.studentId);
|
|
|
const res = await apis.getNextStudentAssignment(props.assignmentId, props.studentId);
|
|
|
if (res.data.code === 200) {
|
|
|
return res.data.data;
|
|
|
@@ -134,6 +162,15 @@ export default defineComponent({
|
|
|
});
|
|
|
|
|
|
const handleCorrect = async () => {
|
|
|
+ console.log(correction.value.score, correction.value.remark);
|
|
|
+ if (!correction.value.score) {
|
|
|
+ ElMessage.error("请先评分");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!correction.value.remark) {
|
|
|
+ ElMessage.error("请先输入评语");
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (isStudent.value) {
|
|
|
ElMessage.error("学生不能提交批改");
|
|
|
return;
|
|
|
@@ -145,29 +182,7 @@ export default defineComponent({
|
|
|
.then(async (res) => {
|
|
|
if (res.data.code === 200) {
|
|
|
ElMessage.success("批改成功");
|
|
|
-
|
|
|
- const nextStudentId = await getNextStudentAssignment();
|
|
|
await fetchCorrectionStats();
|
|
|
-
|
|
|
- if (correctionStats.value.correctNumber === correctionStats.value.engageNumber) {
|
|
|
- // 如果已批改数量等于总数量,说明批改完成
|
|
|
- router.push(`/home/myCorrect/assignment/${props.assignmentId}`);
|
|
|
- ElMessage.info("批改完成,已返回列表页");
|
|
|
- }
|
|
|
- else if (nextStudentId) {
|
|
|
- // 跳转到下一个学生的作业
|
|
|
- router.push({
|
|
|
- name: 'correct',
|
|
|
- params: { assignmentId: props.assignmentId },
|
|
|
- query: { studentId: nextStudentId }
|
|
|
- });
|
|
|
- ElMessage.success("已自动跳转到下一个学生");
|
|
|
- }
|
|
|
- // else {
|
|
|
- // // 没有下一个学生,跳转到作业列表
|
|
|
- // router.push(`/home/myCorrect/assignment/${props.assignmentId}`);
|
|
|
- // ElMessage.info("接收参数异常");
|
|
|
- // }
|
|
|
} else {
|
|
|
ElMessage.error("批改异常" + res.data.msg);
|
|
|
}
|
|
|
@@ -181,14 +196,79 @@ export default defineComponent({
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const handleNext = async () => {
|
|
|
+ if (isStudent.value) {
|
|
|
+ ElMessage.error("学生不能跳转到下一个学生");
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ const nextStudentId = await getNextStudentAssignment();
|
|
|
+ if (nextStudentId) {
|
|
|
+ router.push({
|
|
|
+ name: 'correct',
|
|
|
+ params: { assignmentId: props.assignmentId },
|
|
|
+ query: { studentId: nextStudentId }
|
|
|
+ }).then(() => {
|
|
|
+ // 强制刷新页面以重新加载数据
|
|
|
+ window.location.reload();
|
|
|
+ });
|
|
|
+ ElMessage.success("已自动跳转到下一个学生");
|
|
|
+ } else {
|
|
|
+ ElMessage.info("没有下一个学生");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const goBack = () => {
|
|
|
+ router.go(-1);
|
|
|
+ };
|
|
|
+
|
|
|
return {
|
|
|
correction,
|
|
|
handleCorrect,
|
|
|
+ handleNext,
|
|
|
isStudent,
|
|
|
submitting,
|
|
|
correctionStats,
|
|
|
- progressPercentage
|
|
|
+ progressPercentage,
|
|
|
+ uncorrectedNumber,
|
|
|
+ isAllCorrected,
|
|
|
+ goBack
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.correction-actions {
|
|
|
+ margin-top: 20px;
|
|
|
+
|
|
|
+ .button-group {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ width: 100%;
|
|
|
+
|
|
|
+ .left-buttons {
|
|
|
+ display: flex;
|
|
|
+ gap: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .progress-text {
|
|
|
+ color: #666;
|
|
|
+ font-size: 16px;
|
|
|
+ flex: 1;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .right-buttons {
|
|
|
+ display: flex;
|
|
|
+ gap: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .correction-progress {
|
|
|
+ margin-top: 10px;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|