mirror of
https://github.com/m1ngsama/FUJI.git
synced 2025-12-25 02:56:38 +00:00
edit
This commit is contained in:
parent
805e7869fc
commit
4b7923c997
4 changed files with 62 additions and 60 deletions
|
|
@ -5,6 +5,6 @@ import ReactChild from "./react/join.tsx";
|
|||
|
||||
<BaseLayout title="加入我们">
|
||||
<main>
|
||||
<ReactChild />
|
||||
<ReactChild client:load />
|
||||
</main>
|
||||
</BaseLayout>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ import ReactChild from "./react/list.tsx";
|
|||
|
||||
<BaseLayout title="加入我们">
|
||||
<main>
|
||||
<ReactChild />
|
||||
<ReactChild client:load />
|
||||
</main>
|
||||
</BaseLayout>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ export default function JoinForm() {
|
|||
qq: "",
|
||||
email: "",
|
||||
})
|
||||
|
||||
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const { name, value } = e.target
|
||||
setFormData(prevData => ({
|
||||
|
|
@ -20,22 +19,21 @@ export default function JoinForm() {
|
|||
[name]: value,
|
||||
}))
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
try {
|
||||
await activeClient.freshman.postFreshmanAdd({
|
||||
requestBody: formData,
|
||||
})
|
||||
alert("Form submitted successfully!")
|
||||
alert("提交成功! 后续请加群获取!")
|
||||
}
|
||||
catch (error) {
|
||||
console.error("Error submitting form:", error)
|
||||
alert("Failed to submit form.")
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<form>
|
||||
<Card>
|
||||
<CardBody>
|
||||
<Input
|
||||
|
|
@ -43,48 +41,56 @@ export default function JoinForm() {
|
|||
placeholder="姓名"
|
||||
value={formData.name}
|
||||
onChange={handleChange}
|
||||
required
|
||||
/>
|
||||
<Input
|
||||
name="class"
|
||||
placeholder="班级"
|
||||
value={formData.class}
|
||||
onChange={handleChange}
|
||||
required
|
||||
/>
|
||||
<Input
|
||||
name="number"
|
||||
placeholder="学号"
|
||||
value={formData.number}
|
||||
onChange={handleChange}
|
||||
required
|
||||
/>
|
||||
<Input
|
||||
name="major"
|
||||
placeholder="专业"
|
||||
value={formData.major}
|
||||
onChange={handleChange}
|
||||
required
|
||||
/>
|
||||
<Input
|
||||
name="phone"
|
||||
placeholder="电话"
|
||||
value={formData.phone}
|
||||
onChange={handleChange}
|
||||
required
|
||||
/>
|
||||
<Input
|
||||
name="qq"
|
||||
placeholder="QQ"
|
||||
value={formData.qq}
|
||||
onChange={handleChange}
|
||||
required
|
||||
/>
|
||||
<Input
|
||||
name="email"
|
||||
placeholder="邮箱"
|
||||
value={formData.email}
|
||||
onChange={handleChange}
|
||||
required
|
||||
/>
|
||||
</CardBody>
|
||||
<CardFooter>
|
||||
<Button onClick={handleSubmit}>提交表单</Button>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
</form>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ const FreshmanList = () => {
|
|||
list: [],
|
||||
total: 0,
|
||||
})
|
||||
const [currentPage, setCurrentPage] = useState(0)
|
||||
const [currentPage] = useState(1) // setCurrentPage
|
||||
useEffect(() => {
|
||||
const fetchFreshmen = async () => {
|
||||
const result = await activeClient.freshman.getFreshmanList({
|
||||
|
|
@ -28,13 +28,9 @@ const FreshmanList = () => {
|
|||
}
|
||||
fetchFreshmen()
|
||||
}, [])
|
||||
setTimeout(() => {
|
||||
setCurrentPage(1)
|
||||
}, 1000)
|
||||
return (
|
||||
<div>
|
||||
<Card>
|
||||
{JSON.stringify(freshmen)}
|
||||
<CardBody>
|
||||
{freshmen.list.map(freshman => (
|
||||
<div key={freshman.number}>
|
||||
|
|
|
|||
Loading…
Reference in a new issue