Skip to content

Commit

Permalink
fix: register layout issue
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxtuneLee committed Sep 15, 2024
1 parent d8b1fee commit 7bbf73c
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 68 deletions.
5 changes: 2 additions & 3 deletions app/(tourist)/regist/page.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@
.veriCodeInput {
position: relative;
input {
width: 86px;
padding: 1px 180px 1px 48px;
padding-left: 50px;
}
}

.defaultHead {
position: absolute;
top: 67px;
top: 63px;
left: 0px;
left: 20px;

Expand Down
130 changes: 65 additions & 65 deletions app/(tourist)/regist/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,73 +10,73 @@ import { RegistContext } from "@/lib/context";
import PageTransition from "@/components/pageTransition";

const Regist = () => {
const [registTicket, setRegistTicket] = useState<string | undefined>();
const [username, setUsername] = useState<string | undefined>();
const [step, setStep] = useState<number>(1);
const handleStep = useCallback((step: -1 | 1) => {
setStep((pre) => pre + step);
}, []);
const [registTicket, setRegistTicket] = useState<string | undefined>();
const [username, setUsername] = useState<string | undefined>();
const [step, setStep] = useState<number>(1);
const handleStep = useCallback((step: -1 | 1) => {
setStep((pre) => pre + step);
}, []);

const searchParams = useSearchParams();
// TODO 错误处理
const redirect = searchParams.get("redirect");
// const redirect =
// redirectParams?.split("?")[0] +
// "?" +
// JSON.parse(redirectParams?.split("?")[1] ?? "[]").join("&");
const searchParams = useSearchParams();
// TODO 错误处理
const redirect = searchParams.get("redirect");
// const redirect =
// redirectParams?.split("?")[0] +
// "?" +
// JSON.parse(redirectParams?.split("?")[1] ?? "[]").join("&");

const handleTicket = useCallback((ticket: string) => {
setRegistTicket(ticket);
}, []);
const handleUsername = useCallback((username: string) => {
setUsername(username);
}, []);
const providerValue = {
redirect,
username: username,
registTicket: registTicket,
currentStep: step,
handleStep: handleStep,
handleTicket: handleTicket,
handleUsername: handleUsername,
};
return (
<>
<div className={"pageTitle"}>{"<Register>"}</div>
<div className={"globalContainer"}>
<RegistContext.Provider value={providerValue}>
{step === 1 ? (
<PageTransition>
<RegistStep1 />
</PageTransition>
) : (
<></>
)}
{step === 2 ? (
<PageTransition>
<RegistStep2 />
</PageTransition>
) : (
<></>
)}
{step === 3 ? (
<PageTransition>
<RegistStep3 />
</PageTransition>
) : (
<></>
)}
{step === 4 ? (
<PageTransition>
<RegistStep4 />
</PageTransition>
) : (
<></>
)}
</RegistContext.Provider>
</div>
</>
);
const handleTicket = useCallback((ticket: string) => {
setRegistTicket(ticket);
}, []);
const handleUsername = useCallback((username: string) => {
setUsername(username);
}, []);
const providerValue = {
redirect,
username: username,
registTicket: registTicket,
currentStep: step,
handleStep: handleStep,
handleTicket: handleTicket,
handleUsername: handleUsername,
};
return (
<>
<div className={"pageTitle"}>{"<Register>"}</div>
<div className={"globalContainer"}>
<RegistContext.Provider value={providerValue}>
{step === 1 ? (
<PageTransition>
<RegistStep1 />
</PageTransition>
) : (
<></>
)}
{step === 2 ? (
<PageTransition>
<RegistStep2 />
</PageTransition>
) : (
<></>
)}
{step === 3 ? (
<PageTransition>
<RegistStep3 />
</PageTransition>
) : (
<></>
)}
{step === 4 ? (
<PageTransition>
<RegistStep4 />
</PageTransition>
) : (
<></>
)}
</RegistContext.Provider>
</div>
</>
);
};

export default Regist;

0 comments on commit 7bbf73c

Please sign in to comment.