2022-08-27 03:48:28 +03:00
|
|
|
|
import type { NextPage } from 'next'
|
|
|
|
|
import Head from 'next/head'
|
|
|
|
|
import { ErrorViewer } from '../../Components/ErrorViewer'
|
|
|
|
|
import { FileUploader } from '../../Components/FileUploader'
|
|
|
|
|
import { Header } from '../../Components/header'
|
|
|
|
|
import styles from '../../styles/Home.module.css'
|
|
|
|
|
import 'antd/dist/antd.css';
|
|
|
|
|
import { ItemSelect, SelectItemIE } from '../../Components/ItemSelect'
|
|
|
|
|
import { useState } from 'react'
|
|
|
|
|
import { host } from '../api/consts'
|
|
|
|
|
import { PulseLoader } from 'react-spinners'
|
|
|
|
|
import axios from 'axios'
|
|
|
|
|
import { useRouter } from 'next/router'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const View: NextPage = () => {
|
|
|
|
|
let router = useRouter()
|
|
|
|
|
let uuid = router.query.id as string
|
|
|
|
|
|
|
|
|
|
const [data,setData] = useState("")
|
|
|
|
|
let i = 1;
|
|
|
|
|
let cards = new Array<JSX.Element>()
|
|
|
|
|
|
|
|
|
|
const getData = () =>{
|
|
|
|
|
if (data == ""){
|
2022-08-27 12:17:39 +03:00
|
|
|
|
axios.get(host+"/api/site/docx/" + uuid).then(res => {
|
2022-08-27 03:48:28 +03:00
|
|
|
|
setData(res.data)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
setTimeout(getData, 2000);
|
|
|
|
|
if (data != ""){
|
|
|
|
|
for(var name in data as any) {
|
|
|
|
|
cards.push(
|
2022-08-28 02:18:20 +03:00
|
|
|
|
<ErrorViewer
|
|
|
|
|
num={i}
|
|
|
|
|
paragraph={(data as any)[name].texts}
|
|
|
|
|
errText={name}
|
|
|
|
|
correct={(data as any)[name].correct}
|
|
|
|
|
></ErrorViewer>
|
2022-08-27 03:48:28 +03:00
|
|
|
|
)
|
|
|
|
|
i++
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={styles.container}>
|
|
|
|
|
<Head>
|
2022-08-28 02:18:20 +03:00
|
|
|
|
<title>Вьюха</title>
|
2022-08-27 03:48:28 +03:00
|
|
|
|
<meta name="description" content="Generated by create next app" />
|
|
|
|
|
<link rel="icon" href="/favicon.ico" />
|
|
|
|
|
</Head>
|
|
|
|
|
<main className={styles.main}>
|
|
|
|
|
<Header></Header>
|
2022-08-27 12:17:39 +03:00
|
|
|
|
|
2022-08-28 02:18:20 +03:00
|
|
|
|
<div className={styles.viewer}>
|
|
|
|
|
<div className={styles.viewTools}>
|
2022-08-27 12:17:39 +03:00
|
|
|
|
<div onClick={()=>router.back()}>
|
2022-08-28 02:18:20 +03:00
|
|
|
|
<img style={{ cursor:"pointer"}}src="/images/ArrowLeft.svg"></img>
|
2022-08-27 12:17:39 +03:00
|
|
|
|
</div>
|
2022-08-28 02:18:20 +03:00
|
|
|
|
<div className={styles.viewerText}>
|
2022-08-27 12:17:39 +03:00
|
|
|
|
{localStorage.getItem(uuid)?.slice(48,localStorage.getItem(uuid)?.length)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-08-27 03:48:28 +03:00
|
|
|
|
{data == ""? <PulseLoader color={"#13377D"}></PulseLoader>:cards}
|
|
|
|
|
</div>
|
|
|
|
|
</main>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default View
|