[add] 可以選星期幾
This commit is contained in:
parent
1fffabfae8
commit
4279c449b5
Binary file not shown.
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 264 KiB |
10
src/App.tsx
10
src/App.tsx
@ -2,12 +2,14 @@ import { Pagination } from 'antd';
|
||||
import axios from 'axios';
|
||||
import dayjs from 'dayjs';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { NavigateFunction, useNavigate } from "react-router-dom";
|
||||
import { NavigateFunction, useNavigate, useParams } from "react-router-dom";
|
||||
import './App.css';
|
||||
import A from './Components/CustomA';
|
||||
|
||||
export default function App() {
|
||||
const navigate: NavigateFunction = useNavigate();
|
||||
const { id } = useParams();
|
||||
const dayOfWeek: string = id ?? "1";
|
||||
const [current, setCurrent] = useState(1);
|
||||
const [totalDataLength, setTotalDataLength] = useState(50)
|
||||
const [data, setData] = useState<any[][]>([[]])
|
||||
@ -28,6 +30,7 @@ export default function App() {
|
||||
}
|
||||
|
||||
const reqData = JSON.stringify({
|
||||
"dayOfWeek": dayOfWeek,
|
||||
"page": current
|
||||
});
|
||||
|
||||
@ -55,6 +58,10 @@ export default function App() {
|
||||
}
|
||||
|
||||
function getListPage(): void {
|
||||
const reqData = JSON.stringify({
|
||||
"dayOfWeek": dayOfWeek
|
||||
});
|
||||
|
||||
const config = {
|
||||
method: 'post',
|
||||
maxBodyLength: Infinity,
|
||||
@ -62,6 +69,7 @@ export default function App() {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: reqData
|
||||
};
|
||||
|
||||
axios.request(config)
|
||||
|
@ -16,7 +16,7 @@ export default function Play() {
|
||||
const [scoreList, setScoreList] = useState<any[]>([])
|
||||
|
||||
function onClickLobby(): void {
|
||||
navigate(`/`);
|
||||
navigate(`/home/${data.dayOfWeek}`);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -14,6 +14,10 @@ const hashRouter: Router = createHashRouter([
|
||||
path: "/",
|
||||
element: <App />,
|
||||
},
|
||||
{
|
||||
path: "/home/:id",
|
||||
element: <App />,
|
||||
},
|
||||
{
|
||||
path: "/play/:id",
|
||||
element: <Play />,
|
||||
|
Loading…
Reference in New Issue
Block a user