liushengqiang 1 年之前
父节点
当前提交
1df05424cf

+ 29 - 3
src/views/school-register/index.tsx

@@ -14,6 +14,7 @@ import {
   api_sysAreaQueryAllProvince
 } from './api';
 import { useRoute } from 'vue-router';
+import MImgCode from '@/components/m-img-code';
 
 export default defineComponent({
   name: 'SchoolRegister',
@@ -65,7 +66,8 @@ export default defineComponent({
       showArea: false,
       success: false,
       areaList: {} as any,
-      sendMsg: '发送验证码'
+      sendMsg: '发送验证码',
+      imgCodeStatus: false
     });
     const formateArea = (area: any[]) => {
       const province_list: { [_: string]: string } = {};
@@ -131,7 +133,6 @@ export default defineComponent({
     const handleSubmit = async () => {
       const res = await api_schoolAdd({ ...forms });
       if (res?.code === 200) {
-        showToast('提交成功');
         data.success = true;
       }
     };
@@ -331,7 +332,21 @@ export default defineComponent({
                         size="small"
                         type="primary"
                         color="#198CFE"
-                        onClick={() => onSendSms()}>
+                        onClick={() => {
+                          if (!forms.educationalAdministrationPhone) {
+                            showToast('请输入负责人手机号码');
+                            return;
+                          }
+                          if (
+                            !/^1[3456789]\d{9}$/.test(
+                              forms.educationalAdministrationPhone
+                            )
+                          ) {
+                            showToast('手机号码格式不正确');
+                            return;
+                          }
+                          data.imgCodeStatus = true;
+                        }}>
                         {data.sendMsg}
                       </Button>
                     )
@@ -381,6 +396,17 @@ export default defineComponent({
                 </div>
               </div>
             </Popup>
+
+            {data.imgCodeStatus ? (
+              <MImgCode
+                v-model:value={data.imgCodeStatus}
+                phone={forms.educationalAdministrationPhone}
+                onClose={() => {
+                  data.imgCodeStatus = false;
+                }}
+                onSendCode={onSendSms}
+              />
+            ) : null}
           </div>
         </div>
       </div>

+ 3 - 1
src/views/teaher-register/component/success/index.module.less

@@ -1,12 +1,14 @@
 .container {
     width: 100vw;
-    min-height: 100vh;
+    height: 100vh;
     background-color: rgba(96, 166, 241, 1);
     background-image: url('../../images/icon_bg.png');
     background-repeat: no-repeat;
     background-size: 100%;
     padding-top: 50Px;
     margin: 0 auto;
+    overflow-x: hidden;
+    overflow-y: auto;
 
     .titleIcon {
         display: block;

+ 21 - 5
src/views/teaher-register/index.tsx

@@ -25,6 +25,7 @@ import {
 import { useRoute } from 'vue-router';
 import { postMessage } from '@/helpers/native-message';
 import Success from './component/success/index';
+import MImgCode from '@/components/m-img-code';
 
 export default defineComponent({
   name: 'SchoolRegister',
@@ -36,7 +37,7 @@ export default defineComponent({
       provinceCode: '', // 所属省份
       code: '', // 验证码
       tenantId: route.query.tenantId || '', // 机构
-      phone: null,
+      phone: null as any,
       schoolId: route.query.schoolId || '', // 学校id
       nickname: null,
       gender: 1
@@ -48,7 +49,8 @@ export default defineComponent({
       checked: true,
       success: false,
       areaList: {} as any,
-      sendMsg: '获取验证码'
+      sendMsg: '获取验证码',
+      imgCodeStatus: false
     });
     const formateArea = (area: any[]) => {
       const province_list: { [_: string]: string } = {};
@@ -86,7 +88,7 @@ export default defineComponent({
       getAreaList();
     });
     /** 发送验证码 */
-    const onSendSms = async () => {
+    const onSendSms = () => {
       if (!forms.phone) {
         showToast('请输入手机号码');
         return;
@@ -95,6 +97,9 @@ export default defineComponent({
         showToast('手机号码格式不正确');
         return;
       }
+      data.imgCodeStatus = true;
+    };
+    const onCodeSend = async (code: string) => {
       if (data.sendMsg.includes('s')) return;
       try {
         await api_openSendSms({
@@ -112,8 +117,8 @@ export default defineComponent({
       }
     };
     const onCountDown = () => {
-      data.sendMsg = '30s';
-      let count = 30;
+      data.sendMsg = '60s';
+      let count = 60;
       let timer = setInterval(() => {
         count--;
         data.sendMsg = `${count}s`;
@@ -297,6 +302,17 @@ export default defineComponent({
               v-model:show={data.success}>
               <Success />
             </Popup>
+
+            {data.imgCodeStatus ? (
+              <MImgCode
+                v-model:value={data.imgCodeStatus}
+                phone={forms.phone}
+                onClose={() => {
+                  data.imgCodeStatus = false;
+                }}
+                onSendCode={onCodeSend}
+              />
+            ) : null}
           </div>
         </div>
       </div>