мёрж и вот прям удаление удаление пробелов
This commit is contained in:
commit
8e2bde0d04
@ -17,5 +17,6 @@ export interface QuizQuestionResult extends QuizQuestionBase {
|
||||
rule: QuestionBranchingRule,
|
||||
hint: QuestionHint;
|
||||
autofill: boolean;
|
||||
redirect: string
|
||||
};
|
||||
}
|
||||
|
@ -6,15 +6,34 @@ import MegaphoneIcon from "@icons/MegaphoneIcon";
|
||||
import QuestionIcon from "@icons/QuestionIcon";
|
||||
import QuestionsMapIcon from "@icons/QuestionsMapIcon";
|
||||
|
||||
|
||||
export const quizSetupSteps = [
|
||||
{ stepperText: "Настройка стартовой страницы", sidebarText: "Стартовая страница", sidebarIcon: LayoutIcon },
|
||||
{ stepperText: "Задайте вопросы", sidebarText: "Вопросы", sidebarIcon: QuestionIcon },
|
||||
{ stepperText: "Настройте авторезультаты", sidebarText: "Результаты", sidebarIcon: ChartPieIcon },
|
||||
// { stepperText: "Оценка графа карты вопросов", sidebarText: "Карта вопросов", sidebarIcon: QuestionsMapIcon },
|
||||
{ stepperText: "Настройте форму контактов", sidebarText: "Форма контактов", sidebarIcon: ContactBookIcon },
|
||||
{ stepperText: "Установите квиз", sidebarText: "Установка квиза", sidebarIcon: FlowArrowIcon },
|
||||
// { stepperText: "Запустите рекламу", sidebarText: "Запуск рекламы", sidebarIcon: MegaphoneIcon },
|
||||
{
|
||||
stepperText: "Настройка стартовой страницы",
|
||||
sidebarText: "Стартовая страница",
|
||||
sidebarIcon: LayoutIcon,
|
||||
},
|
||||
{
|
||||
stepperText: "Задайте вопросы",
|
||||
sidebarText: "Вопросы",
|
||||
sidebarIcon: QuestionIcon,
|
||||
},
|
||||
{
|
||||
stepperText: "Настройте авторезультаты",
|
||||
sidebarText: "Результаты",
|
||||
sidebarIcon: ChartPieIcon,
|
||||
},
|
||||
// { stepperText: "Оценка графа карты вопросов", sidebarText: "Карта вопросов", sidebarIcon: QuestionsMapIcon },
|
||||
{
|
||||
stepperText: "Настройте форму контактов",
|
||||
sidebarText: "Форма контактов",
|
||||
sidebarIcon: ContactBookIcon,
|
||||
},
|
||||
{
|
||||
stepperText: "Установите квиз",
|
||||
sidebarText: "Установка квиза",
|
||||
sidebarIcon: FlowArrowIcon,
|
||||
},
|
||||
// { stepperText: "Запустите рекламу", sidebarText: "Запуск рекламы", sidebarIcon: MegaphoneIcon },
|
||||
] as const;
|
||||
|
||||
export const maxQuizSetupSteps = quizSetupSteps.length;
|
||||
@ -28,143 +47,156 @@ export type QuizType = "quiz" | "form" | null;
|
||||
export type QuizResultsType = true | null;
|
||||
|
||||
export interface QuizConfig {
|
||||
type: QuizType;
|
||||
noStartPage: boolean;
|
||||
startpageType: QuizStartpageType;
|
||||
results: QuizResultsType;
|
||||
haveRoot: string | null;
|
||||
theme: "StandardTheme" | "StandardDarkTheme" | "PinkTheme" | "PinkDarkTheme" | "BlackWhiteTheme" | "OliveTheme" | "YellowTheme" | "GoldDarkTheme" | "PurpleTheme" | "BlueTheme" | "BlueDarkTheme";
|
||||
resultInfo: {
|
||||
when: 'before' | 'after' | 'email',
|
||||
share: true | false,
|
||||
replay: true | false,
|
||||
theme: string,
|
||||
reply: string,
|
||||
replname: string,
|
||||
}
|
||||
startpage: {
|
||||
description: string;
|
||||
button: string;
|
||||
position: QuizStartpageAlignType;
|
||||
favIcon: string | null;
|
||||
logo: string | null;
|
||||
originalLogo: string | null;
|
||||
background: {
|
||||
type: null | "image" | "video";
|
||||
desktop: string | null;
|
||||
originalDesktop: string | null;
|
||||
mobile: string | null;
|
||||
originalMobile: string | null;
|
||||
video: string | null;
|
||||
cycle: boolean;
|
||||
};
|
||||
type: QuizType;
|
||||
noStartPage: boolean;
|
||||
startpageType: QuizStartpageType;
|
||||
results: QuizResultsType;
|
||||
haveRoot: string | null;
|
||||
theme:
|
||||
| "StandardTheme"
|
||||
| "StandardDarkTheme"
|
||||
| "PinkTheme"
|
||||
| "PinkDarkTheme"
|
||||
| "BlackWhiteTheme"
|
||||
| "OliveTheme"
|
||||
| "YellowTheme"
|
||||
| "GoldDarkTheme"
|
||||
| "PurpleTheme"
|
||||
| "BlueTheme"
|
||||
| "BlueDarkTheme";
|
||||
resultInfo: {
|
||||
when: "email" | "";
|
||||
share: true | false;
|
||||
replay: true | false;
|
||||
theme: string;
|
||||
reply: string;
|
||||
replname: string;
|
||||
showResultForm: "before" | "after";
|
||||
};
|
||||
startpage: {
|
||||
description: string;
|
||||
button: string;
|
||||
position: QuizStartpageAlignType;
|
||||
favIcon: string | null;
|
||||
logo: string | null;
|
||||
originalLogo: string | null;
|
||||
background: {
|
||||
type: null | "image" | "video";
|
||||
desktop: string | null;
|
||||
originalDesktop: string | null;
|
||||
mobile: string | null;
|
||||
originalMobile: string | null;
|
||||
video: string | null;
|
||||
cycle: boolean;
|
||||
};
|
||||
formContact: {
|
||||
title: string;
|
||||
desc: string;
|
||||
name: FCField;
|
||||
email: FCField;
|
||||
phone: FCField;
|
||||
text: FCField;
|
||||
address: FCField;
|
||||
button: string
|
||||
};
|
||||
info: {
|
||||
phonenumber: string;
|
||||
clickable: boolean;
|
||||
orgname: string;
|
||||
site: string;
|
||||
law?: string;
|
||||
};
|
||||
meta: string;
|
||||
};
|
||||
formContact: {
|
||||
title: string;
|
||||
desc: string;
|
||||
name: FCField;
|
||||
email: FCField;
|
||||
phone: FCField;
|
||||
text: FCField;
|
||||
address: FCField;
|
||||
button: string;
|
||||
};
|
||||
info: {
|
||||
phonenumber: string;
|
||||
clickable: boolean;
|
||||
orgname: string;
|
||||
site: string;
|
||||
law?: string;
|
||||
};
|
||||
meta: string;
|
||||
}
|
||||
|
||||
type FCField = {
|
||||
text: string
|
||||
innerText: string
|
||||
key: string
|
||||
required: boolean
|
||||
used: boolean
|
||||
}
|
||||
text: string;
|
||||
innerText: string;
|
||||
key: string;
|
||||
required: boolean;
|
||||
used: boolean;
|
||||
};
|
||||
|
||||
export const defaultQuizConfig: QuizConfig = {
|
||||
type: null,
|
||||
noStartPage: false,
|
||||
startpageType: null,
|
||||
results: null,
|
||||
haveRoot: null,
|
||||
theme: "StandardTheme",
|
||||
resultInfo: {
|
||||
when: 'after',
|
||||
share: false,
|
||||
replay: false,
|
||||
theme: "",
|
||||
reply: "",
|
||||
replname: "",
|
||||
type: null,
|
||||
noStartPage: false,
|
||||
startpageType: null,
|
||||
results: null,
|
||||
haveRoot: null,
|
||||
theme: "StandardTheme",
|
||||
resultInfo: {
|
||||
when: "",
|
||||
share: false,
|
||||
replay: false,
|
||||
theme: "",
|
||||
reply: "",
|
||||
replname: "",
|
||||
showResultForm: "after",
|
||||
},
|
||||
startpage: {
|
||||
description: "",
|
||||
button: "",
|
||||
position: "left",
|
||||
favIcon: null,
|
||||
logo: null,
|
||||
originalLogo: null,
|
||||
background: {
|
||||
type: null,
|
||||
desktop: null,
|
||||
originalDesktop: null,
|
||||
mobile: null,
|
||||
originalMobile: null,
|
||||
video: null,
|
||||
cycle: false,
|
||||
},
|
||||
startpage: {
|
||||
description: "",
|
||||
button: "",
|
||||
position: "left",
|
||||
favIcon: null,
|
||||
logo: null,
|
||||
originalLogo: null,
|
||||
background: {
|
||||
type: null,
|
||||
desktop: null,
|
||||
originalDesktop: null,
|
||||
mobile: null,
|
||||
originalMobile: null,
|
||||
video: null,
|
||||
cycle: false,
|
||||
},
|
||||
},
|
||||
info: {
|
||||
phonenumber: "",
|
||||
clickable: false,
|
||||
orgname: "",
|
||||
site: "",
|
||||
law: "",
|
||||
},
|
||||
formContact: {
|
||||
title: "",
|
||||
desc: "",
|
||||
name: {
|
||||
text: "",
|
||||
innerText: "",
|
||||
key: "",
|
||||
required: false,
|
||||
used: true,
|
||||
},
|
||||
info: {
|
||||
phonenumber: "",
|
||||
clickable: false,
|
||||
orgname: "",
|
||||
site: "",
|
||||
law: "",
|
||||
email: {
|
||||
text: "",
|
||||
innerText: "",
|
||||
key: "",
|
||||
required: false,
|
||||
used: true,
|
||||
},
|
||||
formContact: {
|
||||
title: "",
|
||||
desc: "",
|
||||
name: {
|
||||
text: "",
|
||||
innerText: "",
|
||||
key: "",
|
||||
required: false,
|
||||
used: true
|
||||
},
|
||||
email: {
|
||||
text: "",
|
||||
innerText: "",
|
||||
key: "",
|
||||
required: false,
|
||||
used: true
|
||||
},
|
||||
phone: {
|
||||
text: "",
|
||||
innerText: "",
|
||||
key: "",
|
||||
required: false,
|
||||
used: true
|
||||
},
|
||||
text: {
|
||||
text: "",
|
||||
innerText: "",
|
||||
key: "",
|
||||
required: false,
|
||||
used: false
|
||||
},
|
||||
address: {
|
||||
text: "",
|
||||
innerText: "",
|
||||
key: "",
|
||||
required: false,
|
||||
used: false
|
||||
},
|
||||
button: ""
|
||||
phone: {
|
||||
text: "",
|
||||
innerText: "",
|
||||
key: "",
|
||||
required: false,
|
||||
used: true,
|
||||
},
|
||||
meta: "",
|
||||
text: {
|
||||
text: "",
|
||||
innerText: "",
|
||||
key: "",
|
||||
required: false,
|
||||
used: false,
|
||||
},
|
||||
address: {
|
||||
text: "",
|
||||
innerText: "",
|
||||
key: "",
|
||||
required: false,
|
||||
used: false,
|
||||
},
|
||||
button: "",
|
||||
},
|
||||
meta: "",
|
||||
};
|
||||
|
@ -9,8 +9,6 @@ export type QuizType = "quiz" | "form";
|
||||
|
||||
export type QuizResultsType = true | null;
|
||||
|
||||
export type QuizResultInfoWhen = 'before' | 'after' | 'email';
|
||||
|
||||
export type FCField = {
|
||||
text: string
|
||||
innerText: string
|
||||
@ -61,12 +59,13 @@ export interface QuizConfig {
|
||||
haveRoot: string;
|
||||
theme: "StandardTheme" | "StandardDarkTheme" | "PinkTheme" | "PinkDarkTheme" | "BlackWhiteTheme" | "OliveTheme" | "YellowTheme" | "GoldDarkTheme" | "PurpleTheme" | "BlueTheme" | "BlueDarkTheme";
|
||||
resultInfo: {
|
||||
when: QuizResultInfoWhen;
|
||||
when: "email" | "";
|
||||
share: boolean;
|
||||
replay: boolean;
|
||||
theme: string;
|
||||
reply: string;
|
||||
replname: string;
|
||||
showResultForm: "before" | "after";
|
||||
};
|
||||
startpage: {
|
||||
description: string;
|
||||
|
@ -244,7 +244,7 @@ export const ContactForm = ({
|
||||
enqueueSnackbar("повторите попытку позже")
|
||||
}
|
||||
|
||||
if ((settings?.cfg.resultInfo.when === "after" || settings?.cfg.resultInfo.when === "email") && !checkEmptyData({ resultData: resultQuestion })) {
|
||||
if ((settings?.cfg.resultInfo.showResultForm === "after" || settings?.cfg.resultInfo.when === "email") && !checkEmptyData({ resultData: resultQuestion })) {
|
||||
setShowContactForm(false)
|
||||
setShowResultForm(true)
|
||||
}
|
||||
|
@ -12,6 +12,8 @@ import { NameplateLogoFQDark } from "@icons/NameplateLogoFQDark";
|
||||
import { modes } from "../../utils/themes/Publication/themePublication";
|
||||
import { checkEmptyData } from "./tools/checkEmptyData";
|
||||
|
||||
import type { QuizQuestionResult } from "@model/questionTypes/result";
|
||||
|
||||
type FooterProps = {
|
||||
setCurrentQuestion: (step: AnyTypedQuizQuestion) => void;
|
||||
question: AnyTypedQuizQuestion;
|
||||
@ -85,17 +87,12 @@ export const Footer = ({ setCurrentQuestion, question, setShowContactForm, setSh
|
||||
}
|
||||
}, [question, answers]);
|
||||
|
||||
const showResult = (nextQuestion: any) => {
|
||||
if (nextQuestion && settings?.cfg.resultInfo.when === "email") {
|
||||
setShowContactForm(true);
|
||||
return;
|
||||
}
|
||||
|
||||
const showResult = (nextQuestion: QuizQuestionResult) => {
|
||||
const isEmpty = checkEmptyData({ resultData: nextQuestion })
|
||||
console.log("isEmpty", isEmpty)
|
||||
|
||||
if (nextQuestion) {
|
||||
if (nextQuestion && settings?.cfg.resultInfo.when === "before") {
|
||||
if (nextQuestion && settings?.cfg.resultInfo.showResultForm === "before") {
|
||||
if (isEmpty) {
|
||||
setShowContactForm(true); //до+пустая = кидать на ФК
|
||||
|
||||
@ -104,7 +101,7 @@ export const Footer = ({ setCurrentQuestion, question, setShowContactForm, setSh
|
||||
|
||||
}
|
||||
}
|
||||
if (nextQuestion && (settings?.cfg.resultInfo.when === "after" || settings?.cfg.resultInfo.when === "email")) {
|
||||
if (nextQuestion && settings?.cfg.resultInfo.showResultForm === "after") {
|
||||
if (isEmpty) {
|
||||
setShowContactForm(true); //после+пустая
|
||||
|
||||
|
@ -103,7 +103,7 @@ export const Question = ({ questions }: QuestionProps) => {
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
{showResultForm && settings?.cfg.resultInfo.when === "before" && (
|
||||
{showResultForm && settings?.cfg.resultInfo.showResultForm === "before" && (
|
||||
<ResultForm
|
||||
currentQuestion={currentQuestion}
|
||||
showContactForm={showContactForm}
|
||||
@ -119,7 +119,7 @@ export const Question = ({ questions }: QuestionProps) => {
|
||||
setShowResultForm={setShowResultForm}
|
||||
/>
|
||||
)}
|
||||
{showResultForm && (settings?.cfg.resultInfo.when === "after" || settings?.cfg.resultInfo.when === "email") && (
|
||||
{showResultForm && settings?.cfg.resultInfo.showResultForm === "after" && (
|
||||
<ResultForm
|
||||
currentQuestion={currentQuestion}
|
||||
showContactForm={showContactForm}
|
||||
|
@ -1,12 +1,19 @@
|
||||
import { Box, Typography, Button, useMediaQuery, useTheme } from "@mui/material";
|
||||
import {
|
||||
Box,
|
||||
Typography,
|
||||
Button,
|
||||
useMediaQuery,
|
||||
useTheme,
|
||||
} from "@mui/material";
|
||||
|
||||
import { useQuestionsStore } from "@root/quizData/store"
|
||||
import { useQuestionsStore } from "@root/quizData/store";
|
||||
|
||||
import type { QuizQuestionResult } from "@model/questionTypes/result";
|
||||
import YoutubeEmbedIframe from "./tools/YoutubeEmbedIframe"
|
||||
import YoutubeEmbedIframe from "./tools/YoutubeEmbedIframe";
|
||||
import { NameplateLogo } from "@icons/NameplateLogo";
|
||||
import { modes } from "../../utils/themes/Publication/themePublication";
|
||||
|
||||
import type { QuizQuestionResult } from "../../model/questionTypes/result";
|
||||
|
||||
type ResultFormProps = {
|
||||
currentQuestion: any;
|
||||
showContactForm: boolean;
|
||||
@ -18,32 +25,31 @@ export const ResultForm = ({
|
||||
showContactForm,
|
||||
setShowContactForm,
|
||||
setShowResultForm,
|
||||
|
||||
}: ResultFormProps) => {
|
||||
const theme = useTheme();
|
||||
const isMobile = useMediaQuery(theme.breakpoints.down(650));
|
||||
const { settings, items } = useQuestionsStore()
|
||||
const { settings, items } = useQuestionsStore();
|
||||
const mode = modes;
|
||||
|
||||
const searchResult = () => {
|
||||
const searchResult = (): QuizQuestionResult => {
|
||||
if (Boolean(settings?.cfg.haveRoot)) {
|
||||
//ищём для ветвления
|
||||
return (items.find(
|
||||
(question) =>
|
||||
question.type === "result" &&
|
||||
question.content.rule.parentId === currentQuestion.content.id,
|
||||
question.content.rule.parentId === currentQuestion.content.id
|
||||
) ||
|
||||
items.find(
|
||||
items.find(
|
||||
(question) =>
|
||||
question.type === "result" &&
|
||||
question.content.rule.parentId === "line",
|
||||
))
|
||||
question.content.rule.parentId === "line"
|
||||
)) as QuizQuestionResult;
|
||||
} else {
|
||||
return items.find(
|
||||
(question) =>
|
||||
question.type === "result" &&
|
||||
question.content.rule.parentId === "line",
|
||||
)
|
||||
question.content.rule.parentId === "line"
|
||||
) as QuizQuestionResult;
|
||||
}
|
||||
};
|
||||
const resultQuestion = searchResult();
|
||||
@ -52,14 +58,11 @@ export const ResultForm = ({
|
||||
setShowResultForm(false);
|
||||
setShowContactForm(true);
|
||||
};
|
||||
console.log(resultQuestion)
|
||||
console.log(resultQuestion);
|
||||
if (resultQuestion === null || resultQuestion === undefined) {
|
||||
|
||||
followNextForm()
|
||||
return <></>
|
||||
|
||||
followNextForm();
|
||||
return <></>;
|
||||
} else {
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@ -70,7 +73,7 @@ export const ResultForm = ({
|
||||
height: "100vh",
|
||||
width: "100vw",
|
||||
pt: "28px",
|
||||
overflow: "auto"
|
||||
overflow: "auto",
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
@ -84,16 +87,18 @@ export const ResultForm = ({
|
||||
>
|
||||
{
|
||||
//@ts-ignore
|
||||
!resultQuestion?.content.useImage && resultQuestion.content.video && (
|
||||
<YoutubeEmbedIframe
|
||||
//@ts-ignore
|
||||
videoUrl={resultQuestion.content.video}
|
||||
containerSX={{
|
||||
width: isMobile ? "100%" : "490px",
|
||||
height: isMobile ? "100%" : "280px",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
!resultQuestion?.content.useImage &&
|
||||
resultQuestion.content.video && (
|
||||
<YoutubeEmbedIframe
|
||||
//@ts-ignore
|
||||
videoUrl={resultQuestion.content.video}
|
||||
containerSX={{
|
||||
width: isMobile ? "100%" : "490px",
|
||||
height: isMobile ? "100%" : "280px",
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
{
|
||||
//@ts-ignore
|
||||
resultQuestion?.content.useImage && resultQuestion.content.back && (
|
||||
@ -105,7 +110,8 @@ export const ResultForm = ({
|
||||
height: isMobile ? "100%" : "280px",
|
||||
}}
|
||||
></Box>
|
||||
)}
|
||||
)
|
||||
}
|
||||
{resultQuestion.description !== "" &&
|
||||
resultQuestion.description !== " " && (
|
||||
<Typography
|
||||
@ -132,20 +138,22 @@ export const ResultForm = ({
|
||||
{
|
||||
//@ts-ignore
|
||||
resultQuestion.content.text !== "" &&
|
||||
//@ts-ignore
|
||||
resultQuestion.content.text !== " " && (
|
||||
<Typography
|
||||
sx={{
|
||||
fontSize: "18px",
|
||||
m: "20px 0",
|
||||
color: theme.palette.text.primary,
|
||||
}}
|
||||
>
|
||||
{
|
||||
//@ts-ignore
|
||||
resultQuestion.content.text}
|
||||
</Typography>
|
||||
)}
|
||||
//@ts-ignore
|
||||
resultQuestion.content.text !== " " && (
|
||||
<Typography
|
||||
sx={{
|
||||
fontSize: "18px",
|
||||
m: "20px 0",
|
||||
color: theme.palette.text.primary,
|
||||
}}
|
||||
>
|
||||
{
|
||||
//@ts-ignore
|
||||
resultQuestion.content.text
|
||||
}
|
||||
</Typography>
|
||||
)
|
||||
}
|
||||
</Box>
|
||||
|
||||
<Box width="100%">
|
||||
@ -165,12 +173,12 @@ export const ResultForm = ({
|
||||
gap: "10px",
|
||||
}}
|
||||
>
|
||||
<NameplateLogo
|
||||
style={{
|
||||
fontSize: "34px",
|
||||
color: mode[settings.cfg.theme] ? "#000000" : "#F5F7FF",
|
||||
}}
|
||||
/>
|
||||
<NameplateLogo
|
||||
style={{
|
||||
fontSize: "34px",
|
||||
color: mode[settings.cfg.theme] ? "#000000" : "#F5F7FF",
|
||||
}}
|
||||
/>
|
||||
<Typography
|
||||
sx={{
|
||||
fontSize: "20px",
|
||||
@ -184,36 +192,43 @@ export const ResultForm = ({
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
{settings?.cfg.resultInfo.when === "before" && (
|
||||
<>
|
||||
<Box
|
||||
<Box
|
||||
sx={{
|
||||
boxShadow: "0 0 15px 0 rgba(0,0,0,.08)",
|
||||
width: "100%",
|
||||
flexDirection: "column",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
p: "20px",
|
||||
}}
|
||||
>
|
||||
{settings?.cfg.resultInfo.showResultForm === "before" && (
|
||||
<Button
|
||||
onClick={followNextForm}
|
||||
variant="contained"
|
||||
sx={{
|
||||
boxShadow: "0 0 15px 0 rgba(0,0,0,.08)",
|
||||
width: "100%",
|
||||
flexDirection: "column",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
p: "20px",
|
||||
p: "10px 20px",
|
||||
width: "210px",
|
||||
height: "50px",
|
||||
}}
|
||||
>
|
||||
{resultQuestion.content.hint.text || "Узнать подробнее"}
|
||||
</Button>
|
||||
)}
|
||||
{settings?.cfg.resultInfo.showResultForm === "after" &&
|
||||
resultQuestion.content.redirect && (
|
||||
<Button
|
||||
onClick={followNextForm}
|
||||
href={resultQuestion.content.redirect}
|
||||
variant="contained"
|
||||
sx={{
|
||||
p: "10px 20px",
|
||||
width: "210px",
|
||||
height: "50px",
|
||||
}}
|
||||
sx={{ p: "10px 20px", width: "210px", height: "50px" }}
|
||||
>
|
||||
{resultQuestion.content.hint.text || "Узнать подробнее"}
|
||||
{resultQuestion.content.hint.text || "Перейти на сайт"}
|
||||
</Button>
|
||||
</Box>
|
||||
</>
|
||||
)}
|
||||
)}
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -18,7 +18,7 @@ const QID =
|
||||
process.env.NODE_ENV === "production" ?
|
||||
window.location.pathname.replace(/\//g, '')
|
||||
:
|
||||
"9fafc6c9-6ccf-42b6-b400-0ee9f5f0fa16"
|
||||
"0bed8483-3016-4bca-b8e0-a72c3146f18b"
|
||||
|
||||
|
||||
export const ViewPage = () => {
|
||||
@ -33,54 +33,48 @@ export const ViewPage = () => {
|
||||
useEffect(() => {
|
||||
async function get() {
|
||||
try {
|
||||
const data = await getData(QID)
|
||||
//@ts-ignore
|
||||
let data = await getData(QID)
|
||||
|
||||
console.log(data)
|
||||
//@ts-ignore
|
||||
const settings = data.settings
|
||||
const parseData = replaceSpacesToEmptyLines({
|
||||
settings: {
|
||||
//@ts-ignore
|
||||
qid: QID,
|
||||
fp: settings.fp,
|
||||
rep: settings.rep,
|
||||
name: settings.name,
|
||||
cfg: JSON.parse(settings?.cfg),
|
||||
lim: settings.lim,
|
||||
due: settings.due,
|
||||
delay: settings.delay,
|
||||
pausable: settings.pausable
|
||||
},
|
||||
|
||||
console.log(data)
|
||||
//@ts-ignore
|
||||
data.settings = {
|
||||
//@ts-ignore
|
||||
items:
|
||||
//@ts-ignore
|
||||
data.items.map((item) => {
|
||||
const content = JSON.parse(item.c)
|
||||
return {
|
||||
description: item.desc,
|
||||
id: item.id,
|
||||
page: item.p,
|
||||
required: item.req,
|
||||
title: item.title,
|
||||
type: item.typ,
|
||||
content
|
||||
}
|
||||
}),
|
||||
qid: QID,
|
||||
fp: settings.fp,
|
||||
rep: settings.rep,
|
||||
name: settings.name,
|
||||
//@ts-ignore
|
||||
cnt: data.cnt
|
||||
})
|
||||
cfg: JSON.parse(data?.settings.cfg),
|
||||
lim: settings.lim,
|
||||
due: settings.due,
|
||||
delay: settings.delay,
|
||||
pausable: settings.pausable
|
||||
}
|
||||
console.log(data)
|
||||
//@ts-ignore
|
||||
data.items = data.items.map((item) => {
|
||||
const content = JSON.parse(item.c)
|
||||
return {
|
||||
description: item.desc,
|
||||
id: item.id,
|
||||
page: item.p,
|
||||
required: item.req,
|
||||
title: item.title,
|
||||
type: item.typ,
|
||||
content
|
||||
}
|
||||
}),
|
||||
console.log(data)
|
||||
console.log(JSON.stringify({data: data}).replaceAll(/\\\" \\\"/g, '""').replaceAll(/\" \"/g, '""'))
|
||||
console.log(JSON.parse(JSON.stringify({data: data}).replaceAll(/\\\" \\\"/g, '""').replaceAll(/\" \"/g, '""')).data)
|
||||
|
||||
data = replaceSpacesToEmptyLines(data)
|
||||
|
||||
parseData.items = parseData.items.map((question:any) => {
|
||||
let data = question
|
||||
for (let key in question) {
|
||||
if (question[key] === " ") data[key] = ""
|
||||
}
|
||||
return data
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
useQuestionsStore.setState(parseData)
|
||||
useQuestionsStore.setState(JSON.parse(JSON.stringify({data: data}).replaceAll(/\\\" \\\"/g, '""').replaceAll(/\" \"/g, '""')).data)
|
||||
|
||||
} catch (e) {
|
||||
|
||||
|
@ -31,6 +31,7 @@ export const Page = ({ currentQuestion }: PageProps) => {
|
||||
currentQuestion.content.useImage ? (
|
||||
<Box sx={{ borderRadius: "12px", border: "1px solid #9A9AAF", overflow: "hidden" }}>
|
||||
<img
|
||||
key={currentQuestion.id}
|
||||
src={currentQuestion.content.back}
|
||||
alt=""
|
||||
style={{
|
||||
|
@ -114,6 +114,7 @@ export const Variant = ({ currentQuestion }: VariantProps) => {
|
||||
{currentQuestion.content.back && currentQuestion.content.back !== " " && (
|
||||
<Box sx={{ maxWidth: "400px", width: "100%", height: "300px" }}>
|
||||
<img
|
||||
key={currentQuestion.id}
|
||||
src={currentQuestion.content.back}
|
||||
style={{ width: "100%", height: "100%", objectFit: "cover" }}
|
||||
alt=""
|
||||
|
@ -10,14 +10,13 @@ export const replaceSpacesToEmptyLines = <T = unknown>(object: T): T => {
|
||||
const result: Record<string, unknown> = {};
|
||||
|
||||
for (const [key, value] of Object.entries(object)) {
|
||||
console.log(key, value)
|
||||
if (typeof value === "string") {
|
||||
result[key] = value.replace(/\" \"/g, '""');
|
||||
// ↓ ЭТО ВРЕМЕННЫЙ КОД ДЛЯ ДЕМОНСТРАЦИИ ДИМЕ
|
||||
|
||||
result[key] = value.replace(
|
||||
"squiz.pena.digital",
|
||||
"storage.yandexcloud.net"
|
||||
);
|
||||
// ↑ ЭТО ВРЕМЕННЫЙ КОД ДЛЯ ДЕМОНСТРАЦИИ ДИМЕ
|
||||
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user