feat: 社区版本增加登录页面账号密码提示可配置功能

This commit is contained in:
fit2cloud-chenyw 2024-05-10 08:49:26 +08:00
parent 9a1fa54cf3
commit 6e0b28c3a6
3 changed files with 30 additions and 16 deletions

View File

@ -13,18 +13,20 @@ import io.dataease.utils.IDUtils;
import io.dataease.utils.SystemSettingUtils;
import jakarta.annotation.Resource;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Component
public class SysParameterManage {
@Value("${dataease.show-demo-tips:false}")
private boolean showDemoTips;
private static final String mapKey = "map.key";
@Resource
@ -93,7 +95,13 @@ public class SysParameterManage {
@XpackInteract(value = "perSetting", replace = true)
public List<Object> getUiList() {
return null;
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);
return result;
}

View File

@ -20,6 +20,7 @@ interface AppearanceState {
foot?: string
footContent?: string
loaded: boolean
showDemoTips?: boolean
}
const { wsCache } = useCache()
export const useAppearanceStore = defineStore('appearanceStore', {
@ -37,7 +38,8 @@ export const useAppearanceStore = defineStore('appearanceStore', {
name: '',
foot: 'false',
footContent: '',
loaded: false
loaded: false,
showDemoTips: false
}
},
getters: {
@ -91,6 +93,9 @@ export const useAppearanceStore = defineStore('appearanceStore', {
},
getFootContent(): string {
return this.footContent
},
getShowDemoTips(): boolean {
return this.showDemoTips
}
},
actions: {
@ -126,6 +131,10 @@ 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 }
resData.forEach(item => {
data[item.pkey] = item.pval

View File

@ -35,12 +35,13 @@ const slogan = ref(null)
const footContent = ref(null)
const loginErrorMsg = ref('')
const xpackLoginHandler = ref()
const showDempTips = ref(false)
const demoTips = '账号admin 密码DataEase@123456 每晚 00:00 重置数据'
const state = reactive({
loginForm: {
username: '',
password: ''
},
uiInfo: {},
footContent: ''
})
const checkUsername = value => {
@ -163,6 +164,7 @@ const showLoginErrorMsg = () => {
}
const loadArrearance = () => {
showDempTips.value = appearanceStore.getShowDemoTips
if (appearanceStore.getBg) {
loginImageUrl.value = appearanceStore.getBg
}
@ -307,15 +309,8 @@ onMounted(() => {
>
{{ t('login.btn') }}
</el-button>
<div
v-if="
state.uiInfo &&
state.uiInfo['ui.demo.tips'] &&
state.uiInfo['ui.demo.tips'].paramValue
"
class="demo-tips"
>
{{ state.uiInfo['ui.demo.tips'].paramValue }}
<div v-if="showDempTips" class="demo-tips">
<span>{{ demoTips }}</span>
</div>
</div>
</div>
@ -426,12 +421,13 @@ onMounted(() => {
}
.demo-tips {
margin-top: 20px;
position: absolute;
font-size: 18px;
color: #f56c6c;
letter-spacing: 0;
line-height: 18px;
text-align: center;
top: 120px;
@media only screen and (max-width: 1280px) {
margin-top: 20px;
}
@ -465,6 +461,7 @@ onMounted(() => {
}
.login-btn {
position: relative;
margin-bottom: 120px;
.submit {
width: 100%;