2022-01-03 18:01:43 +08:00
|
|
|
<script setup lang="ts">
|
2022-01-05 17:02:25 +08:00
|
|
|
import { reactive, ref } from 'vue'
|
2022-01-03 18:01:43 +08:00
|
|
|
import { Form } from '@/components/Form'
|
2022-01-04 16:53:13 +08:00
|
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
2022-01-05 17:02:25 +08:00
|
|
|
import { ElButton, ElCheckbox, ElLink } from 'element-plus'
|
|
|
|
import { required } from '@/utils/formRules'
|
2022-01-04 16:53:13 +08:00
|
|
|
|
|
|
|
const { t } = useI18n()
|
2022-01-03 18:01:43 +08:00
|
|
|
|
2022-01-05 17:02:25 +08:00
|
|
|
const rules = {
|
|
|
|
username: [required],
|
|
|
|
password: [required]
|
|
|
|
}
|
|
|
|
|
|
|
|
const schema = reactive<FormSchema[]>([
|
2022-01-07 09:12:32 +08:00
|
|
|
{
|
|
|
|
field: 'title',
|
|
|
|
colProps: {
|
|
|
|
span: 24
|
|
|
|
}
|
|
|
|
},
|
2022-01-03 18:01:43 +08:00
|
|
|
{
|
|
|
|
field: 'username',
|
2022-01-04 16:53:13 +08:00
|
|
|
label: t('login.username'),
|
|
|
|
component: 'Input',
|
|
|
|
colProps: {
|
|
|
|
span: 24
|
|
|
|
}
|
2022-01-03 18:01:43 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'password',
|
2022-01-04 16:53:13 +08:00
|
|
|
label: t('login.password'),
|
|
|
|
component: 'InputPassword',
|
|
|
|
colProps: {
|
|
|
|
span: 24
|
|
|
|
},
|
|
|
|
componentProps: {
|
|
|
|
style: {
|
|
|
|
width: '100%'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2022-01-05 17:02:25 +08:00
|
|
|
field: 'tool',
|
|
|
|
colProps: {
|
|
|
|
span: 24
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'login',
|
|
|
|
colProps: {
|
|
|
|
span: 24
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'other',
|
|
|
|
component: 'Divider',
|
|
|
|
label: t('login.otherLogin'),
|
|
|
|
componentProps: {
|
|
|
|
contentPosition: 'center'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'otherIcon',
|
|
|
|
colProps: {
|
|
|
|
span: 24
|
|
|
|
}
|
2022-01-03 18:01:43 +08:00
|
|
|
}
|
2022-01-05 17:02:25 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
const iconSize = 30
|
|
|
|
|
|
|
|
const remember = ref(false)
|
2022-01-03 18:01:43 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2022-01-06 17:13:13 +08:00
|
|
|
<Form :schema="schema" :rules="rules" label-position="top" hide-required-asterisk size="large">
|
2022-01-07 09:12:32 +08:00
|
|
|
<template #title>
|
|
|
|
<h2 class="text-2xl font-bold text-center w-[100%]">{{ t('login.login') }}</h2>
|
|
|
|
</template>
|
|
|
|
|
2022-01-05 17:02:25 +08:00
|
|
|
<template #tool>
|
|
|
|
<div class="flex justify-between items-center w-[100%]">
|
|
|
|
<ElCheckbox v-model="remember" :label="t('login.remember')" size="small" />
|
|
|
|
<ElLink type="primary" :underline="false">{{ t('login.forgetPassword') }}</ElLink>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-01-04 16:53:13 +08:00
|
|
|
<template #login>
|
|
|
|
<ElButton type="primary" class="w-[100%]">{{ t('login.login') }}</ElButton>
|
|
|
|
</template>
|
2022-01-05 17:02:25 +08:00
|
|
|
|
|
|
|
<template #otherIcon>
|
|
|
|
<div class="flex justify-between w-[100%]">
|
2022-01-06 17:13:13 +08:00
|
|
|
<Icon icon="ant-design:github-filled" :size="iconSize" class="cursor-pointer anticon" />
|
|
|
|
<Icon icon="ant-design:wechat-filled" :size="iconSize" class="cursor-pointer anticon" />
|
|
|
|
<Icon
|
|
|
|
icon="ant-design:alipay-circle-filled"
|
|
|
|
:size="iconSize"
|
|
|
|
class="cursor-pointer anticon"
|
|
|
|
/>
|
|
|
|
<Icon
|
|
|
|
icon="ant-design:weibo-circle-filled"
|
|
|
|
:size="iconSize"
|
|
|
|
class="cursor-pointer anticon"
|
|
|
|
/>
|
2022-01-05 17:02:25 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
2022-01-04 16:53:13 +08:00
|
|
|
</Form>
|
2022-01-03 18:01:43 +08:00
|
|
|
</template>
|
2022-01-06 17:13:13 +08:00
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
:deep(.anticon) {
|
|
|
|
&:hover {
|
|
|
|
color: var(--el-color-primary) !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|