diff --git a/AES-front/src/views/user/report-submit/components/report-actions.vue b/AES-front/src/views/user/report-submit/components/report-actions.vue index db83e83..ec15f58 100644 --- a/AES-front/src/views/user/report-submit/components/report-actions.vue +++ b/AES-front/src/views/user/report-submit/components/report-actions.vue @@ -11,11 +11,14 @@ import { ref } from 'vue'; import { useRoute } from 'vue-router'; import api from '@/api/user'; import {ElMessage, ElMessageBox} from "element-plus"; +import {longRequest} from "@/utils"; const route = useRoute(); const isClicked = ref(false); const ProblemId = route.params.examId; +const isCheckingPlagiarism = ref(false); // 查重状态 + const props = defineProps({ fileUrls: Array, adminuserId: [String], @@ -89,13 +92,12 @@ const onSaveAndSubmit = async () => {//保存并提交 adminuserId }; const res = await api.submitInfoToProps(submitReport1); - // 提交成功后,调用查重函数 - await checkPlagiarism(); + + // 提交成功后,调用查重函数并后台挂起 + checkPlagiarismInBackground(); emit('clickSaveAndSubmit'); emit('refreshAttachment'); - ElMessage.success('提交成功!'); - - + ElMessage.success('提交成功!正在后台进行查重...'); } catch (error) { } @@ -130,7 +132,8 @@ const onWithdraw = () => { //撤回提交 }; // 查重函数 -const checkPlagiarism = async () => { +const checkPlagiarismInBackground = async () => { + isCheckingPlagiarism.value = true; // 开始查重,更新状态 try{ // 获取文件名 const attachment = props.attachment; @@ -142,16 +145,26 @@ const checkPlagiarism = async () => { attachment }; - // 调用查重接口 - const res = await api.runPlagiarism(submitReport); + // 调用查重接口,使用永不超时longRequest + const res = await longRequest.post('/plagiarism/runPlagiarism', submitReport); console.log('查重结果:', res); - ElMessage.success('查重成功!'); + // 查重完成,更新状态 + isCheckingPlagiarism.value = false; } catch (error) { ElMessage.error('查重过程中发生错误!'); -} + isCheckingPlagiarism.value = false; // 查重失败,也要更新状态 + } }; +// 监听查重状态变化,用于通知用户 + watch(isCheckingPlagiarism, (newValue) => { + if (!newValue) { + // 查重完成,可以在这里通知用户 + ElMessage.success('查重操作已完成!'); + } +}); +