Skip to content

Commit

Permalink
Merge pull request #21 from TuringCup/feat/RealName
Browse files Browse the repository at this point in the history
update
  • Loading branch information
deltaLRD authored Oct 18, 2023
2 parents 634a86e + 8a43020 commit 4d70b3f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/app/user/api-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface RegisterRequest {
school: string;
schoolId: string;
username: string;
name: string;
}

interface RegisterResponse {
Expand Down
19 changes: 19 additions & 0 deletions src/app/user/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const Page = () => {
const [changed, setChanged] = useState(false);
const [schoolId, setSchoolId] = useState("");
const [phone, setPhone] = useState("");
const [name, setName] = useState("");

useEffect(() => {
if (registerFailed) setChanged(true);
Expand Down Expand Up @@ -297,6 +298,22 @@ const Page = () => {
</FormControl>
)

const inputRealName = (
<FormControl sx={{ m: 0.5, minWidth: "24rem" }}>
<TextField
id={"name"}
required
label={config.register.Name}
variant={"outlined"}
value={name}
onChange={e=>setName(e.target.value)}
></TextField>
<FormHelperText>
{config.register.NameHelperText}
</FormHelperText>
</FormControl>
)

const [register, setRegister] = useState({
submit: false,
errorMsg: "",
Expand All @@ -317,6 +334,7 @@ const Page = () => {
let {data, error, isLoading} = api.useRegister(register.submit, {
username,
password,
name,
city,
email,
school,
Expand Down Expand Up @@ -369,6 +387,7 @@ const Page = () => {
{inputPwd}
{inputEmail}
{inputPhone}
{inputRealName}
</Box>
<Box sx={{ display: "flex", flexGrow: 1, flexDirection: "column", maxHeight: "22rem"}}>
{selectProvince}
Expand Down
6 changes: 4 additions & 2 deletions src/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const config = {
Title: "图灵杯",
Description: "图灵杯官网",
appbar:{
Title: "图灵杯官网",
Title: "中兴·图灵杯官网",
ProfileTooltip: "用户",
profile_menu:{
Register: "注册",
Expand All @@ -27,7 +27,9 @@ const config = {
RegisterFailedText: "注册失败",
SchoolID: "本校学号",
Phone: "手机号",
PhoneHelperText: "你的常用手机号"
PhoneHelperText: "你的常用手机号",
Name: "真实姓名",
NameHelperText: "你的真实姓名",
},
login:{
LoginText: "登陆",
Expand Down

0 comments on commit 4d70b3f

Please sign in to comment.