From 13254e70a1c51be035bd135599fcc4f1d1756b6b Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Sun, 5 Nov 2023 10:52:36 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20:recycle:=20=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E8=AE=BE=E7=BD=AE=E6=B7=BB=E5=8A=A0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=EF=BC=8C=E9=AA=8C=E8=AF=81=E7=A0=81=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=90=8D=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/auth/types.ts | 2 +- src/settings.ts | 7 ++++++- src/views/login/index.vue | 26 +++++++++++++++++++++----- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/api/auth/types.ts b/src/api/auth/types.ts index 858f1d9..f76e0f9 100644 --- a/src/api/auth/types.ts +++ b/src/api/auth/types.ts @@ -55,5 +55,5 @@ export interface CaptchaResult { /** * 验证码图片Base64字符串 */ - verifyCodeBase64: string; + captchaImgBase64: string; } diff --git a/src/settings.ts b/src/settings.ts index 75df0b7..da0ab18 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -3,9 +3,13 @@ */ interface DefaultSettings { /** - * 系统title + * 系统标题 */ title: string; + /** + * 系统版本 + */ + version: string; /** * 是否显示设置 */ @@ -49,6 +53,7 @@ interface DefaultSettings { const defaultSettings: DefaultSettings = { title: "vue3-element-admin", + version: "v.2.6.5", showSettings: true, tagsView: true, fixedHeader: false, diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 91057eb..d3312f2 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -9,7 +9,7 @@ :inactive-icon="IconEpSunny" active-color="var(--el-fill-color-dark)" inactive-color="var(--el-color-primary)" - @change="toggleDark" + @change="handleThemeChange" /> @@ -18,7 +18,8 @@ class="z-1 !border-none w-100 !bg-transparent !rounded-4%

- {{ $t("login.title") }} + {{ defaultSettings.title }} + {{ defaultSettings.version }}

-
+

Copyright © 2021 - 2023 youlai.tech All Rights Reserved. 有来技术 版权所有 @@ -121,6 +122,7 @@ import LangSelect from "@/components/LangSelect/index.vue"; import SvgIcon from "@/components/SvgIcon/index.vue"; import IconEpSunny from "~icons/ep/sunny"; import IconEpMoon from "~icons/ep/moon"; +import { useSettingsStore } from "@/store/modules/settings"; // 状态管理依赖 import { useUserStore } from "@/store/modules/user"; @@ -130,6 +132,7 @@ import { useAppStore } from "@/store/modules/app"; import { LocationQuery, LocationQueryValue, useRoute } from "vue-router"; import { getCaptchaApi } from "@/api/auth"; import { LoginData } from "@/api/auth/types"; +import defaultSettings from "@/settings"; const appStore = useAppStore(); const userStore = useUserStore(); @@ -138,6 +141,14 @@ const route = useRoute(); const isDark = useDark(); const toggleDark = () => useToggle(isDark); +function handleThemeChange() { + toggleDark(); + useSettingsStore().changeSetting({ + key: "theme", + value: isDark.value ? "dark" : "light", + }); +} + /** * 按钮loading */ @@ -219,9 +230,9 @@ function checkCapslock(e: any) { */ function getCaptcha() { getCaptchaApi().then(({ data }) => { - const { verifyCodeBase64, verifyCodeKey } = data; + const { captchaImgBase64, verifyCodeKey } = data; loginData.value.verifyCodeKey = verifyCodeKey; - captchaBase64.value = verifyCodeBase64; + captchaBase64.value = captchaImgBase64; }); } @@ -306,6 +317,11 @@ onMounted(() => { background-color: transparent; box-shadow: none; + &.is-focus, + &:hover { + box-shadow: none !important; + } + input:-webkit-autofill { transition: background-color 5000s ease-in-out 0s; /* 通过延时渲染背景色变相去除背景颜色 */ }