|
@@ -2,18 +2,18 @@
|
|
|
<template v-if="getShow">
|
|
|
<LoginFormTitle class="enter-x" />
|
|
|
<Form class="p-4 enter-x" :model="formData" :rules="getFormRules" ref="formRef">
|
|
|
- <FormItem name="account" class="enter-x">
|
|
|
+ <FormItem name="companyName" class="enter-x">
|
|
|
<Input
|
|
|
class="fix-auto-fill"
|
|
|
size="large"
|
|
|
- v-model:value="formData.account"
|
|
|
+ v-model:value="formData.companyName"
|
|
|
:placeholder="t('sys.login.corporationName')"
|
|
|
/>
|
|
|
</FormItem>
|
|
|
- <FormItem name="mobile" class="enter-x">
|
|
|
+ <FormItem name="managerPhone" class="enter-x">
|
|
|
<Input
|
|
|
size="large"
|
|
|
- v-model:value="formData.mobile"
|
|
|
+ v-model:value="formData.managerPhone"
|
|
|
:placeholder="t('sys.login.corporationMail')"
|
|
|
class="fix-auto-fill"
|
|
|
/>
|
|
@@ -22,9 +22,11 @@
|
|
|
<CountdownInput
|
|
|
size="large"
|
|
|
class="fix-auto-fill"
|
|
|
- v-model:value="formData.sms"
|
|
|
- :placeholder="t('sys.login.smsCode')"
|
|
|
+ v-model:value="formData.authCode"
|
|
|
+ :placeholder="t('sys.login.emailSMS')"
|
|
|
+ :sendCodeApi="sendEmailCode"
|
|
|
/>
|
|
|
+ <!-- :sendCodeApi="" -->
|
|
|
</FormItem>
|
|
|
<FormItem name="password" class="enter-x">
|
|
|
<StrengthMeter
|
|
@@ -73,6 +75,7 @@
|
|
|
import { CountdownInput } from '/@/components/CountDown';
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
import { useLoginState, useFormRules, useFormValid, LoginStateEnum } from './useLogin';
|
|
|
+ import { RegisterApi, getEmailAuthCodeApi } from '/@/api/sys/user';
|
|
|
|
|
|
const FormItem = Form.Item;
|
|
|
const InputPassword = Input.Password;
|
|
@@ -83,11 +86,12 @@
|
|
|
const loading = ref(false);
|
|
|
|
|
|
const formData = reactive({
|
|
|
- account: '',
|
|
|
+ companyName: '',
|
|
|
+ managerPhone: '',
|
|
|
password: '',
|
|
|
confirmPassword: '',
|
|
|
mobile: '',
|
|
|
- sms: '',
|
|
|
+ authCode: '',
|
|
|
policy: false,
|
|
|
});
|
|
|
|
|
@@ -96,9 +100,28 @@
|
|
|
|
|
|
const getShow = computed(() => unref(getLoginState) === LoginStateEnum.REGISTER);
|
|
|
|
|
|
+ async function sendEmailCode(): Promise<boolean> {
|
|
|
+ const form = unref(formRef);
|
|
|
+ if (!form) {
|
|
|
+ return Promise.resolve(false);
|
|
|
+ }
|
|
|
+ if (formData.managerPhone?.length > 0) {
|
|
|
+ try {
|
|
|
+ await getEmailAuthCodeApi(formData.managerPhone);
|
|
|
+ return Promise.resolve(true);
|
|
|
+ } catch (error) {
|
|
|
+ return Promise.resolve(false);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return Promise.resolve(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
async function handleRegister() {
|
|
|
const data = await validForm();
|
|
|
if (!data) return;
|
|
|
console.log(data);
|
|
|
+ const res = await RegisterApi(formData);
|
|
|
+ console.log(res);
|
|
|
}
|
|
|
</script>
|