2 Commits ab257470fb ... 87d2bd6c2b

Author SHA1 Message Date
  lex-wxl 87d2bd6c2b Merge branch 'iteration-20250724' into ponline 3 weeks ago
  lex-wxl e53a0a5564 Update index.tsx 3 weeks ago
1 changed files with 18 additions and 7 deletions
  1. 18 7
      src/student/register/index.tsx

+ 18 - 7
src/student/register/index.tsx

@@ -1,4 +1,4 @@
-import { defineComponent, reactive, ref } from 'vue'
+import { defineComponent, nextTick, reactive, ref } from 'vue'
 import styles from './index.module.less'
 import styles from './index.module.less'
 import iconTop from './images/icon-top.png'
 import iconTop from './images/icon-top.png'
 import iconBird from './images/icon-bird.png'
 import iconBird from './images/icon-bird.png'
@@ -33,7 +33,7 @@ export default defineComponent({
       smsCode: null
       smsCode: null
     })
     })
     const checked = ref(false) // 是否同意协议
     const checked = ref(false) // 是否同意协议
-
+    const subBtn = ref(false) // 是否显示提交按钮
     const imgCodeStatus = ref(false) // 是否显示图片验证码
     const imgCodeStatus = ref(false) // 是否显示图片验证码
 
 
     const countDownTime = ref(1000 * 60) // 倒计时时间,单位毫秒
     const countDownTime = ref(1000 * 60) // 倒计时时间,单位毫秒
@@ -50,11 +50,13 @@ export default defineComponent({
     }
     }
     const onCodeSend = () => {
     const onCodeSend = () => {
       countDownStatus.value = false
       countDownStatus.value = false
-      countDownRef.value?.start()
+      nextTick(() => {
+        countDownRef.value?.start()
+      })
     }
     }
     const onFinished = () => {
     const onFinished = () => {
-      countDownStatus.value = true
       countDownRef.value?.reset()
       countDownRef.value?.reset()
+      countDownStatus.value = true
     }
     }
 
 
     // 跳转协议
     // 跳转协议
@@ -94,6 +96,7 @@ export default defineComponent({
         if (!checked.value) {
         if (!checked.value) {
           return Toast('请同意用户注册协议和隐私政策')
           return Toast('请同意用户注册协议和隐私政策')
         }
         }
+        subBtn.value = true
         // 提交注册信息
         // 提交注册信息
         await request.post('/api-auth/smsLogin', {
         await request.post('/api-auth/smsLogin', {
           requestType: 'form',
           requestType: 'form',
@@ -112,6 +115,8 @@ export default defineComponent({
         router.push('/registerDownload')
         router.push('/registerDownload')
       } catch {
       } catch {
         //
         //
+      } finally {
+        subBtn.value = false
       }
       }
     }
     }
     return () => (
     return () => (
@@ -164,7 +169,7 @@ export default defineComponent({
                     </span>
                     </span>
                   ) : (
                   ) : (
                     <CountDown
                     <CountDown
-                      ref={countDownRef.value}
+                      ref={(el: any) => (countDownRef.value = el)}
                       auto-start={false}
                       auto-start={false}
                       time={countDownTime.value}
                       time={countDownTime.value}
                       onFinish={onFinished}
                       onFinish={onFinished}
@@ -208,17 +213,23 @@ export default defineComponent({
             </span>
             </span>
           </div>
           </div>
           <div class={styles.btnBox}>
           <div class={styles.btnBox}>
-            <Button round block type="primary" onClick={onSubmit}>
+            <Button
+              round
+              block
+              type="primary"
+              onClick={onSubmit}
+              disabled={subBtn.value}
+            >
               立即登录
               立即登录
             </Button>
             </Button>
           </div>
           </div>
         </div>
         </div>
 
 
+{/* registerType="REGISTER" */}
         {imgCodeStatus.value ? (
         {imgCodeStatus.value ? (
           <ImgCode
           <ImgCode
             v-model:value={imgCodeStatus.value}
             v-model:value={imgCodeStatus.value}
             phone={forms.phone}
             phone={forms.phone}
-            registerType="REGISTER"
             onClose={() => {
             onClose={() => {
               imgCodeStatus.value = false
               imgCodeStatus.value = false
             }}
             }}