初步框架

This commit is contained in:
禺狨 2023-03-01 17:26:17 +08:00
parent 46a8387515
commit 3dff7f139d
25 changed files with 36399 additions and 6545 deletions

29038
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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"

View File

@ -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
View File

@ -0,0 +1,3 @@
.App {
background-color: #f6f6f6;
}

View File

@ -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
View 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);

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

View 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>
);
};

View File

@ -0,0 +1 @@
export * from "./Footer";

View 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;
}

View 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>
);
};

View File

@ -0,0 +1 @@
export * from "./Header";

2
src/compenents/index.ts Normal file
View File

@ -0,0 +1,2 @@
export * from "./footer";
export * from "./header";

4
src/custom.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
declare module "*.css" {
const css: { [key: string]: string };
export default css;
}

View File

@ -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>

View 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;
}

View 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
View File

@ -0,0 +1 @@
export * from "./HomePage";

2
src/pages/index.ts Normal file
View File

@ -0,0 +1,2 @@
export * from "./home";
export * from "./login";

View File

View 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
View File

@ -0,0 +1 @@
export * from "./Login";

12
src/utils/axios.ts Normal file
View 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)
);

13647
yarn.lock

File diff suppressed because it is too large Load Diff