forked from github/dataease
Merge pull request #9587 from dataease/pr@dev-v2@perf_login_demo_tips
perf: 社区版本登录页面账号密码提示内容可配置功能
This commit is contained in:
commit
f8c645e4fc
@ -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<Object> getUiList() {
|
||||
Map<String, Object> loginTipsItem = new HashMap<>();
|
||||
loginTipsItem.put("pkey", "showDemoTips");
|
||||
loginTipsItem.put("pval", showDemoTips);
|
||||
loginTipsItem.put("sort", 1);
|
||||
List<Object> 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<String, Object> buildSettingItem(String pkey, Object pval) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("pkey", pkey);
|
||||
item.put("pval", pval);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void saveGroup(List<SettingItemVO> vos, String groupKey) {
|
||||
|
@ -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
|
||||
|
@ -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: '',
|
||||
|
Loading…
Reference in New Issue
Block a user