You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

172 lines
3.6 KiB

<template>
<el-dialog
class="mai-login-modal"
v-model="loginVisible"
footer=""
header=""
:closable="false"
@close="onClose"
>
<el-form
class="p-4 enter-x"
:model="formData"
:rules="formRules"
ref="formRef"
>
<el-form-item name="account" class="enter-x">
<el-input
size="large"
v-model="formData.account"
placeholder="请输入账号"
class="fix-auto-fill"
/>
</el-form-item>
<el-form-item name="password" class="enter-x">
<el-input
type="password"
size="large"
v-model="formData.password"
placeholder="请输入密码"
/>
</el-form-item>
<el-form-item name="captcha" class="enter-x">
<el-input
size="large"
v-model="formData.captcha"
placeholder="请输入验证码"
>
<template #append>
<img src="~@/assets/images/testCode.jpg" alt="" />
</template>
</el-input>
</el-form-item>
<el-form-item class="enter-x">
<el-button type="primary" size="large" block @click="handleLogin(formRef)" :loading="loading">
</el-button>
<!-- <Button size="large" class="mt-4 enter-x" block @click="handleRegister">
{{ t('sys.login.registerButton') }}
</Button> -->
</el-form-item>
</el-form>
</el-dialog>
</template>
<script lang="ts" setup>
import { computed, reactive, ref, unref } from 'vue';
import {FormInstance} from "element-plus";
const userStore = useUserInfo();
const formRules = ref({
})
const formRef = ref<FormInstance>();
const loading = ref(false);
const formData = reactive({
account: 'vben',
password: '123456',
captcha: '123456',
});
const prefixCls = useDesign('login');
async function handleLogin(formEl: FormInstance | undefined) {
if (!formEl) return;
await formEl.validate(async (vail: boolean) => {
if (vail) {
loading.value = true;
const userInfo = await userStore.login({
...formData
});
if (userInfo) {
userStore.setLoginVisible(false);
ElMessage.success('登录成功');
}
loading.value = false;
}
})
}
const loginVisible = ref(userStore.getLoginVisible);
watchEffect(()=>{
loginVisible.value = userStore.getLoginVisible;
console.log('loginStatus>>>', loginVisible.value)
})
const onClose = () => {
userStore.setLoginVisible(false);
};
</script>
<style lang="less">
.mai-login-modal {
width: 1105px !important;
max-width: 1105px !important;
min-width: 1105px !important;
.ant-modal-content {
padding: 0 105px;
border-radius: 16px;
box-sizing: border-box;
h2 {
font-size: 48px;
line-height: 67px;
text-align: center;
padding-top: 54px;
p {
color: #999;
font-size: 28px;
line-height: 30px;
margin-top: 12px;
}
}
.ant-input {
height: 117px;
font-size: 32px;
border-radius: 8px;
padding: 0 60px;
}
.ant-input-suffix {
height: 100%;
.anticon {
font-size: 32px;
margin: 0 20px;
}
img {
width: 100%;
height: 100%;
}
}
.ant-input-password {
border-radius: 8px;
}
.ant-input-affix-wrapper {
display: flex;
align-items: center;
height: 119px;
padding: 0;
border-radius: 8px;
overflow: hidden;
}
.ant-btn {
font-size: 28px;
height: 106px;
margin-bottom: 107px;
background-color: #14417a;
border-radius: 8px;
}
}
}
</style>