diff --git a/orion-visor-ui/src/api/system/setting.ts b/orion-visor-ui/src/api/system/setting.ts index 6746de54..63056297 100644 --- a/orion-visor-ui/src/api/system/setting.ts +++ b/orion-visor-ui/src/api/system/setting.ts @@ -2,7 +2,7 @@ import axios from 'axios'; import { dateFormat } from '@/utils'; /** - * 系统配置类型 + * 系统设置类型 */ export type SystemSettingType = 'SFTP' | 'ENCRYPT'; diff --git a/orion-visor-ui/src/store/modules/cache/index.ts b/orion-visor-ui/src/store/modules/cache/index.ts index caadb39a..ecab540a 100644 --- a/orion-visor-ui/src/store/modules/cache/index.ts +++ b/orion-visor-ui/src/store/modules/cache/index.ts @@ -168,7 +168,7 @@ export default defineStore('cache', { return await this.load(`preference_${type}_${item}`, () => getPreference(type, [item]), undefined, force, {}); }, - // 加载系统配置 + // 加载系统设置 async loadSystemSetting(force = false) { return await this.load(`system_setting`, getSystemAggregateSetting, undefined, force, {}); }, diff --git a/orion-visor-ui/src/views/system/setting/components/about-setting.vue b/orion-visor-ui/src/views/system/setting/components/about-setting.vue index e6afdc97..0bdb2630 100644 --- a/orion-visor-ui/src/views/system/setting/components/about-setting.vue +++ b/orion-visor-ui/src/views/system/setting/components/about-setting.vue @@ -4,7 +4,7 @@ class="detail-container" size="large" :align="{ label: 'right', value: 'left' }" - :label-style="{ width: '138px', 'vertical-align': 'top' }" + :label-style="{ paddingTop: '2px', paddingLeft: '32px', verticalAlign: 'top' }" :column="1"> @@ -15,14 +15,14 @@ - {{ 'v' + webVersion }} + {{ 'v' + webVersion }} 当前前端版本与后端版本不一致, 请使用 Ctrl + F5 强制刷新页面 - {{ 'v' + app.version }} + {{ 'v' + app.version }} diff --git a/orion-visor-ui/src/views/system/setting/components/encrypt-setting.vue b/orion-visor-ui/src/views/system/setting/components/encrypt-setting.vue index 1c3ce844..5648e97b 100644 --- a/orion-visor-ui/src/views/system/setting/components/encrypt-setting.vue +++ b/orion-visor-ui/src/views/system/setting/components/encrypt-setting.vue @@ -1,39 +1,42 @@ @@ -62,25 +65,24 @@ import { generatorKeypair, getSystemSetting, updateSystemSettingBatch } from '@/api/system/setting'; import useLoading from '@/hooks/loading'; import { Message } from '@arco-design/web-vue'; + import { SystemSettingTypes } from '../types/const'; const { loading, setLoading } = useLoading(); + const formRef = ref(); const setting = ref({} as EncryptSetting); // 保存 const save = async () => { - if (!setting.value.publicKey) { - Message.error('请输入公钥'); - return; - } - if (!setting.value.privateKey) { - Message.error('请输入私钥'); - return; + // 验证参数 + const error = await formRef.value.validate(); + if (error) { + return false; } setLoading(true); try { await updateSystemSettingBatch({ - type: 'ENCRYPT', + type: SystemSettingTypes.ENCRYPT, settings: { ...setting.value } }); Message.success('修改成功'); @@ -107,7 +109,7 @@ onMounted(async () => { setLoading(true); try { - const { data } = await getSystemSetting('ENCRYPT'); + const { data } = await getSystemSetting(SystemSettingTypes.ENCRYPT); setting.value = data; } catch (e) { } finally { diff --git a/orion-visor-ui/src/views/system/setting/components/sftp-setting.vue b/orion-visor-ui/src/views/system/setting/components/sftp-setting.vue index b762326d..aa5225f8 100644 --- a/orion-visor-ui/src/views/system/setting/components/sftp-setting.vue +++ b/orion-visor-ui/src/views/system/setting/components/sftp-setting.vue @@ -1,13 +1,18 @@ @@ -47,21 +50,24 @@ import { getSystemSetting, updateSystemSettingBatch } from '@/api/system/setting'; import useLoading from '@/hooks/loading'; import { Message } from '@arco-design/web-vue'; + import { SystemSettingTypes } from '../types/const'; const { loading, setLoading } = useLoading(); + const formRef = ref(); const setting = ref({} as SftpSetting); // 保存 const save = async () => { - if (!setting.value.previewSize && setting.value.previewSize !== 0) { - Message.error('请输入文件预览大小'); - return; + // 验证参数 + const error = await formRef.value.validate(); + if (error) { + return false; } setLoading(true); try { await updateSystemSettingBatch({ - type: 'SFTP', + type: SystemSettingTypes.SFTP, settings: setting.value }); Message.success('修改成功'); @@ -75,7 +81,7 @@ onMounted(async () => { setLoading(true); try { - const { data } = await getSystemSetting('SFTP'); + const { data } = await getSystemSetting(SystemSettingTypes.SFTP); setting.value = data; } catch (e) { } finally { diff --git a/orion-visor-ui/src/views/system/setting/index.vue b/orion-visor-ui/src/views/system/setting/index.vue index ba5de3fb..ee6359dc 100644 --- a/orion-visor-ui/src/views/system/setting/index.vue +++ b/orion-visor-ui/src/views/system/setting/index.vue @@ -91,6 +91,17 @@ padding: 16px 0 0 24px; width: 100%; + .setting-header { + color: var(--color-text-1); + margin-top: 0; + margin-bottom: 20px; + font-weight: 600; + } + + .setting-form { + padding-left: 24px; + } + .arco-descriptions-title { font-weight: 600; } diff --git a/orion-visor-ui/src/views/system/setting/types/const.ts b/orion-visor-ui/src/views/system/setting/types/const.ts new file mode 100644 index 00000000..b04bccdd --- /dev/null +++ b/orion-visor-ui/src/views/system/setting/types/const.ts @@ -0,0 +1,7 @@ +import type { SystemSettingType } from '@/api/system/setting'; + +// 系统设置类型 +export const SystemSettingTypes: Record = { + SFTP: 'SFTP', + ENCRYPT: 'ENCRYPT', +};