Browse Source

feat: 支持自定义概览页安全入口提示是否显示 (#2257)

pull/2259/head
ssongliu 1 year ago committed by GitHub
parent
commit
d1d0ca92ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      frontend/src/lang/modules/en.ts
  2. 1
      frontend/src/lang/modules/tw.ts
  3. 1
      frontend/src/lang/modules/zh.ts
  4. 4
      frontend/src/store/index.ts
  5. 1
      frontend/src/store/interface/index.ts
  6. 11
      frontend/src/views/home/index.vue
  7. 6
      frontend/src/views/setting/safe/entrance/index.vue

1
frontend/src/lang/modules/en.ts

@ -1052,6 +1052,7 @@ const message = {
safe: 'Security',
entrance: 'Entrance',
showEntrance: 'Enable Home Page Notification Not Enabled',
entranceHelper: 'Enabling secure entry will only allow logging in to the panel through specified secure entry.',
entranceError:
'Please enter a secure login entry point of 6-10 characters, only numbers or letters are supported.',

1
frontend/src/lang/modules/tw.ts

@ -1052,6 +1052,7 @@ const message = {
safe: '安全',
entrance: '安全入口',
showEntrance: '啟用概覽頁未開啟提醒',
entranceHelper: '開啟安全入口後只能通過指定安全入口登錄面板',
entranceError: '請輸入 6-10 位安全登錄入口僅支持輸入數字或字母',
entranceInputHelper: '安全入口設置為空時則取消安全入口',

1
frontend/src/lang/modules/zh.ts

@ -1052,6 +1052,7 @@ const message = {
safe: '安全',
entrance: '安全入口',
showEntrance: '启用概览页未开启提醒',
entranceHelper: '开启安全入口后只能通过指定安全入口登录面板',
entranceError: '请输入 6-10 位安全登录入口仅支持输入数字或字母',
entranceInputHelper: '安全入口设置为空时则取消安全入口',

4
frontend/src/store/index.ts

@ -28,6 +28,7 @@ export const GlobalStore = defineStore({
device: DeviceType.Desktop,
lastFilePath: '',
currentDB: '',
showEntranceWarn: true,
}),
getters: {},
actions: {
@ -68,6 +69,9 @@ export const GlobalStore = defineStore({
setCurrentDB(name: string) {
this.currentDB = name;
},
setShowEntranceWarn(show: boolean) {
this.showEntranceWarn = show;
},
},
persist: piniaPersistConfig('GlobalState'),
});

1
frontend/src/store/interface/index.ts

@ -23,6 +23,7 @@ export interface GlobalState {
device: DeviceType;
lastFilePath: string;
currentDB: string;
showEntranceWarn: boolean;
}
export interface MenuState {

11
frontend/src/views/home/index.vue

@ -8,7 +8,12 @@
},
]"
/>
<el-alert v-if="!isSafety" :closable="false" style="margin-top: 20px" type="warning">
<el-alert
v-if="!isSafety && globalStore.showEntranceWarn"
style="margin-top: 20px"
type="warning"
@close="hideEntrance"
>
<template #default>
<span>
<span>{{ $t('home.entranceHelper') }}</span>
@ -504,6 +509,10 @@ const loadData = async () => {
}
};
const hideEntrance = () => {
globalStore.setShowEntranceWarn(false);
};
const loadUpgradeStatus = async () => {
const res = await loadUpgradeInfo();
if (res.data) {

6
frontend/src/views/setting/safe/entrance/index.vue

@ -24,6 +24,9 @@
{{ $t('setting.entranceInputHelper') }}
</span>
</el-form-item>
<el-form-item>
<el-checkbox v-model="show" :label="$t('setting.showEntrance')" />
</el-form-item>
</el-col>
</el-row>
</el-form>
@ -56,6 +59,7 @@ interface DialogProps {
}
const drawerVisiable = ref();
const loading = ref();
const show = ref();
const form = reactive({
securityEntrance: '',
@ -78,6 +82,7 @@ function checkSecurityEntrance(rule: any, value: any, callback: any) {
const acceptParams = (params: DialogProps): void => {
form.securityEntrance = params.securityEntrance;
show.value = globalStore.showEntranceWarn;
drawerVisiable.value = true;
};
@ -96,6 +101,7 @@ const submitEntrance = async (formEl: FormInstance | undefined) => {
loading.value = true;
await updateSetting(param)
.then(() => {
globalStore.setShowEntranceWarn(show.value);
globalStore.entrance = form.securityEntrance;
loading.value = false;
drawerVisiable.value = false;

Loading…
Cancel
Save