diff --git a/src/App.vue b/src/App.vue
index 97600d8e3..77abb458e 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -18,6 +18,8 @@
import { computed } from 'vue';
import { ExceptionModal } from '@/views/sys/exception';
+ import { useAppStore } from '@/store/modules/app';
+
// support Multi-language
const { getAntdLocale } = useLocale();
@@ -39,4 +41,10 @@
);
// Listening to page changes and dynamically changing site titles
useTitle();
+
+ /**
+ * 初始化系统参数
+ */
+ const appStore = useAppStore();
+ appStore.initSystemProperties();
diff --git a/src/api/sys/app.ts b/src/api/sys/app.ts
new file mode 100644
index 000000000..9bce92085
--- /dev/null
+++ b/src/api/sys/app.ts
@@ -0,0 +1,15 @@
+import { ApiServiceEnum, defHttp } from '@/utils/http/axios';
+
+enum Api {
+ getAuthProperties = 'public/auth/getAuthProperties',
+}
+
+/**
+ * 获取认证参数
+ */
+export const getAuthPropertiesApi = () => {
+ return defHttp.post({
+ service: ApiServiceEnum.SMART_AUTH,
+ url: Api.getAuthProperties,
+ });
+};
diff --git a/src/api/sys/model/userModel.ts b/src/api/sys/model/userModel.ts
index c459cee6e..301825a50 100644
--- a/src/api/sys/model/userModel.ts
+++ b/src/api/sys/model/userModel.ts
@@ -4,7 +4,7 @@
export interface LoginParams {
username: string;
password: string;
- codeKey: string;
+ key: string;
code: string;
}
diff --git a/src/components/Verify/index.ts b/src/components/Verify/index.ts
index 13df25e02..0322981f8 100644
--- a/src/components/Verify/index.ts
+++ b/src/components/Verify/index.ts
@@ -1,7 +1,10 @@
import { withInstall } from '@/utils';
import basicDragVerify from './src/DragVerify.vue';
import rotateDragVerify from './src/ImgRotate.vue';
+import textCaptcha from './src/TextCaptcha.vue';
export const BasicDragVerify = withInstall(basicDragVerify);
export const RotateDragVerify = withInstall(rotateDragVerify);
export * from './src/typing';
+
+export const TextCaptcha = withInstall(textCaptcha);
diff --git a/src/components/Verify/src/TextCaptcha.vue b/src/components/Verify/src/TextCaptcha.vue
new file mode 100644
index 000000000..a0787a273
--- /dev/null
+++ b/src/components/Verify/src/TextCaptcha.vue
@@ -0,0 +1,55 @@
+
+
+ {{ t('component.verify.refresh') }}
+
+
+
+
+
+
+
diff --git a/src/components/registerGlobComp.ts b/src/components/registerGlobComp.ts
index f7c396eeb..94dd6a0e4 100644
--- a/src/components/registerGlobComp.ts
+++ b/src/components/registerGlobComp.ts
@@ -16,6 +16,10 @@ import {
} from 'ant-design-vue';
import VXETable from 'vxe-table';
+import ExcelJS from 'exceljs';
+import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx';
+import { VXETablePluginAntd } from '@/components/SmartTable/VXETablePluginAntd';
+
import { i18n } from '@/locales/setupI18n';
export function registerGlobComp(app: App) {
@@ -34,6 +38,10 @@ export function registerGlobComp(app: App) {
return key;
},
});
+ VXETable.use(VXETablePluginAntd);
+ VXETable.use(VXETablePluginExportXLSX, {
+ ExcelJS,
+ });
app
.use(Input)
.use(Button)
diff --git a/src/locales/lang/zh-CN/component.json b/src/locales/lang/zh-CN/component.json
index 952d99ddc..3599fd68d 100644
--- a/src/locales/lang/zh-CN/component.json
+++ b/src/locales/lang/zh-CN/component.json
@@ -123,6 +123,7 @@
"time": "验证校验成功,耗时{time}秒!",
"redoTip": "点击图片可刷新",
"dragText": "请按住滑块拖动",
- "successText": "验证通过"
+ "successText": "验证通过",
+ "refresh": "点击刷新验证码"
}
}
diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts
index 6660d2b8b..bbc44e3d1 100644
--- a/src/store/modules/app.ts
+++ b/src/store/modules/app.ts
@@ -6,7 +6,7 @@ import type {
MultiTabsSetting,
SizeConfig,
} from '#/config';
-import type { BeforeMiniState, ApiAddress } from '#/store';
+import type { BeforeMiniState, ApiAddress, SystemProperties } from '#/store';
import { defineStore } from 'pinia';
import { store } from '@/store';
@@ -18,6 +18,8 @@ import { darkMode } from '@/settings/designSetting';
import { resetRouter } from '@/router';
import { deepMerge } from '@/utils';
+import { getAuthPropertiesApi } from '@/api/sys/app';
+
interface AppState {
darkMode?: ThemeEnum;
// Page loading status
@@ -26,6 +28,7 @@ interface AppState {
projectConfig: ProjectConfig | null;
// When the window shrinks, remember some states, and restore these states when the window is restored
beforeMiniInfo: BeforeMiniState;
+ systemProperties: SystemProperties;
}
let timeId: TimeoutHandle;
export const useAppStore = defineStore({
@@ -35,6 +38,7 @@ export const useAppStore = defineStore({
pageLoading: false,
projectConfig: Persistent.getLocal(PROJ_CFG_KEY),
beforeMiniInfo: {},
+ systemProperties: {},
}),
getters: {
getPageLoading(state): boolean {
@@ -70,6 +74,9 @@ export const useAppStore = defineStore({
getSizeSetting(): SizeConfig {
return this.getProjectConfig.sizeConfig;
},
+ getSystemProperties(state): SystemProperties {
+ return state.systemProperties;
+ },
},
actions: {
setPageLoading(loading: boolean): void {
@@ -113,6 +120,15 @@ export const useAppStore = defineStore({
setApiAddress(config: ApiAddress): void {
localStorage.setItem(API_ADDRESS, JSON.stringify(config));
},
+ /**
+ * 初始化系统参数
+ */
+ async initSystemProperties() {
+ const authProperties = await getAuthPropertiesApi();
+ this.systemProperties = {
+ ...authProperties,
+ };
+ },
},
});
diff --git a/src/views/sys/login/LoginForm.vue b/src/views/sys/login/LoginForm.vue
index 8e0731b56..d6df20bc2 100644
--- a/src/views/sys/login/LoginForm.vue
+++ b/src/views/sys/login/LoginForm.vue
@@ -25,7 +25,8 @@
/>
-
+
+
-
- {{ t('system.login.captchaRefreshTooltip') }}
-
-
+ (formData.key = key)"
+ height="40px"
+ :api="getCaptchaApi"
+ />
@@ -101,15 +104,15 @@
diff --git a/types/store.d.ts b/types/store.d.ts
index fdca922cd..ef2591e17 100644
--- a/types/store.d.ts
+++ b/types/store.d.ts
@@ -56,3 +56,23 @@ export interface TableSetting {
columns: Recordable>>;
showRowSelection: Recordable>;
}
+
+/**
+ * 后台的系统参数
+ */
+export interface SystemProperties {
+ /**
+ * 是否启用验证码
+ */
+ captchaEnabled?: boolean;
+
+ /**
+ * 验证码类型
+ */
+ captchaType?: string;
+
+ /**
+ * 验证码标记
+ */
+ captchaIdent?: string;
+}