mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-11-04 04:08:44 +08:00 
			
		
		
		
	【代码优化】注册的逻辑实现
This commit is contained in:
		@@ -105,7 +105,7 @@ import { usePermissionStore } from '@/store/modules/permission'
 | 
			
		||||
import * as LoginApi from '@/api/login'
 | 
			
		||||
import { LoginStateEnum, useLoginState } from './useLogin'
 | 
			
		||||
 | 
			
		||||
defineOptions({ name: 'LoginForm' })
 | 
			
		||||
defineOptions({ name: 'RegisterForm' })
 | 
			
		||||
 | 
			
		||||
const { t } = useI18n()
 | 
			
		||||
const iconHouse = useIcon({ icon: 'ep:house' })
 | 
			
		||||
@@ -159,7 +159,7 @@ const registerData = reactive({
 | 
			
		||||
  captchaEnable: import.meta.env.VITE_APP_CAPTCHA_ENABLE,
 | 
			
		||||
  tenantEnable: import.meta.env.VITE_APP_TENANT_ENABLE,
 | 
			
		||||
  registerForm: {
 | 
			
		||||
    tenantName: '',
 | 
			
		||||
    tenantName: import.meta.env.VITE_APP_DEFAULT_LOGIN_TENANT || '',
 | 
			
		||||
    nickname: '',
 | 
			
		||||
    tenantId: 0,
 | 
			
		||||
    username: '',
 | 
			
		||||
@@ -169,7 +169,8 @@ const registerData = reactive({
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
async function handleRegister(params) {
 | 
			
		||||
// 提交注册
 | 
			
		||||
const handleRegister = async (params: any) => {
 | 
			
		||||
  loading.value = true
 | 
			
		||||
  try {
 | 
			
		||||
    if (registerData.tenantEnable) {
 | 
			
		||||
@@ -181,11 +182,6 @@ async function handleRegister(params) {
 | 
			
		||||
      registerData.registerForm.captchaVerification = params.captchaVerification
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    console.log(
 | 
			
		||||
      'registerData.registerForm.captchaVerification====',
 | 
			
		||||
      registerData.registerForm.captchaVerification
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    const res = await LoginApi.register(registerData.registerForm)
 | 
			
		||||
    if (!res) {
 | 
			
		||||
      return
 | 
			
		||||
@@ -225,6 +221,7 @@ const getCode = async () => {
 | 
			
		||||
    verify.value.show()
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 获取租户 ID
 | 
			
		||||
const getTenantId = async () => {
 | 
			
		||||
  if (registerData.tenantEnable === 'true') {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user