This commit is contained in:
dap
2024-10-21 07:58:31 +08:00
77 changed files with 188 additions and 223 deletions

View File

@@ -112,6 +112,7 @@ async function handleLogin(values: LoginCodeParams) {
smsCode: values.code,
grantType: 'sms',
};
console.log('login params', requestParams);
await authStore.authLogin(requestParams);
} catch (error) {
console.error(error);

View File

@@ -1,5 +1,6 @@
<script lang="ts" setup>
import type { VbenFormSchema } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import { computed, ref } from 'vue';
@@ -27,7 +28,7 @@ const formSchema = computed((): VbenFormSchema[] => {
];
});
function handleSubmit(value: string) {
function handleSubmit(value: Recordable<any>) {
console.log('reset email:', value);
}
</script>

View File

@@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { VbenFormSchema } from '@vben/common-ui';
import type { LoginAndRegisterParams, VbenFormSchema } from '@vben/common-ui';
import { computed, onMounted, ref, useTemplateRef } from 'vue';
@@ -125,15 +125,7 @@ const formSchema = computed((): VbenFormSchema[] => {
];
});
interface LoginForm {
code?: string;
grantType: string;
password: string;
tenantId: string;
username: string;
}
async function handleAccountLogin(values: LoginForm) {
async function handleAccountLogin(values: LoginAndRegisterParams) {
try {
const requestParam: any = omit(values, ['code']);
// 验证码

View File

@@ -1,5 +1,6 @@
<script lang="ts" setup>
import type { LoginAndRegisterParams, VbenFormSchema } from '@vben/common-ui';
import type { VbenFormSchema } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import { computed, h, ref } from 'vue';
@@ -45,7 +46,7 @@ const formSchema = computed((): VbenFormSchema[] => {
rules(values) {
const { password } = values;
return z
.string()
.string({ required_error: $t('authentication.passwordTip') })
.min(1, { message: $t('authentication.passwordTip') })
.refine((value) => value === password, {
message: $t('authentication.confirmPasswordTip'),
@@ -55,7 +56,6 @@ const formSchema = computed((): VbenFormSchema[] => {
},
fieldName: 'confirmPassword',
label: $t('authentication.confirmPassword'),
rules: z.string().min(1, { message: $t('authentication.passwordTip') }),
},
{
component: 'VbenCheckbox',
@@ -67,15 +67,10 @@ const formSchema = computed((): VbenFormSchema[] => {
h(
'a',
{
class:
'cursor-pointer text-primary ml-1 hover:text-primary-hover',
class: 'vben-link ml-1 ',
href: '',
},
[
$t('authentication.privacyPolicy'),
'&',
$t('authentication.terms'),
],
`${$t('authentication.privacyPolicy')} & ${$t('authentication.terms')}`,
),
]),
}),
@@ -86,7 +81,7 @@ const formSchema = computed((): VbenFormSchema[] => {
];
});
function handleSubmit(value: LoginAndRegisterParams) {
function handleSubmit(value: Recordable<any>) {
console.log('register submit:', value);
}
</script>