fix: 优化登录页图片替换

This commit is contained in:
XieYongHong 2023-06-15 20:15:13 +08:00
parent f3b8068044
commit 06d8c03dd0
3 changed files with 25 additions and 15 deletions

View File

@ -19,12 +19,7 @@ import DefaultSetting from '../config/config'
const system = useSystem();
const {configInfo} = storeToRefs(system);
watchEffect(() => {
const ico: any = document.querySelector('link[rel="icon"]');
if(ico !== null){
ico.href = configInfo.value?.front?.ico || DefaultSetting?.logo
}
})
system.setDocumentTitle()
</script>

View File

@ -39,6 +39,15 @@ export const useSystem = defineStore('system', {
const ico: any = document.querySelector('link[rel="icon"]');
ico.href = res.result.ico;
document.title = res.result.title || '';
this.configInfo['front'] = res.result
}
},
setDocumentTitle() {
const _data = this.configInfo['front']
if (_data) {
const ico: any = document.querySelector('link[rel="icon"]');
ico.href = _data.ico;
document.title = _data.title || '';
}
},
async getSystemConfig() {
@ -47,12 +56,13 @@ export const useSystem = defineStore('system', {
if (status === 200) {
params.forEach((key: string) => {
this.configInfo[key] = { ...result.find((item: any) => item.scope === key)?.properties }
if (key === 'front') {
const data = result.find((item: any) => item.scope === key).properties
const ico: any = document.querySelector('link[rel="icon"]');
ico.href = data.ico;
document.title = data.title || '';
}
// if (key === 'front') {
// const data = result.find((item: any) => item.scope === key).properties
// const ico: any = document.querySelector('link[rel="icon"]');
// ico.href = data.ico;
// document.title = data.title || '';
// }
this.setDocumentTitle()
})
}
}

View File

@ -237,7 +237,7 @@ const codeConfig = ref(false);
const loading = ref(false);
const bindings = ref<any[]>();
const basis = ref<any>({});
// const basis = ref<any>({});
const defaultImg = getImage('/apply/provider1.png');
const iconMap = new Map();
@ -266,7 +266,8 @@ const onFinish = async () => {
if (userResp.result?.username === 'admin') {
const resp: any = await getInitSet();
if (resp.status === 200 && !resp.result.length) {
window.location.href = '/#/init-home';
// window.location.href = '/#/init-home';
router.push('/init-home')
return;
}
}
@ -275,7 +276,8 @@ const onFinish = async () => {
...res.result
});
}
window.location.href = '/';
// window.location.href = '/';
router.push('/')
}
} catch (error) {
form.verifyCode = '';
@ -315,6 +317,9 @@ const getOpen = () => {
systemStore.getFront()
};
const basis = computed(() => {
return systemStore.configInfo['front'] || {}
})
const handleClickOther = (item: any) => {
LocalStore.set('onLogin', 'no');
window.open(`${BASE_API_PATH}/application/sso/${item.id}/login`);