mirror of
https://github.com/certd/certd.git
synced 2026-05-14 03:57:30 +08:00
perf(设置): 添加首页启用开关配置
在系统设置中添加首页启用开关配置项,包括前端路由守卫检查、多语言支持和表单配置,以控制是否显示首页
This commit is contained in:
@@ -32,6 +32,7 @@ export class SysPublicSettings extends BaseSettings {
|
||||
customFooter?: string;
|
||||
robots?: boolean = true;
|
||||
aiChatEnabled = true;
|
||||
homePageEnabled = true;
|
||||
|
||||
|
||||
//验证码是否开启
|
||||
@@ -271,4 +272,3 @@ export class SysSafeSetting extends BaseSettings {
|
||||
autoHiddenTimes: 5,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ export default {
|
||||
|
||||
showRunStrategy: "Show RunStrategy",
|
||||
showRunStrategyHelper: "Allow modify the run strategy of the task",
|
||||
homePageEnabled: "Enable Home Page",
|
||||
|
||||
captchaEnabled: "Enable Login Captcha",
|
||||
captchaHelper: "Whether to enable captcha verification for login",
|
||||
|
||||
@@ -18,6 +18,7 @@ export default {
|
||||
|
||||
showRunStrategy: "显示运行策略选择",
|
||||
showRunStrategyHelper: "任务设置中是否允许选择运行策略",
|
||||
homePageEnabled: "启用首页",
|
||||
|
||||
captchaEnabled: "启用登录验证码",
|
||||
captchaHelper: "登录时是否启用验证码",
|
||||
|
||||
@@ -47,6 +47,13 @@ export function setupCommonGuard(router: Router) {
|
||||
const settingStore = useSettingStore();
|
||||
await settingStore.initOnce();
|
||||
|
||||
if (to.path === "/" && settingStore.sysPublic?.homePageEnabled === false) {
|
||||
return {
|
||||
path: DEFAULT_HOME_PATH,
|
||||
replace: true,
|
||||
};
|
||||
}
|
||||
|
||||
to.meta.loaded = loadedPaths.has(to.path);
|
||||
|
||||
// 页面加载进度条
|
||||
|
||||
@@ -48,6 +48,7 @@ export type SysPublicSetting = {
|
||||
customFooter?: string;
|
||||
robots?: boolean;
|
||||
aiChatEnabled?: boolean;
|
||||
homePageEnabled?: boolean;
|
||||
|
||||
showRunStrategy?: boolean;
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ export const useSettingStore = defineStore({
|
||||
registerEnabled: false,
|
||||
managerOtherUserPipeline: false,
|
||||
icpNo: env.ICP_NO || "",
|
||||
homePageEnabled: true,
|
||||
},
|
||||
installInfo: {
|
||||
siteId: "",
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
<a-form-item :label="t('certd.allowCrawlers')" :name="['public', 'robots']">
|
||||
<a-switch v-model:checked="formState.public.robots" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.sys.setting.homePageEnabled')" :name="['public', 'homePageEnabled']">
|
||||
<a-switch v-model:checked="formState.public.homePageEnabled" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :label="t('certd.enableCommonCnameService')" :name="['private', 'commonCnameEnabled']">
|
||||
<a-switch v-model:checked="formState.private.commonCnameEnabled" />
|
||||
@@ -62,6 +65,7 @@ const formState = reactive<Partial<SysSettings>>({
|
||||
public: {
|
||||
icpNo: "",
|
||||
mpsNo: "",
|
||||
homePageEnabled: true,
|
||||
},
|
||||
private: {},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user