From 77cc0736c5567d6578c49094988ccde4327b62ba Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Wed, 1 Jun 2022 13:42:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=E5=90=8E?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=87=AA=E5=AE=9A=E4=B9=89=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/vue/src/api/sys/model/themeModel.ts | 8 ++++ apps/vue/src/api/sys/theme.ts | 15 +++++++ apps/vue/src/hooks/web/useSignalR.ts | 5 ++- .../setting/components/SettingFooter.vue | 39 ++++++++++++++++--- apps/vue/src/locales/lang/en/layout.ts | 1 + apps/vue/src/locales/lang/zh-CN/layout.ts | 1 + apps/vue/src/store/modules/app.ts | 8 ++++ apps/vue/src/store/modules/user.ts | 9 +++++ .../VueVbenAdmin/ThemeSettingController.cs | 1 + .../Theme/VueVbenAdmin/ThemeSettingDto.cs | 1 - 10 files changed, 80 insertions(+), 8 deletions(-) create mode 100644 apps/vue/src/api/sys/model/themeModel.ts create mode 100644 apps/vue/src/api/sys/theme.ts diff --git a/apps/vue/src/api/sys/model/themeModel.ts b/apps/vue/src/api/sys/model/themeModel.ts new file mode 100644 index 000000000..2f53c432e --- /dev/null +++ b/apps/vue/src/api/sys/model/themeModel.ts @@ -0,0 +1,8 @@ +import type { BeforeMiniState } from '/#/store'; +import type { ProjectConfig } from '/#/config'; + +export interface ThemeSetting { + darkMode?: string; + projectConfig: ProjectConfig; + beforeMiniInfo: BeforeMiniState; +} diff --git a/apps/vue/src/api/sys/theme.ts b/apps/vue/src/api/sys/theme.ts new file mode 100644 index 000000000..151b84cc8 --- /dev/null +++ b/apps/vue/src/api/sys/theme.ts @@ -0,0 +1,15 @@ +import { defAbpHttp } from '/@/utils/http/abp'; +import { ThemeSetting } from './model/themeModel'; + +export const getTheme = () => { + return defAbpHttp.get({ + url: '/api/theme/vue-vben-admin', + }); +}; + +export const changeTheme = (themeSetting: ThemeSetting) => { + return defAbpHttp.put({ + url: '/api/theme/vue-vben-admin/change', + data: themeSetting, + }); +}; diff --git a/apps/vue/src/hooks/web/useSignalR.ts b/apps/vue/src/hooks/web/useSignalR.ts index c550613ee..58a649cd9 100644 --- a/apps/vue/src/hooks/web/useSignalR.ts +++ b/apps/vue/src/hooks/web/useSignalR.ts @@ -4,6 +4,7 @@ import { HubConnectionBuilder, HubConnectionState, IHttpConnectionOptions, + LogLevel, } from '@microsoft/signalr'; import { useUserStoreWithOut } from '/@/store/modules/user'; @@ -45,7 +46,9 @@ export function useSignalR({ httpOptions.accessTokenFactory = () => token.startsWith('Bearer ') ? token.substring(7) : token; } - var connectionBuilder = new HubConnectionBuilder().withUrl(serverUrl, httpOptions); + var connectionBuilder = new HubConnectionBuilder() + .withUrl(serverUrl, httpOptions) + .configureLogging(LogLevel.Warning); if (automaticReconnect) { connectionBuilder.withAutomaticReconnect({ nextRetryDelayInMilliseconds: () => nextRetryDelayInMilliseconds, diff --git a/apps/vue/src/layouts/default/setting/components/SettingFooter.vue b/apps/vue/src/layouts/default/setting/components/SettingFooter.vue index 237566401..985fc04e4 100644 --- a/apps/vue/src/layouts/default/setting/components/SettingFooter.vue +++ b/apps/vue/src/layouts/default/setting/components/SettingFooter.vue @@ -1,25 +1,30 @@