From f4b8299e3a00803dc6c3a8bdc605846412ea5bac Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 10 May 2024 14:44:33 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E7=A4=BE=E5=8C=BA=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=A1=B5=E9=9D=A2=E8=B4=A6=E5=8F=B7=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E6=8F=90=E7=A4=BA=E5=86=85=E5=AE=B9=E5=8F=AF=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/manage/SysParameterManage.java | 18 ++++++++--- .../src/store/modules/appearance.ts | 31 +++++++++++++++---- core/core-frontend/src/views/login/index.vue | 9 +++++- 3 files changed, 46 insertions(+), 12 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/system/manage/SysParameterManage.java b/core/core-backend/src/main/java/io/dataease/system/manage/SysParameterManage.java index ce361a12c6..c2a197b20c 100644 --- a/core/core-backend/src/main/java/io/dataease/system/manage/SysParameterManage.java +++ b/core/core-backend/src/main/java/io/dataease/system/manage/SysParameterManage.java @@ -27,6 +27,9 @@ public class SysParameterManage { @Value("${dataease.show-demo-tips:false}") private boolean showDemoTips; + @Value("${dataease.demo-tips-content:#{null}}") + private String demoTipsContent; + private static final String mapKey = "map.key"; @Resource @@ -95,15 +98,20 @@ public class SysParameterManage { @XpackInteract(value = "perSetting", replace = true) public List getUiList() { - Map loginTipsItem = new HashMap<>(); - loginTipsItem.put("pkey", "showDemoTips"); - loginTipsItem.put("pval", showDemoTips); - loginTipsItem.put("sort", 1); List result = new ArrayList<>(); - result.add(loginTipsItem); + result.add(buildSettingItem("community", true)); + result.add(buildSettingItem("showDemoTips", showDemoTips)); + result.add(buildSettingItem("demoTipsContent", demoTipsContent)); return result; } + private Map buildSettingItem(String pkey, Object pval) { + Map item = new HashMap<>(); + item.put("pkey", pkey); + item.put("pval", pval); + return item; + } + @Transactional public void saveGroup(List vos, String groupKey) { diff --git a/core/core-frontend/src/store/modules/appearance.ts b/core/core-frontend/src/store/modules/appearance.ts index 91f347d12e..237f7416ac 100644 --- a/core/core-frontend/src/store/modules/appearance.ts +++ b/core/core-frontend/src/store/modules/appearance.ts @@ -21,6 +21,8 @@ interface AppearanceState { footContent?: string loaded: boolean showDemoTips?: boolean + demoTipsContent?: string + community: boolean } const { wsCache } = useCache() export const useAppearanceStore = defineStore('appearanceStore', { @@ -39,7 +41,9 @@ export const useAppearanceStore = defineStore('appearanceStore', { foot: 'false', footContent: '', loaded: false, - showDemoTips: false + showDemoTips: false, + demoTipsContent: '', + community: true } }, getters: { @@ -96,6 +100,12 @@ export const useAppearanceStore = defineStore('appearanceStore', { }, getShowDemoTips(): boolean { return this.showDemoTips + }, + getDemoTipsContent(): string { + return this.demoTipsContent + }, + getCommunity(): boolean { + return this.community } }, actions: { @@ -121,6 +131,7 @@ export const useAppearanceStore = defineStore('appearanceStore', { const desktop = wsCache.get('app.desktop') if (desktop) { this.loaded = true + this.community = true } if (this.loaded) { return @@ -131,14 +142,22 @@ export const useAppearanceStore = defineStore('appearanceStore', { if (!resData?.length) { return } - if (resData.length === 1 && resData[0]?.pkey === 'showDemoTips') { - this.showDemoTips = resData[0].pval - return - } - const data: AppearanceState = { loaded: false } + const data: AppearanceState = { loaded: false, community: true } + let isCommunity = false resData.forEach(item => { data[item.pkey] = item.pval + if (item.pkey === 'community') { + isCommunity = true + } }) + data.community = isCommunity + this.community = data.community + if (this.community) { + this.showDemoTips = data.showDemoTips + this.demoTipsContent = data.demoTipsContent + this.loaded = true + return + } this.navigate = data.navigate this.help = data.help this.navigateBg = data.navigateBg diff --git a/core/core-frontend/src/views/login/index.vue b/core/core-frontend/src/views/login/index.vue index cf38c129fe..d1309ecba0 100644 --- a/core/core-frontend/src/views/login/index.vue +++ b/core/core-frontend/src/views/login/index.vue @@ -36,7 +36,14 @@ const footContent = ref(null) const loginErrorMsg = ref('') const xpackLoginHandler = ref() const showDempTips = ref(false) -const demoTips = '账号:admin 密码:DataEase@123456 每晚 00:00 重置数据' +const demoTips = computed(() => { + if (!showDempTips.value) { + return '' + } + return ( + appearanceStore.getDemoTipsContent || '账号:admin 密码:DataEase@123456 每晚 00:00 重置数据' + ) +}) const state = reactive({ loginForm: { username: '',