|  |  |  | 
|---|
|  |  |  | 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, | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (res && process.env.APP_ENV === 'staging') { | 
|---|
|  |  |  | if (res && APP_ENV === 'staging') { | 
|---|
|  |  |  | // @ts-ignore | 
|---|
|  |  |  | form.verificationCode = res?.data?.extras?.code ?? ''; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // @ts-ignore | 
|---|
|  |  |  | return res?.data?.data; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | async function handleRegister() { | 
|---|
|  |  |  | 
|---|
|  |  |  | let res = await authServices.registerPersonalUser(params); | 
|---|
|  |  |  | if (res) { | 
|---|
|  |  |  | Message.success('注册成功', { | 
|---|
|  |  |  | onClosed: () => { | 
|---|
|  |  |  | goLogin(); | 
|---|
|  |  |  | onClosed: async () => { | 
|---|
|  |  |  | userStore.loginSuccess(res); | 
|---|
|  |  |  | jump(); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|