@@ -1,17 +1,10 @@
|
||||
<script lang="ts" setup>
|
||||
import { atou } from "utils/functions"
|
||||
import { useMermaid } from "shared/composables/useMermaid"
|
||||
|
||||
interface EvaluationResult {
|
||||
score?: number
|
||||
grade?: string
|
||||
feedback?: string
|
||||
suggestions?: string
|
||||
criteriaDetails?: any
|
||||
}
|
||||
import { Evaluation } from "../composables/useFlowchart"
|
||||
|
||||
interface Props {
|
||||
evaluationResult: EvaluationResult | null
|
||||
evaluation: Evaluation | null
|
||||
myFlowchartZippedStr: string
|
||||
myMermaidCode: string
|
||||
}
|
||||
@@ -19,7 +12,6 @@ interface Props {
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
close: []
|
||||
loadToEditor: [data: any]
|
||||
}>()
|
||||
|
||||
@@ -47,7 +39,6 @@ async function openDetailModal() {
|
||||
|
||||
function closeModal() {
|
||||
showDetailModal.value = false
|
||||
emit("close")
|
||||
}
|
||||
|
||||
function loadToEditor() {
|
||||
@@ -69,11 +60,11 @@ function loadToEditor() {
|
||||
<!-- 评分结果显示 -->
|
||||
<n-button
|
||||
secondary
|
||||
v-if="evaluationResult"
|
||||
v-if="evaluation"
|
||||
@click="openDetailModal"
|
||||
:type="getScoreType(evaluationResult.score!)"
|
||||
:type="getScoreType(evaluation.score)"
|
||||
>
|
||||
{{ evaluationResult.score }}分 {{ evaluationResult.grade }}级
|
||||
{{ evaluation.score }}分 {{ evaluation.grade }}级
|
||||
</n-button>
|
||||
|
||||
<!-- 详情弹框 -->
|
||||
@@ -101,32 +92,32 @@ function loadToEditor() {
|
||||
</n-gi>
|
||||
<n-gi :span="2">
|
||||
<n-card
|
||||
v-if="evaluationResult?.feedback"
|
||||
v-if="evaluation?.feedback"
|
||||
size="small"
|
||||
title="AI反馈"
|
||||
style="margin-bottom: 16px"
|
||||
>
|
||||
<n-text>{{ evaluationResult.feedback }}</n-text>
|
||||
<n-text>{{ evaluation.feedback }}</n-text>
|
||||
</n-card>
|
||||
|
||||
<!-- 建议部分 -->
|
||||
<n-card
|
||||
v-if="evaluationResult?.suggestions"
|
||||
v-if="evaluation?.suggestions"
|
||||
size="small"
|
||||
title="改进建议"
|
||||
style="margin-bottom: 16px"
|
||||
>
|
||||
<n-text>{{ evaluationResult.suggestions }}</n-text>
|
||||
<n-text>{{ evaluation.suggestions }}</n-text>
|
||||
</n-card>
|
||||
|
||||
<!-- 详细评分部分 -->
|
||||
<n-card
|
||||
v-if="evaluationResult?.criteriaDetails"
|
||||
v-if="evaluation?.criteria_details"
|
||||
size="small"
|
||||
title="详细评分"
|
||||
>
|
||||
<div
|
||||
v-for="(detail, key) in evaluationResult.criteriaDetails"
|
||||
v-for="(detail, key) in evaluation.criteria_details"
|
||||
:key="key"
|
||||
style="margin-bottom: 12px"
|
||||
>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import { useBreakpoints } from "shared/composables/breakpoints"
|
||||
import { useFlowchartSubmission } from "../composables/useFlowchartSubmission"
|
||||
import { useFlowchart } from "../composables/useFlowchart"
|
||||
import FlowchartEvaluationDisplay from "./FlowchartEvaluationDisplay.vue"
|
||||
|
||||
const { isDesktop } = useBreakpoints()
|
||||
@@ -8,9 +8,9 @@ const { isDesktop } = useBreakpoints()
|
||||
// 通过inject获取FlowchartEditor组件的引用
|
||||
const flowchartEditorRef = inject<any>("flowchartEditorRef")
|
||||
|
||||
// 使用拆分后的逻辑
|
||||
// 使用合并后的逻辑
|
||||
const {
|
||||
evaluationResult,
|
||||
evaluation,
|
||||
loading,
|
||||
submissionCount,
|
||||
myFlowchartZippedStr,
|
||||
@@ -19,7 +19,7 @@ const {
|
||||
disconnect,
|
||||
checkCurrentSubmissionStatus,
|
||||
submitFlowchartData,
|
||||
} = useFlowchartSubmission()
|
||||
} = useFlowchart()
|
||||
|
||||
// 组件挂载时连接 WebSocket 并检查状态
|
||||
onMounted(() => {
|
||||
@@ -33,8 +33,8 @@ onUnmounted(() => {
|
||||
})
|
||||
|
||||
// 提交函数
|
||||
async function submit() {
|
||||
await submitFlowchartData(flowchartEditorRef)
|
||||
function submit() {
|
||||
submitFlowchartData(flowchartEditorRef)
|
||||
}
|
||||
|
||||
// 处理加载到编辑器
|
||||
@@ -64,10 +64,9 @@ function handleLoadToEditor(data: any) {
|
||||
|
||||
<!-- 评分结果显示组件 -->
|
||||
<FlowchartEvaluationDisplay
|
||||
:evaluation-result="evaluationResult"
|
||||
:evaluation="evaluation"
|
||||
:my-flowchart-zipped-str="myFlowchartZippedStr"
|
||||
:my-mermaid-code="myMermaidCode"
|
||||
@close="() => {}"
|
||||
@load-to-editor="handleLoadToEditor"
|
||||
/>
|
||||
</n-flex>
|
||||
|
||||
Reference in New Issue
Block a user