|  |  | 
 |  |  | </template> | 
 |  |  |  | 
 |  |  | <script setup lang="ts"> | 
 |  |  | import * as commonServices from '@12333/services/api/Common'; | 
 |  |  | import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types'; | 
 |  |  | import { FormValidator, Message } from '@12333/utils'; | 
 |  |  | import { LargeButton } from '@/components'; | 
 |  |  | import { ProFormCaptcha } from 'senin-mini/components'; | 
 |  |  | import { VerificationCodeBusinessType } from '@12333/constants'; | 
 |  |  | import { useLoginedJump } from '@/hooks'; | 
 |  |  | import { useUserStore } from '@/stores/modules/user'; | 
 |  |  | import Taro from '@tarojs/taro'; | 
 |  |  | import * as authServices from '@12333/services/apiV2/auth'; | 
 |  |  | import { APP_ENV } from '@/constants'; | 
 |  |  |  | 
 |  |  | defineOptions({ | 
 |  |  |   name: 'verificationCodeLoginForm', | 
 |  |  | 
 |  |  | }); | 
 |  |  |  | 
 |  |  | async function onGetCaptcha() { | 
 |  |  |   await commonServices.sendVerificationCode( | 
 |  |  |   const res = await authServices.sendLoginOrRegisterVerifyCode( | 
 |  |  |     { | 
 |  |  |       phoneNumber: form.phoneNumber, | 
 |  |  |       businessType: VerificationCodeBusinessType.PhoneMesssageCodeLogin, | 
 |  |  |     }, | 
 |  |  |     { showLoading: false } | 
 |  |  |     { showLoading: false, getResponse: true } | 
 |  |  |   ); | 
 |  |  |   if (res && APP_ENV === 'staging') { | 
 |  |  |     // @ts-ignore | 
 |  |  |     form.verificationCode = res?.data?.extras?.code ?? ''; | 
 |  |  |   } | 
 |  |  | } | 
 |  |  |  | 
 |  |  | async function handleLogin() { | 
 |  |  | 
 |  |  |         form.loading = true; | 
 |  |  |         await userStore.loginByUsername({ | 
 |  |  |           phoneNumber: form.phoneNumber, | 
 |  |  |           code: form.verificationCode, | 
 |  |  |           verifyCode: form.verificationCode, | 
 |  |  |         }); | 
 |  |  |         jump(); | 
 |  |  |       } |