【代码优化】注册的逻辑实现

pull/547/MERGE
YunaiV 2024-09-10 21:04:46 +08:00
parent b1e3337cb4
commit cb6e716ce2
1 changed files with 5 additions and 8 deletions

View File

@ -105,7 +105,7 @@ import { usePermissionStore } from '@/store/modules/permission'
import * as LoginApi from '@/api/login' import * as LoginApi from '@/api/login'
import { LoginStateEnum, useLoginState } from './useLogin' import { LoginStateEnum, useLoginState } from './useLogin'
defineOptions({ name: 'LoginForm' }) defineOptions({ name: 'RegisterForm' })
const { t } = useI18n() const { t } = useI18n()
const iconHouse = useIcon({ icon: 'ep:house' }) const iconHouse = useIcon({ icon: 'ep:house' })
@ -159,7 +159,7 @@ const registerData = reactive({
captchaEnable: import.meta.env.VITE_APP_CAPTCHA_ENABLE, captchaEnable: import.meta.env.VITE_APP_CAPTCHA_ENABLE,
tenantEnable: import.meta.env.VITE_APP_TENANT_ENABLE, tenantEnable: import.meta.env.VITE_APP_TENANT_ENABLE,
registerForm: { registerForm: {
tenantName: '', tenantName: import.meta.env.VITE_APP_DEFAULT_LOGIN_TENANT || '',
nickname: '', nickname: '',
tenantId: 0, tenantId: 0,
username: '', username: '',
@ -169,7 +169,8 @@ const registerData = reactive({
} }
}) })
async function handleRegister(params) { //
const handleRegister = async (params: any) => {
loading.value = true loading.value = true
try { try {
if (registerData.tenantEnable) { if (registerData.tenantEnable) {
@ -181,11 +182,6 @@ async function handleRegister(params) {
registerData.registerForm.captchaVerification = params.captchaVerification registerData.registerForm.captchaVerification = params.captchaVerification
} }
console.log(
'registerData.registerForm.captchaVerification====',
registerData.registerForm.captchaVerification
)
const res = await LoginApi.register(registerData.registerForm) const res = await LoginApi.register(registerData.registerForm)
if (!res) { if (!res) {
return return
@ -225,6 +221,7 @@ const getCode = async () => {
verify.value.show() verify.value.show()
} }
} }
// ID // ID
const getTenantId = async () => { const getTenantId = async () => {
if (registerData.tenantEnable === 'true') { if (registerData.tenantEnable === 'true') {