MinsoftK

dump 파일 제거

This diff is collapsed. Click to expand it.
1 -# Getting Started with Create React App
2 -
3 -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4 -
5 -## Available Scripts
6 -
7 -In the project directory, you can run:
8 -
9 -### `npm start`
10 -
11 -Runs the app in the development mode.\
12 -Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13 -
14 -The page will reload if you make edits.\
15 -You will also see any lint errors in the console.
16 -
17 -### `npm test`
18 -
19 -Launches the test runner in the interactive watch mode.\
20 -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21 -
22 -### `npm run build`
23 -
24 -Builds the app for production to the `build` folder.\
25 -It correctly bundles React in production mode and optimizes the build for the best performance.
26 -
27 -The build is minified and the filenames include the hashes.\
28 -Your app is ready to be deployed!
29 -
30 -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31 -
32 -### `npm run eject`
33 -
34 -**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35 -
36 -If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37 -
38 -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
39 -
40 -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
41 -
42 -## Learn More
43 -
44 -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45 -
46 -To learn React, check out the [React documentation](https://reactjs.org/).
47 -
48 -### Code Splitting
49 -
50 -This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51 -
52 -### Analyzing the Bundle Size
53 -
54 -This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55 -
56 -### Making a Progressive Web App
57 -
58 -This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59 -
60 -### Advanced Configuration
61 -
62 -This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63 -
64 -### Deployment
65 -
66 -This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67 -
68 -### `npm run build` fails to minify
69 -
70 -This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
This diff is collapsed. Click to expand it.
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
6 "@testing-library/jest-dom": "^5.11.6", 6 "@testing-library/jest-dom": "^5.11.6",
7 "@testing-library/react": "^11.2.2", 7 "@testing-library/react": "^11.2.2",
8 "@testing-library/user-event": "^12.5.0", 8 "@testing-library/user-event": "^12.5.0",
9 + "antd": "^4.9.2",
9 "react": "^17.0.1", 10 "react": "^17.0.1",
10 "react-dom": "^17.0.1", 11 "react-dom": "^17.0.1",
11 "react-scripts": "4.0.1", 12 "react-scripts": "4.0.1",
......
1 -.trigger {
2 - font-size: 18px;
3 - line-height: 64px;
4 - padding: 0 24px;
5 - cursor: pointer;
6 - transition: color 0.3s;
7 -}
8 -
9 -.trigger:hover {
10 - color: #1890ff;
11 -}
12 -
13 -.logo {
14 - height: 32px;
15 - background: rgba(255, 255, 255, 0.2);
16 - margin: 16px;
17 -}
18 -
19 -.site-layout .site-layout-background {
20 - background: #fff;
21 -}
...\ No newline at end of file ...\ No newline at end of file
1 -import React,{useState, useEffect} from 'react';
2 -import { Route, Redirect, withRouter, Switch} from 'react-router-dom';
3 -import { Home, Html, Mathcha, Tikz, Login} from './Container';
4 -import {isauth} from './Container/Login';
5 -//import {ConnectedRouter} from 'connected-react-router';
6 -
7 -
8 -const authentication = () => {}
9 -
10 -
11 -function App() {
12 - return (
13 - <div>
14 - <Switch>
15 - <Route exact path="/" component={Login}/>
16 - <Route path="/Home" component={Home}/>
17 - </Switch>
18 - </div>
19 - );
20 -}
21 -//history를 쓰는 경우는 Link
22 -export default withRouter(App);
1 -.site-layout .site-layout-background {
2 - background: #fff;
3 -}
4 -
5 -[data-theme="dark"] .site-layout .site-layout-background {
6 - background: #141414;
7 -}
8 -
9 -/*
10 -.ant-menu-item.ant-menu-item-only-child.ant-menu-item:link {
11 - background-color: red;
12 -}
13 -
14 -.ant-menu-item.ant-menu-item-only-child.ant-menu-item:visited {
15 - background-color: red;
16 -}
17 -*/
18 -.logout {
19 - position: absolute;
20 - right:15px;
21 - top:15px;
22 - text-align: center;
23 - justify-content: center;
24 -}
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
1 -import React, { useState, useEffect } from 'react';
2 -import { Modal, Upload, message, Form, InputNumber, Button , Select ,Row, Col} from 'antd';
3 -import { InboxOutlined, LockOutlined, SaveTwoTone } from '@ant-design/icons';
4 -import { saveFileAndQno } from 'lib/api/html';
5 -import { checkQno } from '../lib/api/html';
6 -
7 -const { Option} = Select;
8 -//파일 업로드
9 -//업로드 폼에서의 로직
10 -
11 -const fetchSaveData = async (data) => {
12 - try{
13 - console.log(data);
14 - const result = await saveFileAndQno(data);
15 - if(result.status===200){
16 - return result.data;
17 - }
18 - }catch(e){
19 - console.log(e);
20 - message.warn(e.message);
21 - }
22 -}
23 -
24 -const fetchCheckQno = async(qno) => {
25 - try{
26 - const result = await checkQno(qno);
27 - if(result.status===200){
28 - console.log(result);
29 - message.info("사용 가능한 문항 번호 입니다.");
30 - return true;
31 - }else{
32 - message.info("존재 하지 않는 문항 번호 입니다.");
33 - return false;
34 - }
35 - }catch(e){
36 - console.log(e);
37 - message.info("존재 하지 않는 문항 번호 입니다.");
38 - return false;
39 - }
40 -}
41 -
42 -const Html = ({ visible, onCancel, callback }) => {
43 - const [fields,setFields] =useState([]);
44 - const [qno, setQno] = useState(null);
45 - const [upload,setUpload]=useState(false);
46 - const [fileList, setFileList]=useState([]);
47 - const [qnoCheck,setQnoCheck] =useState(false);
48 -
49 -
50 - const changeNumber = (value) => {
51 - setQno(value);
52 - setFields([...fields, {name:['qno'],value:value}]);
53 - };
54 -
55 -
56 - useEffect(()=>{
57 - if(!visible){
58 - let initFields = [
59 - {name:['qno'],value:null},
60 - {name:['typeSol'],value:null},
61 - {name:['typeQue'],value:null},
62 - {name:['creator'],value:null},
63 - ];
64 - setQno(null);
65 - setFields(initFields);
66 - setFileList([]);
67 - }
68 - },[visible]);
69 -
70 - const props = {
71 - multiple:false,
72 - //data: { qno: qno },
73 - accept:'.html',
74 - onRemove: file => {
75 - const index = fileList.indexOf(file);
76 - const newFileList = fileList.slice();
77 - newFileList.splice(index, 1);
78 - return {
79 - fileList: newFileList,
80 - };
81 - },
82 -
83 - beforeUpload: file => {
84 - console.log(file);
85 - if(file.name.indexOf('.html')>0)
86 - {
87 - setFileList([file]);
88 - }else {
89 - setFileList([]);
90 - message.info("Html 형식의 파일이 아닙니다.");
91 - }
92 - return false;
93 -
94 - },
95 - };
96 -
97 - const onOk = () => {
98 - setUpload(true)
99 - };
100 -
101 -
102 - const normFile = e => {
103 - console.log('Upload event:', e);
104 - if (Array.isArray(e)) {
105 - return e;
106 - }
107 - return e && e.fileList;
108 - };
109 -
110 - const onClickQno = async(e)=>{
111 - e.preventDefault();
112 - //번호가 호출 성공시 setQnoCheck(true);
113 - if(qno){
114 - const _checkQno= await fetchCheckQno(qno);
115 - setQnoCheck(_checkQno);
116 - }
117 - };
118 -
119 - const onFinish = async values => {
120 - console.log(qnoCheck);
121 - if(!qnoCheck){
122 - message.warning("문제 번호를 확인해 주세요.")
123 - return;
124 - }else{
125 - const creator = sessionStorage.getItem('id');
126 - console.log('Received values of form: ', values);
127 - const formData = new FormData();
128 - formData.append('qno', values.qno);
129 - formData.append('typeSol', values.typeSol);
130 - formData.append('typeQue', values.typeQue);
131 - formData.append('html', values.html[0]);
132 - formData.append('creator', creator);
133 -
134 - const result = await fetchSaveData(formData);
135 - console.log(result);
136 - if(result){
137 - message.info(result.message);
138 - let initFields = [
139 - {name:['qno'],value:null},
140 - {name:['typeSol'],value:null},
141 - {name:['typeQue'],value:null},
142 - {name:['creator'],value:null},
143 - ];
144 - setQno(null);
145 - setFields(initFields);
146 - setFileList([]);
147 - onCancel();
148 - callback({status:'SAVE_OK'});
149 - }else{
150 - callback({status:'SAVE_FAIL'})
151 - }
152 - }
153 - };
154 -
155 - const onChangeTypeSol = (value) => {
156 - console.log(value);
157 - setFields([...fields, {name:['typeSol'],value:value}]);
158 - }
159 -
160 - const onChangeTypeQue = (value) => {
161 - console.log(value);
162 - setFields([...fields, {name:['typeQue'],value:value}])
163 - }
164 -
165 -
166 -
167 - const formItemLayout = {
168 - labelCol: { span: 6 },
169 - wrapperCol: { span: 14 },
170 - };
171 -
172 - return (
173 - <Modal
174 - placement={'bottom'}
175 - closable={true}
176 - height={'75%'}
177 - visible={visible}
178 - okText={'저장'}
179 - cancelText={'이전'}
180 - onCancel={onCancel}
181 - footer={null}
182 - >
183 - <Form name="validate_other"
184 - {...formItemLayout}
185 - onFinish={onFinish}
186 - fields={[{name:['html'],value:fileList},...fields]}
187 - >
188 - <Form.Item
189 - name="qno"
190 - label="문제 번호"
191 - rules={[
192 - {
193 - required: true,
194 - message: '저장할 html의 문항번호를 입력해 주세요.',
195 - },
196 - ]}>
197 - <Row>
198 - <Col>
199 - <InputNumber
200 - min={0}
201 - max={10000}
202 - value={qno}
203 - onChange={changeNumber}>
204 - </InputNumber>
205 - </Col>
206 - <Col>
207 - <Button onClick={onClickQno}>번호 확인</Button>
208 - </Col>
209 - </Row>
210 - </Form.Item>
211 - <Form.Item
212 - name="typeSol"
213 - label="문제 타입"
214 - rules={[
215 - {
216 - required: true,
217 - message: '저장할 html의 문제 타입을 선택해 주세요.',
218 - },
219 - ]}>
220 - <Select onChange={onChangeTypeSol}>
221 - <Option value="오지선다형">오지선다형</Option>
222 - <Option value="단답형">단답형</Option>
223 - <Option value="계산식">계산식</Option>
224 - </Select>
225 - </Form.Item>
226 - <Form.Item
227 - name="typeQue"
228 - label="문제/풀이 구분"
229 - rules={[
230 - {
231 - required: true,
232 - message: '저장할 html의 문제/풀이 구분을 선택해 주세요.',
233 - },
234 - ]}>
235 - <Select onChange={onChangeTypeQue}>
236 - <Option value="문제">문제</Option>
237 - <Option value="풀이">풀이</Option>
238 - </Select>
239 - </Form.Item>
240 - <Form.Item label="파일 업로드">
241 - <Form.Item
242 - name="html"
243 - valuePropName="fileList"
244 - getValueFromEvent={normFile}
245 -
246 - noStyle
247 - rules={[
248 - {
249 - required: true,
250 - message: '파일을 드래그하거나 선택해 주세요.',
251 - },
252 - ]}>
253 - <Upload.Dragger name="files" {...props} >
254 - <p className="ant-upload-drag-icon">
255 - <InboxOutlined />
256 - </p>
257 - <p className="ant-upload-text">Click or drag file to this area to upload</p>
258 - <p className="ant-upload-hint">Support for a single or bulk upload.</p>
259 - </Upload.Dragger>
260 - </Form.Item>
261 - </Form.Item>
262 -
263 - <Form.Item style={{alignContent:'middle'}} wrapperCol={{ span: 12, offset: 6 }}>
264 - <Button type="primary" htmlType="submit">
265 - 저장
266 - </Button>
267 - </Form.Item>
268 - </Form>
269 -
270 - </Modal>
271 - );
272 -};
273 -
274 -export default Html;
1 -import React,{useState} from 'react';
2 -import LoginForm from '../component/LoginForm';
3 -import { getLoginInfo } from '../lib/api/login';
4 -import {Redirect, withRouter} from "react-router-dom";
5 -
6 -const fetchLogInfo= async(data) =>{
7 - try{
8 - const result = await getLoginInfo(data);
9 - if(result.status ===200){
10 - console.log("서버 데이터와 일치: "+ result.data ); // result의 반환값 확인
11 - return true;
12 - }
13 - } catch(e){
14 - console.log(e);
15 - alert("id와 비밀번호를 확인해주세요!");
16 - return false;
17 - }
18 -}
19 -
20 -const Login = () => {
21 -
22 - const [authenticated,setAuthenticated] = useState(false);
23 - const onFinish = async (values)=> {
24 - console.log('Received values of form: ', values);
25 - const isAuth = await fetchLogInfo(values);
26 - sessionStorage.setItem("isAuth", isAuth); //세션 스토리지 저장
27 - sessionStorage.setItem("id",values.userid);
28 -
29 - setAuthenticated(isAuth);
30 - }
31 - if(authenticated){
32 - // history.push('/Home');
33 - return <Redirect to="/Home"/>
34 - }else{
35 - return <LoginForm onFinish={onFinish} >
36 - </LoginForm>
37 - }
38 -};
39 -
40 -export default withRouter(Login);
1 -.trigger {
2 - font-size: 18px;
3 - line-height: 64px;
4 - padding: 0 24px;
5 - cursor: pointer;
6 - transition: color 0.3s;
7 -}
8 -
9 -.trigger:hover {
10 - color: #1890ff;
11 -}
12 -
13 -.logo {
14 - height: 32px;
15 - background: rgba(255, 255, 255, 0.2);
16 - margin: 16px;
17 -}
18 -
19 -.site-layout .site-layout-background {
20 - background: #fff;
21 -}
22 -
23 -
24 -div.demo-editor.rdw-editor-main {
25 - border: 1px solid #f1f1f1;
26 - height: 65vh;
27 -}
...\ No newline at end of file ...\ No newline at end of file
1 -import React, { useState, useEffect, useCallback } from 'react';
2 -import { Drawer, message } from 'antd';
3 -import { UploadOutlined, RetweetOutlined } from '@ant-design/icons';
4 -import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
5 -import { getTexToSvg, checkQno, saveFileAndQno } from '../lib/api/tikz'; // Request api
6 -import TikzForm from '../component/tikzForm';
7 -
8 -
9 -
10 -const fetchTexToSvg = async (data) => {
11 - // getTexToSvg api를 이용하기 위한 const
12 - try {
13 - const result = await getTexToSvg({ tex: data });
14 - if (result.status === 200) {
15 - console.log(result.status);
16 - console.log(result.data);
17 - return result.data;
18 - }
19 - } catch (e) {
20 - console.log(e);
21 - //Notification. 추가해서 변환상태 알려주기
22 - return null;
23 - }
24 -};
25 -
26 -
27 -const fetchSaveData = async (data) => {
28 - try{
29 - const result = await saveFileAndQno(data);
30 - console.log(result);
31 - if(result.status===200){
32 - return result.data;
33 - }
34 - }catch(e){
35 - console.log(e);
36 - message.warning(e.message);
37 - }
38 - }
39 -
40 -/* 문항번호 체크 */
41 -const fetchCheckQno = async(qno) => {
42 - try{
43 - const result = await checkQno(qno);
44 - if(result.status===200){
45 - console.log(result);
46 - message.info("사용 가능한 문항 번호 입니다.");
47 - return true;
48 - }else{
49 - message.info("존재 하지 않는 문항 번호 입니다.");
50 - return false;
51 - }
52 - }catch(e){
53 - console.log(e);
54 - message.info("존재 하지 않는 문항 번호 입니다.");
55 - return false;
56 - }
57 - }
58 -
59 -
60 - const _tikzcode= "% 예시 (x축, y축, 반지름이 1cm인 원의 그림) %\n\
61 -% 오른쪽의 변환 버튼을 눌러보세요! %\n\n\
62 - \\documentclass{article}\n\
63 - \\usepackage{tikz}\n\
64 - \\begin{document}\n\n\n\
65 - \\begin{tikzpicture}\n\
66 - \\draw (-1.5,0) -- (1.5,0);\n\
67 - \\draw (0,-1.5) -- (0,1.5);\n\
68 - \\draw (0,0) circle (1cm);\n\
69 - \\end{tikzpicture}\n\n\n\
70 - \\end{document}";
71 -
72 -
73 - const Tikz = ({ onLeave, visible, callback, selectItem, mode }) => {
74 - const [fields,setFields] =useState([]);
75 - const [qno, setQno] = useState(null);
76 - const [number, setNumber] = useState(null); //문항번호를 저장하는 state
77 - const [inputText, setinputText] = useState(_tikzcode); //tikz code를 저장하는 state
78 - const [svg, setSvg] = useState(null); //변환된 svg 데이터를 저장하는 state
79 - const [qnoCheck,setQnoCheck] = useState(false);
80 - const [tikzcode,setTikzCode] = useState(_tikzcode);
81 - //svg
82 - //onclickevent : Tikz 변환하기 Button의 onClick Event
83 - //onChangeTikz : TextArea 컴포넌트의 onChange event
84 - //onFinish : Form data를 제출하기 위한 event
85 -
86 - useEffect(()=> {
87 - if(mode==='preview'&&selectItem){
88 - console.log(selectItem);
89 -
90 - let initFields = [
91 - {name:['qno'],value:selectItem.qno},
92 - {name:['typeSol'],value:selectItem.typeSol},
93 - {name:['typeQue'],value:selectItem.typeQue},
94 - {name:['creator'],value:selectItem.creator},
95 -
96 - ];
97 - setQno(selectItem.qno);
98 - setTikzCode(selectItem.tex);
99 - setFields(initFields);
100 - setSvg(null);
101 - }
102 - },[mode, selectItem]);
103 -
104 - useEffect(()=>{
105 - if(mode === 'new'){
106 - let initFields = [
107 - {name:['qno'],value:null},
108 - {name:['typeSol'],value:null},
109 - {name:['typeQue'],value:null},
110 - {name:['creator'],value:null},
111 - ];
112 - setQno(null);
113 - setTikzCode(_tikzcode);
114 - setFields(initFields);
115 - setSvg(null);
116 - }
117 - },[mode]);
118 -
119 - const onClickEvent = (e) => {
120 - if(inputText){
121 - callbackSVG(inputText);
122 - }
123 -
124 - if (inputText === null) {
125 - console.log(inputText);
126 - alert(
127 - //data에 null이 입력된 경우
128 - 'Code 값을 입력해주세요!'
129 - );
130 - } else {
131 - console.log(inputText);
132 - callbackSVG(inputText);
133 - }
134 - };
135 - const onChangeQno = (value) => {
136 - console.log(value);
137 - setQno(value);
138 - setFields([...fields, {name:['qno'],value:value}]);
139 - };
140 -/*
141 - useEffect(()=>{
142 - if(!visible ){
143 - let initFields = [
144 - {name:['qno'],value:null},
145 - {name:['typeSol'],value:null},
146 - {name:['typeQue'],value:null},
147 - {name:['creator'],value:null},
148 - ];
149 - setQno(null);
150 - setTikzCode(tikzcode);
151 - setFields(initFields);
152 - }
153 - },[visible,mode]);
154 -*/
155 - const callbackSVG = useCallback(async () => {
156 - const result = await fetchTexToSvg(inputText);
157 - setSvg(result); //api로 받아온 result를 svg state에 저장
158 - }, [inputText]);
159 -
160 - const onChangeTikz = (e) => {
161 - if (e) {
162 - setinputText(e.target.value);
163 - } else setinputText(null);
164 - };
165 -
166 - const onSaveEvent = () => {
167 - try {
168 - //서버에 저장이 확인 됐을때 200, 500(오류) http status
169 - const result = alert('전송이 성공적으로 완료됐습니다.');
170 - } catch (e) {
171 - //서버에 저장 오류가 났을때
172 - console.log(e);
173 - alert(e);
174 - }
175 - };
176 - const onClickQno = async(e)=>{
177 - e.preventDefault();
178 - //번호가 호출 성공시 setQnoCheck(true);
179 - if(qno){
180 - const _checkQno= await fetchCheckQno(qno);
181 - setQnoCheck(_checkQno);
182 - }
183 - };
184 -
185 -
186 - const onFinish = async(values) => {
187 - console.log(values);
188 - console.log(qnoCheck);
189 - if(!qnoCheck){
190 - message.warning("문제 번호를 확인해 주세요.")
191 - return;
192 - }else{
193 - const creator = sessionStorage.getItem('id');
194 - console.log('Received values of form: ', values);
195 - const result = await fetchSaveData({...values, creator});
196 - console.log(result);
197 - if(result){
198 - message.info(result.message);
199 - let initFields = [
200 - {name:['qno'],value:null},
201 - {name:['typeSol'],value:null},
202 - {name:['typeQue'],value:null},
203 - {name:['creator'],value:null},
204 - ];
205 - setFields(initFields);
206 - onLeave();
207 - callback({status:'SAVE_OK'});
208 - setQno(null);
209 - }else{
210 - callback({status:'SAVE_FAIL'})
211 - }
212 - }
213 - };
214 -
215 -
216 - const onChangeTypeSol = (value) => {
217 - console.log(value);
218 - setFields([...fields, {name:['typeSol'],value:value}]);
219 - }
220 -
221 - const onChangeTypeQue = (value) => {
222 - console.log(value);
223 - setFields([...fields, {name:['typeQue'],value:value}])
224 - }
225 -
226 - return (
227 - <Drawer
228 - title={'Tikz Editor'}
229 - placement={'bottom'}
230 - closable={true}
231 - height={'90vh'}
232 - onClose={onLeave}
233 - visible={visible}>
234 - <TikzForm
235 - svg={svg}
236 - onClickEvent={onClickEvent}
237 - onChangeTikz={onChangeTikz}
238 - onSaveEvent={onSaveEvent}
239 - onFinish={onFinish}
240 - tikzcode={tikzcode}
241 - fields={fields}
242 - onClickQno={onClickQno}
243 - onChangeQno={onChangeQno}
244 - onChangeTypeSol={onChangeTypeSol}
245 - onChangeTypeQue={onChangeTypeQue}
246 - qno={qno}>
247 - </TikzForm>
248 - </Drawer>
249 - );
250 -};
251 -
252 -export default Tikz;
253 -
254 -//<Transform value={tikzHtml}></Transform>
1 -export { default as Home } from './Home';
2 -export { default as Html } from './Html';
3 -export { default as Mathcha } from './Mathcha';
4 -export { default as Tikz } from './Tikz';
5 -export { default as Login} from './Login';
1 -import React from 'react';
2 -import { Menu, Dropdown, Button } from 'antd';
3 -//import Scroll from '../component/Slider';
4 -// 화살표 함수에서 {} 가 들어가는 경우에는 처리해야 되는 루틴이 있을때 return 값만 있을때는 () or 생략도 가능하다.
5 -//
6 -
7 -//기본적인 도형들을 그리는 도형상수
8 -const draw = () => (
9 - <Menu>
10 - <Menu.Item>
11 - <button onclick="">Triangle</button>
12 - </Menu.Item>
13 - <Menu.Item>
14 - <a
15 - target="_blank"
16 - rel="noopener noreferrer"
17 - href="http://www.taobao.com/">
18 - Rectangle
19 - </a>
20 - </Menu.Item>
21 - <Menu.Item>
22 - <a target="_blank" rel="noopener noreferrer" href="http://www.tmall.com/">
23 - pentagon
24 - </a>
25 - </Menu.Item>
26 - <Menu.Item danger>도형 디자인</Menu.Item>
27 - </Menu>
28 -);
29 -
30 -//기본적인 그래프를 그리는 그래프 상수
31 -const graph = () => (
32 - <Menu>
33 - <Menu.Item>
34 - <a
35 - target="_blank"
36 - rel="noopener noreferrer"
37 - href="http://www.alipay.com/">
38 - 2차함수
39 - </a>
40 - </Menu.Item>
41 - <Menu.Item>
42 - <a
43 - target="_blank"
44 - rel="noopener noreferrer"
45 - href="http://www.taobao.com/">
46 - 3차함수
47 - </a>
48 - </Menu.Item>
49 -
50 - <Menu.Item danger>함수 디자인</Menu.Item>
51 - </Menu>
52 -);
53 -
54 -// x축 y축을 그리게 만드는 상수
55 -const grid = () => (
56 - <Menu>
57 - <Menu.Item>
58 - <a
59 - target="_blank"
60 - rel="noopener noreferrer"
61 - href="http://www.alipay.com/">
62 - 2차원
63 - </a>
64 - </Menu.Item>
65 - <Menu.Item>
66 - <a
67 - target="_blank"
68 - rel="noopener noreferrer"
69 - href="http://www.taobao.com/">
70 - 3차원
71 - </a>
72 - </Menu.Item>
73 - <Menu.Item>
74 - <a target="_blank" rel="noopener noreferrer" href="http://www.tmall.com/">
75 - 3rd menu item
76 - </a>
77 - </Menu.Item>
78 - <Menu.Item danger>좌표축 디자인</Menu.Item>
79 - </Menu>
80 -);
81 -
82 -// 수학 공식들을 선택하는 상수
83 -const MathFunction = () => (
84 - <Menu>
85 - <Menu.Item>
86 - <a
87 - target="_blank"
88 - rel="noopener noreferrer"
89 - href="http://www.alipay.com/"></a>
90 - </Menu.Item>
91 - <Menu.Item>
92 - <a
93 - target="_blank"
94 - rel="noopener noreferrer"
95 - href="http://www.taobao.com/">
96 - 2nd menu item
97 - </a>
98 - </Menu.Item>
99 - <Menu.Item>
100 - <a target="_blank" rel="noopener noreferrer" href="http://www.tmall.com/">
101 - 3rd menu item
102 - </a>
103 - </Menu.Item>
104 - <Menu.Item danger>a danger item</Menu.Item>
105 - </Menu>
106 -);
107 -
108 -//위의 상수 값들을 집어넣어 Dropdowm 메뉴 바들을 구성해준다.
109 -const DropMenu = () => (
110 - //위의 상수 값들을 집어넣어 Dropdowm 메뉴 바들을 구성해준다. const DropMenu
111 -
112 - <div style={{ display: 'inline-block' }}>
113 - <Dropdown overlay={draw} placement="bottomLeft" arrow>
114 - <Button>Draw</Button>
115 - </Dropdown>
116 - <Button>Graph</Button>
117 -
118 - <Dropdown overlay={grid} placement="bottomRight" arrow>
119 - <Button>Grid</Button>
120 - </Dropdown>
121 - <Dropdown overlay={MathFunction} arrow>
122 - <Button>Function</Button>
123 - </Dropdown>
124 - </div>
125 -);
126 -export default DropMenu;
127 -
128 -//<Scroll> </Scroll>
...\ No newline at end of file ...\ No newline at end of file
1 -import React from 'react';
2 -import { Form, Input, Button, Checkbox, Row, Col } from 'antd';
3 -import { UserOutlined, LockOutlined } from '@ant-design/icons';
4 -import {HeartOutlined} from '@ant-design/icons';
5 -
6 -const LoginForm = ({onFinish},) => {
7 -
8 - return (
9 - <Form name="normal_login" className="login-form" initialValues={{remember: true, }} onFinish={onFinish}>
10 - <Row justify="center" style={{marginTop:'80px'}}>
11 - <HeartOutlined />
12 - </Row>
13 -
14 - <Row justify="center" style={{marginTop:'20px'}}>
15 - <Col>
16 - <Form.Item name="userid" rules={[{required: true, message: 'id를 입력해주세요.', },]}>
17 - <Input prefix={<UserOutlined className="site-form-item-icon" />} placeholder="User id" />
18 - </Form.Item>
19 - </Col>
20 - </Row>
21 -
22 - <Row justify="center" style={{marginTop:'10px'}}>
23 - <Col>
24 - <Form.Item name="userpwd" rules={[{required: true, message: '비밀번호를 입력해주세요.'},]}>
25 - <Input prefix={<LockOutlined className="site-form-item-icon" />} type="password" placeholder="Password"/>
26 - </Form.Item>
27 - </Col>
28 - </Row>
29 -
30 - <Row justify="center" style={{marginTop:'10px'}}>
31 - <Col>
32 - <Form.Item name="remember" valuePropName="checked" noStyle>
33 - <Checkbox>Remember me</Checkbox>
34 - </Form.Item>
35 - </Col>
36 - </Row>
37 -
38 - <Row justify="center" style={{marginTop:'10px'}}>
39 - <Col>
40 - <Form.Item>
41 - <Button type="primary" htmlType="submit" className="login-form-button">
42 - 로그인하기
43 - </Button>
44 - </Form.Item>
45 - </Col>
46 - </Row>
47 -
48 - </Form>
49 - );
50 -}
51 -
52 -export default LoginForm;
...\ No newline at end of file ...\ No newline at end of file
1 -import React,{Flagment} from 'react';
2 -import { Drawer, Input, Button, Menu, Form, Col, Row, AutoComplete, Tooltip, Select } from 'antd';
3 -import { UploadOutlined, RetweetOutlined } from '@ant-design/icons';
4 -import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
5 -import { PanZoom } from 'react-easy-panzoom';
6 -import { InputNumber } from 'antd';
7 -import { IFrame } from './iframe';
8 -import './tikzForm.css';
9 -const { TextArea } = Input;
10 -const {Option} = Select;
11 -
12 -const TikzForm = ({ svg, onClickEvent, onChangeTikz, onFinish, onChangeQno, onClickQno, tikzcode, fields, qno, onChangeTypeSol,onChangeTypeQue}) => {
13 - //svg
14 - //onclickevent : Tikz 변환하기 Button의 onClick Event
15 - //onChangeTikz : TextArea 컴포넌트의 onChange event
16 - //onFinish : Form data를 제출하기 위한 event
17 - //onSaveEvent : Tikz 등록하기의 버튼 event
18 -
19 -console.log(fields);
20 -
21 - return (
22 -
23 - <Form onFinish={onFinish} fields={[...fields]}>
24 -
25 -<Form.Item
26 - name="qno"
27 - label="문제 번호"
28 - rules={[
29 - {
30 - required: true,
31 - message: '문항번호를 입력해 주세요.',
32 - },
33 - ]}><Row>
34 - <Col>
35 - <InputNumber
36 - min={0}
37 - max={10000}
38 - value={qno}
39 - onChange={onChangeQno}>
40 - </InputNumber>
41 - </Col>
42 - <Col>
43 - <Button onClick={onClickQno}>번호 확인</Button>
44 - </Col>
45 - </Row>
46 - </Form.Item>
47 -
48 - <Form.Item
49 - name="typeSol"
50 - label="문제 타입"
51 - wrapperCol={{span: 2 }}
52 - rules={[
53 - {
54 - required: true,
55 - message: '문제 타입을 선택해 주세요.',
56 - },
57 - ]}>
58 - <Select onChange={onChangeTypeSol}>
59 - <Option value="오지선다형">오지선다형</Option>
60 - <Option value="단답형">단답형</Option>
61 - <Option value="계산식">계산식</Option>
62 - </Select>
63 - </Form.Item>
64 -
65 - <Form.Item
66 - name="typeQue"
67 - label="문제/풀이 구분"
68 - rules={[
69 - {
70 - required: true,
71 - message: '문제/풀이 구분을 선택해 주세요.',
72 - },
73 - ]}
74 - wrapperCol={{span: 2 }}
75 - >
76 - <Select onChange={onChangeTypeQue}>
77 - <Option value="문제">문제</Option>
78 - <Option value="풀이">풀이</Option>
79 - </Select>
80 - </Form.Item>
81 -
82 -
83 -
84 - <Row justify="space-between" align="middle">
85 - <Col span={11}>
86 - <Form.Item name="tikzCode" rules={[{ required: true, message: 'tikz 코드를 입력해 주세요.' }]} initialValue={tikzcode}>
87 - <TextArea
88 - style={{ width: '44vw', height: '70vh' }}
89 - onChange={onChangeTikz}
90 - />
91 - </Form.Item>
92 - </Col>
93 -
94 - <Col span={2} style={{textAlign:'center'}} >
95 - <Tooltip title={'tikz 미리보기'}>
96 - <Button type="ghost" icon={<RetweetOutlined />} onClick={onClickEvent}></Button>
97 - </Tooltip>
98 - </Col>
99 -
100 - <Col span={11} >
101 - <IFrame
102 - style={{
103 - width: '44vw',
104 - height: '70vh',
105 - marginTop: '-15px',
106 - border: '1px solid #d9d9d9',
107 - }}>
108 - <PanZoom
109 - style={{
110 - display: 'block',
111 - outline: 'none',
112 - width: '44vw',
113 - height: '70vh',
114 - margin: '0px',
115 - }}>
116 - <div dangerouslySetInnerHTML={{ __html: svg }} />
117 - </PanZoom>
118 - </IFrame>
119 - </Col>
120 - </Row>
121 - <Form.Item>
122 - <Button type="primary" htmlType="submit">
123 - 저장하기
124 - </Button>
125 - </Form.Item>
126 - </Form>
127 - );
128 -};
129 -
130 -export default TikzForm;
1 -import { Upload, Button, message } from 'antd';
2 -import { UploadOutlined } from '@ant-design/icons';
3 -import reqwest from 'reqwest';
4 -
5 -class Demo extends React.Component {
6 - state = {
7 - fileList: [],
8 - uploading: false,
9 - };
10 -
11 - handleUpload = () => {
12 - const { fileList } = this.state;
13 - const formData = new FormData();
14 - fileList.forEach((file) => {
15 - formData.append('files[]', file);
16 - });
17 -
18 - this.setState({
19 - uploading: true,
20 - });
21 -
22 - // You can use any AJAX library you like
23 - reqwest({
24 - url: 'https://localhost:5000/user',
25 - method: 'post',
26 - processData: false,
27 - data: formData,
28 - success: () => {
29 - this.setState({
30 - fileList: [],
31 - uploading: false,
32 - });
33 - message.success('upload successfully.');
34 - },
35 - error: () => {
36 - this.setState({
37 - uploading: false,
38 - });
39 - message.error('upload failed.');
40 - },
41 - });
42 - };
43 -
44 - render() {
45 - const { uploading, fileList } = this.state;
46 - const props = {
47 - onRemove: (file) => {
48 - this.setState((state) => {
49 - const index = state.fileList.indexOf(file);
50 - const newFileList = state.fileList.slice();
51 - newFileList.splice(index, 1);
52 - return {
53 - fileList: newFileList,
54 - };
55 - });
56 - },
57 - beforeUpload: (file) => {
58 - this.setState((state) => ({
59 - fileList: [...state.fileList, file],
60 - }));
61 - return false;
62 - },
63 - fileList,
64 - };
65 -
66 - return (
67 - <>
68 - <Upload {...props}>
69 - <Button>
70 - <UploadOutlined /> Select File
71 - </Button>
72 - </Upload>
73 - <Button
74 - type="primary"
75 - onClick={this.handleUpload}
76 - disabled={fileList.length === 0}
77 - loading={uploading}
78 - style={{ marginTop: 16 }}>
79 - {uploading ? 'Uploading' : 'Start Upload'}
80 - </Button>
81 - </>
82 - );
83 - }
84 -}
1 -body {
2 - margin: 0;
3 - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 - 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 - sans-serif;
6 - -webkit-font-smoothing: antialiased;
7 - -moz-osx-font-smoothing: grayscale;
8 -}
9 -
10 -code {
11 - font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 - monospace;
13 -}
1 -import React from 'react';
2 -import ReactDOM from 'react-dom';
3 -import './index.css';
4 -import App from './App';
5 -import * as serviceWorker from './serviceWorker';
6 -import { createBrowserHistory } from 'history';
7 -import { BrowserRouter,Router } from 'react-router-dom';
8 -
9 -const history = createBrowserHistory();
10 -//<BrowserRouter history={history}></BrowserRouter>
11 -ReactDOM.render(
12 - <BrowserRouter history={history}>
13 - <App />
14 - </BrowserRouter>
15 - ,
16 - document.getElementById('root')
17 -);
18 -
19 -// If you want your app to work offline and load faster, you can change
20 -// unregister() to register() below. Note this comes with some pitfalls.
21 -// Learn more about service workers: https://bit.ly/CRA-PWA
22 -serviceWorker.unregister();
1 -import axios from 'axios';
2 -import qs from 'qs';
3 -export const checkFiles = (data, whatUpload) => {
4 - const options = {
5 - method: 'POST',
6 - headers: { 'content-type': 'application/x-www-form-urlencoded' },
7 - data: qs.stringify(data),
8 - url: 'http://localhost:5000/{whatUpload}',
9 - };
10 - return axios(options);
11 -};
12 -
13 -//export const tikz = (id) => tikz.post(`/users?id=${id != null ? id : ''}`);
14 -//export const testAdd = (name, tel) => client.post('/users/add', { name, tel });
1 -import axios from 'axios';
2 -
3 -const client = axios.create();
4 -
5 -client.defaults.baseURL = '';
6 -client.defaults.withCredentials = true;
7 -
8 -export default client;
1 -import client from './client';
2 -
3 -export const feedbackFind = () => client.get('/commenter');
4 -export const feedbackAdd = (nickname, comment) =>
5 - client.post('/commenter/add', { nickname, comment });
1 -import axios from 'axios';
2 -const hostMath = "http://ai.natmal.com:7070";
3 -
4 -export const checkQno = (qno) => axios.get(`${hostMath}/checkQno?qno=${qno}`);
5 -
6 -export const saveFileAndQno = (formData) =>
7 -{
8 - return axios({
9 - method: 'post',
10 - url: '/upload/html',
11 - data: formData,
12 - headers: {
13 - 'Content-Type': 'multipart/form-data',
14 - },
15 - });
16 -}
17 -
18 -export const getData = (user, pageSize, currentPage,orderWhat,orderKind) => axios.post('/tikzs',{user, pageSize, currentPage,orderWhat,orderKind});
19 -
1 -import axios from 'axios';
2 -import qs from 'qs';
3 -export const getLoginInfo = (data) =>
4 -{
5 - const options = {
6 - method: 'POST',
7 - headers: { 'content-type': 'application/x-www-form-urlencoded' },
8 - data: qs.stringify(data),
9 - url:'http://ai.natmal.com:7070/checkUser',
10 - };
11 - return axios(options);
12 -
13 -
14 -}
15 -
16 -
17 -//export const tikz = (id) => tikz.post(`/users?id=${id != null ? id : ''}`);
18 -//export const testAdd = (name, tel) => client.post('/users/add', { name, tel });
1 -import axios from 'axios';
2 -import qs from 'qs';
3 -export const matchInfo = (data) =>
4 -{
5 - const options = {
6 - method: 'GET',
7 - headers: { 'content-type': 'application/x-www-form-urlencoded' },
8 - data: qs.stringify(data),
9 - url:'http://localhost:5000/users',
10 - };
11 - return axios(options);
12 -
13 -
14 -}
15 -
16 -
17 -//export const tikz = (id) => tikz.post(`/users?id=${id != null ? id : ''}`);
18 -//export const testAdd = (name, tel) => client.post('/users/add', { name, tel });
1 -import axios from 'axios';
2 -const hostMath = 'http://ai.natmal.com:7070';
3 -
4 -export const checkQno = (qno) => axios.get(`${hostMath}/checkQno?qno=${qno}`);
5 -export const saveFileAndQno = (formData) =>
6 -{
7 - console.log(formData);
8 - return axios({
9 - method: 'post',
10 - url: '/upload/math',
11 - data: formData,
12 - headers: {
13 - 'Content-Type': 'multipart/form-data',
14 - },
15 - });
16 -}
17 -
18 -//export const getMathData = (user, pageSize, currentPage,orderWhat) => axios.post('/tikzs',{user, pageSize, currentPage,ordeWhat});
19 -
20 -
1 -import client from './client';
2 -
3 -export const testFind = (id) => client.get(`/users?id=${id != null ? id : ''}`);
4 -export const testAdd = (name, tel) => client.post('/users/add', { name, tel });
5 -export const testEdit = (id, name, tel) =>
6 - client.post('/users/edit', { id, name, tel });
7 -export const testDelete = (id) => client.get('/users/delete?id=' + id);
1 -import axios from 'axios';
2 -import qs from 'qs';
3 -export const getTexToSvg = (data) =>
4 -{
5 - const options = {
6 - method: 'POST',
7 - headers: { 'content-type': 'application/x-www-form-urlencoded' },
8 - data: qs.stringify(data),
9 - url:'http://ai.natmal.com:9292',
10 - };
11 - return axios(options);
12 -
13 -}
14 -
15 -const hostMath = "http://ai.natmal.com:7070";
16 -
17 -export const checkQno = (qno) => axios.get(`${hostMath}/checkQno?qno=${qno}`);
18 -
19 -export const saveFileAndQno = (data) => axios.post('/upload/tikz',{...data});
20 -
21 -export const removeItem = (id) => axios.get(`/tikzs/removeItem?id=${id}`);
22 -
23 -export const removeItems = (ids) => axios.post("/tikzs/removeItems",{ids});
24 -
25 -
26 -//export const getData = (user, pageSize, currentPage,orderWhat) => axios.post('/tikzs',{user, pageSize, currentPage,ordeWhat});
27 -
28 -
29 -
30 -
31 -//export const tikz = (id) => tikz.post(`/users?id=${id != null ? id : ''}`);
32 -//export const testAdd = (name, tel) => client.post('/users/add', { name, tel });