Showing
32 changed files
with
1500 additions
and
39 deletions
1 | -[{"C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\index.js":"1","C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\App.js":"2","C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\reportWebVitals.js":"3"},{"size":500,"mtime":499162500000,"results":"4","hashOfConfig":"5"},{"size":528,"mtime":499162500000,"results":"6","hashOfConfig":"5"},{"size":362,"mtime":499162500000,"results":"7","hashOfConfig":"5"},{"filePath":"8","messages":"9","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"igk043",{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\index.js",[],"C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\App.js",[],"C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\reportWebVitals.js",[]] | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +[{"C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\index.js":"1","C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\App.js":"2","C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\Container\\Login.js":"3","C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\Container\\index.js":"4","C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\component\\LoginForm.js":"5","C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\Container\\Tikz.js":"6","C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\Container\\Html.js":"7","C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\Container\\Home.js":"8","C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\component\\tikzForm.js":"9"},{"size":715,"mtime":1607870137130,"results":"10","hashOfConfig":"11"},{"size":594,"mtime":1607870203797,"results":"12","hashOfConfig":"11"},{"size":1242,"mtime":1607869960148,"results":"13","hashOfConfig":"11"},{"size":222,"mtime":1607869960164,"results":"14","hashOfConfig":"11"},{"size":1770,"mtime":1607869866203,"results":"15","hashOfConfig":"11"},{"size":6657,"mtime":1607869960160,"results":"16","hashOfConfig":"11"},{"size":7489,"mtime":1607869960144,"results":"17","hashOfConfig":"11"},{"size":17130,"mtime":1607870130113,"results":"18","hashOfConfig":"11"},{"size":3569,"mtime":1607869866172,"results":"19","hashOfConfig":"11"},{"filePath":"20","messages":"21","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"igk043",{"filePath":"22","messages":"23","errorCount":0,"warningCount":8,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"24","messages":"25","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"26","messages":"27","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"28","messages":"29","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"30","messages":"31","errorCount":0,"warningCount":6,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"32","messages":"33","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"34","messages":"35","errorCount":0,"warningCount":19,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"36","messages":"37","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\index.js",["38"],"C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\App.js",["39","40","41","42","43","44","45","46"],"C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\Container\\Login.js",[],"C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\Container\\index.js",[],"C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\component\\LoginForm.js",[],"C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\Container\\Tikz.js",["47","48","49","50","51","52"],"C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\Container\\Html.js",["53","54","55","56"],"C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\Container\\Home.js",["57","58","59","60","61","62","63","64","65","66","67","68","69","70","71","72","73","74","75"],"C:\\Users\\kkwan_000\\Desktop\\git\\2017110269\\minsung\\src\\component\\tikzForm.js",["76","77","78","79","80"],{"ruleId":"81","severity":1,"message":"82","line":7,"column":24,"nodeType":"83","messageId":"84","endLine":7,"endColumn":30},{"ruleId":"81","severity":1,"message":"85","line":1,"column":15,"nodeType":"83","messageId":"84","endLine":1,"endColumn":23},{"ruleId":"81","severity":1,"message":"86","line":1,"column":25,"nodeType":"83","messageId":"84","endLine":1,"endColumn":34},{"ruleId":"81","severity":1,"message":"87","line":2,"column":17,"nodeType":"83","messageId":"84","endLine":2,"endColumn":25},{"ruleId":"81","severity":1,"message":"88","line":3,"column":16,"nodeType":"83","messageId":"84","endLine":3,"endColumn":20},{"ruleId":"81","severity":1,"message":"89","line":3,"column":22,"nodeType":"83","messageId":"84","endLine":3,"endColumn":29},{"ruleId":"81","severity":1,"message":"90","line":3,"column":31,"nodeType":"83","messageId":"84","endLine":3,"endColumn":35},{"ruleId":"81","severity":1,"message":"91","line":4,"column":9,"nodeType":"83","messageId":"84","endLine":4,"endColumn":15},{"ruleId":"81","severity":1,"message":"92","line":8,"column":7,"nodeType":"83","messageId":"84","endLine":8,"endColumn":21},{"ruleId":"81","severity":1,"message":"93","line":3,"column":10,"nodeType":"83","messageId":"84","endLine":3,"endColumn":24},{"ruleId":"81","severity":1,"message":"94","line":3,"column":26,"nodeType":"83","messageId":"84","endLine":3,"endColumn":41},{"ruleId":"95","severity":1,"message":"96","line":60,"column":20,"nodeType":"97","messageId":"98","endLine":70,"endColumn":18},{"ruleId":"81","severity":1,"message":"99","line":76,"column":9,"nodeType":"83","messageId":"84","endLine":76,"endColumn":15},{"ruleId":"81","severity":1,"message":"100","line":76,"column":17,"nodeType":"83","messageId":"84","endLine":76,"endColumn":26},{"ruleId":"81","severity":1,"message":"101","line":169,"column":10,"nodeType":"83","messageId":"84","endLine":169,"endColumn":16},{"ruleId":"81","severity":1,"message":"102","line":3,"column":25,"nodeType":"83","messageId":"84","endLine":3,"endColumn":37},{"ruleId":"81","severity":1,"message":"103","line":3,"column":39,"nodeType":"83","messageId":"84","endLine":3,"endColumn":50},{"ruleId":"81","severity":1,"message":"104","line":45,"column":10,"nodeType":"83","messageId":"84","endLine":45,"endColumn":16},{"ruleId":"81","severity":1,"message":"105","line":97,"column":10,"nodeType":"83","messageId":"84","endLine":97,"endColumn":14},{"ruleId":"81","severity":1,"message":"106","line":6,"column":39,"nodeType":"83","messageId":"84","endLine":6,"endColumn":43},{"ruleId":"81","severity":1,"message":"107","line":9,"column":3,"nodeType":"83","messageId":"84","endLine":9,"endColumn":19},{"ruleId":"81","severity":1,"message":"108","line":10,"column":3,"nodeType":"83","messageId":"84","endLine":10,"endColumn":19},{"ruleId":"81","severity":1,"message":"109","line":12,"column":3,"nodeType":"83","messageId":"84","endLine":12,"endColumn":14},{"ruleId":"81","severity":1,"message":"110","line":20,"column":8,"nodeType":"83","messageId":"84","endLine":20,"endColumn":18},{"ruleId":"81","severity":1,"message":"111","line":26,"column":10,"nodeType":"83","messageId":"84","endLine":26,"endColumn":21},{"ruleId":"81","severity":1,"message":"112","line":66,"column":27,"nodeType":"83","messageId":"84","endLine":66,"endColumn":45},{"ruleId":"81","severity":1,"message":"113","line":86,"column":19,"nodeType":"83","messageId":"84","endLine":86,"endColumn":30},{"ruleId":"114","severity":1,"message":"115","line":134,"column":5,"nodeType":"116","endLine":134,"endColumn":60,"suggestions":"117"},{"ruleId":"114","severity":1,"message":"118","line":143,"column":5,"nodeType":"116","endLine":143,"endColumn":45,"suggestions":"119"},{"ruleId":"114","severity":1,"message":"120","line":149,"column":5,"nodeType":"116","endLine":149,"endColumn":59,"suggestions":"121"},{"ruleId":"81","severity":1,"message":"122","line":169,"column":9,"nodeType":"83","messageId":"84","endLine":169,"endColumn":18},{"ruleId":"123","severity":1,"message":"124","line":281,"column":23,"nodeType":"125","messageId":"126","endLine":281,"endColumn":25},{"ruleId":"123","severity":1,"message":"124","line":294,"column":25,"nodeType":"125","messageId":"126","endLine":294,"endColumn":27},{"ruleId":"81","severity":1,"message":"127","line":318,"column":9,"nodeType":"83","messageId":"84","endLine":318,"endColumn":15},{"ruleId":"128","severity":1,"message":"129","line":421,"column":48,"nodeType":"130","endLine":421,"endColumn":63},{"ruleId":"128","severity":1,"message":"129","line":431,"column":145,"nodeType":"130","endLine":431,"endColumn":160},{"ruleId":"128","severity":1,"message":"129","line":441,"column":86,"nodeType":"130","endLine":441,"endColumn":101},{"ruleId":"131","severity":1,"message":"132","line":567,"column":32,"nodeType":"133","endLine":567,"endColumn":319},{"ruleId":"81","severity":1,"message":"134","line":1,"column":15,"nodeType":"83","messageId":"84","endLine":1,"endColumn":23},{"ruleId":"81","severity":1,"message":"135","line":2,"column":10,"nodeType":"83","messageId":"84","endLine":2,"endColumn":16},{"ruleId":"81","severity":1,"message":"136","line":2,"column":33,"nodeType":"83","messageId":"84","endLine":2,"endColumn":37},{"ruleId":"81","severity":1,"message":"137","line":2,"column":55,"nodeType":"83","messageId":"84","endLine":2,"endColumn":67},{"ruleId":"81","severity":1,"message":"93","line":3,"column":10,"nodeType":"83","messageId":"84","endLine":3,"endColumn":24},"no-unused-vars","'Router' is defined but never used.","Identifier","unusedVar","'useState' is defined but never used.","'useEffect' is defined but never used.","'Redirect' is defined but never used.","'Html' is defined but never used.","'Mathcha' is defined but never used.","'Tikz' is defined but never used.","'isauth' is defined but never used.","'authentication' is assigned a value but never used.","'UploadOutlined' is defined but never used.","'RetweetOutlined' is defined but never used.","no-multi-str","Multiline support is limited to browsers supporting ES5 only.","Literal","multilineString","'number' is assigned a value but never used.","'setNumber' is assigned a value but never used.","'result' is assigned a value but never used.","'LockOutlined' is defined but never used.","'SaveTwoTone' is defined but never used.","'upload' is assigned a value but never used.","'onOk' is assigned a value but never used.","'Card' is defined but never used.","'FunctionOutlined' is defined but never used.","'FontSizeOutlined' is defined but never used.","'EyeOutlined' is defined but never used.","'heartgraph' is defined but never used.","'getMathData' is defined but never used.","'setSelectedRowKeys' is assigned a value but never used.","'setPageSize' is assigned a value but never used.","react-hooks/exhaustive-deps","React Hook useCallback has an unnecessary dependency: 'fetchGetData'. Either exclude it or remove the dependency array. Outer scope values like 'fetchGetData' aren't valid dependencies because mutating them doesn't re-render the component.","ArrayExpression",["138"],"React Hook useEffect has a missing dependency: 'callbackFetch'. Either include it or remove the dependency array.",["139"],"React Hook useEffect has an unnecessary dependency: 'Table'. Either exclude it or remove the dependency array. Outer scope values like 'Table' aren't valid dependencies because mutating them doesn't re-render the component.",["140"],"'showLogin' is assigned a value but never used.","eqeqeq","Expected '===' and instead saw '=='.","BinaryExpression","unexpected","'onExit' is assigned a value but never used.","react/jsx-no-target-blank","Using target=\"_blank\" without rel=\"noreferrer\" is a security risk: see https://html.spec.whatwg.org/multipage/links.html#link-type-noopener","JSXAttribute","jsx-a11y/iframe-has-title","<iframe> elements must have a unique title property.","JSXOpeningElement","'Flagment' is defined but never used.","'Drawer' is defined but never used.","'Menu' is defined but never used.","'AutoComplete' is defined but never used.",{"desc":"141","fix":"142"},{"desc":"143","fix":"144"},{"desc":"145","fix":"146"},"Update the dependencies array to be: [pageSize, currentPage, orderWhat, orderKind]",{"range":"147","text":"148"},"Update the dependencies array to be: [status, orderKindStatus, orderWhatStatus, callbackFetch]",{"range":"149","text":"150"},"Update the dependencies array to be: [orderWhat, orderWhatKor, orderKind, orderKindKor]",{"range":"151","text":"152"},[3825,3880],"[pageSize, currentPage, orderWhat, orderKind]",[4099,4139],"[status, orderKindStatus, orderWhatStatus, callbackFetch]",[4193,4247],"[orderWhat, orderWhatKor, orderKind, orderKindKor]"] | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | -.App { | 1 | +.trigger { |
2 | - text-align: center; | 2 | + font-size: 18px; |
3 | + line-height: 64px; | ||
4 | + padding: 0 24px; | ||
5 | + cursor: pointer; | ||
6 | + transition: color 0.3s; | ||
3 | } | 7 | } |
4 | 8 | ||
5 | -.App-logo { | 9 | +.trigger:hover { |
6 | - height: 40vmin; | 10 | + color: #1890ff; |
7 | - pointer-events: none; | ||
8 | } | 11 | } |
9 | 12 | ||
10 | -@media (prefers-reduced-motion: no-preference) { | 13 | +.logo { |
11 | - .App-logo { | 14 | + height: 32px; |
12 | - animation: App-logo-spin infinite 20s linear; | 15 | + background: rgba(255, 255, 255, 0.2); |
13 | - } | 16 | + margin: 16px; |
14 | } | 17 | } |
15 | 18 | ||
16 | -.App-header { | 19 | +.site-layout .site-layout-background { |
17 | - background-color: #282c34; | 20 | + background: #fff; |
18 | - min-height: 100vh; | ||
19 | - display: flex; | ||
20 | - flex-direction: column; | ||
21 | - align-items: center; | ||
22 | - justify-content: center; | ||
23 | - font-size: calc(10px + 2vmin); | ||
24 | - color: white; | ||
25 | -} | ||
26 | - | ||
27 | -.App-link { | ||
28 | - color: #61dafb; | ||
29 | -} | ||
30 | - | ||
31 | -@keyframes App-logo-spin { | ||
32 | - from { | ||
33 | - transform: rotate(0deg); | ||
34 | - } | ||
35 | - to { | ||
36 | - transform: rotate(360deg); | ||
37 | - } | ||
38 | } | 21 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
minsung/src/Container/Home.css
0 → 100644
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 |
minsung/src/Container/Home.js
0 → 100644
1 | +import React, { useState, useEffect, useCallback } from 'react'; | ||
2 | +import 'antd/dist/antd.css'; | ||
3 | +import './Tikz.css'; | ||
4 | +import './Home.css'; | ||
5 | +import {withRouter} from 'react-router-dom'; | ||
6 | +import { Layout, Menu, Table, Button, Card, Modal,message } from 'antd'; | ||
7 | +import { | ||
8 | + MenuOutlined, | ||
9 | + FunctionOutlined, | ||
10 | + FontSizeOutlined, | ||
11 | + LineChartOutlined, | ||
12 | + EyeOutlined, | ||
13 | + DownloadOutlined, | ||
14 | + UploadOutlined, | ||
15 | + DeleteOutlined, | ||
16 | + UserOutlined, | ||
17 | + ReadOutlined | ||
18 | +} from '@ant-design/icons'; | ||
19 | +import mathbank from '../lib/mathbank.png'; | ||
20 | +import heartgraph from '../lib/heartgraph.png'; | ||
21 | +import Html from './Html.js'; | ||
22 | +import Mathcha from './Mathcha.js'; | ||
23 | +import Tikz from './Tikz.js'; | ||
24 | +import { Redirect } from 'react-router-dom'; | ||
25 | +import {getData} from 'lib/api/html'; | ||
26 | +import { getMathData } from '../lib/api/mathCha'; | ||
27 | +import { removeItem,removeItems } from '../lib/api/tikz'; | ||
28 | + | ||
29 | +const { Header, Sider, Content } = Layout; | ||
30 | +const { SubMenu } = Menu; | ||
31 | + | ||
32 | +const host= 'http://localhost:5000'; | ||
33 | + | ||
34 | +/* 테이블에 들어가는 컨텐츠 메크로로 생성 */ | ||
35 | + | ||
36 | +const fetchGetData = async(user, pageSize, currentPage, orderWhat,orderKind) => { | ||
37 | + try{ | ||
38 | + console.log(pageSize); | ||
39 | + const result = await getData(user, pageSize, currentPage,orderWhat,orderKind); | ||
40 | + if(result.status === 200){ | ||
41 | + return result.data; | ||
42 | + }else { | ||
43 | + return null; | ||
44 | + } | ||
45 | + }catch(e){ | ||
46 | + console.log(e); | ||
47 | + return null; | ||
48 | + } | ||
49 | +}; | ||
50 | + | ||
51 | + | ||
52 | + | ||
53 | +//로그아웃 기능 -> session storage 제거 및 Login으로 이동하게 해야함 | ||
54 | + | ||
55 | + | ||
56 | + | ||
57 | +const Home = ({history}) => { | ||
58 | + const [html, setHtml] = useState(false); | ||
59 | + | ||
60 | + const [mathcha, setMathcha] = useState(false); | ||
61 | + | ||
62 | + const [tikz, setTikz] = useState(false); | ||
63 | + | ||
64 | + const [visible, setVisible] = useState(false); | ||
65 | + | ||
66 | + const [selectedRowKeys, setSelectedRowKeys] = useState(false); | ||
67 | + | ||
68 | + const [collapsed, setCollapsed] = useState(false); | ||
69 | + | ||
70 | + const [status,setStatus] = useState(null); | ||
71 | + | ||
72 | + const [data, setData] = useState([]); | ||
73 | + | ||
74 | + const [selectItem, setSelectItem] = useState(null); | ||
75 | + | ||
76 | + const [selectItems, setSelectItems] = useState([]); | ||
77 | + | ||
78 | + const [removeVisible,setRemoveVisible] = useState(false); | ||
79 | + | ||
80 | + const [mode ,setMode] =useState(null); | ||
81 | + | ||
82 | + const [tikzmode,setTikzMode] =useState(null); | ||
83 | + | ||
84 | + const [total, setTotal] =useState(0); | ||
85 | + const [currentPage, setCurrentPage] =useState(1); | ||
86 | + const [pageSize,setPageSize] =useState(10); | ||
87 | + const [orderWhat,setOrderWhat] = useState('qno'); | ||
88 | + const [orderWhatKor,setOrderWhatKor] =useState('문제번호순'); | ||
89 | + const [orderKind,setOrderKind] = useState('desc'); | ||
90 | + const [orderKindKor,setOrderKindKor] = useState('내림차순'); | ||
91 | + const [orderWhatStatus,setOrderWhatStatus] =useState(false); | ||
92 | + const [orderKindStatus,setOrderKindStatus] =useState(false); | ||
93 | + const callback = (param) => { | ||
94 | + const {status} = param; | ||
95 | + if(status){ | ||
96 | + setStatus(status); | ||
97 | + } | ||
98 | + } | ||
99 | + const onOrderWhat = async() => { | ||
100 | + if(orderWhatKor ==="문제번호순"){ | ||
101 | + setOrderWhat('id'); | ||
102 | + setOrderWhatKor("최근등록순"); | ||
103 | + setOrderWhatStatus(true); | ||
104 | + }else{ | ||
105 | + setOrderWhat('qno'); | ||
106 | + setOrderWhatKor("문제번호순"); | ||
107 | + setOrderWhatStatus(true); | ||
108 | + } | ||
109 | + }; | ||
110 | + const onOrderKind = () => { | ||
111 | + if(orderKindKor ==="내림차순"){ | ||
112 | + setOrderKind('asc'); | ||
113 | + setOrderKindKor("오름차순"); | ||
114 | + setOrderKindStatus(true); | ||
115 | + }else{ | ||
116 | + setOrderKind('desc') | ||
117 | + setOrderKindKor("내림차순"); | ||
118 | + setOrderKindStatus(true); | ||
119 | + } | ||
120 | + }; | ||
121 | + | ||
122 | + const callbackFetch = useCallback(async () => { | ||
123 | + const user = sessionStorage.getItem('id'); | ||
124 | + const result = await fetchGetData(user,pageSize,currentPage,orderWhat, orderKind); | ||
125 | + console.log(pageSize); | ||
126 | + if(result){ | ||
127 | + console.log(result.tikzs); | ||
128 | + setData(result.tikzs.map(x=>Object.assign({},x,{key: x.id}))); | ||
129 | + setTotal(result.total); | ||
130 | + setStatus(null); | ||
131 | + setOrderKindStatus(false); | ||
132 | + setOrderWhatStatus(false); | ||
133 | + } | ||
134 | + },[fetchGetData,pageSize,currentPage,orderWhat,orderKind]); | ||
135 | + | ||
136 | + useEffect(() =>{ | ||
137 | + if(status==null || (status!=null && status==='SAVE_OK')){ | ||
138 | + callbackFetch(); | ||
139 | + } | ||
140 | + if(orderKindStatus === true || orderWhatStatus ===true){ | ||
141 | + callbackFetch(); | ||
142 | + } | ||
143 | + },[status,orderKindStatus,orderWhatStatus]) | ||
144 | + | ||
145 | + | ||
146 | + /*파일 정렬 */ | ||
147 | + useEffect(()=>{ | ||
148 | + | ||
149 | + },[orderWhat,orderWhatKor,orderKind,orderKindKor, Table]) | ||
150 | + | ||
151 | + /* 모달 */ | ||
152 | + const showModal = (e, value) => { | ||
153 | + console.log(value); | ||
154 | + setSelectItem(value); | ||
155 | + setVisible(!visible); | ||
156 | + }; | ||
157 | + | ||
158 | + const handleOk = (e) => { | ||
159 | + console.log(e); | ||
160 | + setVisible(!visible); | ||
161 | + }; | ||
162 | + | ||
163 | + const handleCancel = (e) => { | ||
164 | + console.log(e); | ||
165 | + setVisible(!visible); | ||
166 | + }; | ||
167 | + | ||
168 | + /* 로그인 모달 */ | ||
169 | + const showLogin = (e) => { | ||
170 | + console.log(e); | ||
171 | + setVisible(!visible); | ||
172 | + }; | ||
173 | + | ||
174 | + const showTikz= (e, value) => { | ||
175 | + setTikzMode("preview"); | ||
176 | + setSelectItem(value); | ||
177 | + setTikz(true); | ||
178 | + }; | ||
179 | + | ||
180 | + const columns = [ | ||
181 | + | ||
182 | + { | ||
183 | + title: '문제 번호', | ||
184 | + dataIndex: 'qno', | ||
185 | + }, | ||
186 | + { | ||
187 | + title: '문제 타입', | ||
188 | + dataIndex: 'typeSol', | ||
189 | + }, | ||
190 | + { | ||
191 | + title: '문제/풀이 구분', | ||
192 | + dataIndex: 'typeQue', | ||
193 | + }, | ||
194 | + { | ||
195 | + title: 'HTML', | ||
196 | + dataIndex: 'htmlFileName', | ||
197 | + render: (value, row) => { | ||
198 | + if(value){ | ||
199 | + return ( | ||
200 | + <Button | ||
201 | + type="dashed" | ||
202 | + shape="round" | ||
203 | + icon={<LineChartOutlined />} | ||
204 | + onClick={(e)=>showModal(e, row)} | ||
205 | + /> | ||
206 | + ); | ||
207 | + }else{ | ||
208 | + return <span>-</span> | ||
209 | + } | ||
210 | + }, | ||
211 | + }, | ||
212 | + { | ||
213 | + title: 'Mathcha', | ||
214 | + dataIndex: 'mathcharFileName', | ||
215 | + render: (value, row) => { | ||
216 | + if(value){ | ||
217 | + return ( | ||
218 | + <a href={`${host}/mathchaDownload/${value}`}> | ||
219 | + <DownloadOutlined/> | ||
220 | + </a> | ||
221 | + | ||
222 | + ); | ||
223 | + }else{ | ||
224 | + return <span>-</span> | ||
225 | + } | ||
226 | + }, | ||
227 | + }, | ||
228 | + { | ||
229 | + title: 'TikZ', | ||
230 | + dataIndex: 'tex', | ||
231 | + render:(value, row) => { | ||
232 | + if(value){ | ||
233 | + return ( | ||
234 | + <Button | ||
235 | + type="dashed" | ||
236 | + shape="round" | ||
237 | + icon={<LineChartOutlined />} | ||
238 | + onClick={(e)=> showTikz(e,row)} | ||
239 | + /> | ||
240 | + ); | ||
241 | + }else{ | ||
242 | + return <span>-</span> | ||
243 | + } | ||
244 | + }, | ||
245 | + }, | ||
246 | + { | ||
247 | + title: '삭제', | ||
248 | + dataIndex: 'delete', | ||
249 | + render: (value, row) => { | ||
250 | + return <Button type="text" icon={<DeleteOutlined />} danger onClick={(e)=>removeShowModal(e,row)}/>; | ||
251 | + }, | ||
252 | + }, | ||
253 | + { | ||
254 | + title: '작성자', | ||
255 | + dataIndex: 'creator', | ||
256 | + }, | ||
257 | + ]; | ||
258 | + | ||
259 | + const removeShowModal = (e,row) => { | ||
260 | + setSelectItem(row); | ||
261 | + setMode('single'); | ||
262 | + setRemoveVisible(true); | ||
263 | + }; | ||
264 | + | ||
265 | + const removeItemsShowModal =() => { | ||
266 | + setMode('multi'); | ||
267 | + setRemoveVisible(true); | ||
268 | + }; | ||
269 | + | ||
270 | + | ||
271 | + | ||
272 | + const removeHandleCancel = () => { | ||
273 | + | ||
274 | + setRemoveVisible(false); | ||
275 | + }; | ||
276 | + const removeHandleOk = async () => { | ||
277 | + if(mode === 'single'){ | ||
278 | + | ||
279 | + try{ | ||
280 | + const result = await removeItem(selectItem.id); | ||
281 | + if(result.status==200){ | ||
282 | + message.info("삭제되었습니다."); | ||
283 | + callbackFetch(); | ||
284 | + setRemoveVisible(false); | ||
285 | + }}catch(e){ | ||
286 | + console.log(e); | ||
287 | + message.warn(e); | ||
288 | + } | ||
289 | + } | ||
290 | + if(mode ==='multi'){ | ||
291 | + | ||
292 | + try{ | ||
293 | + const result = await removeItems(selectItems); | ||
294 | + if(result.status==200){ | ||
295 | + message.info("삭제되었습니다."); | ||
296 | + callbackFetch(); | ||
297 | + setRemoveVisible(false); | ||
298 | + }}catch(e){ | ||
299 | + console.log(e); | ||
300 | + message.warn(e); | ||
301 | + } | ||
302 | + } | ||
303 | + | ||
304 | + } | ||
305 | + | ||
306 | + const onSelectChange = selectedRowKeys => { | ||
307 | + console.log('selectedRowKeys Changed: ', selectedRowKeys); | ||
308 | + setSelectItems(selectedRowKeys); | ||
309 | + } | ||
310 | + | ||
311 | + const onCancelHtml = () => { | ||
312 | + setHtml(false); | ||
313 | + }; | ||
314 | + const onCancelMathCha = () => { | ||
315 | + setMathcha(false); | ||
316 | + }; | ||
317 | + | ||
318 | + const onExit = () => { | ||
319 | + setMathcha(false); | ||
320 | + }; | ||
321 | + | ||
322 | + const onLeave = () => { | ||
323 | + setSelectItem(null); | ||
324 | + setTikz(false); | ||
325 | + }; | ||
326 | + | ||
327 | + const onHtml = () => { | ||
328 | + setHtml(true); | ||
329 | + }; | ||
330 | + | ||
331 | + const onMathcha = () => { | ||
332 | + setMathcha(true); | ||
333 | + }; | ||
334 | + | ||
335 | + const onTikz = () => { | ||
336 | + setTikzMode("new") | ||
337 | + setTikz(true); | ||
338 | + }; | ||
339 | + | ||
340 | + const toggle = () => { | ||
341 | + setCollapsed(!collapsed); | ||
342 | + }; | ||
343 | + | ||
344 | + const onCollapse = (collapsed, type) => { | ||
345 | + //this.setState({ collapsed }); | ||
346 | + setCollapsed(!collapsed); | ||
347 | + }; | ||
348 | + | ||
349 | + | ||
350 | + | ||
351 | + const rowSelection = { | ||
352 | + selectedRowKeys: selectItems, onChange: onSelectChange | ||
353 | + }; | ||
354 | + const hasSelected = selectedRowKeys.length > 0; | ||
355 | + | ||
356 | + const isAuth = sessionStorage.getItem('isAuth'); | ||
357 | + const userId = sessionStorage.getItem('id'); | ||
358 | + if (!isAuth) return <Redirect to="/" />; | ||
359 | + | ||
360 | + | ||
361 | + return ( | ||
362 | + <Layout> | ||
363 | + <Sider | ||
364 | + trigger={null} | ||
365 | + collapsible | ||
366 | + collapsed={!collapsed} | ||
367 | + onCollapse={onCollapse} | ||
368 | + style={{ height: '100vh' }}> | ||
369 | + <img | ||
370 | + className="mathbank" | ||
371 | + src={mathbank} | ||
372 | + alt="mathbank" | ||
373 | + onClick={() => window.location.reload()} | ||
374 | + style={{ | ||
375 | + width: 'auto', | ||
376 | + height: '54px', | ||
377 | + marginLeft: '22px', | ||
378 | + marginTop: '10px', | ||
379 | + cursor: 'pointer', | ||
380 | + }} | ||
381 | + /> | ||
382 | + <Menu | ||
383 | + | ||
384 | + theme="dark" | ||
385 | + defaultSelectedKeys={['1']} | ||
386 | + mode="inline" | ||
387 | + style={{ fontSize: '18px' }}> | ||
388 | + <SubMenu | ||
389 | + key="sub1" | ||
390 | + icon={<UserOutlined style={{ fontSize: '18px' }} />} | ||
391 | + title="User's Info" | ||
392 | + style={{ backgroundColor: 'rgb(0, 21, 41)' }}> | ||
393 | + <Menu.Item | ||
394 | + key="1" | ||
395 | + onClick="none" | ||
396 | + style={{ | ||
397 | + width: '200px', | ||
398 | + height: '100%', | ||
399 | + paddingLeft: '0px', | ||
400 | + background: 'rgb(0, 21, 41)', | ||
401 | + textAlign: 'center', | ||
402 | + }}> | ||
403 | + {userId}님 환영합니다. | ||
404 | + </Menu.Item> | ||
405 | + </SubMenu> | ||
406 | + <SubMenu | ||
407 | + key="sub2" | ||
408 | + icon={<ReadOutlined style={{ fontsize: '15px'}}/>} | ||
409 | + title="MathCha" | ||
410 | + style={{ | ||
411 | + backgroundColor: 'rgb(0, 21, 41)' | ||
412 | + }}> | ||
413 | + <Menu.Item | ||
414 | + key="1" | ||
415 | + style={{ | ||
416 | + width: '200px', | ||
417 | + height: '100%', | ||
418 | + paddingLeft: '0px', | ||
419 | + background: 'rgb(0, 21, 41)', | ||
420 | + textAlign: 'center', | ||
421 | + }}><a href="http://mathcha.io" target="_blank">MathCha 다운로드</a> | ||
422 | + </Menu.Item> | ||
423 | + <Menu.Item | ||
424 | + key="2" | ||
425 | + style={{ | ||
426 | + width: '200px', | ||
427 | + height: '100%', | ||
428 | + paddingLeft: '0px', | ||
429 | + background: 'rgb(0, 21, 41)', | ||
430 | + textAlign: 'center', | ||
431 | + }}><a href="https://m.blog.naver.com/PostView.nhn?blogId=wool613&logNo=221511340406&proxyReferer=https:%2F%2Fwww.google.com%2F" target="_blank">tikz 간단 설명</a> | ||
432 | + </Menu.Item> | ||
433 | + <Menu.Item | ||
434 | + key="3" | ||
435 | + style={{ | ||
436 | + width: '200px', | ||
437 | + height: '100%', | ||
438 | + paddingLeft: '0px', | ||
439 | + background: 'rgb(0, 21, 41)', | ||
440 | + textAlign: 'center', | ||
441 | + }}><a href="https://www.bu.edu/math/files/2013/08/tikzpgfmanual.pdf" target="_blank">tikz 상세 메뉴얼</a> | ||
442 | + </Menu.Item> | ||
443 | + </SubMenu> | ||
444 | + </Menu> | ||
445 | + </Sider> | ||
446 | + <Layout className="site-layout"> | ||
447 | + <Header className="site-layout-background" style={{ padding: 0 }}> | ||
448 | + <MenuOutlined | ||
449 | + style={{ marginLeft: '13px' }} | ||
450 | + onClick={(collapsed, toggle)}></MenuOutlined> | ||
451 | + | ||
452 | + <Button className="logout" type="default" onClick={(e)=>{ | ||
453 | + sessionStorage.removeItem('id'); | ||
454 | + sessionStorage.removeItem('isAuth'); | ||
455 | + history.push('/'); | ||
456 | + | ||
457 | + }}> | ||
458 | + 로그아웃 | ||
459 | + </Button> | ||
460 | + </Header> | ||
461 | + <Content> | ||
462 | + <div> | ||
463 | + <div style={{ marginBottom: 16 }}> | ||
464 | + <span style={{ marginLeft: 8 }}> | ||
465 | + {hasSelected ? `Selected ${selectedRowKeys.length} items` : ''} | ||
466 | + </span> | ||
467 | + </div> | ||
468 | + <Button | ||
469 | + style={{ display: 'inline-block', top: '0.5vh', left: '8vw' }} | ||
470 | + type="primary" | ||
471 | + shape="round" | ||
472 | + icon={<UploadOutlined />} | ||
473 | + onClick={onHtml}> | ||
474 | + HTML 업로드 | ||
475 | + </Button> | ||
476 | + <Button | ||
477 | + style={{ display: 'inline-block', top: '0.5vh', left: '8.5vw' }} | ||
478 | + type="primary" | ||
479 | + shape="round" | ||
480 | + icon={<UploadOutlined />} | ||
481 | + onClick={onMathcha}> | ||
482 | + Mathcha 업로드 | ||
483 | + </Button> | ||
484 | + <Button | ||
485 | + style={{ display: 'inline-block', top: '0.5vh', left: '9vw' }} | ||
486 | + type="primary" | ||
487 | + shape="round" | ||
488 | + icon={<UploadOutlined />} | ||
489 | + onClick={onTikz}> | ||
490 | + TikZ 업로드 | ||
491 | + </Button> | ||
492 | + <Button | ||
493 | + style={{ | ||
494 | + display: 'inline-block', | ||
495 | + top: '0.5vh', | ||
496 | + left: '9.5vw', | ||
497 | + }} | ||
498 | + type="dashed" | ||
499 | + shape="round" | ||
500 | + icon={<DeleteOutlined />} | ||
501 | + onClick={(e)=>{ | ||
502 | + console.log(selectItems); | ||
503 | + if(selectItems.length>0){ | ||
504 | + | ||
505 | + removeItemsShowModal(); | ||
506 | + }else{ | ||
507 | + message.info("삭제할 데이터를 선택해 주세요."); | ||
508 | + } | ||
509 | + }} | ||
510 | + danger> | ||
511 | + 선택 삭제 | ||
512 | + </Button> | ||
513 | + | ||
514 | + <Button | ||
515 | + style={{ | ||
516 | + display: 'inline-block', | ||
517 | + top: '0.5vh', | ||
518 | + left: '50vw', | ||
519 | + }}className="orderWhat" type="default" onClick={onOrderWhat}> | ||
520 | + {orderWhatKor} | ||
521 | + </Button> | ||
522 | + <Button | ||
523 | + style={{ | ||
524 | + display: 'inline-block', | ||
525 | + top: '0.5vh', | ||
526 | + left: '50.2vw', | ||
527 | + }}className="orderKind" type="default" onClick={onOrderKind}> | ||
528 | + {orderKindKor} | ||
529 | + </Button> | ||
530 | + <Table | ||
531 | + rowSelection={rowSelection} | ||
532 | + pagination={ | ||
533 | + { | ||
534 | + total: total, | ||
535 | + current:currentPage, | ||
536 | + pageSize:pageSize, | ||
537 | + orderWhat:orderWhat , | ||
538 | + orderKind:orderKind, | ||
539 | + onChange:async (page,pageSize)=>{ | ||
540 | + console.log(page,pageSize); | ||
541 | + setCurrentPage(page); | ||
542 | + const user = sessionStorage.getItem('id'); | ||
543 | + const result = await fetchGetData(user,pageSize,page,orderWhat,orderKind); | ||
544 | + console.log(pageSize); | ||
545 | + if(result){ | ||
546 | + console.log(result.tikzs); | ||
547 | + setData(result.tikzs.map(x=>Object.assign({},x,{key: x.id}))); | ||
548 | + setTotal(result.total); | ||
549 | + setStatus(null); | ||
550 | + } | ||
551 | + } | ||
552 | + } | ||
553 | + } | ||
554 | + columns={columns} | ||
555 | + dataSource={data} | ||
556 | + style={{ width: '80vw', marginTop: '1.5vh', marginLeft: '8vw' }} | ||
557 | + /> | ||
558 | + <Modal | ||
559 | + title="미리보기" | ||
560 | + visible={visible} | ||
561 | + centered | ||
562 | + width="400px" | ||
563 | + height="400px" | ||
564 | + onOk={handleOk} | ||
565 | + onCancel={handleCancel}> | ||
566 | + { | ||
567 | + selectItem && <iframe scrolling='no' frameBorder="0" style={{overflow:'hidden' , overflowX:'hidden', overflowY:'hidden' , position:'relative', top:'0px',left:'0px', right:'0px', bottom:'0px' ,height:'300px', width:'350px' }} className="iframe" src={`${host}/htmlPreview/${selectItem.htmlFileName}`}/> | ||
568 | + } | ||
569 | + </Modal> | ||
570 | + <Modal | ||
571 | + title="다운로드" | ||
572 | + /> | ||
573 | + <Modal | ||
574 | + title="삭제하시겠습니까?" | ||
575 | + visible={removeVisible} | ||
576 | + onOk={removeHandleOk} | ||
577 | + onCancel={removeHandleCancel} | ||
578 | + okText="확인" | ||
579 | + cancelText="취소" | ||
580 | + > | ||
581 | + <p>확인을 클릭하시면 삭제됩니다!</p> | ||
582 | + </Modal> | ||
583 | + <Html visible={html} onCancel={onCancelHtml} callback={callback}></Html> | ||
584 | + <Mathcha visible={mathcha} onCancel={onCancelMathCha} callback={callback}></Mathcha> | ||
585 | + <Tikz visible={tikz} onLeave={onLeave} callback={callback} selectItem={selectItem} mode={tikzmode}></Tikz> | ||
586 | + </div> | ||
587 | + </Content> | ||
588 | + </Layout> | ||
589 | + </Layout> | ||
590 | + ); | ||
591 | +}; | ||
592 | + | ||
593 | +export default withRouter(Home); |
minsung/src/Container/Login.js
0 → 100644
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); |
minsung/src/Container/Tikz.css
0 → 100644
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 |
minsung/src/Container/Tikz.js
0 → 100644
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> |
minsung/src/component/DropMenu.js
0 → 100644
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 |
minsung/src/component/LoginForm.js
0 → 100644
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 |
minsung/src/component/tikzForm.js
0 → 100644
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; |
minsung/src/component/uploadForm.js
0 → 100644
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 | +} |
... | @@ -2,16 +2,21 @@ import React from 'react'; | ... | @@ -2,16 +2,21 @@ import React from 'react'; |
2 | import ReactDOM from 'react-dom'; | 2 | import ReactDOM from 'react-dom'; |
3 | import './index.css'; | 3 | import './index.css'; |
4 | import App from './App'; | 4 | import App from './App'; |
5 | -import reportWebVitals from './reportWebVitals'; | 5 | +import * as serviceWorker from './serviceWorker'; |
6 | +import { createBrowserHistory } from 'history'; | ||
7 | +import { BrowserRouter,Router } from 'react-router-dom'; | ||
6 | 8 | ||
9 | +const history = createBrowserHistory(); | ||
10 | +//<BrowserRouter history={history}></BrowserRouter> | ||
7 | ReactDOM.render( | 11 | ReactDOM.render( |
8 | - <React.StrictMode> | 12 | + <BrowserRouter history={history}> |
9 | <App /> | 13 | <App /> |
10 | - </React.StrictMode>, | 14 | + </BrowserRouter> |
15 | + , | ||
11 | document.getElementById('root') | 16 | document.getElementById('root') |
12 | ); | 17 | ); |
13 | 18 | ||
14 | -// If you want to start measuring performance in your app, pass a function | 19 | +// If you want your app to work offline and load faster, you can change |
15 | -// to log results (for example: reportWebVitals(console.log)) | 20 | +// unregister() to register() below. Note this comes with some pitfalls. |
16 | -// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals | 21 | +// Learn more about service workers: https://bit.ly/CRA-PWA |
17 | -reportWebVitals(); | 22 | +serviceWorker.unregister(); | ... | ... |
minsung/src/lib/api/checkFiles.js
0 → 100644
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 }); |
minsung/src/lib/api/client.js
0 → 100644
minsung/src/lib/api/feedback.js
0 → 100644
minsung/src/lib/api/html.js
0 → 100644
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 | + |
minsung/src/lib/api/login.js
0 → 100644
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 }); |
minsung/src/lib/api/matchInfo.js
0 → 100644
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 }); |
minsung/src/lib/api/mathCha.js
0 → 100644
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 | + |
minsung/src/lib/api/test.js
0 → 100644
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); |
minsung/src/lib/api/tikz.js
0 → 100644
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 }); |
minsung/src/lib/bluejuicer.png
0 → 100644
47.9 KB
minsung/src/lib/giflogo.gif
0 → 100644
705 KB
minsung/src/lib/graphconsole.png
0 → 100644
51.1 KB
minsung/src/lib/heartgraph.png
0 → 100644
5.76 KB
minsung/src/lib/latexlogo.png
0 → 100644
29.6 KB
minsung/src/lib/mathbank.png
0 → 100644
41.2 KB
minsung/src/lib/newspaper.jpg
0 → 100644
472 KB
minsung/src/lib/orangejuicer.png
0 → 100644
47.8 KB
minsung/src/lib/pngegg.png
0 → 100644
3.62 KB
minsung/src/lib/skybluejuicer.png
0 → 100644
47.5 KB
minsung/src/lib/yellowjuicer.png
0 → 100644
48 KB
-
Please register or login to post a comment