From b29590beb907e4a32654b186c374970a9b441cb1 Mon Sep 17 00:00:00 2001 From: Firesieht Date: Sat, 27 Aug 2022 17:41:59 +0300 Subject: [PATCH] add score --- Components/ErrorViewer/error.module.css | 13 +++++- Components/ErrorViewer/index.tsx | 4 +- Components/FileUploader/index.tsx | 1 - Components/ItemSelect/index.tsx | 46 +++++++-------------- Components/ItemSelect/itemSelect.module.css | 44 ++++++++++++++++++-- Components/header/header.module.css | 1 + pages/404.tsx | 38 +++++++++++++++++ pages/api/consts.ts | 2 +- pages/files.tsx | 25 ++++++++--- styles/Home.module.css | 8 ++++ 10 files changed, 135 insertions(+), 47 deletions(-) create mode 100644 pages/404.tsx diff --git a/Components/ErrorViewer/error.module.css b/Components/ErrorViewer/error.module.css index 59ee088..e643584 100644 --- a/Components/ErrorViewer/error.module.css +++ b/Components/ErrorViewer/error.module.css @@ -56,7 +56,6 @@ font-size: 14px; line-height: 22px; color: rgba(0, 0, 0, 0.45); - } .paragraphs{ @@ -74,4 +73,16 @@ .correct{ width: 110px; +} + +.circle{ + border-radius: 50%; + height: 16px; + width: 16px; +} + +.num{ + display: flex; + gap:5px; + align-items: center; } \ No newline at end of file diff --git a/Components/ErrorViewer/index.tsx b/Components/ErrorViewer/index.tsx index aa21a8a..19f8b79 100644 --- a/Components/ErrorViewer/index.tsx +++ b/Components/ErrorViewer/index.tsx @@ -14,8 +14,6 @@ interface ErrorViewerIE{ export const ErrorViewer : React.FC = (props) =>{ const [open, setOpen] = useState(false) - console.log(props.paragraph) - return(
@@ -41,7 +39,7 @@ export const ErrorViewer : React.FC = (props) =>{ { props.paragraph.map( (value, index)=>
-
№{index+1}
+
№{index+1}
{value[0]}
Score:{value[1]}
diff --git a/Components/FileUploader/index.tsx b/Components/FileUploader/index.tsx index 8c6153e..b17f1d6 100644 --- a/Components/FileUploader/index.tsx +++ b/Components/FileUploader/index.tsx @@ -20,7 +20,6 @@ export const FileUploader:React.FC = (data) =>{ onChange(info:any) { if (info.file.status !== 'uploading') { - console.log(info.file, info.fileList); } if (info.file.status === 'done') { diff --git a/Components/ItemSelect/index.tsx b/Components/ItemSelect/index.tsx index dd35944..e8ca67f 100644 --- a/Components/ItemSelect/index.tsx +++ b/Components/ItemSelect/index.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useState } from "react"; import styles from "./itemSelect.module.css" export interface SelectItemIE{ @@ -13,46 +13,30 @@ interface SelectIE{ } export const ItemSelect: React.FC = (props) =>{ + const [selected, setSelected] = useState(props.items[0]) + const [open, setOpen] = useState(false) let options = new Array() props.items.map((item:SelectItemIE)=>{ options.push( - +
onItemChange(item)}>{item.name}
) }) - - const getValue = (name:string) =>{ - let val; - props.items.map((item:SelectItemIE) => { - if (item.name == name){ - val = item.value - } - }) - return val + const onItemChange = (item:SelectItemIE) =>{ + setSelected(item) + props.onChange(item.value) } - const getName = (value:number) =>{ - let name; - props.items.map((item:SelectItemIE) => { - if (item.value == value){ - name = item.name - } - }) - return name - } - return( -
- { - props.value == undefined? - - : - - } +
: "" + } +
) } \ No newline at end of file diff --git a/Components/ItemSelect/itemSelect.module.css b/Components/ItemSelect/itemSelect.module.css index f844616..cf99b24 100644 --- a/Components/ItemSelect/itemSelect.module.css +++ b/Components/ItemSelect/itemSelect.module.css @@ -1,25 +1,61 @@ .myselect{ border: none; + width: 240px; font-size: 14px; - color: #1C85BF; + color: #1890FF; font-weight: 500; outline: none; width: inherit; } +.head{ + display: flex; + flex-direction: row; + justify-content: space-between; + padding: 10px; + cursor: pointer; + width: 240px ; +} +.options{ + display: flex; + flex-direction: column; + gap:8px +} +.option{ + display: flex; + align-items: center; + padding: 10px; + justify-content: right; + color: #0E1A33; + background: #F4F7FD; + width: 100%; + cursor: pointer; +} +.selected{ + width: 100%; + display: flex; + align-items: center; + padding: 10px; + justify-content: right; + color: #1890FF; + background: #E6F7FF; + box-shadow: inset -3px 0px 0px #1890FF; + border-right: solid 3px #1890FF; + cursor: pointer; +} @media screen and (max-width: 1300px) { .myselect{ - font-size: 18px; + font-size: 12px; } } @media screen and (max-width: 900px) { .myselect{ - font-size: 14px; + font-size: 12px; } } @media screen and (max-width: 500px) { .myselect{ - font-size: 12px; + font-size: 10px; } } \ No newline at end of file diff --git a/Components/header/header.module.css b/Components/header/header.module.css index 73aadd9..be2309a 100644 --- a/Components/header/header.module.css +++ b/Components/header/header.module.css @@ -16,6 +16,7 @@ .logo{ cursor: pointer; + user-select: none; } .itemWrapper{ display: flex; diff --git a/pages/404.tsx b/pages/404.tsx new file mode 100644 index 0000000..bf5e87d --- /dev/null +++ b/pages/404.tsx @@ -0,0 +1,38 @@ +import type { NextPage } from 'next' + +import { Header } from '../Components/header' +import styles from '../styles/Home.module.css' +import 'antd/dist/antd.css'; +import { useState } from 'react' +import { host } from './api/consts' +import { PulseLoader } from 'react-spinners' +import axios from 'axios' +import { useRouter } from 'next/router' +import Head from 'next/head'; + + + +const History: NextPage = () => { + + +let router = useRouter() + return ( +
+ + Загрузите файл + + + +
+
+
+
404 страница не найдена
+
router.push("/")}>Главная
+ +
+
+
+ ) +} + +export default History diff --git a/pages/api/consts.ts b/pages/api/consts.ts index 14f2e32..9dc0a7c 100644 --- a/pages/api/consts.ts +++ b/pages/api/consts.ts @@ -1 +1 @@ -export const host = "http://192.168.9.152:8000" \ No newline at end of file +export const host = "http://192.168.9.201:8000" \ No newline at end of file diff --git a/pages/files.tsx b/pages/files.tsx index 3e44ed1..ef86064 100644 --- a/pages/files.tsx +++ b/pages/files.tsx @@ -11,27 +11,33 @@ import { get } from './api/fetch' import { host } from './api/consts' import { PulseLoader } from 'react-spinners' import axios from 'axios' +import { Checkbox } from 'antd' const Home: NextPage = () => { - + const [correct, setCorrect] = useState(true) + const [err, setErr] = useState(true) + const [sort, setSort] = useState("alphabet") + + + let files = JSON.parse(localStorage.getItem("files") as string) - const [file, setFile] = useState(files[0].uuid) + const [file, setFile] = useState(files[0]) const [data,setData] = useState("") let i = 1; let cards = new Array() const getData = () =>{ if (data == ""){ - axios.get(host+"/api/site/docx/" + file).then(res => { + axios.get(host+"/api/site/docx/" + file.uuid).then(res => { setData(res.data) }) } } const onFileChange = (newFile:any) =>{ setData("") - axios.get(host+"/api/site/docx/" + newFile).then(res => { + axios.get(host+"/api/site/docx/" + newFile.uuid).then(res => { setData(res.data) }) setFile(newFile) @@ -40,6 +46,8 @@ const Home: NextPage = () => { setTimeout(getData, 2000); if (data != ""){ for(var name in data as any) { + if (correct == false && (data as any)[name][0]!=undefined){continue} + if (err == false && (data as any)[name][0]==undefined){continue} cards.push( { > ) i++ - } + } } let select = new Array() @@ -57,7 +65,7 @@ const Home: NextPage = () => { select.push( { name: value.file.slice(48, value.uuid.lenght), - value: value.uuid + value: value } as SelectItemIE ) }); @@ -79,6 +87,11 @@ const Home: NextPage = () => { >
+
+ + setErr(!err)}>Есть замечания + setCorrect(!correct)}>Без замечаний +
{data == ""? :cards}
diff --git a/styles/Home.module.css b/styles/Home.module.css index 4537414..89765b3 100644 --- a/styles/Home.module.css +++ b/styles/Home.module.css @@ -69,4 +69,12 @@ text-align: center; color: #13377D; cursor: pointer; +} + +.tools{ + display: flex; + flex-direction: row; + gap:25px; + justify-content: left; + } \ No newline at end of file