육현진

add usermode page

This diff is collapsed. Click to expand it.
......@@ -16,17 +16,16 @@ import Toolbar from '@material-ui/core/Toolbar';
import IconButton from '@material-ui/core/IconButton';
import Typography from '@material-ui/core/Typography';
import InputBase from '@material-ui/core/InputBase';
import { fade } from '@material-ui/core/styles/colorManipulator';
import { fade, makeStyles } from '@material-ui/core/styles';
import MenuIcon from '@material-ui/icons/Menu';
import SearchIcon from '@material-ui/icons/Search';
const styles = theme => ({
root: {
width: '100%',
minWidth:1080
},
table: {
paper: {
marginLeft:18,
marginRight:18
},
......@@ -96,8 +95,8 @@ const styles = theme => ({
const students = [
{
'st_Code': 6666,
'st_Name': '육현진',
'st_Id': 2018102210,
//'st_Name': '육현진',
//'st_Id': 2018102210,
'st_Major':'컴퓨터공학과',
'st_Midscore': 100,
'st_Finalscore': 100,
......@@ -107,8 +106,8 @@ const students = [
},
{
'st_Code': 1111,
'st_Name': '김창동',
'st_Id': 2020021120,
//'st_Name': '김창동',
//'st_Id': 2020021120,
'st_Major':'컴퓨터공학과',
'st_Midscore': 79,
'st_Finalscore': 85,
......@@ -174,8 +173,8 @@ class App extends Component{
return <Student stateRefresh={this.stateRefresh}
key={c.st_Code}
st_Code={c.st_Code}
st_Name={c.st_Name}
st_Id={c.st_Id}
//st_Name={c.st_Name}
//st_Id={c.st_Id}
st_Major={c.st_Major}
st_Midscore={c.st_Midscore}
st_Finalscore={c.st_Finalscore}
......@@ -186,7 +185,7 @@ class App extends Component{
}
const {classes}= this.props;
const cellList=["코드번호","이름","학번","전공","중간","기말","과제","출석","설정"];
const cellList=["코드번호","이름","학번","전공","중간","기말","과제","출석","성적","설정"];
return (
<div className={classes.root}>
<AppBar position="static">
......@@ -200,8 +199,9 @@ class App extends Component{
<MenuIcon />
</IconButton>
<Typography className={classes.title} variant="h6" noWrap>
학생 성적 관리 프로그램
성적 조회 프로그램
</Typography>
<div className={classes.search}>
<div className={classes.searchIcon}>
<SearchIcon />
......@@ -212,14 +212,15 @@ class App extends Component{
root: classes.inputRoot,
input: classes.inputInput,
}}
name="searchKeyword"
st_Name="searchKeyword"
value={this.state.searchKeyword}
onChange={this.handleValueChange}
//inputProps={{ 'aria-label': 'search' }}
inputProps={{ 'aria-label': 'search' }}
/>
</div>
</Toolbar>
</AppBar>
<div className={classes.menu}>
<StudentAdd stateRefresh={this.stateRefresh}/>
</div>
......
......@@ -36,8 +36,8 @@ class StudentAdd extends React.Component{
super(props);
this.state={
st_Code:'',
st_Name:'',
st_Id:'',
//st_Name:'',
//st_Id:'',
st_Major:'',
st_Midscore:'',
st_Finalscore:'',
......@@ -57,8 +57,8 @@ class StudentAdd extends React.Component{
})
this.setState({
st_Code:'',
st_Name:'',
st_Id:'',
//st_Name:'',
//st_Id:'',
st_Major:'',
st_Midscore:'',
st_Finalscore:'',
......@@ -80,8 +80,8 @@ class StudentAdd extends React.Component{
const url ='/api/students';
const formData=new FormData();
formData.append('st_Code',this.state.st_Code);
formData.append('st_Name',this.state.st_Name);
formData.append('st_Id',this.state.st_Id);
//formData.append('st_Name',this.state.st_Name);
//formData.append('st_Id',this.state.st_Id);
formData.append('st_Major',this.state.st_Major);
formData.append('st_Midscore',this.state.st_Midscore);
formData.append('st_Finalscore',this.state.st_Finalscore);
......@@ -106,8 +106,8 @@ class StudentAdd extends React.Component{
handleClose = () => {
this.setState({
st_Code:'',
st_Name:'',
st_Id:'',
//st_Name:'',
//st_Id:'',
st_Major:'',
st_Midscore:'',
st_Finalscore:'',
......@@ -123,20 +123,22 @@ class StudentAdd extends React.Component{
return(
<div>
<Button variant="contained" color="primary" onClick={this.handleClickOpen}>
학생 추가하기
등수확인
</Button>
<Dialog open={this.state.open} onClose={this.handleClose}>
<DialogTitle>학생 추가</DialogTitle>
<DialogContent>
<Textfield label="코드 번호" type="text" name="st_Code" value={this.state.st_Code} onChange={this.handleValueChange}/><br/>
<Textfield label="이름" name="st_Name" value={this.state.st_Name} onChange={this.handleValueChange}/><br/>
<Textfield label="학번" name="st_Id" value={this.state.st_Id} onChange={this.handleValueChange}/><br/>
<Textfield label="전공" name="st_Major" value={this.state.st_Major} onChange={this.handleValueChange}/><br/>
<Textfield label="중간 점수" name="st_Midscore" value={this.state.st_Midscore} onChange={this.handleValueChange}/><br/>
<Textfield label="기말 점수" name="st_Finalscore" value={this.state.st_Finalscore} onChange={this.handleValueChange}/><br/>
<Textfield label="과제 점수" name="st_Assignscore" value={this.state.st_Assignscore} onChange={this.handleValueChange}/><br/>
<Textfield label="출석 점수" name="st_Attendscore" value={this.state.st_Attendscore} onChange={this.handleValueChange}/><br/>
<Textfield label="학점" name="st_Score" value={this.state.st_Score} onChange={this.handleValueChange}/><br/>
<Textfield label="전공" type="text" name="st_Major" value={this.state.st_Major} onChange={this.handleValueChange}/><br/>
<Textfield label="중간 점수" type="text" name="st_Midscore" value={this.state.st_Midscore} onChange={this.handleValueChange}/><br/>
<Textfield label="기말 점수" type="text" name="st_Finalscore" value={this.state.st_Finalscore} onChange={this.handleValueChange}/><br/>
<Textfield label="과제 점수" type="text" name="st_Assignscore" value={this.state.st_Assignscore} onChange={this.handleValueChange}/><br/>
<Textfield label="출석 점수" type="text" name="st_Attendscore" value={this.state.st_Attendscore} onChange={this.handleValueChange}/><br/>
<Textfield label="학점" type="text" name="st_Score" value={this.state.st_Score} onChange={this.handleValueChange}/><br/>
</DialogContent>
<DialogActions>
<Button varient="contained" color="primary" onClick={this.handleFormSubmit}>추가</Button>
......@@ -144,6 +146,12 @@ class StudentAdd extends React.Component{
</DialogActions>
</Dialog>
</div>
)
}
}
export default withStyles(styles)(StudentAdd);
/*
<form onSubmit={this.handleFormSubmit}>
<h1>학생 추가</h1>
......@@ -160,8 +168,3 @@ class StudentAdd extends React.Component{
</form>
*/
\ No newline at end of file
)
}
}
export default withStyles(styles)(StudentAdd);
\ No newline at end of file
......
......@@ -52,7 +52,7 @@ class StudentDelete extends React.Component{
return(
<div>
<Button variant="contained" color="secondary" onClick={this.handleClickOpen}>삭제</Button>
<Dialog open={this.state.open} onClose={this.handleClose}>
<DialogTitle onClose={this.handleClose}>
삭제 경고
......
......@@ -29,6 +29,7 @@ app.get('/api/students', (req, res)=>{
"SELECT * FROM dbproject.Students WHERE isDeleted=0",
(err,rows,fields)=>{
res.send(rows);
console.log(err);
}
);
});
......@@ -36,10 +37,10 @@ app.get('/api/students', (req, res)=>{
app.use('/image', express.static('./upload'));
app.post('/api/students',upload.single('image'), (req, res) =>{
let sql = 'INSERT INTO dbproject.Students VALUES (?,?,?,?,?,?,?,?,?,now(),0)';
let sql = 'INSERT INTO dbproject.Students VALUES (?,?,?,?,?,?,?,?,?,now)';
let st_Code= req.body.st_Code;
let st_Name = req.body.st_Name;
let st_Id = req.body.st_Id;
//let st_Name = req.body.st_Name;
//let st_Id = req.body.st_Id;
let st_Major = req.body.st_Major;
let st_Midscore = req.body.st_Midscore;
let st_Finalscore = req.body.st_Finalscore;
......@@ -47,8 +48,8 @@ app.post('/api/students',upload.single('image'), (req, res) =>{
let st_Attendscore = req.body.st_Attendscore;
let st_Score = req.body.st_Score;
console.log(st_Code);
console.log(st_Name);
console.log(st_Id);
//console.log(st_Name);
//console.log(st_Id);
console.log(st_Major);
console.log(st_Midscore);
console.log(st_Finalscore);
......@@ -56,8 +57,9 @@ app.post('/api/students',upload.single('image'), (req, res) =>{
console.log(st_Attendscore);
console.log(st_Score);
let params=[st_Code, st_Name,
st_Id,
let params=[st_Code,
//st_Name,
//st_Id,
st_Major,
st_Midscore,
st_Finalscore,
......
st_Code:'',
st_Name
st_Id
st_Major
st_Midscore
st_Finalscore
st_Assignscore
st_Attendscore
st_Score
this.state.students.map(c=>{
return (
<Student stateRefresh={this.stateRefresh}
key={c.st_Code}
st_Code={c.st_Code}
st_Name={c.st_Name}
st_Id={c.st_Id}
st_Major={c.st_Major}
st_Midscore={c.st_Midscore}
st_Finalscore={c.st_Finalscore}
st_Assignscore={c.st_Assignscore}
st_Attendscore={c.st_Attendscore}
st_Score={c.st_Score}
/>
);
//<Button variant="contained" color = "secondary" onClick={this.handleClickOpen}>삭제</Button>
<Textfield label="이름" type="text" name="st_Name" value={this.state.st_Name} onChange={this.handleValueChange}/><br/>
<Textfield label="학번" type="text" name="st_Id" value={this.state.st_Id} onChange={this.handleValueChange}/><br/>
SELECT @RNUM := @RNUM + 1 AS ROWNUM, t.*
FROM
(
SELECT *
FROM dbproject.Students
ORDER BY st_Score
) t,
( SELECT @RNUM := 0 ) R
\ No newline at end of file