Просмотр исходного кода

😎优化系统配置与登录相关代码

zuohuaijun 1 год назад
Родитель
Сommit
7ae655c3ea

+ 3 - 3
Admin.NET/Admin.NET.Core/Service/Config/SysConfigService.cs

@@ -247,7 +247,7 @@ public class SysConfigService : IDynamicApiController, ITransient
         var sysIcpUrl = await GetConfigValue<string>(ConfigConst.SysWebIcpUrl);
         var sysSecondVer = await GetConfigValue<bool>(ConfigConst.SysSecondVer);
         var sysCaptcha = await GetConfigValue<bool>(ConfigConst.SysCaptcha);
-        
+
         return new
         {
             SysLogo = sysLogo,
@@ -312,7 +312,7 @@ public class SysConfigService : IDynamicApiController, ITransient
         await UpdateConfigValue(ConfigConst.SysWebCopyright, input.SysCopyright);
         await UpdateConfigValue(ConfigConst.SysWebIcp, input.SysIcp);
         await UpdateConfigValue(ConfigConst.SysWebIcpUrl, input.SysIcpUrl);
-        await UpdateConfigValue(ConfigConst.SysSecondVer, (input.SysSecondVer??true).ToString());
-        await UpdateConfigValue(ConfigConst.SysCaptcha, (input.SysCaptcha??true).ToString());
+        await UpdateConfigValue(ConfigConst.SysSecondVer, (input.SysSecondVer ?? false).ToString());
+        await UpdateConfigValue(ConfigConst.SysCaptcha, (input.SysCaptcha ?? true).ToString());
     }
 }

+ 1 - 0
Web/src/App.vue

