feat(admin): 登录表单区对齐客迹V1——移除账号下拉/注册/忘记密码入口,固定浅色
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -3,9 +3,7 @@
|
|||||||
<div class="flex w-full h-screen">
|
<div class="flex w-full h-screen">
|
||||||
<LoginLeftView />
|
<LoginLeftView />
|
||||||
|
|
||||||
<div class="relative flex-1">
|
<div class="relative flex-1 auth-right-bg">
|
||||||
<AuthTopBar />
|
|
||||||
|
|
||||||
<div class="auth-right-wrap">
|
<div class="auth-right-wrap">
|
||||||
<div class="form">
|
<div class="form">
|
||||||
<h3 class="title">{{ $t('login.title') }}</h3>
|
<h3 class="title">{{ $t('login.title') }}</h3>
|
||||||
@@ -14,33 +12,24 @@
|
|||||||
ref="formRef"
|
ref="formRef"
|
||||||
:model="formData"
|
:model="formData"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
|
label-position="top"
|
||||||
:key="formKey"
|
:key="formKey"
|
||||||
@keyup.enter="handleSubmit"
|
@keyup.enter="handleSubmit"
|
||||||
style="margin-top: 25px"
|
class="login-form"
|
||||||
>
|
>
|
||||||
<ElFormItem prop="account">
|
<ElFormItem :label="$t('login.accountLabel')" prop="username">
|
||||||
<ElSelect v-model="formData.account" @change="setupAccount">
|
|
||||||
<ElOption
|
|
||||||
v-for="account in accounts"
|
|
||||||
:key="account.key"
|
|
||||||
:label="account.label"
|
|
||||||
:value="account.key"
|
|
||||||
>
|
|
||||||
<span>{{ account.label }}</span>
|
|
||||||
</ElOption>
|
|
||||||
</ElSelect>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem prop="username">
|
|
||||||
<ElInput
|
<ElInput
|
||||||
class="custom-height"
|
class="custom-height"
|
||||||
:placeholder="$t('login.placeholder.username')"
|
:placeholder="$t('login.placeholder.username')"
|
||||||
|
:prefix-icon="User"
|
||||||
v-model.trim="formData.username"
|
v-model.trim="formData.username"
|
||||||
/>
|
/>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
<ElFormItem prop="password">
|
<ElFormItem :label="$t('login.passwordLabel')" prop="password">
|
||||||
<ElInput
|
<ElInput
|
||||||
class="custom-height"
|
class="custom-height"
|
||||||
:placeholder="$t('login.placeholder.password')"
|
:placeholder="$t('login.placeholder.password')"
|
||||||
|
:prefix-icon="Lock"
|
||||||
v-model.trim="formData.password"
|
v-model.trim="formData.password"
|
||||||
type="password"
|
type="password"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
@@ -49,7 +38,7 @@
|
|||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
|
|
||||||
<!-- 推拽验证 -->
|
<!-- 推拽验证 -->
|
||||||
<div class="relative pb-5 mt-6">
|
<div class="relative pb-5 mt-4">
|
||||||
<div
|
<div
|
||||||
class="relative z-[2] overflow-hidden select-none rounded-lg border border-transparent tad-300"
|
class="relative z-[2] overflow-hidden select-none rounded-lg border border-transparent tad-300"
|
||||||
:class="{ '!border-[#FF4E4F]': !isPassing && isClickPass }"
|
:class="{ '!border-[#FF4E4F]': !isPassing && isClickPass }"
|
||||||
@@ -58,11 +47,13 @@
|
|||||||
ref="dragVerify"
|
ref="dragVerify"
|
||||||
v-model:value="isPassing"
|
v-model:value="isPassing"
|
||||||
:text="$t('login.sliderText')"
|
:text="$t('login.sliderText')"
|
||||||
textColor="var(--art-gray-700)"
|
textColor="#4D5875"
|
||||||
:successText="$t('login.sliderSuccessText')"
|
:successText="$t('login.sliderSuccessText')"
|
||||||
progressBarBg="var(--main-color)"
|
progressBarBg="var(--main-color)"
|
||||||
:background="isDark ? '#26272F' : '#F1F1F4'"
|
background="#E8EEF6"
|
||||||
handlerBg="var(--default-box-color)"
|
handlerBg="#FFFFFF"
|
||||||
|
:height="56"
|
||||||
|
radius="10px"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<p
|
<p
|
||||||
@@ -77,12 +68,9 @@
|
|||||||
<ElCheckbox v-model="formData.rememberPassword">{{
|
<ElCheckbox v-model="formData.rememberPassword">{{
|
||||||
$t('login.rememberPwd')
|
$t('login.rememberPwd')
|
||||||
}}</ElCheckbox>
|
}}</ElCheckbox>
|
||||||
<RouterLink class="text-theme" :to="{ name: 'ForgetPassword' }">{{
|
|
||||||
$t('login.forgetPwd')
|
|
||||||
}}</RouterLink>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="margin-top: 30px">
|
<div class="mt-6">
|
||||||
<ElButton
|
<ElButton
|
||||||
class="w-full custom-height"
|
class="w-full custom-height"
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -94,11 +82,10 @@
|
|||||||
</ElButton>
|
</ElButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-5 text-sm text-gray-600">
|
<div class="admin-assigned">
|
||||||
<span>{{ $t('login.noAccount') }}</span>
|
<span class="line"></span>
|
||||||
<RouterLink class="text-theme" :to="{ name: 'Register' }">{{
|
<span class="text">{{ $t('login.adminAssigned') }}</span>
|
||||||
$t('login.register')
|
<span class="line"></span>
|
||||||
}}</RouterLink>
|
|
||||||
</div>
|
</div>
|
||||||
</ElForm>
|
</ElForm>
|
||||||
</div>
|
</div>
|
||||||
@@ -109,17 +96,15 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import AppConfig from '@/config'
|
import AppConfig from '@/config'
|
||||||
|
import { User, Lock } from '@element-plus/icons-vue'
|
||||||
import { useUserStore } from '@/store/modules/user'
|
import { useUserStore } from '@/store/modules/user'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { HttpError } from '@/utils/http/error'
|
import { HttpError } from '@/utils/http/error'
|
||||||
import { fetchLogin } from '@/api/auth'
|
import { fetchLogin } from '@/api/auth'
|
||||||
import { ElNotification, type FormInstance, type FormRules } from 'element-plus'
|
import { ElNotification, type FormInstance, type FormRules } from 'element-plus'
|
||||||
import { useSettingStore } from '@/store/modules/setting'
|
|
||||||
|
|
||||||
defineOptions({ name: 'Login' })
|
defineOptions({ name: 'Login' })
|
||||||
|
|
||||||
const settingStore = useSettingStore()
|
|
||||||
const { isDark } = storeToRefs(settingStore)
|
|
||||||
const { t, locale } = useI18n()
|
const { t, locale } = useI18n()
|
||||||
const formKey = ref(0)
|
const formKey = ref(0)
|
||||||
|
|
||||||
@@ -128,27 +113,6 @@
|
|||||||
formKey.value++
|
formKey.value++
|
||||||
})
|
})
|
||||||
|
|
||||||
type AccountKey = 'admin'
|
|
||||||
|
|
||||||
export interface Account {
|
|
||||||
key: AccountKey
|
|
||||||
label: string
|
|
||||||
userName: string
|
|
||||||
password: string
|
|
||||||
roles: string[]
|
|
||||||
}
|
|
||||||
|
|
||||||
// 对接 Django 后端真实账号(M1 单管理员),密码不预填
|
|
||||||
const accounts = computed<Account[]>(() => [
|
|
||||||
{
|
|
||||||
key: 'admin',
|
|
||||||
label: t('login.roles.admin'),
|
|
||||||
userName: 'admin',
|
|
||||||
password: '',
|
|
||||||
roles: ['R_ADMIN']
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
const dragVerify = ref()
|
const dragVerify = ref()
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
@@ -162,7 +126,7 @@
|
|||||||
|
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
account: '',
|
account: '',
|
||||||
username: '',
|
username: 'admin',
|
||||||
password: '',
|
password: '',
|
||||||
rememberPassword: true
|
rememberPassword: true
|
||||||
})
|
})
|
||||||
@@ -174,18 +138,6 @@
|
|||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
setupAccount('admin')
|
|
||||||
})
|
|
||||||
|
|
||||||
// 设置账号
|
|
||||||
const setupAccount = (key: AccountKey) => {
|
|
||||||
const selectedAccount = accounts.value.find((account: Account) => account.key === key)
|
|
||||||
formData.account = key
|
|
||||||
formData.username = selectedAccount?.userName ?? ''
|
|
||||||
formData.password = selectedAccount?.password ?? ''
|
|
||||||
}
|
|
||||||
|
|
||||||
// 登录
|
// 登录
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
if (!formRef.value) return
|
if (!formRef.value) return
|
||||||
@@ -263,9 +215,3 @@
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
@import './style.css';
|
@import './style.css';
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
:deep(.el-select__wrapper) {
|
|
||||||
height: 40px !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -1,8 +1,22 @@
|
|||||||
@reference '@styles/core/tailwind.css';
|
@reference '@styles/core/tailwind.css';
|
||||||
|
|
||||||
/* 授权页右侧区域 */
|
/* 授权页右侧区域(客迹V1:固定浅色,不随暗色主题变化) */
|
||||||
|
.auth-right-bg {
|
||||||
|
/* 覆盖 Element Plus 暗色变量,防止 html.dark 时表单控件变暗 */
|
||||||
|
--el-bg-color: #ffffff;
|
||||||
|
--el-bg-color-overlay: #ffffff;
|
||||||
|
--el-fill-color-blank: #ffffff;
|
||||||
|
--el-fill-color-light: #f5f7fa;
|
||||||
|
--el-text-color-primary: #1a1a1a;
|
||||||
|
--el-text-color-regular: #303133;
|
||||||
|
--el-border-color: #dcdfe6;
|
||||||
|
--el-border-color-light: #e4e7ed;
|
||||||
|
--el-border-color-lighter: #ebeef5;
|
||||||
|
background-color: #f7f8fa;
|
||||||
|
}
|
||||||
|
|
||||||
.auth-right-wrap {
|
.auth-right-wrap {
|
||||||
@apply absolute inset-0 w-[440px] h-[650px] py-[5px] m-auto overflow-hidden
|
@apply absolute inset-0 w-[440px] h-[680px] py-[5px] m-auto overflow-hidden
|
||||||
max-sm:px-7 max-sm:w-full
|
max-sm:px-7 max-sm:w-full
|
||||||
animate-[slideInRight_0.6s_cubic-bezier(0.25,0.46,0.45,0.94)_forwards]
|
animate-[slideInRight_0.6s_cubic-bezier(0.25,0.46,0.45,0.94)_forwards]
|
||||||
max-md:animate-none;
|
max-md:animate-none;
|
||||||
@@ -12,15 +26,34 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
@apply text-g-900 text-4xl font-semibold max-md:text-3xl max-sm:pt-10;
|
@apply text-[#1A1A1A] text-[32px] font-semibold text-center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sub-title {
|
.sub-title {
|
||||||
@apply mt-[10px] text-g-600 text-sm;
|
@apply mt-[10px] text-[#8A94A6] text-[15px] text-center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-height {
|
.custom-height {
|
||||||
@apply !h-[40px];
|
@apply !h-[56px];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 表单标签样式 */
|
||||||
|
:deep(.el-form-item__label) {
|
||||||
|
color: #1a1a1a;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 账号由管理员分配 */
|
||||||
|
.admin-assigned {
|
||||||
|
@apply flex-cc gap-3 mt-8;
|
||||||
|
|
||||||
|
.line {
|
||||||
|
@apply inline-block w-6 h-px bg-[#D3D9E3];
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
@apply text-[13px] text-[#9AA3B2];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user