починил добавление и удаление ответа на задание
This commit is contained in:
parent
d57f2de2da
commit
45a4f278ca
@ -144,34 +144,34 @@ const ViewTaskModal = () => {
|
|||||||
<Panel
|
<Panel
|
||||||
key={solution.id}
|
key={solution.id}
|
||||||
header={
|
header={
|
||||||
<Flex justify="space-between" align="center">
|
<Flex justify="space-between" align="center">
|
||||||
<Text strong>Решение
|
<Text strong>Решение
|
||||||
от {new Date(solution.created_at).toLocaleString("ru-RU")}</Text>
|
от {new Date(solution.created_at).toLocaleString("ru-RU")}</Text>
|
||||||
{solution.assessment !== null ? (
|
{solution.assessment !== null ? (
|
||||||
<Tag
|
<Tag
|
||||||
color={solution.assessment >= 80 ? "green" : solution.assessment >= 60 ? "orange" : "red"}>
|
color={solution.assessment >= 80 ? "green" : solution.assessment >= 60 ? "orange" : "red"}>
|
||||||
Оценка: {solution.assessment} / 100
|
Оценка: {solution.assessment} / 100
|
||||||
</Tag>
|
</Tag>
|
||||||
) : (
|
) : (
|
||||||
<Tag color="blue">На проверке</Tag>
|
<Tag color="blue">На проверке</Tag>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={`Удалить ответ на задание?`}
|
title={`Удалить ответ на задание?`}
|
||||||
description="Это действие нельзя отменить"
|
description="Это действие нельзя отменить"
|
||||||
onConfirm={(e) => {
|
onConfirm={(e) => {
|
||||||
handleDeleSolution(solution.id)
|
handleDeleSolution(solution.id)
|
||||||
}}
|
}}
|
||||||
okText="Удалить"
|
okText="Удалить"
|
||||||
cancelText="Отмена"
|
cancelText="Отмена"
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
type="text"
|
type="text"
|
||||||
danger
|
danger
|
||||||
icon={<DeleteOutlined/>}
|
icon={<DeleteOutlined/>}
|
||||||
/>
|
/>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
</Flex>
|
</Flex>
|
||||||
}
|
}
|
||||||
extra={
|
extra={
|
||||||
solution.assessment !== null && (
|
solution.assessment !== null && (
|
||||||
@ -183,17 +183,17 @@ const ViewTaskModal = () => {
|
|||||||
>
|
>
|
||||||
<div style={{marginBottom: 16}}>
|
<div style={{marginBottom: 16}}>
|
||||||
<Text strong>Ответ:</Text>
|
<Text strong>Ответ:</Text>
|
||||||
<Paragraph
|
<div
|
||||||
style={{
|
style={{
|
||||||
background: "#f9f9f9",
|
background: "#f9f9f9",
|
||||||
padding: 12,
|
padding: 16,
|
||||||
borderRadius: 8,
|
borderRadius: 8,
|
||||||
margin: "8px 0",
|
margin: "12px 0",
|
||||||
whiteSpace: "pre-wrap",
|
border: "1px solid #f0f0f0",
|
||||||
|
minHeight: 60,
|
||||||
}}
|
}}
|
||||||
>
|
dangerouslySetInnerHTML={{__html: solution.answer_text || "<em>Текст ответа отсутствует</em>"}}
|
||||||
{solution.answer_text}
|
/>
|
||||||
</Paragraph>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{solution.files && solution.files.length > 0 ? (
|
{solution.files && solution.files.length > 0 ? (
|
||||||
|
|||||||
@ -103,7 +103,7 @@ const useViewTaskModal = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setDraftFiles([]);
|
||||||
notification.success({
|
notification.success({
|
||||||
title: "Успех",
|
title: "Успех",
|
||||||
description: "Задание успешно создано!",
|
description: "Задание успешно создано!",
|
||||||
@ -114,6 +114,7 @@ const useViewTaskModal = () => {
|
|||||||
editorRef.current.value = "";
|
editorRef.current.value = "";
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
notification.error({
|
notification.error({
|
||||||
title: "Ошибка",
|
title: "Ошибка",
|
||||||
description: error?.data?.detail || "Не удалось создать задание",
|
description: error?.data?.detail || "Не удалось создать задание",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user