diff --git a/src/App.vue b/src/App.vue index cbefb6f0..c1c758c3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -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() diff --git a/src/store/system.ts b/src/store/system.ts index 024daa98..ae7da083 100644 --- a/src/store/system.ts +++ b/src/store/system.ts @@ -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() }) } } diff --git a/src/views/user/Login/index.vue b/src/views/user/Login/index.vue index b98d58a3..ee99091e 100644 --- a/src/views/user/Login/index.vue +++ b/src/views/user/Login/index.vue @@ -237,7 +237,7 @@ const codeConfig = ref(false); const loading = ref(false); const bindings = ref(); -const basis = ref({}); +// const basis = ref({}); 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`);