-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sgpublic
committed
Jun 8, 2021
1 parent
8757aaf
commit f164eff
Showing
30 changed files
with
266 additions
and
203 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,17 @@ | ||
# Getting Started with Create React App | ||
# 工科助手 Web | ||
|
||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). | ||
工科助手网页版适用于四川工业科技学院学生,旨在为师生提供一个更好的教务交互体验,并扩展支持更多使用功能。 | ||
|
||
## Available Scripts | ||
## 项目使用 | ||
|
||
In the project directory, you can run: | ||
启动项目 | ||
|
||
### `npm start` | ||
``` | ||
npm start | ||
``` | ||
|
||
Runs the app in the development mode.\ | ||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
编译 | ||
|
||
The page will reload if you make edits.\ | ||
You will also see any lint errors in the console. | ||
|
||
### `npm test` | ||
|
||
Launches the test runner in the interactive watch mode.\ | ||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. | ||
|
||
### `npm run build` | ||
|
||
Builds the app for production to the `build` folder.\ | ||
It correctly bundles React in production mode and optimizes the build for the best performance. | ||
|
||
The build is minified and the filenames include the hashes.\ | ||
Your app is ready to be deployed! | ||
|
||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. | ||
|
||
### `npm run eject` | ||
|
||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!** | ||
|
||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. | ||
|
||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. | ||
|
||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. | ||
|
||
## Learn More | ||
|
||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). | ||
|
||
To learn React, check out the [React documentation](https://reactjs.org/). | ||
``` | ||
npm run build | ||
``` |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import './res/css/index.css'; | ||
import App from './ts/pages/App'; | ||
import {BrowserRouter} from "react-router-dom"; | ||
import App from "./ts/App"; | ||
|
||
ReactDOM.render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode>, | ||
<BrowserRouter> | ||
<App /> | ||
</BrowserRouter>, | ||
document.getElementById('root') | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,5 @@ | ||
.App { | ||
text-align: center; | ||
} | ||
|
||
.App-logo { | ||
height: 40vmin; | ||
pointer-events: none; | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
.App-logo { | ||
animation: App-logo-spin infinite 20s linear; | ||
} | ||
} | ||
|
||
.App-header { | ||
background-color: #282c34; | ||
min-height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
font-size: calc(10px + 2vmin); | ||
color: white; | ||
} | ||
|
||
.App-link { | ||
color: #61dafb; | ||
} | ||
|
||
@keyframes App-logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
#components-layout-demo-side .logo { | ||
height: 32px; | ||
margin: 16px; | ||
background: rgba(255, 255, 255, 0.3); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.primary-background { | ||
background: transparent; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#welcome-logo { | ||
width: 200px; | ||
height: 200px; | ||
} | ||
|
||
#welcome-base { | ||
position: absolute; | ||
left: 50%; | ||
top: 50%; | ||
transform: translate(-50%, -100%); | ||
} | ||
|
||
welcome-loading { | ||
width: 100%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,3 @@ | ||
body { | ||
margin: 0; | ||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', | ||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', | ||
sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} | ||
|
||
code { | ||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', | ||
monospace; | ||
} | ||
.primary-background { | ||
background: #fff; | ||
} |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {ReactComponentCompact} from "./core/ReactComponentCompact"; | ||
import {Route, Switch, withRouter} from "react-router-dom"; | ||
import Login from "./pages/Login"; | ||
import Welcome from "./pages/Welcome"; | ||
import Home from "./pages/Home"; | ||
|
||
class App extends ReactComponentCompact { | ||
render() { | ||
const location = this.props.location | ||
return ( | ||
<Switch location={location}> | ||
<Route exact path={"/"} component={Welcome} /> | ||
<Route exact path={"/login"} component={Login} /> | ||
<Route path={"/home"} component={Home} /> | ||
</Switch> | ||
) | ||
} | ||
} | ||
|
||
export default withRouter(App) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export class HomeSiderData { | ||
public readonly icon: string; | ||
public readonly title: string; | ||
public readonly key: string; | ||
public readonly child: Array<HomeSiderChildData>; | ||
public readonly path: string; | ||
|
||
constructor(image: string, title: string, key: string, child: Array<HomeSiderChildData>, path: string) { | ||
this.icon = image; | ||
this.title = title; | ||
this.key = key; | ||
this.child = child; | ||
this.path = path; | ||
} | ||
} | ||
|
||
export class HomeSiderChildData { | ||
public readonly title: string; | ||
public readonly key: string; | ||
public readonly path: string; | ||
|
||
constructor(title: string, key: string, path: any) { | ||
this.title = title; | ||
this.key = key; | ||
this.path = path; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import {ReactComponentCompact} from "../core/ReactComponentCompact"; | ||
import "../../res/css/Home.css" | ||
|
||
import {withRouter} from "react-router-dom"; | ||
import {Layout, Menu} from "antd"; | ||
import {HomeSiderData} from "../data/HomeSiderData"; | ||
|
||
const { Header, Content, Footer, Sider } = Layout; | ||
const { SubMenu } = Menu; | ||
|
||
class Home extends ReactComponentCompact { | ||
state = { | ||
collapsed: false, | ||
sider_items: new Array<HomeSiderData>(), | ||
}; | ||
|
||
onCollapse = (collapsed: boolean) => { | ||
console.log(collapsed); | ||
this.setState({ collapsed }); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<Layout> | ||
<Header className={"primary-background"}> | ||
<div className={"logo"} /> | ||
</Header> | ||
<Content> | ||
<Layout style={{ minHeight: '100vh'}}> | ||
<Sider className={"primary-background"} collapsible collapsed={this.state.collapsed} | ||
onCollapse={this.onCollapse}> | ||
<Menu theme={this.theme.menu} mode={"inline"}>{ | ||
this.state.sider_items.map((data) => { | ||
if (data.child.length > 0){ | ||
return ( | ||
<SubMenu key={data.key} icon={data.icon} title={data.title}>{ | ||
data.child.map((index) => { | ||
return ( | ||
<Menu.Item key={index.key} | ||
onClick={() => this.props.history.replace(data.path)}> | ||
{index.title} | ||
</Menu.Item> | ||
) | ||
}) | ||
}</SubMenu> | ||
) | ||
} else { | ||
return ( | ||
<Menu.Item key={data.key} icon={data.icon} | ||
onClick={() => this.props.history.replace(data.path)}> | ||
{data.title} | ||
</Menu.Item> | ||
) | ||
} | ||
}) | ||
}</Menu> | ||
</Sider> | ||
</Layout> | ||
</Content> | ||
<Footer> | ||
|
||
</Footer> | ||
</Layout> | ||
) | ||
} | ||
} | ||
|
||
export default withRouter(Home) |
Oops, something went wrong.