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 io.dataease.utils.SystemSettingUtils;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.Comparator; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Component @Component
public class SysParameterManage { public class SysParameterManage {
@Value("${dataease.show-demo-tips:false}")
private boolean showDemoTips;
private static final String mapKey = "map.key"; private static final String mapKey = "map.key";
@Resource @Resource
@ -93,7 +95,13 @@ public class SysParameterManage {
@XpackInteract(value = "perSetting", replace = true) @XpackInteract(value = "perSetting", replace = true)
public List<Object> getUiList() { 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 foot?: string
footContent?: string footContent?: string
loaded: boolean loaded: boolean
showDemoTips?: boolean
} }
const { wsCache } = useCache() const { wsCache } = useCache()
export const useAppearanceStore = defineStore('appearanceStore', { export const useAppearanceStore = defineStore('appearanceStore', {
@ -37,7 +38,8 @@ export const useAppearanceStore = defineStore('appearanceStore', {
name: '', name: '',
foot: 'false', foot: 'false',
footContent: '', footContent: '',
loaded: false loaded: false,
showDemoTips: false
} }
}, },
getters: { getters: {
@ -91,6 +93,9 @@ export const useAppearanceStore = defineStore('appearanceStore', {
}, },
getFootContent(): string { getFootContent(): string {
return this.footContent return this.footContent
},
getShowDemoTips(): boolean {
return this.showDemoTips
} }
}, },
actions: { actions: {
@ -126,6 +131,10 @@ export const useAppearanceStore = defineStore('appearanceStore', {
if (!resData?.length) { if (!resData?.length) {
return 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 }
resData.forEach(item => { resData.forEach(item => {
data[item.pkey] = item.pval data[item.pkey] = item.pval

View File

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