mirror of
https://github.com/PlayEdu/backend
synced 2025-06-07 05:54:15 +08:00
初步框架
This commit is contained in:
parent
46a8387515
commit
3dff7f139d
29038
package-lock.json
generated
Normal file
29038
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -10,8 +10,11 @@
|
||||
"@types/node": "^16.7.13",
|
||||
"@types/react": "^18.0.0",
|
||||
"@types/react-dom": "^18.0.0",
|
||||
"antd": "^5.2.3",
|
||||
"axios": "^1.3.4",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-router-dom": "^6.8.2",
|
||||
"react-scripts": "5.0.1",
|
||||
"typescript": "^4.4.2",
|
||||
"web-vitals": "^2.1.0"
|
||||
|
38
src/App.css
38
src/App.css
@ -1,38 +0,0 @@
|
||||
.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);
|
||||
}
|
||||
}
|
3
src/App.module.css
Normal file
3
src/App.module.css
Normal file
@ -0,0 +1,3 @@
|
||||
.App {
|
||||
background-color: #f6f6f6;
|
||||
}
|
33
src/App.tsx
33
src/App.tsx
@ -1,24 +1,21 @@
|
||||
import React from 'react';
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
import React from "react";
|
||||
import styles from "./App.module.css";
|
||||
import { BrowserRouter, Routes, Route } from "react-router-dom";
|
||||
import { Login, HomePage } from "./pages";
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.tsx</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
<div className={styles.App}>
|
||||
<BrowserRouter>
|
||||
<Routes>
|
||||
<Route path="/" element={<HomePage></HomePage>}></Route>
|
||||
<Route path="/login" element={<Login></Login>}></Route>
|
||||
<Route
|
||||
path="*"
|
||||
element={<h1>404 not found 页面去火星了!</h1>}
|
||||
></Route>
|
||||
</Routes>
|
||||
</BrowserRouter>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
9
src/api/categories.ts
Normal file
9
src/api/categories.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import axios from "axios";
|
||||
|
||||
export const getCategoriesAsync = (params: any) =>
|
||||
axios.get("/categroy/findCategroy", {
|
||||
params: params,
|
||||
});
|
||||
|
||||
export const addCategoriesAsync = (data: any) =>
|
||||
axios.post("/categroy/addCategroy", data);
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
0
src/compenents/footer/Footer.module.css
Normal file
0
src/compenents/footer/Footer.module.css
Normal file
33
src/compenents/footer/Footer.tsx
Normal file
33
src/compenents/footer/Footer.tsx
Normal file
@ -0,0 +1,33 @@
|
||||
import React from "react";
|
||||
import styles from "./Footer.module.css";
|
||||
import { Layout, Typography } from "antd";
|
||||
|
||||
export const Footer: React.FC = () => {
|
||||
return (
|
||||
<Layout.Footer
|
||||
style={{ backgroundColor: "#0F0A1E", height: 103, paddingTop: 30 }}
|
||||
>
|
||||
<Typography.Title
|
||||
style={{
|
||||
textAlign: "center",
|
||||
fontSize: 12,
|
||||
color: "#FFFFFF",
|
||||
opacity: 0.3,
|
||||
}}
|
||||
>
|
||||
© 2021 PlayEdu • 粤ICP备20026280号-01
|
||||
</Typography.Title>
|
||||
<Typography.Title
|
||||
style={{
|
||||
textAlign: "center",
|
||||
fontSize: 12,
|
||||
color: "#FFFFFF",
|
||||
opacity: 0.3,
|
||||
marginTop: 19,
|
||||
}}
|
||||
>
|
||||
Powered By 杭州白书科技
|
||||
</Typography.Title>
|
||||
</Layout.Footer>
|
||||
);
|
||||
};
|
1
src/compenents/footer/index.ts
Normal file
1
src/compenents/footer/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from "./Footer";
|
46
src/compenents/header/Header.module.css
Normal file
46
src/compenents/header/Header.module.css
Normal file
@ -0,0 +1,46 @@
|
||||
.app-header {
|
||||
background-color: white !important;
|
||||
}
|
||||
|
||||
.main-menu {
|
||||
padding-left: 6% !important;
|
||||
padding-right: 6% !important;
|
||||
background-color: #1976d2 !important;
|
||||
color: #f5f5f5 !important;
|
||||
}
|
||||
|
||||
.button-group {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.main-header {
|
||||
width: 1200px;
|
||||
background-color: white !important;
|
||||
height: 70px;
|
||||
line-height: 70px;
|
||||
width: 1200px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
width: 151px;
|
||||
height: 40px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.top-main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
line-height: 64px !important;
|
||||
display: inline;
|
||||
color: #03a9f4 !important;
|
||||
}
|
||||
|
||||
|
30
src/compenents/header/Header.tsx
Normal file
30
src/compenents/header/Header.tsx
Normal file
@ -0,0 +1,30 @@
|
||||
import React from "react";
|
||||
import styles from "./Header.module.css";
|
||||
import logo from "../../assets/logo.svg";
|
||||
import { Layout, Typography, Menu, Button, Dropdown, MenuProps } from "antd";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
|
||||
|
||||
export const Header: React.FC = () => {
|
||||
|
||||
|
||||
return (
|
||||
<div className={styles["app-header"]}>
|
||||
<Layout.Header className={styles["main-header"]}>
|
||||
<Link
|
||||
className={styles["top-main"]}
|
||||
style={{ textDecoration: "none" }}
|
||||
to={`/`}
|
||||
>
|
||||
<img src={logo} alt="" className={styles["App-logo"]} />
|
||||
</Link>
|
||||
<Button.Group className={styles["button-group"]}>
|
||||
<Link style={{ textDecoration: "none" }} to={`/login`}>
|
||||
<Button>登录</Button>
|
||||
</Link>
|
||||
</Button.Group>
|
||||
</Layout.Header>
|
||||
</div>
|
||||
);
|
||||
};
|
1
src/compenents/header/index.ts
Normal file
1
src/compenents/header/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from "./Header";
|
2
src/compenents/index.ts
Normal file
2
src/compenents/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from "./footer";
|
||||
export * from "./header";
|
4
src/custom.d.ts
vendored
Normal file
4
src/custom.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
declare module "*.css" {
|
||||
const css: { [key: string]: string };
|
||||
export default css;
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
import "./index.css";
|
||||
import App from "./App";
|
||||
import reportWebVitals from "./reportWebVitals";
|
||||
import "./utils/axios";
|
||||
|
||||
const root = ReactDOM.createRoot(
|
||||
document.getElementById('root') as HTMLElement
|
||||
document.getElementById("root") as HTMLElement
|
||||
);
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
|
8
src/pages/home/HomePage.module.css
Normal file
8
src/pages/home/HomePage.module.css
Normal file
@ -0,0 +1,8 @@
|
||||
.page-content {
|
||||
width: 1200px;
|
||||
min-height: calc(100vh - 173px);
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
margin-top: 30px;
|
||||
margin-bottom: 100px;
|
||||
}
|
13
src/pages/home/HomePage.tsx
Normal file
13
src/pages/home/HomePage.tsx
Normal file
@ -0,0 +1,13 @@
|
||||
import React from "react";
|
||||
import styles from "./HomePage.module.css";
|
||||
import { Header, Footer } from "../../compenents";
|
||||
|
||||
export const HomePage: React.FC = () => {
|
||||
return (
|
||||
<>
|
||||
<Header></Header>
|
||||
<div className={styles["page-content"]}>主页</div>
|
||||
<Footer></Footer>
|
||||
</>
|
||||
);
|
||||
};
|
1
src/pages/home/index.ts
Normal file
1
src/pages/home/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from "./HomePage";
|
2
src/pages/index.ts
Normal file
2
src/pages/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from "./home";
|
||||
export * from "./login";
|
0
src/pages/login/Login.module.css
Normal file
0
src/pages/login/Login.module.css
Normal file
6
src/pages/login/Login.tsx
Normal file
6
src/pages/login/Login.tsx
Normal file
@ -0,0 +1,6 @@
|
||||
import React from "react";
|
||||
import styles from "./Login.module.css";
|
||||
|
||||
export const Login: React.FC = () => {
|
||||
return <h1>登录页面</h1>;
|
||||
};
|
1
src/pages/login/index.ts
Normal file
1
src/pages/login/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from "./Login";
|
12
src/utils/axios.ts
Normal file
12
src/utils/axios.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import axios from "axios";
|
||||
|
||||
axios.defaults.timeout = 10000;
|
||||
axios.defaults.headers.Authorization = "Bearer ";
|
||||
axios.defaults.headers.common["meedu-platform"] = "backend";
|
||||
axios.defaults.baseURL = "https://dev-local.meedu.vip/";
|
||||
|
||||
// 响应拦截器
|
||||
axios.interceptors.response.use(
|
||||
(res) => res.data, // 拦截到响应对象,将响应对象的 data 属性返回给调用的地方
|
||||
(err) => Promise.reject(err)
|
||||
);
|
Loading…
x
Reference in New Issue
Block a user