Skip to content

Commit

Permalink
初始
Browse files Browse the repository at this point in the history
  • Loading branch information
zqf1120qr committed May 15, 2023
1 parent f44ffd4 commit a9d1b98
Show file tree
Hide file tree
Showing 28 changed files with 342 additions and 162 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"antd-mobile": "^5.30.0",
"antd-mobile-icons": "^0.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.11.1",
"react-scripts": "5.0.1",
"swiper": "^9.3.1",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand Down
Binary file removed public/favicon.ico
Binary file not shown.
33 changes: 1 addition & 32 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,11 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>FakeShop</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Binary file removed public/logo192.png
Binary file not shown.
Binary file removed public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions public/manifest.json

This file was deleted.

3 changes: 0 additions & 3 deletions public/robots.txt

This file was deleted.

38 changes: 0 additions & 38 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -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);
}
}
21 changes: 5 additions & 16 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
import logo from './logo.svg';
import './App.css';
import { useRoutes } from "react-router-dom";
import {routes} from "./router/routers";

function App() {
const elements=useRoutes(routes)
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
<div>
{elements}
</div>
);
}
Expand Down
8 changes: 0 additions & 8 deletions src/App.test.js

This file was deleted.

5 changes: 5 additions & 0 deletions src/components/MenuBar/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.tabBar{
position:fixed;
bottom: 5px;
width: 100%;
}
46 changes: 46 additions & 0 deletions src/components/MenuBar/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from "react";
import {
MessageOutline,
UserOutline,
UnorderedListOutline,
HeartOutline,
AddOutline
} from "antd-mobile-icons";
import { TabBar } from "antd-mobile";
import { useNavigate, useLocation } from "react-router-dom";
import './index.css'
function getItem(title, key, icon) {
return {
key,
title,
icon,
};
}
const items = [
getItem("首页", "/home", <UnorderedListOutline />),
getItem("论坛", "/forum", <MessageOutline />),
getItem("发帖", "/post", <AddOutline />),
getItem("心愿单", "/like", <HeartOutline />),
getItem("我的", "/me", <UserOutline />),
];

export default function MenuBar() {
const navigate = useNavigate();
const location = useLocation();
const setRouteActive = e => {
navigate(e);
window.scrollTo(0,0);
};
return (
<TabBar
className='tabBar'
activeKey={location.pathname}
onChange={value => setRouteActive(value)}>
{items.map(item => (
<TabBar.Item key={item.key} icon={item.icon} title={item.title} />
))}
</TabBar>
);
}


13 changes: 0 additions & 13 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,13 +0,0 @@
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;
}
12 changes: 4 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import {BrowserRouter} from 'react-router-dom'
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
1 change: 0 additions & 1 deletion src/logo.svg

This file was deleted.

Empty file added src/pages/Forum/index.css
Empty file.
12 changes: 12 additions & 0 deletions src/pages/Forum/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import MenuBar from "../../components/MenuBar";
import './index.css'
export default function Forum() {
return (
<div>

<MenuBar></MenuBar>
</div>
);
}

8 changes: 8 additions & 0 deletions src/pages/GoodDetail/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react';

export default function GoodDetail() {
return (
<div>GoodDetail</div>
);
}

47 changes: 47 additions & 0 deletions src/pages/Home/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
*{
margin: 0;
padding: 0;
}
.container{
height: 300px;
width: 90%;
display: flex;
flex-direction: row;
margin: 5px auto;
color: #d11a2d;
}
.left{
border-radius: 3%;
/*background-color: #f8f4ed;*/
padding: 5px;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
}
.left img{
width: 90%;
height: 80%;
display: block;
margin: 5px auto;

}
.price{
display: inline-block;
color: #d11a2d;
}
.right{
flex: 1;
display: flex;
flex-direction: column;
}
.every{
width: 90%;
flex:1;
margin: 2px auto;
border-radius: 3%;
padding: 5px;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
}
.every img{
width: 80px;
height: 80px;

}
Loading

0 comments on commit a9d1b98

Please sign in to comment.