|
@@ -1,5 +1,6 @@
|
|
import { useMarkStore } from "@/store";
|
|
import { useMarkStore } from "@/store";
|
|
import { getStatus } from "@/api/markPage";
|
|
import { getStatus } from "@/api/markPage";
|
|
|
|
+import { MarkStatus } from "@/types";
|
|
|
|
|
|
export default function useTaskQuestion() {
|
|
export default function useTaskQuestion() {
|
|
const markStore = useMarkStore();
|
|
const markStore = useMarkStore();
|
|
@@ -39,7 +40,7 @@ export default function useTaskQuestion() {
|
|
// 提交试题任务之后,更新试题状态信息
|
|
// 提交试题任务之后,更新试题状态信息
|
|
function updateStatusQuestionCount(data: {
|
|
function updateStatusQuestionCount(data: {
|
|
questionId: string;
|
|
questionId: string;
|
|
- leftCount: number;
|
|
|
|
|
|
+ statusData: Partial<MarkStatus>;
|
|
}) {
|
|
}) {
|
|
if (!data.questionId) return;
|
|
if (!data.questionId) return;
|
|
|
|
|
|
@@ -47,14 +48,17 @@ export default function useTaskQuestion() {
|
|
(item) => item.questionId === data.questionId
|
|
(item) => item.questionId === data.questionId
|
|
);
|
|
);
|
|
if (questionIndex < 0) return;
|
|
if (questionIndex < 0) return;
|
|
- markStore.status[questionIndex].leftCount = data.leftCount;
|
|
|
|
|
|
+ markStore.status[questionIndex] = Object.assign(
|
|
|
|
+ markStore.status[questionIndex],
|
|
|
|
+ data.statusData
|
|
|
|
+ );
|
|
}
|
|
}
|
|
|
|
|
|
async function updateQuestionStatus(questionId: string) {
|
|
async function updateQuestionStatus(questionId: string) {
|
|
const res = await getStatus(markStore.setting.questionModel, questionId);
|
|
const res = await getStatus(markStore.setting.questionModel, questionId);
|
|
updateStatusQuestionCount({
|
|
updateStatusQuestionCount({
|
|
questionId,
|
|
questionId,
|
|
- leftCount: res.data[0]?.leftCount,
|
|
|
|
|
|
+ statusData: res.data[0],
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|