2
0

Merge remote-tracking branch 'origin/wfc-modules-user'

This commit is contained in:
lai
2024-11-29 18:32:00 +08:00
70 changed files with 1286 additions and 3960 deletions

View File

@@ -1,25 +1,27 @@
<script setup lang="ts">
import { $t } from '@/locales';
import { loginModuleRecord } from '@/constants/app';
import { useRouterPush } from '@/hooks/common/router';
import { useAntdForm, useFormRules } from '@/hooks/common/form';
import { useAuthStore } from '@/store/modules/auth';
import {useI18n} from "vue-i18n";
defineOptions({
name: 'PwdLogin'
});
const { t } = useI18n();
const authStore = useAuthStore();
const { toggleLoginModule } = useRouterPush();
const { formRef, validate } = useAntdForm();
const { patternRules } = useFormRules();
const codeImg = ref('');
getCheckCode();
const model = reactive({
username: 'ryadmin',
password: 'admin123',
username: '123456',
password: '123456',
code: '',
uuid: '',
authType: 'sys'
@@ -31,11 +33,11 @@ const rules = {
};
async function handleSubmit() {
await validate();
await validate();//验证表单内容
await authStore.login({
loginForm: model,
loginForm: model,//发送表单的数据
onError() {
getCheckCode();
getCheckCode();//重新获取验证码
}
});
}
@@ -45,6 +47,9 @@ async function getCheckCode() {
if (!error) {
codeImg.value = `data:image/png;base64,${data.img}`;
model.uuid = data.uuid;
if (data?.text) {
model.code = data.text;
}
}
}
</script>
@@ -73,18 +78,18 @@ async function getCheckCode() {
<ASpace direction="vertical" size="large" class="w-full">
<div class="flex-y-center justify-between">
<ACheckbox>{{ $t('page.login.pwdLogin.rememberMe') }}</ACheckbox>
<AButton type="text" @click="toggleLoginModule('reset-pwd')">{{ $t('page.login.pwdLogin.forgetPassword') }}</AButton>
<AButton type="text" @click="toggleLoginModule('reset-pwd')">{{ t('page.login.pwdLogin.forgetPassword') }}</AButton>
</div>
<AButton type="primary" block size="large" shape="round" :loading="authStore.loginLoading" @click="handleSubmit">
{{ $t('common.confirm') }}
</AButton>
<div class="flex-y-center justify-between">
<AButton class="h-34px flex-1" block @click="toggleLoginModule('code-login')">
{{ $t(loginModuleRecord['code-login']) }}
</AButton>
<!-- <AButton class="h-34px flex-1" block @click="toggleLoginModule('code-login')">-->
<!-- {{ t(loginModuleRecord['code-login']) }}-->
<!-- </AButton>-->
<div class="w-12px"></div>
<AButton class="h-34px flex-1" block @click="toggleLoginModule('register')">
{{ $t(loginModuleRecord.register) }}
{{ t(loginModuleRecord.register) }}
</AButton>
</div>
</ASpace>