vue-vben-admin/src/views/sys/login/Login.vue

219 lines
5.2 KiB
Vue
Raw Normal View History

2020-09-28 20:19:10 +08:00
<template>
2021-02-21 17:56:23 +08:00
<div :class="prefixCls" class="relative w-full h-full px-4">
<AppLocalePicker
class="absolute top-4 right-4 enter-x text-white xl:text-gray-600"
:showText="false"
/>
2021-04-07 23:14:51 +08:00
<AppDarkModeToggle class="absolute top-3 right-7 enter-x" />
2021-02-21 17:56:23 +08:00
<span class="-enter-x xl:hidden">
<AppLogo :alwaysShowTitle="true" />
</span>
2021-02-23 00:31:10 +08:00
<div class="container relative h-full py-2 mx-auto sm:px-10">
2021-02-21 17:56:23 +08:00
<div class="flex h-full">
<div class="hidden xl:flex xl:flex-col xl:w-6/12 min-h-full mr-4 pl-4">
<AppLogo class="-enter-x" />
<div class="my-auto">
<img
:alt="title"
src="../../../assets/svg/login-box-bg.svg"
class="w-1/2 -mt-16 -enter-x"
/>
<div class="mt-10 font-medium text-white -enter-x">
<span class="mt-4 text-3xl inline-block"> {{ t('sys.login.signInTitle') }}</span>
</div>
<div class="mt-5 text-md text-white font-normal dark:text-gray-500 -enter-x">
{{ t('sys.login.signInDesc') }}
</div>
</div>
</div>
<div class="h-full xl:h-auto flex py-5 xl:py-0 xl:my-0 w-full xl:w-6/12">
<div
2021-04-08 22:08:55 +08:00
:class="`${prefixCls}-form`"
2021-04-07 23:14:51 +08:00
class="my-auto mx-auto xl:ml-20 xl:bg-transparent px-5 py-8 sm:px-8 xl:p-4 rounded-md shadow-md xl:shadow-none w-full sm:w-3/4 lg:w-2/4 xl:w-auto enter-x relative"
2021-02-21 17:56:23 +08:00
>
2021-02-22 23:04:47 +08:00
<LoginForm />
<ForgetPasswordForm />
<RegisterForm />
<MobileForm />
<QrCodeForm />
2021-02-21 17:56:23 +08:00
</div>
2020-09-28 20:19:10 +08:00
</div>
</div>
</div>
</div>
</template>
<script lang="ts">
2021-02-21 17:56:23 +08:00
import { defineComponent, computed } from 'vue';
2021-02-21 17:56:23 +08:00
import { AppLogo } from '/@/components/Application';
2021-04-07 23:14:51 +08:00
import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application';
2021-02-21 17:56:23 +08:00
import LoginForm from './LoginForm.vue';
import ForgetPasswordForm from './ForgetPasswordForm.vue';
import RegisterForm from './RegisterForm.vue';
import MobileForm from './MobileForm.vue';
import QrCodeForm from './QrCodeForm.vue';
import { useGlobSetting } from '/@/hooks/setting';
2020-11-25 23:20:30 +08:00
import { useI18n } from '/@/hooks/web/useI18n';
2021-02-21 17:56:23 +08:00
import { useDesign } from '/@/hooks/web/useDesign';
2021-04-10 19:25:49 +08:00
import { useLocaleStore } from '/@/store/modules/locale';
2020-09-28 20:19:10 +08:00
export default defineComponent({
2021-02-21 17:56:23 +08:00
name: 'Login',
components: {
2021-02-21 17:56:23 +08:00
AppLogo,
LoginForm,
ForgetPasswordForm,
RegisterForm,
MobileForm,
QrCodeForm,
2020-11-25 23:20:30 +08:00
AppLocalePicker,
2021-04-07 23:14:51 +08:00
AppDarkModeToggle,
},
2020-09-28 20:19:10 +08:00
setup() {
2020-11-23 00:35:15 +08:00
const globSetting = useGlobSetting();
2021-02-21 17:56:23 +08:00
const { prefixCls } = useDesign('login');
2020-12-01 23:51:39 +08:00
const { t } = useI18n();
2021-04-10 19:25:49 +08:00
const localeStore = useLocaleStore();
2020-09-28 20:19:10 +08:00
return {
t,
2021-02-21 17:56:23 +08:00
prefixCls,
title: computed(() => globSetting?.title ?? ''),
showLocale: localeStore.getShowPicker,
2020-09-28 20:19:10 +08:00
};
},
});
</script>
2020-11-26 21:10:21 +08:00
<style lang="less">
2021-02-21 17:56:23 +08:00
@prefix-cls: ~'@{namespace}-login';
@logo-prefix-cls: ~'@{namespace}-app-logo';
@countdown-prefix-cls: ~'@{namespace}-countdown-input';
2021-04-08 22:08:55 +08:00
@dark-bg: #293146;
2020-11-26 21:10:21 +08:00
2021-04-07 23:14:51 +08:00
html[data-theme='dark'] {
.@{prefix-cls} {
2021-04-08 22:08:55 +08:00
background: @dark-bg;
2021-04-07 23:14:51 +08:00
&::before {
background-image: url(/@/assets/svg/login-bg-dark.svg);
}
.ant-input,
.ant-input-password {
background-color: #232a3b;
}
.ant-btn:not(.ant-btn-link):not(.ant-btn-primary) {
border: 1px solid #4a5569;
}
2021-04-08 22:08:55 +08:00
&-form {
background: transparent !important;
}
.app-iconify {
color: #fff;
}
2021-04-07 23:14:51 +08:00
}
}
2021-02-21 17:56:23 +08:00
.@{prefix-cls} {
overflow: hidden;
2021-02-21 17:56:23 +08:00
@media (max-width: @screen-xl) {
2021-04-08 22:08:55 +08:00
background: #293146;
.@{prefix-cls}-form {
background: #fff;
}
2021-02-21 17:56:23 +08:00
}
2020-09-28 20:19:10 +08:00
2021-02-21 17:56:23 +08:00
&::before {
position: absolute;
top: 0;
left: 0;
width: 100%;
2020-10-11 00:05:29 +08:00
height: 100%;
2021-02-21 17:56:23 +08:00
margin-left: -48%;
background-image: url(/@/assets/svg/login-bg.svg);
background-position: 100%;
background-repeat: no-repeat;
background-size: auto 100%;
content: '';
@media (max-width: @screen-xl) {
display: none;
}
2020-09-28 20:19:10 +08:00
}
2021-02-21 17:56:23 +08:00
.@{logo-prefix-cls} {
position: absolute;
top: 12px;
height: 30px;
&__title {
font-size: 16px;
color: #fff;
2021-01-18 23:37:36 +08:00
}
2021-02-21 17:56:23 +08:00
img {
width: 32px;
2020-11-23 00:35:15 +08:00
}
2021-02-21 17:56:23 +08:00
}
.container {
.@{logo-prefix-cls} {
display: flex;
width: 60%;
height: 80px;
&__title {
font-size: 24px;
color: #fff;
}
2020-11-23 00:35:15 +08:00
2021-02-21 17:56:23 +08:00
img {
width: 48px;
2020-10-11 00:05:29 +08:00
}
2021-02-21 17:56:23 +08:00
}
}
&-sign-in-way {
.anticon {
font-size: 22px;
color: #888;
cursor: pointer;
2020-10-11 00:05:29 +08:00
2021-02-21 17:56:23 +08:00
&:hover {
color: @primary-color;
2020-10-11 00:05:29 +08:00
}
}
2020-09-28 20:19:10 +08:00
}
2021-02-21 17:56:23 +08:00
input:not([type='checkbox']) {
min-width: 360px;
2021-02-26 00:17:50 +08:00
@media (max-width: @screen-lg) {
min-width: 300px;
}
@media (max-width: @screen-md) {
min-width: 280px;
}
2021-02-21 17:56:23 +08:00
@media (max-width: @screen-sm) {
2021-03-02 00:40:00 +08:00
min-width: 180px;
2021-02-21 17:56:23 +08:00
}
}
.@{countdown-prefix-cls} input {
min-width: unset;
}
.ant-divider-inner-text {
font-size: 12px;
color: @text-color-secondary;
}
2020-09-28 20:19:10 +08:00
}
</style>