-
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
Showing
13 changed files
with
179 additions
and
21,809 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
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,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.
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,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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
示例活动介绍: | ||
好,敢惹我 那你算是踢到棉花了 | ||
你惹了我有什么用 | ||
你惹我的后果就是惹了我一下 | ||
因我毫无还手之力 | ||
惹我算是捏到软柿子了我告诉你 | ||
我会用实际行动告诉你 惹到我的下场就是什么都不会发生 | ||
我和别人不一样 你惹了我就相当于没惹 | ||
你算是遇到好欺负的人了 | ||
惹我的人你就偷着乐吧 | ||
你惹到了方圆百里最好惹的人 |
Oops, something went wrong.