|
|
@@ -54,7 +54,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import {defineProps, nextTick, onMounted, reactive, ref, watch, watchEffect} from 'vue'
|
|
|
+import {defineProps, nextTick, onMounted, onUnmounted, reactive, ref, watch, watchEffect} from 'vue'
|
|
|
import "./index.scss"
|
|
|
import type {engagementVO, IAssignment} from "@/types/vo";
|
|
|
import useApis from "@/apis";
|
|
|
@@ -66,6 +66,7 @@ import {useRoute} from "vue-router";
|
|
|
import {ElMessage} from "element-plus";
|
|
|
import router from "@/router";
|
|
|
import * as path from "node:path";
|
|
|
+import emitter from "@/utils/emitter";
|
|
|
|
|
|
|
|
|
interface IPreviewProps {
|
|
|
@@ -183,7 +184,9 @@ import * as path from "node:path";
|
|
|
const handleCorrectToPage = () => {
|
|
|
router.push({
|
|
|
path: `/home/assignment/${props.engagement.assignmentId}/AIEvaluation`,
|
|
|
- })
|
|
|
+ }).then(() => {
|
|
|
+ window.location.reload()
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
const openEditor = (url: string, title: string) => {
|
|
|
@@ -251,13 +254,13 @@ import * as path from "node:path";
|
|
|
// 使用节流包装 handleCorrectTip
|
|
|
const handleCorrectTip = throttle(() => {
|
|
|
if(!showCorrectBtn.value) {
|
|
|
- ElMessage.error("请更新作文内容并暂存后批改");
|
|
|
+ ElMessage.info("请更新作文内容并暂存后批改");
|
|
|
}
|
|
|
}, 2000); // 2秒的节流时间
|
|
|
|
|
|
const handleCorrectToPageTip = throttle(() => {
|
|
|
if(!showCorrectToPageBtn.value)
|
|
|
- ElMessage.error("批改后查看报告")
|
|
|
+ ElMessage.info("批改后查看报告")
|
|
|
},1000);
|
|
|
|
|
|
// 监听props变化
|
|
|
@@ -267,9 +270,21 @@ import * as path from "node:path";
|
|
|
}
|
|
|
}, { immediate: true });
|
|
|
|
|
|
+ // 监听暂存成功事件
|
|
|
+ emitter.on('stage-success', () => {
|
|
|
+ console.log('收到暂存成功事件,启用批改按钮')
|
|
|
+ // 暂存成功后,启用"开始批改"按钮
|
|
|
+ showCorrectBtn.value = true
|
|
|
+ })
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
fetchData()
|
|
|
});
|
|
|
+
|
|
|
+ onUnmounted(() => {
|
|
|
+ // 清理事件监听器
|
|
|
+ emitter.off('stage-success');
|
|
|
+ });
|
|
|
</script>
|
|
|
|
|
|
<script lang="ts">
|