From 06d8c03dd084fa11782f61b2f6b05263faaf7cf6 Mon Sep 17 00:00:00 2001 From: XieYongHong <18010623010@163.com> Date: Thu, 15 Jun 2023 20:15:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=A1=B5=E5=9B=BE=E7=89=87=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 7 +------ src/store/system.ts | 22 ++++++++++++++++------ src/views/user/Login/index.vue | 11 ++++++++--- 3 files changed, 25 insertions(+), 15 deletions(-) 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`);