Files
ReelShortWeb/src/views/Login/Login.vue
T

263 lines
5.4 KiB
Vue

<!-- Author: fruit.com.cn -->
<script setup lang="ts">
import { LoginForm } from './components'
import { ThemeSwitch } from '@/components/ThemeSwitch'
import { LocaleDropdown } from '@/components/LocaleDropdown'
import { useI18n } from '@/hooks/web/useI18n'
import { getCssVar, underlineToHump } from '@/utils'
import { useAppStore } from '@/store/modules/app'
import { computed } from 'vue'
import { ElScrollbar } from 'element-plus'
const appStore = useAppStore()
const { t } = useI18n()
const isDark = computed(() => appStore.getIsDark)
const toolColor = computed(() => (isDark.value ? '#e5eaf3' : '#303133'))
const themeChange = () => {
const color = getCssVar('--el-bg-color')
appStore.setMenuTheme(color)
appStore.setHeaderTheme(color)
}
</script>
<template>
<div class="login-page" :class="{ 'is-dark': isDark }">
<ElScrollbar class="login-scroll">
<div class="login-shell">
<section class="login-hero">
<div class="hero-brand">
<img src="@/assets/imgs/brand-mark.png" alt="" />
<span>{{ underlineToHump(appStore.getTitle) }}</span>
</div>
<div class="hero-copy">
<p class="hero-kicker">{{ t('login.consoleLabel') }}</p>
<h1>{{ t('login.welcome') }}</h1>
</div>
</section>
<section class="login-panel">
<div class="login-tools">
<ThemeSwitch @change="themeChange" />
<LocaleDropdown :color="toolColor" />
</div>
<div class="login-card">
<LoginForm />
</div>
</section>
</div>
</ElScrollbar>
</div>
</template>
<style lang="less" scoped>
.login-page {
height: 100%;
color: var(--el-text-color-primary);
background: var(--el-bg-color-page);
}
.login-scroll {
height: 100%;
}
.login-shell {
display: flex;
min-height: 100vh;
}
.login-hero {
position: relative;
display: flex;
padding: 40px 56px 56px;
overflow: hidden;
color: #fff;
background:
radial-gradient(circle at 18% 18%, rgb(255 255 255 / 10%), transparent 28%),
radial-gradient(circle at 82% 78%, rgb(196 50 42 / 34%), transparent 34%),
linear-gradient(155deg, #17100f 0%, #241714 55%, #3b1d19 100%);
flex: 1.05;
flex-direction: column;
justify-content: space-between;
&::after {
position: absolute;
right: -80px;
bottom: -120px;
width: 360px;
height: 360px;
border: 1px solid rgb(255 255 255 / 16%);
border-radius: 50%;
content: '';
}
}
.hero-brand {
position: relative;
z-index: 1;
display: flex;
align-items: center;
gap: 12px;
font-size: 20px;
font-weight: 700;
img {
width: var(--brand-mark-size);
height: var(--brand-mark-size);
border-radius: var(--brand-mark-radius);
box-shadow: 0 10px 24px rgb(196 50 42 / 28%);
}
}
.hero-copy {
position: relative;
z-index: 1;
max-width: 460px;
h1 {
margin: 10px 0 12px;
font-size: 40px;
font-weight: 700;
line-height: 1.2;
color: #fff;
}
}
.hero-kicker {
margin: 0;
font-size: 13px;
font-weight: 600;
letter-spacing: 0.08em;
color: var(--el-color-primary-light-8) !important;
}
.login-panel {
position: relative;
display: flex;
flex: 0.95;
align-items: center;
justify-content: center;
padding: 88px 32px 48px;
background: var(--el-bg-color-page);
}
.login-tools {
position: absolute;
top: 22px;
right: 24px;
display: flex;
gap: 12px;
align-items: center;
}
.login-card {
width: min(420px, 100%);
padding: 36px 32px 28px;
background: var(--el-bg-color);
border: 1px solid var(--el-border-color-light);
border-radius: 18px;
box-shadow: 0 18px 50px rgb(42 24 16 / 10%);
}
.is-dark {
background: var(--el-bg-color-page);
.login-hero {
background:
radial-gradient(circle at 18% 18%, rgb(255 255 255 / 8%), transparent 30%),
linear-gradient(155deg, #0e0a09 0%, #1a1110 58%, #2c1513 100%);
}
.login-panel {
background: var(--el-bg-color-page);
}
.login-card {
background: var(--el-bg-color-overlay);
border-color: var(--el-border-color);
box-shadow: none;
}
}
@media (width <= 960px) {
.login-shell {
flex-direction: column;
}
.login-hero {
flex: none;
min-height: 132px;
padding: 16px 24px 20px;
}
.hero-copy h1 {
margin: 6px 0 8px;
font-size: 28px;
}
.login-panel {
padding: 44px 16px 12px;
}
.login-card {
padding-top: 28px;
padding-bottom: 20px;
}
.login-tools {
top: 8px;
right: 16px;
}
}
@media (width <= 600px) {
.login-hero {
min-height: 118px;
padding: 16px 18px 18px;
}
.login-card {
padding: 28px 20px 24px;
}
}
</style>
<style lang="less">
.login-heading {
margin-bottom: 8px;
h2 {
margin: 0;
font-size: 28px;
font-weight: 700;
line-height: 1.2;
color: var(--el-text-color-primary);
}
p {
margin: 8px 0 0;
font-size: 14px;
color: var(--el-text-color-secondary);
}
}
.login-card :deep(.el-button--primary) {
--el-button-bg-color: var(--app-brand);
--el-button-border-color: var(--app-brand);
--el-button-hover-bg-color: var(--app-brand-pressed);
--el-button-hover-border-color: var(--app-brand-pressed);
--el-button-active-bg-color: var(--app-brand-pressed);
--el-button-active-border-color: var(--app-brand-pressed);
}
.login-card :deep(.el-input__wrapper.is-focus) {
box-shadow: 0 0 0 1px var(--app-brand) inset;
}
body:has(.login-page) {
min-width: 0;
background: transparent;
}
</style>