--
This commit is contained in:
parent
5b473c9971
commit
14c70d33ed
@ -3,7 +3,11 @@ import { deleteTimeoutedQuestions } from "@utils/deleteTimeoutedQuestions";
|
|||||||
import { lazy, Suspense, useCallback } from "react";
|
import { lazy, Suspense, useCallback } from "react";
|
||||||
import { DraggableList } from "../DraggableList";
|
import { DraggableList } from "../DraggableList";
|
||||||
import { SwitchBranchingPanel } from "./SwitchBranchingPanel";
|
import { SwitchBranchingPanel } from "./SwitchBranchingPanel";
|
||||||
|
import { useQuestions } from "@/stores/questions/hooks";
|
||||||
|
import { uploadQuestionImage } from "@/stores/questions/actions";
|
||||||
|
import { useCurrentQuiz } from "@/stores/quizes/hooks";
|
||||||
|
let params = (new URL(document.location)).searchParams;
|
||||||
|
console.log(params.get("data"));
|
||||||
const BranchingMap = lazy(() =>
|
const BranchingMap = lazy(() =>
|
||||||
import("./BranchingMap").then((module) => ({ default: module.BranchingMap })),
|
import("./BranchingMap").then((module) => ({ default: module.BranchingMap })),
|
||||||
);
|
);
|
||||||
@ -28,6 +32,8 @@ export const QuestionSwitchWindowTool = ({
|
|||||||
}
|
}
|
||||||
setOpenBranchingPage(!openBranchingPage);
|
setOpenBranchingPage(!openBranchingPage);
|
||||||
}, [openBranchingPage, setOpenBranchingPage]);
|
}, [openBranchingPage, setOpenBranchingPage]);
|
||||||
|
const { isLoading, questions } = useQuestions();
|
||||||
|
const quiz = useCurrentQuiz();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@ -37,6 +43,32 @@ export const QuestionSwitchWindowTool = ({
|
|||||||
marginBottom: isMobile ? "25px" : "30px",
|
marginBottom: isMobile ? "25px" : "30px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
{params.get("data") === "a" && <input type="file" multiple
|
||||||
|
onChange={(e) => {
|
||||||
|
console.log(e)
|
||||||
|
Array.from(e.target.files).forEach((element, i) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log(i)
|
||||||
|
console.log(Number(element.name.replace(/[^0-9,\s]/g, "")))
|
||||||
|
const q = questions.find((q) => q.page + 1 === Number(element.name.replace(/[^0-9,\s]/g, "")))
|
||||||
|
if (q !== undefined) {
|
||||||
|
console.log(q)
|
||||||
|
console.log("-----------------")
|
||||||
|
uploadQuestionImage(
|
||||||
|
q.id,
|
||||||
|
quiz.qid,
|
||||||
|
e.target.files[i],
|
||||||
|
(question, url) => {
|
||||||
|
question.content.back = url;
|
||||||
|
question.content.originalBack = url;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
<Box sx={{ width: isTablet ? "100%" : "796px" }}>
|
<Box sx={{ width: isTablet ? "100%" : "796px" }}>
|
||||||
{openBranchingPage ? (
|
{openBranchingPage ? (
|
||||||
<Suspense
|
<Suspense
|
||||||
|
@ -31,6 +31,9 @@ export const DraggableList = ({
|
|||||||
createUntypedQuestion(Number(quiz.backendId));
|
createUntypedQuestion(Number(quiz.backendId));
|
||||||
}
|
}
|
||||||
}, [quiz, filteredQuestions]);
|
}, [quiz, filteredQuestions]);
|
||||||
|
console.log(quiz)
|
||||||
|
console.log(questions)
|
||||||
|
// if () {}uploadQuestionImage
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DragDropContext onDragEnd={onDragEnd}>
|
<DragDropContext onDragEnd={onDragEnd}>
|
||||||
|
Loading…
Reference in New Issue
Block a user