refactor: ♻️ 系统默认设置添加版本号,验证码字段名调整

Former-commit-id: 13254e70a1c51be035bd135599fcc4f1d1756b6b
This commit is contained in:
hxr
2023-11-05 10:52:36 +08:00
parent 35371481e3
commit b43bf70f21
3 changed files with 28 additions and 7 deletions

View File

@@ -55,5 +55,5 @@ export interface CaptchaResult {
/** /**
* 验证码图片Base64字符串 * 验证码图片Base64字符串
*/ */
verifyCodeBase64: string; captchaImgBase64: string;
} }

View File

@@ -3,9 +3,13 @@
*/ */
interface DefaultSettings { interface DefaultSettings {
/** /**
* 系统title * 系统标题
*/ */
title: string; title: string;
/**
* 系统版本
*/
version: string;
/** /**
* 是否显示设置 * 是否显示设置
*/ */
@@ -49,6 +53,7 @@ interface DefaultSettings {
const defaultSettings: DefaultSettings = { const defaultSettings: DefaultSettings = {
title: "vue3-element-admin", title: "vue3-element-admin",
version: "v.2.6.5",
showSettings: true, showSettings: true,
tagsView: true, tagsView: true,
fixedHeader: false, fixedHeader: false,

View File

@@ -9,7 +9,7 @@
:inactive-icon="IconEpSunny" :inactive-icon="IconEpSunny"
active-color="var(--el-fill-color-dark)" active-color="var(--el-fill-color-dark)"
inactive-color="var(--el-color-primary)" inactive-color="var(--el-color-primary)"
@change="toggleDark" @change="handleThemeChange"
/> />
<lang-select class="ml-4 cursor-pointer" /> <lang-select class="ml-4 cursor-pointer" />
</div> </div>
@@ -18,7 +18,8 @@
class="z-1 !border-none w-100 !bg-transparent !rounded-4% <sm:w-83" class="z-1 !border-none w-100 !bg-transparent !rounded-4% <sm:w-83"
> >
<h2 class="text-center"> <h2 class="text-center">
{{ $t("login.title") }} {{ defaultSettings.title }}
<el-tag class="ml-2">{{ defaultSettings.version }}</el-tag>
</h2> </h2>
<el-form <el-form
ref="loginFormRef" ref="loginFormRef"
@@ -104,7 +105,7 @@
</el-card> </el-card>
<!-- ICP备案 --> <!-- ICP备案 -->
<div class="absolute bottom-1 text-[6px] text-center"> <div class="absolute bottom-1 text-[10px] text-center">
<p> <p>
Copyright © 2021 - 2023 youlai.tech All Rights Reserved. 有来技术 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 SvgIcon from "@/components/SvgIcon/index.vue";
import IconEpSunny from "~icons/ep/sunny"; import IconEpSunny from "~icons/ep/sunny";
import IconEpMoon from "~icons/ep/moon"; import IconEpMoon from "~icons/ep/moon";
import { useSettingsStore } from "@/store/modules/settings";
// 状态管理依赖 // 状态管理依赖
import { useUserStore } from "@/store/modules/user"; import { useUserStore } from "@/store/modules/user";
@@ -130,6 +132,7 @@ import { useAppStore } from "@/store/modules/app";
import { LocationQuery, LocationQueryValue, useRoute } from "vue-router"; import { LocationQuery, LocationQueryValue, useRoute } from "vue-router";
import { getCaptchaApi } from "@/api/auth"; import { getCaptchaApi } from "@/api/auth";
import { LoginData } from "@/api/auth/types"; import { LoginData } from "@/api/auth/types";
import defaultSettings from "@/settings";
const appStore = useAppStore(); const appStore = useAppStore();
const userStore = useUserStore(); const userStore = useUserStore();
@@ -138,6 +141,14 @@ const route = useRoute();
const isDark = useDark(); const isDark = useDark();
const toggleDark = () => useToggle(isDark); const toggleDark = () => useToggle(isDark);
function handleThemeChange() {
toggleDark();
useSettingsStore().changeSetting({
key: "theme",
value: isDark.value ? "dark" : "light",
});
}
/** /**
* 按钮loading * 按钮loading
*/ */
@@ -219,9 +230,9 @@ function checkCapslock(e: any) {
*/ */
function getCaptcha() { function getCaptcha() {
getCaptchaApi().then(({ data }) => { getCaptchaApi().then(({ data }) => {
const { verifyCodeBase64, verifyCodeKey } = data; const { captchaImgBase64, verifyCodeKey } = data;
loginData.value.verifyCodeKey = verifyCodeKey; loginData.value.verifyCodeKey = verifyCodeKey;
captchaBase64.value = verifyCodeBase64; captchaBase64.value = captchaImgBase64;
}); });
} }
@@ -306,6 +317,11 @@ onMounted(() => {
background-color: transparent; background-color: transparent;
box-shadow: none; box-shadow: none;
&.is-focus,
&:hover {
box-shadow: none !important;
}
input:-webkit-autofill { input:-webkit-autofill {
transition: background-color 5000s ease-in-out 0s; /* 通过延时渲染背景色变相去除背景颜色 */ transition: background-color 5000s ease-in-out 0s; /* 通过延时渲染背景色变相去除背景颜色 */
} }