Skip to content

week3-homework#17

Open
MRW6217 wants to merge 1 commit intodistinctioncoding:mainfrom
MRW6217:feature/week3-homework/will
Open

week3-homework#17
MRW6217 wants to merge 1 commit intodistinctioncoding:mainfrom
MRW6217:feature/week3-homework/will

Conversation

@MRW6217
Copy link

@MRW6217 MRW6217 commented Dec 5, 2025

No description provided.

Copy link

@Gary-Distinctioncoding Gary-Distinctioncoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a major logic issue when submitting the form, as well as the layout for the whole react app

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the git track of this file, this file should not be commited

@@ -0,0 +1,15 @@
import bgImage from '../Component/bgi.png';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static file should be put in public folder

Comment on lines +11 to +13
<App />
<BackGround />
<SignIn />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this layout will cause all the pages use the background image, consider to put background image wrapped in signin component only.
App component 通常作为应用的根组件

function App() {
  return (
    <div>
      <Header />
      <MainContent />
      <Footer />
    </div>
  );
}

Comment on lines +11 to +12
const [phoneError, setPhoneError] = useState("");
const [passwordError, setPasswordError] = useState("");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以尝试把error也打包成一个对象

Comment on lines +18 to +28
if (!phoneNumber) {
setPhoneError("Phone number is required.");
} else if (!/^\+?[1-9]\d{1,14}$/.test(phoneNumber)) {
setPhoneError("Please enter a valid phone number.");
}

if (!password) {
setPasswordError("Password is required.");
} else if (password.length < 6) {
setPasswordError("Password must be at least 6 characters long.");
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

验证不通过还是会发送http请求,需要return中断这个function
可以考虑把表单验证单独提取出一个function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants