Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
LogicDX342 committed Apr 14, 2024
2 parents ad558d8 + 8d8a084 commit 4594000
Show file tree
Hide file tree
Showing 183 changed files with 11,733 additions and 141 deletions.
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/team-project-24spring-34.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added client/package-lock.json
Empty file.
11 changes: 9 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@
"@emotion/styled": "^11.11.0",
"@fontsource/roboto": "^5.0.12",
"@mui/icons-material": "^5.15.14",
"@mui/material": "^5.15.14",
"@mui/material": "^5.12.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.6.8",
"chroma-js": "^2.4.2",
"localforage": "^1.10.0",
"match-sorter": "^6.3.4",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-flatpickr": "^3.10.13",
"react-router-dom": "^6.22.3",
"react-scripts": "5.0.1",
"sort-by": "^1.2.0",
Expand Down Expand Up @@ -44,5 +47,9 @@
"last 1 firefox version",
"last 1 safari version"
]
}
},
"description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).",
"main": "index.js",
"author": "",
"license": "ISC"
}
15 changes: 2 additions & 13 deletions client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
import logo from './logo.svg';
import './App.css';
import Mainpage from './mainpage/Mainpage';

function App() {
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>
<Mainpage />
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/App.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {render, screen} from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {
Expand Down
45 changes: 45 additions & 0 deletions client/src/Booking_page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React, { useState, useEffect } from 'react';
import { TextField, Button } from '@mui/material';

const BookingPage = () => {
const [seats, setSeats] = useState([
{ id: 1, row: 1, col: 1, status: 'available' },
{ id: 2, row: 1, col: 2, status: 'available' },
]);

const handleSeatSelect = (seatId) => {
setSeats(prevSeats => prevSeats.map(seat => {
if (seat.id === seatId) {
return { ...seat, status: seat.status === 'available' ? 'selected' : 'available' };
}
return seat;
}));
};

const handleConfirm = () => {
console.log('Selected seats:', seats.filter(seat => seat.status === 'selected'));
};

return (
<div>
<h2>Seat Reservation</h2>
<table>
<tbody>
{seats.map(seat => (
<tr key={seat.id}>
<td
className={seat.status}
onClick={() => handleSeatSelect(seat.id)}
>
{seat.row} - {seat.col}
</td>
</tr>
))}
</tbody>
</table>
<button onClick={handleConfirm}>Confirm</button>
</div>
);
};

export default BookingPage;
Empty file added client/src/Detail_page.css
Empty file.
87 changes: 87 additions & 0 deletions client/src/Detial_page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// ActivityDetails.js
import React, { useState, useEffect } from 'react';
import example_img from './example-poster.jpg';
import sample_text from './sample-text.txt';
import { TextField, Button } from '@mui/material';

async function fetchActivityDescription() {
try{
// const response = await fetch('http://localhost:3306/activity-description');
// const data = await response.json();

// 用于测试的假数据
const response = await fetch(sample_text);
const data = await response.text();
return data;
} catch (error) {
console.error(error);
}
}

function ActivityDetails() {
const [activityDescription, setActivityDescription] = React.useState('');//用户文本
const [activityTitle, setActivityTitle] = React.useState('');//活动标题

const redirectToBookingPage = () => {
window.location.href = "/booking";
};

useEffect(() => {
async function fetchData() {
const data = await fetchActivityDescription();
setActivityDescription(data);
}
fetchData();
async function fetchTitle() {
// const response = await fetch('http://localhost:3306/activity-title');
// const data = await response.json();

// 用于测试的假数据
const data = '示例标题';
setActivityTitle(data);
}
fetchTitle();
}, []);

return (
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
<div>
<h1 style={{ textAlign: 'center', fontSize: '4rem' }}>{activityTitle}</h1>
</div>

<div style={{justifyContent: 'space-around', display: 'flex', width: '100%'}}>
{/* 图片 */}
<img
src={example_img}
alt="活动海报"
style={{display: 'flex',width: '50%', height: 'auto' }}
/>
<div style={{display: 'flex',width: '50%', fontSize: '2rem', flexDirection: 'column'}}>
{/* 活动信息模块 */}
<p>活动时间:2024-04-015 12:00</p>
<p>活动地点:示例地点</p>
<p>活动主办方:示例主办方</p>
<p>活动介绍</p>
<div>
{/* 用户自定义文本模块 */}
{activityDescription}
</div>
</div>

</div>

<div style={{ textAlign: 'center', marginTop: '20px', fontSize: '2rem'}}>
<div>
<p>剩余座位数:50</p>
<Button variant="contained" onClick={redirectToBookingPage}>预定</Button>
</div>

<div style={{ marginTop: '20px'}}>
{/* 评论区 */}
</div>
</div>
</div>
);
}

export default ActivityDetails;
Loading

0 comments on commit 4594000

Please sign in to comment.