diff --git a/src/App.js b/src/App.js index c40341e..d092ed2 100644 --- a/src/App.js +++ b/src/App.js @@ -4,6 +4,7 @@ import ProgramType from "./ProgramType"; import Male from "./Male"; import Female from "./Female"; import Team from "./Team"; +import List from "./List"; import {HashRouter, Switch, Route} from 'react-router-dom'; class App extends React.Component { @@ -28,6 +29,9 @@ class App extends React.Component { + + + diff --git a/src/Female.js b/src/Female.js index 57a5d1d..1bb7e8c 100644 --- a/src/Female.js +++ b/src/Female.js @@ -124,6 +124,13 @@ class Female extends React.Component { to="/type"> 返回上级 + + 查看当前名单 + *': { + borderBottom: 'unset', + }, + }, +}); + + +function Row(props) { + const {row} = props; + const [open, setOpen] = React.useState(false); + const classes = useRowStyles(); + + return ( + + + + setOpen(!open)}> + {open ? '▲' : '▼'} + + + + {row.type} + + + + + + + + + + 项目 + 姓名 + + + + {row.list.map(line => ( + + + {line[0]} + + + {line[1]} + + + ))} + + + + + + + + ); +} + +const useStyles = theme => ({ + paper: { + marginTop: theme.spacing(8), + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + '& > *': { + marginTop: theme.spacing(2), + }, + }, + modalPaper: { + backgroundColor: theme.palette.background.paper, + border: '2px solid #000', + boxShadow: theme.shadows[5], + padding: theme.spacing(2, 4, 3), + }, + modal: { + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + }, +}); + +class List extends React.Component { + constructor(props) { + super(props); + this.state = { + loading: true, + modalContent: '加载中', + list: [], + }; + } + + componentDidMount() { + if (document.cookie.includes('jwt')) { + fetch('/get_list', { + method: 'Post' + }) + .then(response => response.json()) + .then(json => { + if (json.result === 'success') { + this.setState({loading: false, list: json.list}); + } else { + this.setState({modalContent: '加载失败'}); + } + }); + } + } + + handleCloseModal() { + this.setState({loading: false}); + } + + render() { + return ( + + + + + 当前名单 + + + + + {this.state.list && this.state.list.map(row => ( + + ))} + + + + + 返回报名 + + + + + + {this.state.modalContent} + + + + + ); + } +} + +export default withStyles(useStyles)(List); \ No newline at end of file diff --git a/src/Male.js b/src/Male.js index cfb7f62..4df3616 100644 --- a/src/Male.js +++ b/src/Male.js @@ -127,6 +127,13 @@ class Male extends React.Component { to="/type"> 返回上级 + + 查看当前名单 + ({ + buttonPaper: { + display: 'flex', + flexDirection: 'column', + textAlign: 'center', + '& > *': { + marginTop: theme.spacing(2), + }, + }, +}); + +class ProgramType extends React.Component { + render() { + return ( + + + + + 请选择项目类型 + + + 男子 + + + 女子 + + + 团体 + + + 查看当前名单 + + + + ); + } +} + +export default withStyles(useStyles)(ProgramType); \ No newline at end of file diff --git a/src/Team.js b/src/Team.js index eb795fa..9e0ceee 100644 --- a/src/Team.js +++ b/src/Team.js @@ -115,6 +115,13 @@ class Team extends React.Component { to="/type"> 返回上级 + + 查看当前名单 +
{this.state.modalContent}