提交 04de15b2 authored 作者: 王鹏飞's avatar 王鹏飞

feat: 添加重置考试状态功能,优化评分操作逻辑

上级 2d105ddf
...@@ -20,6 +20,11 @@ export function updateScore(data: { id: string; check_status: number; total_scor ...@@ -20,6 +20,11 @@ export function updateScore(data: { id: string; check_status: number; total_scor
return httpRequest.post('/api/lab/v1/experiment/live-student-record/score', data) return httpRequest.post('/api/lab/v1/experiment/live-student-record/score', data)
} }
// 重置考试状态(学生误触提交时,将已提交重置为未提交,允许重新作答)
export function resetStatus(data: { id: string }) {
return httpRequest.post('/api/lab/v1/experiment/live-student-record/reset-status', data)
}
// 一键发布成绩 // 一键发布成绩
export function publishAll() { export function publishAll() {
return httpRequest.post('/api/lab/v1/experiment/live-student-record/publish-all') return httpRequest.post('/api/lab/v1/experiment/live-student-record/publish-all')
......
import { getScoreList, getScoreDetail, updateScore } from '../api' import { getScoreList, getScoreDetail, updateScore, resetStatus } from '../api'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import { useChat } from '@ezijing/ai-vue' import { useChat } from '@ezijing/ai-vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
...@@ -216,10 +216,31 @@ ${JSON.stringify(outputExample, null, 2)}` ...@@ -216,10 +216,31 @@ ${JSON.stringify(outputExample, null, 2)}`
} }
} }
const handleResetScoreStatus = async (id: string) => { // 解锁评分:卡在「评分中」时恢复为已评分,数据保留
const handleUnlockScoreStatus = async (id: string) => {
await updateScore({ id, check_status: 2 }) await updateScore({ id, check_status: 2 })
ElMessage.success('重置成绩状态成功') ElMessage.success('解锁成功')
}
// 重置评分:回到暂未评分(可重新进入评分流程),数据保留
const handleResetScoreStatus = async (id: string) => {
await updateScore({ id, check_status: 0 })
ElMessage.success('重置评分成功')
} }
return { isLoading, fetchScoreList, fetchScoreDetail, handleAIScoreList, handleAIScore, handleResetScoreStatus } const handleResetExamStatus = async (id: string) => {
await resetStatus({ id })
ElMessage.success('重置考试状态成功')
}
return {
isLoading,
fetchScoreList,
fetchScoreDetail,
handleAIScoreList,
handleAIScore,
handleUnlockScoreStatus,
handleResetScoreStatus,
handleResetExamStatus,
}
} }
...@@ -7,7 +7,8 @@ import { useScore } from '../composables/useScore' ...@@ -7,7 +7,8 @@ import { useScore } from '../composables/useScore'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
const userStore = useUserStore() const userStore = useUserStore()
const { isLoading, handleAIScoreList, handleResetScoreStatus } = useScore() const { isLoading, handleAIScoreList, handleUnlockScoreStatus, handleResetScoreStatus, handleResetExamStatus } =
useScore()
const route = useRoute() const route = useRoute()
const appList = ref(null) const appList = ref(null)
...@@ -62,7 +63,7 @@ const listOptions = computed(() => { ...@@ -62,7 +63,7 @@ const listOptions = computed(() => {
}, },
{ label: '提交时间', prop: 'commit_time' }, { label: '提交时间', prop: 'commit_time' },
{ label: '批改时间', prop: 'check_time' }, { label: '批改时间', prop: 'check_time' },
{ label: '操作', slots: 'table-x', width: 120 }, { label: '操作', slots: 'table-x', width: 280 },
], ],
} }
}) })
...@@ -109,8 +110,14 @@ useIntervalFn(() => { ...@@ -109,8 +110,14 @@ useIntervalFn(() => {
<el-button text type="primary" v-if="row.check_status != '1'"> <el-button text type="primary" v-if="row.check_status != '1'">
<router-link :to="{ path: 'score/view', query: { ...$route.query, id: row.id } }">评分</router-link> <router-link :to="{ path: 'score/view', query: { ...$route.query, id: row.id } }">评分</router-link>
</el-button> </el-button>
<el-button text type="primary" @click="() => handleResetScoreStatus(row.id)" v-if="userStore.isAdmin" <el-button text type="primary" @click="() => handleUnlockScoreStatus(row.id)" v-if="userStore.isAdmin && row.check_status == '1'"
>重置</el-button >解锁</el-button
>
<el-button text type="primary" @click="() => handleResetScoreStatus(row.id)" v-if="userStore.isAdmin && row.check_status != '0'"
>重置评分</el-button
>
<el-button text type="primary" @click="() => handleResetExamStatus(row.id)" v-if="userStore.isAdmin"
>重置考试</el-button
> >
</template> </template>
</AppList> </AppList>
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论