@@ -133,6 +133,7 @@ const loadSysInfo = () => {
 			themeConfig.value.watermarkText = data.sysWatermark;
 			// 版权说明
 			themeConfig.value.copyright = data.sysCopyright;
+			// 登录验证
 			themeConfig.value.secondVer = data.sysSecondVer;
 			themeConfig.value.captcha = data.sysCaptcha;
 

+ 6 - 6
Web/src/api-services/models/info-save-input.ts

@@ -91,20 +91,20 @@ export interface InfoSaveInput {
      * @memberof InfoSaveInput
      */
     sysIcpUrl?: string | null;
-    
+
     /**
      * 登录二次验证
      *
-     * @type {string}
+     * @type {boolean}
      * @memberof InfoSaveInput
      */
-    sysSecondVer?: string | null;
-    
+    sysSecondVer?: boolean | null;
+
     /**
      * 图形验证码
      *
-     * @type {string}
+     * @type {boolean}
      * @memberof InfoSaveInput
      */
-    sysCaptcha?: string | null;
+    sysCaptcha?: boolean | null;
 }

+ 5 - 5
Web/src/api-services/models/member-info.ts

@@ -31,22 +31,22 @@ export interface MemberInfo {
     memberType?: MemberTypes;
 
     /**
-     * @type {Type}
+     * @type {string}
      * @memberof MemberInfo
      */
-    declaringType?: Type;
+    name?: string | null;
 
     /**
      * @type {Type}
      * @memberof MemberInfo
      */
-    reflectedType?: Type;
+    declaringType?: Type;
 
     /**
-     * @type {string}
+     * @type {Type}
      * @memberof MemberInfo
      */
-    name?: string | null;
+    reflectedType?: Type;
 
     /**
      * @type {Module}

+ 52 - 52
Web/src/types/pinia.d.ts

@@ -45,60 +45,60 @@ declare interface RoutesListState<T = any> {
 // 布局配置
 declare interface ThemeConfigState {
 	themeConfig: {
-		isDrawer: boolean;
-		primary: string;
-		topBar: string;
-		topBarColor: string;
-		isTopBarColorGradual: boolean;
-		menuBar: string;
-		menuBarColor: string;
-		menuBarActiveColor: string;
-		isMenuBarColorGradual: boolean;
-		columnsMenuBar: string;
-		columnsMenuBarColor: string;
-		isColumnsMenuBarColorGradual: boolean;
-		isColumnsMenuHoverPreload: boolean;
-		columnsLogoHeight: number;
-		columnsMenuWidth: number;
-		columnsMenuHeight: number;
-		isCollapse: boolean;
-		isUniqueOpened: boolean;
-		isFixedHeader: boolean;
-		isFixedHeaderChange: boolean;
-		isClassicSplitMenu: boolean;
-		isLockScreen: boolean;
-		lockScreenTime: number;
-		isShowLogo: boolean;
-		isShowLogoChange: boolean;
-		isBreadcrumb: boolean;
-		isTagsview: boolean;
-		isBreadcrumbIcon: boolean;
-		isTagsviewIcon: boolean;
-		isCacheTagsView: boolean;
-		isSortableTagsView: boolean;
-		isShareTagsView: boolean;
-		isFooter: boolean;
-		isGrayscale: boolean;
-		isInvert: boolean;
-		isIsDark: boolean;
-		isWatermark: boolean;
-		watermarkText: string;
-		tagsStyle: string;
-		animation: string;
-		columnsAsideStyle: string;
-		columnsAsideLayout: string;
-		layout: string;
-		isRequestRoutes: boolean;
-		globalTitle: string;
-		globalViceTitle: string;
-		globalViceTitleMsg: string;
-		copyright: string;
-		secondVer: boolean;
-		captcha: boolean;
-		globalI18n: string;
-		globalComponentSize: string;
+		isDrawer: boolean; // 是否开启抽屉配置
+		primary: string; // 主题颜色
+		topBar: string; // 顶部栏背景
+		topBarColor: string; // 顶部栏背景色
+		isTopBarColorGradual: boolean; // 是否顶部栏背景渐变
+		menuBar: string; // 侧边栏菜单栏背景
+		menuBarColor: string; // 侧边栏菜单栏背景色
+		menuBarActiveColor: string; // 侧边栏激活项背景色
+		isMenuBarColorGradual: boolean; // 是否侧边栏菜单栏背景渐变
+		columnsMenuBar: string; // 侧边栏菜单栏背景
+		columnsMenuBarColor: string; // 侧边栏菜单栏背景
+		isColumnsMenuBarColorGradual: boolean; // 是否侧边栏菜单栏背景渐变
+		isColumnsMenuHoverPreload: boolean; // 是否鼠标悬停预加载路由
+		columnsLogoHeight: number; // 侧边栏logo高度
+		columnsMenuWidth: number; // 侧边栏宽度
+		columnsMenuHeight: number; // 侧边栏高度
+		isCollapse: boolean; // 是否水平折叠收起菜单(支持手机端)
+		isUniqueOpened: boolean; // 是否只保持一个菜单的展开
+		isFixedHeader: boolean; // 是否固定头部
+		isFixedHeaderChange: boolean; // 是否固定头部
+		isClassicSplitMenu: boolean; // 是否分割菜单
+		isLockScreen: boolean; // 是否开启锁屏
+		lockScreenTime: number; //  锁屏时间
+		isShowLogo: boolean; // 是否显示logo
+		isShowLogoChange: boolean; // 是否显示logo动画
+		isBreadcrumb: boolean; // 是否显示面包屑
+		isTagsview: boolean; // 是否显示多标签页
+		isBreadcrumbIcon: boolean; // 是否显示面包屑图标
+		isTagsviewIcon: boolean; // 是否显示多标签页图标
+		isCacheTagsView: boolean; // 是否缓存 TagsView
+		isSortableTagsView: boolean; // 是否开启拖拽排序
+		isShareTagsView: boolean; // 是否开启多标签页缓存
+		isFooter: boolean; // 是否显示页脚
+		isGrayscale: boolean; // 是否灰度模式
+		isInvert: boolean; // 是否色弱模式
+		isIsDark: boolean; // 是否暗黑模式
+		isWatermark: boolean; // 是否开启水印
+		watermarkText: string; // 水印内容
+		tagsStyle: string; // 标签页主题
+		animation: string; // 动画
+		columnsAsideStyle: string; // 侧边栏主题
+		columnsAsideLayout: string; // 侧边栏布局
+		layout: string; // 布局模式
+		isRequestRoutes: boolean; // 是否开启路由懒加载
+		globalI18n: string; // 是否开启国际化
+		globalComponentSize: string; // 全局组件大小
+		globalTitle: string; // 全局标题
+		globalViceTitle: string; // 全局副标题
+		globalViceTitleMsg: string; // 全局副标题消息
+		copyright: string; // 版权信息
 		logoUrl: string; // 系统 logo 地址
 		icp: string; // Icp备案号
 		icpUrl: string; // Icp地址
+		secondVer: boolean; // 是否开启二级验证
+		captcha: boolean; // 是否开启验证码
 	};
 }

+ 3 - 2
Web/src/views/login/component/account.vue

@@ -133,13 +133,14 @@ const state = reactive({
 	capsLockVisible: false,
 });
 
+// 页面初始化
 onMounted(async () => {
 	// 若URL带有Token参数(第三方登录)
 	var accessToken = route.query.token;
 	if (accessToken != null && accessToken != undefined) {
 		await saveTokenAndInitRoutes(accessToken);
 	}
-	// 获取登录配置	
+	// 获取登录配置
 	state.secondVerEnabled = themeConfig.value.secondVer ?? true;
 	state.captchaEnabled = themeConfig.value.captcha ?? true;
 
@@ -150,7 +151,7 @@ onMounted(async () => {
 	document.addEventListener('keyup', handleKeyPress);
 });
 
-// 页面初始化
+// 页面卸载
 onUnmounted(() => {
 	document.removeEventListener('keyup', handleKeyPress);
 });

+ 11 - 11
Web/src/views/system/infoSetting/index.vue

@@ -39,17 +39,17 @@
 				</el-descriptions-item>
 				<el-descriptions-item label="登录二次验证">
 					<el-radio-group v-model="state.formData.sysSecondVer">
-								<el-radio :value="true">启用</el-radio>
-								<el-radio :value="false">禁用</el-radio>
-							</el-radio-group>
+						<el-radio :value="true">启用</el-radio>
+						<el-radio :value="false">禁用</el-radio>
+					</el-radio-group>
 				</el-descriptions-item>
 				<el-descriptions-item label="图形验证码">
 					<el-radio-group v-model="state.formData.sysCaptcha">
-								<el-radio :value="true">启用</el-radio>
-								<el-radio :value="false">禁用</el-radio>
-							</el-radio-group>
+						<el-radio :value="true">启用</el-radio>
+						<el-radio :value="false">禁用</el-radio>
+					</el-radio-group>
 				</el-descriptions-item>
-				
+
 				<template #extra>
 					<el-button type="primary" icon="ele-SuccessFilled" @click="onSave">保存</el-button>
 				</template>
@@ -81,8 +81,8 @@ const state = reactive({
 		sysCopyright: '',
 		sysIcp: '',
 		sysIcpUrl: '',
-		sysSecondVer:undefined,
-		sysCaptcha:undefined,
+		sysSecondVer: undefined,
+		sysCaptcha: undefined,
 	},
 });
 
@@ -115,7 +115,7 @@ const onSave = async () => {
 			sysWatermark: state.formData.sysWatermark,
 			sysCopyright: state.formData.sysCopyright,
 			sysIcp: state.formData.sysIcp,
-			sysIcpUrl: state.formData.sysIcpUrl,			
+			sysIcpUrl: state.formData.sysIcpUrl,
 			sysSecondVer: state.formData.sysSecondVer,
 			sysCaptcha: state.formData.sysCaptcha,
 		});
@@ -150,7 +150,7 @@ const loadData = async () => {
 			sysWatermark: result.sysWatermark,
 			sysCopyright: result.sysCopyright,
 			sysIcp: result.sysIcp,
-			sysIcpUrl: result.sysIcpUrl,			
+			sysIcpUrl: result.sysIcpUrl,
 			sysSecondVer: result.sysSecondVer,
 			sysCaptcha: result.sysCaptcha,
 		};