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