|
|
@@ -251,28 +251,39 @@
|
|
|
score-template="{value} 分"
|
|
|
/>
|
|
|
</div>
|
|
|
- <!-- <el-button style="background-color:#597D3B;color:white" @click="submitComment" class="submit-button"
|
|
|
- >提交评语</el-button
|
|
|
- > -->
|
|
|
- <div class="submit-next-group">
|
|
|
- <el-button
|
|
|
- style="background-color:#597D3B;color:white"
|
|
|
- @click="submitComment"
|
|
|
- class="submit-button"
|
|
|
- >
|
|
|
- 提交评语
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- style="background-color:#597D3B;color:white"
|
|
|
- class="next-button"
|
|
|
- @click="goToNextStudent"
|
|
|
- >
|
|
|
- 下一个学生
|
|
|
- </el-button>
|
|
|
- </div>
|
|
|
- <div class="engagement-stats">
|
|
|
- 已批改:{{ engagementStats.correctNumber }}
|
|
|
- 未批改:{{ engagementStats.engageNumber - engagementStats.correctNumber }}
|
|
|
+ <div class="correction-actions">
|
|
|
+ <div class="button-container">
|
|
|
+ <div class="left-buttons">
|
|
|
+ <el-button
|
|
|
+ style="background-color:#597D3B;color:white;width:200px"
|
|
|
+ @click="submitComment"
|
|
|
+ class="submit-button"
|
|
|
+ :loading="submitting"
|
|
|
+ >
|
|
|
+ 提交评语
|
|
|
+ </el-button>
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ style="background-color:#597D3B;color:white;width:200px;margin-top:50px"
|
|
|
+ @click="handleNext"
|
|
|
+ :disabled="isAllCorrected"
|
|
|
+ >
|
|
|
+ 下一个
|
|
|
+ </el-button>
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ style="background-color:#597D3B;color:white;width:200px;margin-top:50px;"
|
|
|
+ @click="goBack"
|
|
|
+ >
|
|
|
+ 返回
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 批改进度显示 -->
|
|
|
+ <div class="progress-numbers">
|
|
|
+ 已批改/未批改:{{ correctionStats.correctNumber }}/{{ uncorrectedNumber }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</div>
|
|
|
@@ -281,7 +292,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, onMounted, onBeforeUnmount, nextTick, defineProps } from "vue";
|
|
|
+import { ref, onMounted, onBeforeUnmount, nextTick, defineProps, computed } from "vue";
|
|
|
import doubaoApis from "@/apis/doubao";
|
|
|
import engagementApis from "@/apis/engagement";
|
|
|
import mediaApis from "@/apis/media";
|
|
|
@@ -339,13 +350,56 @@ const engagement = ref({
|
|
|
remark: "",
|
|
|
});
|
|
|
|
|
|
-const engagementStats = ref({
|
|
|
- correctNumber: 0,
|
|
|
+const isSuggestionLoading = ref(true);
|
|
|
+const isVideoEmotionLoading = ref(true);
|
|
|
+const submitting = ref(false);
|
|
|
+
|
|
|
+// 批改进度统计
|
|
|
+const correctionStats = ref({
|
|
|
engageNumber: 0,
|
|
|
+ correctNumber: 0
|
|
|
});
|
|
|
|
|
|
-const isSuggestionLoading = ref(true);
|
|
|
-const isVideoEmotionLoading = ref(true);
|
|
|
+// 计算批改进度百分比
|
|
|
+const progressPercentage = computed(() => {
|
|
|
+ if (correctionStats.value.engageNumber === 0) return 0;
|
|
|
+ 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 () => {
|
|
|
+ try {
|
|
|
+ const res = await engagementApis.getAssignmentCorrectionStats(props.assignmentId);
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ correctionStats.value = res.data.data;
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取批改进度失败:', error);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 获取下一个学生作业ID
|
|
|
+const getNextStudentAssignment = async () => {
|
|
|
+ try {
|
|
|
+ const res = await engagementApis.getNextStudentAssignment(props.assignmentId, props.userId);
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ return res.data.data;
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取下一个学生失败:', error);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+};
|
|
|
|
|
|
const emotionChartRef = ref(null);
|
|
|
let emotionChartInstance = null;
|
|
|
@@ -395,55 +449,35 @@ const createEmotionPieChart = (emotionList) => {
|
|
|
window.addEventListener("resize", () => emotionChartInstance.resize());
|
|
|
};
|
|
|
|
|
|
-// 跳转到下一个学生
|
|
|
-const goToNextStudent = async () => {
|
|
|
- try {
|
|
|
- // 获取下一个学生的 ID
|
|
|
- const nextStudentRes = await engagementApis.getNextStudentId(props.assignmentId, props.userId);
|
|
|
- if (nextStudentRes.data.code !== 200 || !nextStudentRes.data.data) {
|
|
|
- ElMessage.error("获取下一个学生失败");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // 获取当前作业的批改统计数据
|
|
|
- const statsRes = await engagementApis.getEngagementStats(props.assignmentId);
|
|
|
- if (statsRes.data.code !== 200 || !statsRes.data.data) {
|
|
|
- ElMessage.error("获取批改统计数据失败");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- const { engageNumber, correctNumber } = statsRes.data.data;
|
|
|
-
|
|
|
- // 判断是否已经完成所有批改
|
|
|
- if (correctNumber === engageNumber) {
|
|
|
- ElMessage.info("已全部批改完毕");
|
|
|
- router.push(`/home/myCorrect/assignment/${props.assignmentId}`);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // 如果未完成所有批改,跳转到下一个学生
|
|
|
- const nextStudentId = nextStudentRes.data.data;
|
|
|
+// 处理下一个按钮点击
|
|
|
+const handleNext = async () => {
|
|
|
+ const nextStudentId = await getNextStudentAssignment();
|
|
|
+ if (nextStudentId) {
|
|
|
router.push({
|
|
|
- path: `/home/myCorrect/assignment/${props.assignmentId}/airecord`,
|
|
|
+ path: `/home/assignment/${props.assignmentId}/airecord`,
|
|
|
query: {
|
|
|
- userId: nextStudentId,
|
|
|
- assignmentId: props.assignmentId,
|
|
|
- assignmentName: props.assignmentName || ''
|
|
|
- },
|
|
|
-});
|
|
|
- } catch (err) {
|
|
|
- console.error("跳转失败", err);
|
|
|
- ElMessage.error("获取下一个学生或批改统计数据失败");
|
|
|
+ userId: nextStudentId,
|
|
|
+ assignmentId: props.assignmentId,
|
|
|
+ assignmentName: props.assignmentName
|
|
|
+ }
|
|
|
+ }).then(() => {
|
|
|
+ window.location.reload();
|
|
|
+ });
|
|
|
+ ElMessage.success("已自动跳转到下一个学生");
|
|
|
+ } else {
|
|
|
+ ElMessage.info("没有下一个学生");
|
|
|
}
|
|
|
};
|
|
|
-// 提交评语
|
|
|
+
|
|
|
+// 修改提交评语函数,移除跳转逻辑
|
|
|
const submitComment = async () => {
|
|
|
if (!engagement.value.remark || engagement.value.score === 0) {
|
|
|
ElMessage.warning("请填写评语和评分");
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ submitting.value = true;
|
|
|
try {
|
|
|
- // 调用 API 提交评语和评分
|
|
|
const response = await engagementApis.engagementCorrect(
|
|
|
props.userId,
|
|
|
props.assignmentId,
|
|
|
@@ -454,12 +488,15 @@ const submitComment = async () => {
|
|
|
);
|
|
|
if (response.data.code === 200) {
|
|
|
ElMessage.success("评语提交成功");
|
|
|
+ await fetchCorrectionStats();
|
|
|
} else {
|
|
|
ElMessage.error("评语提交失败");
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.error("提交评语失败:", error);
|
|
|
ElMessage.error("网络错误,请重试");
|
|
|
+ } finally {
|
|
|
+ submitting.value = false;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -857,7 +894,10 @@ onBeforeUnmount(() => {
|
|
|
});
|
|
|
|
|
|
const goBack = () => {
|
|
|
- router.go(-1);
|
|
|
+ router.push({
|
|
|
+ name: 'myCorrectWithAssignmentId',
|
|
|
+ params: { assignmentId: props.assignmentId }
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const ROLE = store.user.role;
|
|
|
@@ -906,17 +946,6 @@ onMounted(async () => {
|
|
|
speakingAIDialogue.value.videoAnalysis.emotion_percentage_dict
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
- const statsRes = await engagementApis.getEngagementStats(props.assignmentId);
|
|
|
- if (statsRes.data.code === 200 && statsRes.data.data) {
|
|
|
- engagementStats.value = {
|
|
|
- correctNumber: statsRes.data.data.correctNumber,
|
|
|
- engageNumber: statsRes.data.data.engageNumber
|
|
|
- };
|
|
|
- } else {
|
|
|
- console.warn("获取批改统计失败");
|
|
|
- }
|
|
|
-
|
|
|
const engagementRes = await engagementApis.getEngagement(
|
|
|
props.userId,
|
|
|
props.assignmentId
|
|
|
@@ -926,6 +955,10 @@ onMounted(async () => {
|
|
|
score: engagementRes.data.data.score || 0,
|
|
|
remark: engagementRes.data.data.remark || "",
|
|
|
};
|
|
|
+
|
|
|
+ // 获取批改进度统计
|
|
|
+ await fetchCorrectionStats();
|
|
|
+
|
|
|
// 渲染每个对话的图表
|
|
|
nextTick(() => {
|
|
|
renderAvgScoreChart();
|
|
|
@@ -1127,8 +1160,8 @@ onMounted(async () => {
|
|
|
margin-left: 40%;
|
|
|
}
|
|
|
|
|
|
-.submit-button ,.next-button{
|
|
|
- width: 300px;
|
|
|
+.submit-button {
|
|
|
+ width: 30%;
|
|
|
margin-top: 50px;
|
|
|
}
|
|
|
|
|
|
@@ -1184,15 +1217,37 @@ onMounted(async () => {
|
|
|
margin-bottom: 30px !important;
|
|
|
}
|
|
|
|
|
|
-.submit-next-group {
|
|
|
+.correction-actions {
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
- /* gap: 20px; */
|
|
|
- margin-top: 50px;
|
|
|
+ margin-top: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.button-container {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ gap: 8px;
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+
|
|
|
+.left-buttons {
|
|
|
+ display: flex;
|
|
|
+ gap: 20px;
|
|
|
+ margin-bottom: 10px;
|
|
|
}
|
|
|
|
|
|
-.engagement-stats
|
|
|
-{
|
|
|
- margin: 0 auto;
|
|
|
+.left-buttons .el-button.is-disabled {
|
|
|
+ background-color: #a8a8a8 !important;
|
|
|
+ border-color: #a8a8a8 !important;
|
|
|
+ color: #ffffff !important;
|
|
|
+ cursor: not-allowed;
|
|
|
+}
|
|
|
+
|
|
|
+.progress-numbers {
|
|
|
+ font-size: 16px;
|
|
|
+ color: #666;
|
|
|
+ font-weight: 700;
|
|
|
+ margin-top: 10px;
|
|
|
}
|
|
|
</style>
|