style(projects): 重构登录页样式

This commit is contained in:
xlsea 2025-06-19 23:04:09 +08:00
parent 7e4ecae6cb
commit 406800de59
6 changed files with 258 additions and 162 deletions

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 192 KiB

View File

@ -34,6 +34,7 @@ declare module 'vue' {
IconIcRoundRefresh: typeof import('~icons/ic/round-refresh')['default'] IconIcRoundRefresh: typeof import('~icons/ic/round-refresh')['default']
IconIcRoundSearch: typeof import('~icons/ic/round-search')['default'] IconIcRoundSearch: typeof import('~icons/ic/round-search')['default']
IconLocalBanner: typeof import('~icons/local/banner')['default'] IconLocalBanner: typeof import('~icons/local/banner')['default']
IconLocalLoginBg: typeof import('~icons/local/login-bg')['default']
IconLocalLogo: typeof import('~icons/local/logo')['default'] IconLocalLogo: typeof import('~icons/local/logo')['default']
'IconMaterialSymbols:add': typeof import('~icons/material-symbols/add')['default'] 'IconMaterialSymbols:add': typeof import('~icons/material-symbols/add')['default']
'IconMaterialSymbols:deleteOutline': typeof import('~icons/material-symbols/delete-outline')['default'] 'IconMaterialSymbols:deleteOutline': typeof import('~icons/material-symbols/delete-outline')['default']
@ -46,6 +47,7 @@ declare module 'vue' {
IconMaterialSymbolsAddRounded: typeof import('~icons/material-symbols/add-rounded')['default'] IconMaterialSymbolsAddRounded: typeof import('~icons/material-symbols/add-rounded')['default']
IconMaterialSymbolsDeleteOutline: typeof import('~icons/material-symbols/delete-outline')['default'] IconMaterialSymbolsDeleteOutline: typeof import('~icons/material-symbols/delete-outline')['default']
IconMaterialSymbolsDriveFileRenameOutlineOutline: typeof import('~icons/material-symbols/drive-file-rename-outline-outline')['default'] IconMaterialSymbolsDriveFileRenameOutlineOutline: typeof import('~icons/material-symbols/drive-file-rename-outline-outline')['default']
'IconMdi:github': typeof import('~icons/mdi/github')['default']
IconMdiArrowDownThin: typeof import('~icons/mdi/arrow-down-thin')['default'] IconMdiArrowDownThin: typeof import('~icons/mdi/arrow-down-thin')['default']
IconMdiArrowUpThin: typeof import('~icons/mdi/arrow-up-thin')['default'] IconMdiArrowUpThin: typeof import('~icons/mdi/arrow-up-thin')['default']
IconMdiDrag: typeof import('~icons/mdi/drag')['default'] IconMdiDrag: typeof import('~icons/mdi/drag')['default']
@ -53,6 +55,7 @@ declare module 'vue' {
IconMdiKeyboardReturn: typeof import('~icons/mdi/keyboard-return')['default'] IconMdiKeyboardReturn: typeof import('~icons/mdi/keyboard-return')['default']
'IconQuill:collapse': typeof import('~icons/quill/collapse')['default'] 'IconQuill:collapse': typeof import('~icons/quill/collapse')['default']
'IconQuill:expand': typeof import('~icons/quill/expand')['default'] 'IconQuill:expand': typeof import('~icons/quill/expand')['default']
'IconSimpleIcons:gitee': typeof import('~icons/simple-icons/gitee')['default']
IconUilSearch: typeof import('~icons/uil/search')['default'] IconUilSearch: typeof import('~icons/uil/search')['default']
JsonPreview: typeof import('./../components/custom/json-preview.vue')['default'] JsonPreview: typeof import('./../components/custom/json-preview.vue')['default']
LangSwitch: typeof import('./../components/common/lang-switch.vue')['default'] LangSwitch: typeof import('./../components/common/lang-switch.vue')['default']

View File

@ -1,10 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'; import { computed } from 'vue';
import type { Component } from 'vue'; import type { Component } from 'vue';
import { getPaletteColorByNumber, mixColor } from '@sa/color';
import { loginModuleRecord } from '@/constants/app'; import { loginModuleRecord } from '@/constants/app';
import { useAppStore } from '@/store/modules/app'; import { useAppStore } from '@/store/modules/app';
import { useThemeStore } from '@/store/modules/theme'; import { useThemeStore } from '@/store/modules/theme';
import loginBackground from '@/assets/svg-icon/login-background.svg';
import { $t } from '@/locales'; import { $t } from '@/locales';
import PwdLogin from './modules/pwd-login.vue'; import PwdLogin from './modules/pwd-login.vue';
import CodeLogin from './modules/code-login.vue'; import CodeLogin from './modules/code-login.vue';
@ -36,29 +36,23 @@ const moduleMap: Record<UnionKey.LoginModule, LoginModule> = {
}; };
const activeModule = computed(() => moduleMap[props.module || 'pwd-login']); const activeModule = computed(() => moduleMap[props.module || 'pwd-login']);
const bgThemeColor = computed(() =>
themeStore.darkMode ? getPaletteColorByNumber(themeStore.themeColor, 600) : themeStore.themeColor
);
const bgColor = computed(() => {
const COLOR_WHITE = '#ffffff';
const ratio = themeStore.darkMode ? 0.5 : 0.2;
return mixColor(COLOR_WHITE, themeStore.themeColor, ratio);
});
</script> </script>
<template> <template>
<div class="relative size-full flex-center overflow-hidden" :style="{ backgroundColor: bgColor }"> <div class="relative size-full flex flex-wrap overflow-hidden">
<WaveBg :theme-color="bgThemeColor" /> <div class="hidden h-full w-50% bg-primary-100 lg:block dark:bg-primary-800">
<NCard :bordered="false" class="relative z-4 w-auto rd-12px"> <div class="size-full flex-center">
<div class="w-400px lt-sm:w-300px"> <img class="w-60% sm:w-80%" :src="loginBackground" />
</div>
</div>
<div class="w-full flex-col-center px-24px py-32px lg:w-50%">
<div class="mx-auto max-w-464px w-full">
<header class="flex-y-center justify-between"> <header class="flex-y-center justify-between">
<SystemLogo class="text-58px text-primary lt-sm:text-52px" /> <div class="flex-y-center gap-16px">
<h3 class="text-28px text-primary font-500 lt-sm:text-22px">{{ $t('system.title') }}</h3> <SystemLogo class="text-42px text-primary" />
<div class="i-flex-col"> <h3 class="text-32px text-primary font-500">{{ $t('system.title') }}</h3>
</div>
<div class="flex-y-center">
<ThemeSchemaSwitch <ThemeSchemaSwitch
:theme-schema="themeStore.themeScheme" :theme-schema="themeStore.themeScheme"
:show-tooltip="false" :show-tooltip="false"
@ -75,15 +69,14 @@ const bgColor = computed(() => {
</div> </div>
</header> </header>
<main class="pt-24px"> <main class="pt-24px">
<h3 class="text-18px text-primary font-medium">{{ $t(activeModule.label) }}</h3> <div>
<div class="pt-24px">
<Transition :name="themeStore.page.animateMode" mode="out-in" appear> <Transition :name="themeStore.page.animateMode" mode="out-in" appear>
<component :is="activeModule.component" /> <component :is="activeModule.component" />
</Transition> </Transition>
</div> </div>
</main> </main>
</div> </div>
</NCard> </div>
</div> </div>
</template> </template>

View File

@ -121,6 +121,9 @@ async function handleSocialLogin(type: Api.System.SocialSource) {
</script> </script>
<template> <template>
<div>
<div class="mb-12px text-30px text-black font-500 dark:text-white">登录到您的账户</div>
<div class="pb-24px text-18px text-#858585">欢迎回来请输入您的账户信息</div>
<NForm <NForm
ref="formRef" ref="formRef"
:model="model" :model="model"
@ -151,8 +154,8 @@ async function handleSocialLogin(type: Api.System.SocialSource) {
<NFormItem v-if="captchaEnabled" path="code"> <NFormItem v-if="captchaEnabled" path="code">
<div class="w-full flex-y-center gap-16px"> <div class="w-full flex-y-center gap-16px">
<NInput v-model:value="model.code" :placeholder="$t('page.login.common.codePlaceholder')" /> <NInput v-model:value="model.code" :placeholder="$t('page.login.common.codePlaceholder')" />
<NSpin :show="codeLoading" :size="28" class="h-42px"> <NSpin :show="codeLoading" :size="28" class="h-52px">
<NButton :focusable="false" class="login-code h-42px w-116px" @click="handleFetchCaptchaCode"> <NButton :focusable="false" class="login-code h-52px w-136px" @click="handleFetchCaptchaCode">
<img v-if="codeUrl" :src="codeUrl" /> <img v-if="codeUrl" :src="codeUrl" />
<NEmpty v-else :show-icon="false" description="暂无验证码" /> <NEmpty v-else :show-icon="false" description="暂无验证码" />
</NButton> </NButton>
@ -160,15 +163,11 @@ async function handleSocialLogin(type: Api.System.SocialSource) {
</div> </div>
</NFormItem> </NFormItem>
<NSpace vertical :size="16" class="mb-8px"> <NSpace vertical :size="16" class="mb-8px">
<div class="mx-6px flex-y-center justify-between"> <div class="mx-6px mb-10px flex-y-center justify-between">
<NCheckbox v-model:checked="remberMe">{{ $t('page.login.pwdLogin.rememberMe') }}</NCheckbox> <NCheckbox v-model:checked="remberMe" size="large">{{ $t('page.login.pwdLogin.rememberMe') }}</NCheckbox>
<NSpace :size="1"> <NA type="primary" class="text-18px" @click="toggleLoginModule('reset-pwd')">
<ButtonIcon class="color-#44b549" icon="ic:outline-wechat" @click="handleSocialLogin('wechat_open')" /> {{ $t('page.login.pwdLogin.forgetPassword') }}
<ButtonIcon local-icon="topiam" @click="handleSocialLogin('topiam')" /> </NA>
<ButtonIcon local-icon="maxkey" @click="handleSocialLogin('maxkey')" />
<ButtonIcon class="color-#c71d23" icon="simple-icons:gitee" @click="handleSocialLogin('gitee')" />
<ButtonIcon class="color-#010409" icon="mdi:github" @click="handleSocialLogin('github')" />
</NSpace>
</div> </div>
<NButton type="primary" size="large" block :loading="authStore.loginLoading" @click="handleSubmit"> <NButton type="primary" size="large" block :loading="authStore.loginLoading" @click="handleSubmit">
{{ $t('common.login') }} {{ $t('common.login') }}
@ -178,6 +177,33 @@ async function handleSocialLogin(type: Api.System.SocialSource) {
</NButton> </NButton>
</NSpace> </NSpace>
</NForm> </NForm>
<NDivider>
<div class="color-#858585">{{ $t('page.login.pwdLogin.otherAccountLogin') }}</div>
</NDivider>
<div class="w-full flex-y-center gap-16px">
<NButton class="flex-1" @click="handleSocialLogin('gitee')">
<template #icon>
<icon-simple-icons:gitee class="color-#c71d23" />
</template>
<span class="ml-6px">Gitee</span>
</NButton>
<NButton class="flex-1" @click="handleSocialLogin('github')">
<template #icon>
<icon-mdi:github class="color-#010409" />
</template>
<span class="ml-6px">GitHub</span>
</NButton>
</div>
<div class="mt-32px w-full text-center text-18px text-#858585">
您还没有账户
<NA type="primary" class="text-18px" @click="toggleLoginModule('register')">
{{ $t('page.login.common.register') }}
</NA>
</div>
</div>
</template> </template>
<style scoped> <style scoped>
@ -188,7 +214,34 @@ async function handleSocialLogin(type: Api.System.SocialSource) {
} }
img { img {
height: 40px; height: 52px;
} }
} }
:deep(.n-base-selection),
:deep(.n-input) {
--n-height: 52px !important;
--n-font-size: 16px !important;
--n-border-radius: 8px !important;
}
:deep(.n-base-selection-label) {
padding: 0 6px !important;
}
:deep(.n-checkbox) {
--n-size: 18px !important;
--n-font-size: 16px !important;
}
:deep(.n-button) {
--n-height: 52px !important;
--n-font-size: 18px !important;
--n-border-radius: 8px !important;
}
:deep(.n-divider) {
--n-font-size: 16px !important;
--n-font-weight: 400 !important;
}
</style> </style>

View File

@ -103,6 +103,9 @@ handleFetchCaptchaCode();
</script> </script>
<template> <template>
<div>
<div class="mb-12px text-30px text-black font-500 dark:text-white">注册新账户</div>
<div class="pb-24px text-18px text-#858585">欢迎注册请输入您的账户信息</div>
<NForm <NForm
ref="formRef" ref="formRef"
:model="model" :model="model"
@ -136,23 +139,28 @@ handleFetchCaptchaCode();
<NFormItem v-if="captchaEnabled" path="code"> <NFormItem v-if="captchaEnabled" path="code">
<div class="w-full flex-y-center gap-16px"> <div class="w-full flex-y-center gap-16px">
<NInput v-model:value="model.code" :placeholder="$t('page.login.common.codePlaceholder')" /> <NInput v-model:value="model.code" :placeholder="$t('page.login.common.codePlaceholder')" />
<NSpin :show="codeLoading" :size="28" class="h-42px"> <NSpin :show="codeLoading" :size="28" class="h-52px">
<NButton :focusable="false" class="login-code h-42px w-116px" @click="handleFetchCaptchaCode"> <NButton :focusable="false" class="login-code h-52px w-136px" @click="handleFetchCaptchaCode">
<img v-if="codeUrl" :src="codeUrl" /> <img v-if="codeUrl" :src="codeUrl" />
<NEmpty v-else :show-icon="false" description="暂无验证码" /> <NEmpty v-else :show-icon="false" description="暂无验证码" />
</NButton> </NButton>
</NSpin> </NSpin>
</div> </div>
</NFormItem> </NFormItem>
<NSpace vertical :size="18" class="w-full"> <NSpace vertical :size="18" class="w-full pt-6px">
<NButton type="primary" size="large" block :loading="registerLoading" @click="handleSubmit"> <NButton type="primary" size="large" block :loading="registerLoading" @click="handleSubmit">
{{ $t('page.login.common.register') }} {{ $t('page.login.common.register') }}
</NButton> </NButton>
<NButton size="large" block @click="toggleLoginModule('pwd-login')">
{{ $t('page.login.common.back') }}
</NButton>
</NSpace> </NSpace>
</NForm> </NForm>
<div class="mt-32px w-full text-center text-18px text-#858585">
您已有账户
<NA type="primary" class="text-18px" @click="toggleLoginModule('pwd-login')">
{{ $t('common.login') }}
</NA>
</div>
</div>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
@ -166,4 +174,21 @@ handleFetchCaptchaCode();
height: 40px; height: 40px;
} }
} }
:deep(.n-base-selection),
:deep(.n-input) {
--n-height: 52px !important;
--n-font-size: 16px !important;
--n-border-radius: 8px !important;
}
:deep(.n-base-selection-label) {
padding: 0 6px !important;
}
:deep(.n-button) {
--n-height: 52px !important;
--n-font-size: 18px !important;
--n-border-radius: 8px !important;
}
</style> </style>

View File

@ -45,6 +45,9 @@ async function handleSubmit() {
</script> </script>
<template> <template>
<div>
<div class="mb-12px text-30px text-black font-500 dark:text-white">{{ $t('page.login.resetPwd.title') }}</div>
<div class="pb-24px text-18px text-#858585">请输入您的手机号我们将发送验证码到您的手机</div>
<NForm ref="formRef" :model="model" :rules="rules" size="large" :show-label="false" @keyup.enter="handleSubmit"> <NForm ref="formRef" :model="model" :rules="rules" size="large" :show-label="false" @keyup.enter="handleSubmit">
<NFormItem path="phone"> <NFormItem path="phone">
<NInput v-model:value="model.phone" :placeholder="$t('page.login.common.phonePlaceholder')" /> <NInput v-model:value="model.phone" :placeholder="$t('page.login.common.phonePlaceholder')" />
@ -69,14 +72,32 @@ async function handleSubmit() {
/> />
</NFormItem> </NFormItem>
<NSpace vertical :size="18" class="w-full"> <NSpace vertical :size="18" class="w-full">
<NButton type="primary" size="large" round block @click="handleSubmit"> <NButton type="primary" size="large" block @click="handleSubmit">
{{ $t('common.confirm') }} {{ $t('page.login.resetPwd.title') }}
</NButton> </NButton>
<NButton size="large" round block @click="toggleLoginModule('pwd-login')"> <NButton size="large" block @click="toggleLoginModule('pwd-login')">
{{ $t('page.login.common.back') }} {{ $t('page.login.common.back') }}
</NButton> </NButton>
</NSpace> </NSpace>
</NForm> </NForm>
</div>
</template> </template>
<style scoped></style> <style scoped>
:deep(.n-base-selection),
:deep(.n-input) {
--n-height: 52px !important;
--n-font-size: 16px !important;
--n-border-radius: 8px !important;
}
:deep(.n-base-selection-label) {
padding: 0 6px !important;
}
:deep(.n-button) {
--n-height: 52px !important;
--n-font-size: 18px !important;
--n-border-radius: 8px !important;
}
</style>