From 5ab2aaa066340a7c288de7979be23a7520d64705 Mon Sep 17 00:00:00 2001 From: H0nGzA1 <2505811377@qq.com> Date: Wed, 22 Mar 2023 19:56:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E9=AA=8C=E8=AF=81=E7=A0=81=E5=85=B3=E9=97=AD?= =?UTF-8?q?issue):=20=F0=9F=90=9B=20https://gitee.com/huge-dream/django-vu?= =?UTF-8?q?e3-admin/issues/I6OS75?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/router/backEnd.ts | 2 +- web/src/stores/systemConfig.ts | 13 ++----------- .../views/system/login/component/account.vue | 17 +++++++++-------- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/web/src/router/backEnd.ts b/web/src/router/backEnd.ts index f225125..7efe7c8 100644 --- a/web/src/router/backEnd.ts +++ b/web/src/router/backEnd.ts @@ -11,7 +11,7 @@ import { useRoutesList } from '/@/stores/routesList'; import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes'; import { useMenuApi } from '/@/api/menu/index'; import { handleMenu } from '../utils/menu'; -import {BtnPermissionStore} from "/@/plugin/permission/store.permission"; +import { BtnPermissionStore } from '/@/plugin/permission/store.permission'; const menuApi = useMenuApi(); diff --git a/web/src/stores/systemConfig.ts b/web/src/stores/systemConfig.ts index 77896af..a823074 100644 --- a/web/src/stores/systemConfig.ts +++ b/web/src/stores/systemConfig.ts @@ -1,8 +1,7 @@ import { defineStore } from 'pinia'; import { ConfigStates } from './interface'; import { request } from '../utils/service'; - -export const urlPrefix = '/api/system/system_config/'; +export const urlPrefix = '/api/init/settings/'; /** * 系统配置数据 @@ -19,15 +18,7 @@ export const SystemConfigStore = defineStore('SystemConfig', { method: 'get', }).then((ret: { data: [] }) => { // 转换数据格式并保存到pinia - let dataList = ret.data; - dataList.forEach((item: any) => { - let childrens = item.children; - if (childrens.length > 1) { - this.systemConfig[item.key] = childrens; - } else { - this.systemConfig[item.key] = item.value; - } - }); + this.systemConfig = JSON.parse(JSON.stringify(ret.data)); }); }, }, diff --git a/web/src/views/system/login/component/account.vue b/web/src/views/system/login/component/account.vue index 9a98767..88a539d 100644 --- a/web/src/views/system/login/component/account.vue +++ b/web/src/views/system/login/component/account.vue @@ -27,7 +27,7 @@ - + { return formatAxis(new Date()); }); - - const showCaptcha = (): boolean => { - return SystemConfigStore().systemConfig.captcha_state; - }; + // 是否关闭验证码 + const isShowCaptcha = computed(() => { + return SystemConfigStore().systemConfig['base.captcha_state']; + }); const getCaptcha = async () => { loginApi.getCaptcha().then((ret: any) => { @@ -146,8 +146,7 @@ export default defineComponent({ getUserInfo(); //获取所有字典 DictionaryStore().getSystemDictionarys(); - //获取系统配置 - SystemConfigStore().getSystemConfigs(); + // 初始化登录成功时间问候语 let currentTimeInfo = currentTime.value; // 登录成功,跳到转首页 @@ -170,13 +169,15 @@ export default defineComponent({ }; onMounted(() => { getCaptcha(); + //获取系统配置 + SystemConfigStore().getSystemConfigs(); }); return { refreshCaptcha, loginClick, loginSuccess, - showCaptcha, + isShowCaptcha, ...toRefs(state), }; },