Pārlūkot izejas kodu

Update index.tsx

lex 1 gadu atpakaļ
vecāks
revīzija
2a0319a305
1 mainītis faili ar 11 papildinājumiem un 10 dzēšanām
  1. 11 10
      src/views/student-register/index.tsx

+ 11 - 10
src/views/student-register/index.tsx

@@ -397,21 +397,21 @@ export default defineComponent({
       };
     });
 
-    const checkForm = () => {
+    const checkForm = (status = true) => {
       if (!checkPhone(studentInfo.username)) {
-        showToast('请输入正确的手机号码');
+        status && showToast('请输入正确的手机号码');
         return true;
       } else if (!studentInfo.password) {
-        showToast('请输入验证码');
+        status && showToast('请输入验证码');
         return true;
       } else if (!studentInfo.extra.nickname) {
-        showToast('请输入学生姓名');
+        status && showToast('请输入学生姓名');
         return true;
       } else if (!studentInfo.extra.currentGradeNum) {
-        showToast('请选择所在年级');
+        status && showToast('请选择所在年级');
         return true;
       } else if (!studentInfo.extra.currentClass) {
-        showToast('请选择所在班级');
+        status && showToast('请选择所在班级');
         return true;
       }
       return false;
@@ -1158,8 +1158,9 @@ export default defineComponent({
                   forms.joinType === 'digitalize' && styles.checked
                 ]}
                 onClick={() => {
-                  if (!forms.gradeNumText || !forms.currentClassText) {
-                    showToast('请先选择所在年级班级');
+                  //
+                  if (checkForm()) {
+                    showToast('请将资料填写完整');
                     return;
                   }
                   forms.joinType = 'digitalize';
@@ -1182,8 +1183,8 @@ export default defineComponent({
                   forms.joinType === 'tradition' && styles.checked1
                 ]}
                 onClick={() => {
-                  if (!forms.gradeNumText || !forms.currentClassText) {
-                    showToast('请先选择所在年级班级');
+                  if (checkForm()) {
+                    showToast('请将资料填写完整');
                     return;
                   }
                   forms.joinType = 'tradition';