Showing
6 changed files
with
94 additions
and
43 deletions
This diff is collapsed. Click to expand it.
... | @@ -16,17 +16,16 @@ import Toolbar from '@material-ui/core/Toolbar'; | ... | @@ -16,17 +16,16 @@ import Toolbar from '@material-ui/core/Toolbar'; |
16 | import IconButton from '@material-ui/core/IconButton'; | 16 | import IconButton from '@material-ui/core/IconButton'; |
17 | import Typography from '@material-ui/core/Typography'; | 17 | import Typography from '@material-ui/core/Typography'; |
18 | import InputBase from '@material-ui/core/InputBase'; | 18 | import InputBase from '@material-ui/core/InputBase'; |
19 | -import { fade } from '@material-ui/core/styles/colorManipulator'; | 19 | +import { fade, makeStyles } from '@material-ui/core/styles'; |
20 | import MenuIcon from '@material-ui/icons/Menu'; | 20 | import MenuIcon from '@material-ui/icons/Menu'; |
21 | import SearchIcon from '@material-ui/icons/Search'; | 21 | import SearchIcon from '@material-ui/icons/Search'; |
22 | 22 | ||
23 | - | ||
24 | const styles = theme => ({ | 23 | const styles = theme => ({ |
25 | root: { | 24 | root: { |
26 | width: '100%', | 25 | width: '100%', |
27 | minWidth:1080 | 26 | minWidth:1080 |
28 | }, | 27 | }, |
29 | - table: { | 28 | + paper: { |
30 | marginLeft:18, | 29 | marginLeft:18, |
31 | marginRight:18 | 30 | marginRight:18 |
32 | }, | 31 | }, |
... | @@ -96,8 +95,8 @@ const styles = theme => ({ | ... | @@ -96,8 +95,8 @@ const styles = theme => ({ |
96 | const students = [ | 95 | const students = [ |
97 | { | 96 | { |
98 | 'st_Code': 6666, | 97 | 'st_Code': 6666, |
99 | - 'st_Name': '육현진', | 98 | + //'st_Name': '육현진', |
100 | - 'st_Id': 2018102210, | 99 | + //'st_Id': 2018102210, |
101 | 'st_Major':'컴퓨터공학과', | 100 | 'st_Major':'컴퓨터공학과', |
102 | 'st_Midscore': 100, | 101 | 'st_Midscore': 100, |
103 | 'st_Finalscore': 100, | 102 | 'st_Finalscore': 100, |
... | @@ -107,8 +106,8 @@ const students = [ | ... | @@ -107,8 +106,8 @@ const students = [ |
107 | }, | 106 | }, |
108 | { | 107 | { |
109 | 'st_Code': 1111, | 108 | 'st_Code': 1111, |
110 | - 'st_Name': '김창동', | 109 | + //'st_Name': '김창동', |
111 | - 'st_Id': 2020021120, | 110 | + //'st_Id': 2020021120, |
112 | 'st_Major':'컴퓨터공학과', | 111 | 'st_Major':'컴퓨터공학과', |
113 | 'st_Midscore': 79, | 112 | 'st_Midscore': 79, |
114 | 'st_Finalscore': 85, | 113 | 'st_Finalscore': 85, |
... | @@ -174,8 +173,8 @@ class App extends Component{ | ... | @@ -174,8 +173,8 @@ class App extends Component{ |
174 | return <Student stateRefresh={this.stateRefresh} | 173 | return <Student stateRefresh={this.stateRefresh} |
175 | key={c.st_Code} | 174 | key={c.st_Code} |
176 | st_Code={c.st_Code} | 175 | st_Code={c.st_Code} |
177 | - st_Name={c.st_Name} | 176 | + //st_Name={c.st_Name} |
178 | - st_Id={c.st_Id} | 177 | + //st_Id={c.st_Id} |
179 | st_Major={c.st_Major} | 178 | st_Major={c.st_Major} |
180 | st_Midscore={c.st_Midscore} | 179 | st_Midscore={c.st_Midscore} |
181 | st_Finalscore={c.st_Finalscore} | 180 | st_Finalscore={c.st_Finalscore} |
... | @@ -186,7 +185,7 @@ class App extends Component{ | ... | @@ -186,7 +185,7 @@ class App extends Component{ |
186 | } | 185 | } |
187 | 186 | ||
188 | const {classes}= this.props; | 187 | const {classes}= this.props; |
189 | - const cellList=["코드번호","이름","학번","전공","중간","기말","과제","출석","설정"]; | 188 | + const cellList=["코드번호","이름","학번","전공","중간","기말","과제","출석","성적","설정"]; |
190 | return ( | 189 | return ( |
191 | <div className={classes.root}> | 190 | <div className={classes.root}> |
192 | <AppBar position="static"> | 191 | <AppBar position="static"> |
... | @@ -200,8 +199,9 @@ class App extends Component{ | ... | @@ -200,8 +199,9 @@ class App extends Component{ |
200 | <MenuIcon /> | 199 | <MenuIcon /> |
201 | </IconButton> | 200 | </IconButton> |
202 | <Typography className={classes.title} variant="h6" noWrap> | 201 | <Typography className={classes.title} variant="h6" noWrap> |
203 | - 학생 성적 관리 프로그램 | 202 | + 성적 조회 프로그램 |
204 | </Typography> | 203 | </Typography> |
204 | + | ||
205 | <div className={classes.search}> | 205 | <div className={classes.search}> |
206 | <div className={classes.searchIcon}> | 206 | <div className={classes.searchIcon}> |
207 | <SearchIcon /> | 207 | <SearchIcon /> |
... | @@ -212,14 +212,15 @@ class App extends Component{ | ... | @@ -212,14 +212,15 @@ class App extends Component{ |
212 | root: classes.inputRoot, | 212 | root: classes.inputRoot, |
213 | input: classes.inputInput, | 213 | input: classes.inputInput, |
214 | }} | 214 | }} |
215 | - name="searchKeyword" | 215 | + st_Name="searchKeyword" |
216 | value={this.state.searchKeyword} | 216 | value={this.state.searchKeyword} |
217 | onChange={this.handleValueChange} | 217 | onChange={this.handleValueChange} |
218 | - //inputProps={{ 'aria-label': 'search' }} | 218 | + inputProps={{ 'aria-label': 'search' }} |
219 | /> | 219 | /> |
220 | </div> | 220 | </div> |
221 | </Toolbar> | 221 | </Toolbar> |
222 | </AppBar> | 222 | </AppBar> |
223 | + | ||
223 | <div className={classes.menu}> | 224 | <div className={classes.menu}> |
224 | <StudentAdd stateRefresh={this.stateRefresh}/> | 225 | <StudentAdd stateRefresh={this.stateRefresh}/> |
225 | </div> | 226 | </div> | ... | ... |
... | @@ -36,8 +36,8 @@ class StudentAdd extends React.Component{ | ... | @@ -36,8 +36,8 @@ class StudentAdd extends React.Component{ |
36 | super(props); | 36 | super(props); |
37 | this.state={ | 37 | this.state={ |
38 | st_Code:'', | 38 | st_Code:'', |
39 | - st_Name:'', | 39 | + //st_Name:'', |
40 | - st_Id:'', | 40 | + //st_Id:'', |
41 | st_Major:'', | 41 | st_Major:'', |
42 | st_Midscore:'', | 42 | st_Midscore:'', |
43 | st_Finalscore:'', | 43 | st_Finalscore:'', |
... | @@ -57,8 +57,8 @@ class StudentAdd extends React.Component{ | ... | @@ -57,8 +57,8 @@ class StudentAdd extends React.Component{ |
57 | }) | 57 | }) |
58 | this.setState({ | 58 | this.setState({ |
59 | st_Code:'', | 59 | st_Code:'', |
60 | - st_Name:'', | 60 | + //st_Name:'', |
61 | - st_Id:'', | 61 | + //st_Id:'', |
62 | st_Major:'', | 62 | st_Major:'', |
63 | st_Midscore:'', | 63 | st_Midscore:'', |
64 | st_Finalscore:'', | 64 | st_Finalscore:'', |
... | @@ -80,8 +80,8 @@ class StudentAdd extends React.Component{ | ... | @@ -80,8 +80,8 @@ class StudentAdd extends React.Component{ |
80 | const url ='/api/students'; | 80 | const url ='/api/students'; |
81 | const formData=new FormData(); | 81 | const formData=new FormData(); |
82 | formData.append('st_Code',this.state.st_Code); | 82 | formData.append('st_Code',this.state.st_Code); |
83 | - formData.append('st_Name',this.state.st_Name); | 83 | + //formData.append('st_Name',this.state.st_Name); |
84 | - formData.append('st_Id',this.state.st_Id); | 84 | + //formData.append('st_Id',this.state.st_Id); |
85 | formData.append('st_Major',this.state.st_Major); | 85 | formData.append('st_Major',this.state.st_Major); |
86 | formData.append('st_Midscore',this.state.st_Midscore); | 86 | formData.append('st_Midscore',this.state.st_Midscore); |
87 | formData.append('st_Finalscore',this.state.st_Finalscore); | 87 | formData.append('st_Finalscore',this.state.st_Finalscore); |
... | @@ -106,8 +106,8 @@ class StudentAdd extends React.Component{ | ... | @@ -106,8 +106,8 @@ class StudentAdd extends React.Component{ |
106 | handleClose = () => { | 106 | handleClose = () => { |
107 | this.setState({ | 107 | this.setState({ |
108 | st_Code:'', | 108 | st_Code:'', |
109 | - st_Name:'', | 109 | + //st_Name:'', |
110 | - st_Id:'', | 110 | + //st_Id:'', |
111 | st_Major:'', | 111 | st_Major:'', |
112 | st_Midscore:'', | 112 | st_Midscore:'', |
113 | st_Finalscore:'', | 113 | st_Finalscore:'', |
... | @@ -123,20 +123,22 @@ class StudentAdd extends React.Component{ | ... | @@ -123,20 +123,22 @@ class StudentAdd extends React.Component{ |
123 | return( | 123 | return( |
124 | <div> | 124 | <div> |
125 | <Button variant="contained" color="primary" onClick={this.handleClickOpen}> | 125 | <Button variant="contained" color="primary" onClick={this.handleClickOpen}> |
126 | - 학생 추가하기 | 126 | + 등수확인 |
127 | </Button> | 127 | </Button> |
128 | + | ||
128 | <Dialog open={this.state.open} onClose={this.handleClose}> | 129 | <Dialog open={this.state.open} onClose={this.handleClose}> |
129 | <DialogTitle>학생 추가</DialogTitle> | 130 | <DialogTitle>학생 추가</DialogTitle> |
131 | + | ||
130 | <DialogContent> | 132 | <DialogContent> |
131 | <Textfield label="코드 번호" type="text" name="st_Code" value={this.state.st_Code} onChange={this.handleValueChange}/><br/> | 133 | <Textfield label="코드 번호" type="text" name="st_Code" value={this.state.st_Code} onChange={this.handleValueChange}/><br/> |
132 | - <Textfield label="이름" name="st_Name" value={this.state.st_Name} onChange={this.handleValueChange}/><br/> | 134 | + |
133 | - <Textfield label="학번" name="st_Id" value={this.state.st_Id} onChange={this.handleValueChange}/><br/> | 135 | + |
134 | - <Textfield label="전공" name="st_Major" value={this.state.st_Major} onChange={this.handleValueChange}/><br/> | 136 | + <Textfield label="전공" type="text" name="st_Major" value={this.state.st_Major} onChange={this.handleValueChange}/><br/> |
135 | - <Textfield label="중간 점수" name="st_Midscore" value={this.state.st_Midscore} onChange={this.handleValueChange}/><br/> | 137 | + <Textfield label="중간 점수" type="text" name="st_Midscore" value={this.state.st_Midscore} onChange={this.handleValueChange}/><br/> |
136 | - <Textfield label="기말 점수" name="st_Finalscore" value={this.state.st_Finalscore} onChange={this.handleValueChange}/><br/> | 138 | + <Textfield label="기말 점수" type="text" name="st_Finalscore" value={this.state.st_Finalscore} onChange={this.handleValueChange}/><br/> |
137 | - <Textfield label="과제 점수" name="st_Assignscore" value={this.state.st_Assignscore} onChange={this.handleValueChange}/><br/> | 139 | + <Textfield label="과제 점수" type="text" name="st_Assignscore" value={this.state.st_Assignscore} onChange={this.handleValueChange}/><br/> |
138 | - <Textfield label="출석 점수" name="st_Attendscore" value={this.state.st_Attendscore} onChange={this.handleValueChange}/><br/> | 140 | + <Textfield label="출석 점수" type="text" name="st_Attendscore" value={this.state.st_Attendscore} onChange={this.handleValueChange}/><br/> |
139 | - <Textfield label="학점" name="st_Score" value={this.state.st_Score} onChange={this.handleValueChange}/><br/> | 141 | + <Textfield label="학점" type="text" name="st_Score" value={this.state.st_Score} onChange={this.handleValueChange}/><br/> |
140 | </DialogContent> | 142 | </DialogContent> |
141 | <DialogActions> | 143 | <DialogActions> |
142 | <Button varient="contained" color="primary" onClick={this.handleFormSubmit}>추가</Button> | 144 | <Button varient="contained" color="primary" onClick={this.handleFormSubmit}>추가</Button> |
... | @@ -144,6 +146,12 @@ class StudentAdd extends React.Component{ | ... | @@ -144,6 +146,12 @@ class StudentAdd extends React.Component{ |
144 | </DialogActions> | 146 | </DialogActions> |
145 | </Dialog> | 147 | </Dialog> |
146 | </div> | 148 | </div> |
149 | + | ||
150 | + ) | ||
151 | + } | ||
152 | +} | ||
153 | + | ||
154 | +export default withStyles(styles)(StudentAdd); | ||
147 | /* | 155 | /* |
148 | <form onSubmit={this.handleFormSubmit}> | 156 | <form onSubmit={this.handleFormSubmit}> |
149 | <h1>학생 추가</h1> | 157 | <h1>학생 추가</h1> |
... | @@ -160,8 +168,3 @@ class StudentAdd extends React.Component{ | ... | @@ -160,8 +168,3 @@ class StudentAdd extends React.Component{ |
160 | 168 | ||
161 | </form> | 169 | </form> |
162 | */ | 170 | */ |
... | \ No newline at end of file | ... | \ No newline at end of file |
163 | - ) | ||
164 | - } | ||
165 | -} | ||
166 | - | ||
167 | -export default withStyles(styles)(StudentAdd); | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -52,7 +52,7 @@ class StudentDelete extends React.Component{ | ... | @@ -52,7 +52,7 @@ class StudentDelete extends React.Component{ |
52 | 52 | ||
53 | return( | 53 | return( |
54 | <div> | 54 | <div> |
55 | - <Button variant="contained" color="secondary" onClick={this.handleClickOpen}>삭제</Button> | 55 | + |
56 | <Dialog open={this.state.open} onClose={this.handleClose}> | 56 | <Dialog open={this.state.open} onClose={this.handleClose}> |
57 | <DialogTitle onClose={this.handleClose}> | 57 | <DialogTitle onClose={this.handleClose}> |
58 | 삭제 경고 | 58 | 삭제 경고 | ... | ... |
... | @@ -29,6 +29,7 @@ app.get('/api/students', (req, res)=>{ | ... | @@ -29,6 +29,7 @@ app.get('/api/students', (req, res)=>{ |
29 | "SELECT * FROM dbproject.Students WHERE isDeleted=0", | 29 | "SELECT * FROM dbproject.Students WHERE isDeleted=0", |
30 | (err,rows,fields)=>{ | 30 | (err,rows,fields)=>{ |
31 | res.send(rows); | 31 | res.send(rows); |
32 | + console.log(err); | ||
32 | } | 33 | } |
33 | ); | 34 | ); |
34 | }); | 35 | }); |
... | @@ -36,10 +37,10 @@ app.get('/api/students', (req, res)=>{ | ... | @@ -36,10 +37,10 @@ app.get('/api/students', (req, res)=>{ |
36 | app.use('/image', express.static('./upload')); | 37 | app.use('/image', express.static('./upload')); |
37 | 38 | ||
38 | app.post('/api/students',upload.single('image'), (req, res) =>{ | 39 | app.post('/api/students',upload.single('image'), (req, res) =>{ |
39 | - let sql = 'INSERT INTO dbproject.Students VALUES (?,?,?,?,?,?,?,?,?,now(),0)'; | 40 | + let sql = 'INSERT INTO dbproject.Students VALUES (?,?,?,?,?,?,?,?,?,now)'; |
40 | let st_Code= req.body.st_Code; | 41 | let st_Code= req.body.st_Code; |
41 | - let st_Name = req.body.st_Name; | 42 | + //let st_Name = req.body.st_Name; |
42 | - let st_Id = req.body.st_Id; | 43 | + //let st_Id = req.body.st_Id; |
43 | let st_Major = req.body.st_Major; | 44 | let st_Major = req.body.st_Major; |
44 | let st_Midscore = req.body.st_Midscore; | 45 | let st_Midscore = req.body.st_Midscore; |
45 | let st_Finalscore = req.body.st_Finalscore; | 46 | let st_Finalscore = req.body.st_Finalscore; |
... | @@ -47,8 +48,8 @@ app.post('/api/students',upload.single('image'), (req, res) =>{ | ... | @@ -47,8 +48,8 @@ app.post('/api/students',upload.single('image'), (req, res) =>{ |
47 | let st_Attendscore = req.body.st_Attendscore; | 48 | let st_Attendscore = req.body.st_Attendscore; |
48 | let st_Score = req.body.st_Score; | 49 | let st_Score = req.body.st_Score; |
49 | console.log(st_Code); | 50 | console.log(st_Code); |
50 | - console.log(st_Name); | 51 | + //console.log(st_Name); |
51 | - console.log(st_Id); | 52 | + //console.log(st_Id); |
52 | console.log(st_Major); | 53 | console.log(st_Major); |
53 | console.log(st_Midscore); | 54 | console.log(st_Midscore); |
54 | console.log(st_Finalscore); | 55 | console.log(st_Finalscore); |
... | @@ -56,8 +57,9 @@ app.post('/api/students',upload.single('image'), (req, res) =>{ | ... | @@ -56,8 +57,9 @@ app.post('/api/students',upload.single('image'), (req, res) =>{ |
56 | console.log(st_Attendscore); | 57 | console.log(st_Attendscore); |
57 | console.log(st_Score); | 58 | console.log(st_Score); |
58 | 59 | ||
59 | - let params=[st_Code, st_Name, | 60 | + let params=[st_Code, |
60 | - st_Id, | 61 | + //st_Name, |
62 | + //st_Id, | ||
61 | st_Major, | 63 | st_Major, |
62 | st_Midscore, | 64 | st_Midscore, |
63 | st_Finalscore, | 65 | st_Finalscore, | ... | ... |
코드.txt
0 → 100644
1 | + st_Code:'', | ||
2 | + st_Name | ||
3 | + st_Id | ||
4 | + st_Major | ||
5 | + st_Midscore | ||
6 | + st_Finalscore | ||
7 | + st_Assignscore | ||
8 | + st_Attendscore | ||
9 | + st_Score | ||
10 | + | ||
11 | + this.state.students.map(c=>{ | ||
12 | + return ( | ||
13 | + <Student stateRefresh={this.stateRefresh} | ||
14 | + key={c.st_Code} | ||
15 | + st_Code={c.st_Code} | ||
16 | + st_Name={c.st_Name} | ||
17 | + st_Id={c.st_Id} | ||
18 | + st_Major={c.st_Major} | ||
19 | + st_Midscore={c.st_Midscore} | ||
20 | + st_Finalscore={c.st_Finalscore} | ||
21 | + st_Assignscore={c.st_Assignscore} | ||
22 | + st_Attendscore={c.st_Attendscore} | ||
23 | + st_Score={c.st_Score} | ||
24 | + /> | ||
25 | + ); | ||
26 | + //<Button variant="contained" color = "secondary" onClick={this.handleClickOpen}>삭제</Button> | ||
27 | + | ||
28 | +<Textfield label="이름" type="text" name="st_Name" value={this.state.st_Name} onChange={this.handleValueChange}/><br/> | ||
29 | +<Textfield label="학번" type="text" name="st_Id" value={this.state.st_Id} onChange={this.handleValueChange}/><br/> | ||
30 | + | ||
31 | +SELECT @RNUM := @RNUM + 1 AS ROWNUM, t.* | ||
32 | + | ||
33 | +FROM | ||
34 | + | ||
35 | + ( | ||
36 | + | ||
37 | + SELECT * | ||
38 | + | ||
39 | + FROM dbproject.Students | ||
40 | + | ||
41 | + ORDER BY st_Score | ||
42 | + | ||
43 | + ) t, | ||
44 | + | ||
45 | + ( SELECT @RNUM := 0 ) R | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment