|  |  | 
 |  |  | import Taro from '@tarojs/taro'; | 
 |  |  | import { ResponseCode } from '@12333/constants'; | 
 |  |  | import * as authServices from '@12333/services/apiV2/auth'; | 
 |  |  | import { APP_ENV } from '@/constants'; | 
 |  |  | import { useUserStore } from '@/stores/modules/user'; | 
 |  |  |  | 
 |  |  | defineOptions({ | 
 |  |  |   name: 'registerForm', | 
 |  |  | }); | 
 |  |  |  | 
 |  |  | const userStore = useUserStore(); | 
 |  |  |  | 
 |  |  | const { jump } = useLoginedJump(); | 
 |  |  |  | 
 |  |  | const state = reactive({ | 
 |  |  |   policyChecked: false, | 
 |  |  | 
 |  |  | }); | 
 |  |  |  | 
 |  |  | async function onGetCaptcha() { | 
 |  |  |   await authServices.sendLoginOrRegisterVerifyCode( | 
 |  |  |   const res = await authServices.sendLoginOrRegisterVerifyCode( | 
 |  |  |     { | 
 |  |  |       phoneNumber: form.phoneNumber, | 
 |  |  |     }, | 
 |  |  |     { | 
 |  |  |       showLoading: false, | 
 |  |  |       getResponse: true, | 
 |  |  |       // customErrorHandler(error) { | 
 |  |  |       //   if (error?.response?.data?.error?.code === ResponseCode.RegisterExistsPhoneNumber) { | 
 |  |  |       //     Message.confirm({ | 
 |  |  | 
 |  |  |       // }, | 
 |  |  |     } | 
 |  |  |   ); | 
 |  |  |  | 
 |  |  |   if (res && APP_ENV === 'staging') { | 
 |  |  |     // @ts-ignore | 
 |  |  |     form.verificationCode = res?.data?.extras?.code ?? ''; | 
 |  |  |   } | 
 |  |  | } | 
 |  |  |  | 
 |  |  | async function handleRegister() { | 
 |  |  | 
 |  |  |         let res = await authServices.registerPersonalUser(params); | 
 |  |  |         if (res) { | 
 |  |  |           Message.success('注册成功', { | 
 |  |  |             onClosed: () => { | 
 |  |  |               goLogin(); | 
 |  |  |             onClosed: async () => { | 
 |  |  |               userStore.loginSuccess(res); | 
 |  |  |               jump(); | 
 |  |  |             }, | 
 |  |  |           }); | 
 |  |  |         } |