Commit 2078e658692cdc585fc8e8d8b259f770b171f1fb

Authored by fengtao
1 parent eaaab819

fix:修改登录页icon和logo未变化问题

Showing 1 changed file with 32 additions and 30 deletions
@@ -21,11 +21,7 @@ @@ -21,11 +21,7 @@
21 <div class="hidden min-h-full pl-4 mr-4 xl:flex xl:flex-col xl:w-6/12"> 21 <div class="hidden min-h-full pl-4 mr-4 xl:flex xl:flex-col xl:w-6/12">
22 <!-- <AppLogo class="-enter-x" /> --> 22 <!-- <AppLogo class="-enter-x" /> -->
23 <div style="display: flex; margin-top: 10px"> 23 <div style="display: flex; margin-top: 10px">
24 - <img  
25 - v-if="defaultLogo || getLogo"  
26 - :src="defaultLogo || getLogo"  
27 - style="width: 48px; height: 48px"  
28 - /> 24 + <img v-if="defaultLogo" :src="defaultLogo" style="width: 48px; height: 48px" />
29 <img style="width: 48px; height: 48px" v-else src="/src/assets/images/logo.png" /> 25 <img style="width: 48px; height: 48px" v-else src="/src/assets/images/logo.png" />
30 <div 26 <div
31 class="ml-2 truncate md:opacity-100" 27 class="ml-2 truncate md:opacity-100"
@@ -37,7 +33,7 @@ @@ -37,7 +33,7 @@
37 font-weight: 700; 33 font-weight: 700;
38 " 34 "
39 > 35 >
40 - {{ defaultTitle || getTitle }} 36 + {{ defaultTitle }}
41 </div> 37 </div>
42 </div> 38 </div>
43 <div v-if="ifCustom" class="my-auto"> 39 <div v-if="ifCustom" class="my-auto">
@@ -70,7 +66,7 @@ @@ -70,7 +66,7 @@
70 </div> 66 </div>
71 </template> 67 </template>
72 <script lang="ts" setup> 68 <script lang="ts" setup>
73 - import { computed, ref, onMounted } from 'vue'; 69 + import { ref, onMounted } from 'vue';
74 // import { AppLogo } from '/@/components/Application'; 70 // import { AppLogo } from '/@/components/Application';
75 import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application'; 71 import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application';
76 import LoginForm from './LoginForm.vue'; 72 import LoginForm from './LoginForm.vue';
@@ -81,7 +77,7 @@ @@ -81,7 +77,7 @@
81 import { useI18n } from '/@/hooks/web/useI18n'; 77 import { useI18n } from '/@/hooks/web/useI18n';
82 import { useDesign } from '/@/hooks/web/useDesign'; 78 import { useDesign } from '/@/hooks/web/useDesign';
83 import { useLocaleStore } from '/@/store/modules/locale'; 79 import { useLocaleStore } from '/@/store/modules/locale';
84 - import { useUserStore } from '/@/store/modules/user'; 80 + // import { useUserStore } from '/@/store/modules/user';
85 import { getPlatForm } from '/@/api/oem/index'; 81 import { getPlatForm } from '/@/api/oem/index';
86 import defaultShowLogoImg from '/@/assets/svg/login-bg.svg'; 82 import defaultShowLogoImg from '/@/assets/svg/login-bg.svg';
87 83
@@ -90,14 +86,21 @@ @@ -90,14 +86,21 @@
90 type: Boolean, 86 type: Boolean,
91 }, 87 },
92 }); 88 });
  89 + const { title } = useGlobSetting();
93 const defaultTitle = ref(''); 90 const defaultTitle = ref('');
94 const defaultLogo = ref(''); 91 const defaultLogo = ref('');
95 const logoUrl = ref(''); 92 const logoUrl = ref('');
96 onMounted(async () => { 93 onMounted(async () => {
97 const res = await getPlatForm(); 94 const res = await getPlatForm();
98 logoUrl.value = res?.background; 95 logoUrl.value = res?.background;
99 - defaultTitle.value = res?.name; 96 + defaultTitle.value = res?.name || title;
100 defaultLogo.value = res?.logo; 97 defaultLogo.value = res?.logo;
  98 + let link = (document.querySelector("link[rel*='icon']") ||
  99 + document.createElement('link')) as HTMLLinkElement;
  100 + link.type = 'image/x-icon';
  101 + link.rel = 'shortcut icon';
  102 + link.href = res.icon ?? '/favicon.ico';
  103 + document.getElementsByTagName('head')[0].appendChild(link);
101 if (logoUrl.value !== undefined) { 104 if (logoUrl.value !== undefined) {
102 ifCustom.value = false; 105 ifCustom.value = false;
103 } else { 106 } else {
@@ -105,29 +108,28 @@ @@ -105,29 +108,28 @@
105 } 108 }
106 }); 109 });
107 110
108 - const userStore = useUserStore(); 111 + // const userStore = useUserStore();
109 112
110 const ifCustom = ref(true); 113 const ifCustom = ref(true);
111 - const getLogo = computed(() => {  
112 - return userStore.platInfo?.logo;  
113 - });  
114 - const { title } = useGlobSetting();  
115 - const getTitle = computed(() => {  
116 - // 设置icon  
117 - let link = (document.querySelector("link[rel*='icon']") ||  
118 - document.createElement('link')) as HTMLLinkElement;  
119 - link.type = 'image/x-icon';  
120 - link.rel = 'shortcut icon';  
121 - link.href = userStore.platInfo?.icon ?? '/favicon.ico';  
122 - document.getElementsByTagName('head')[0].appendChild(link);  
123 - // logoUrl.value = userStore.platInfo?.background;  
124 - // if (logoUrl.value !== undefined) {  
125 - // ifCustom.value = false;  
126 - // } else {  
127 - // logoUrl.value = 'url(' + defaultShowLogoImg + ')';  
128 - // }  
129 - return userStore.platInfo?.name ?? title;  
130 - }); 114 + // const getLogo = computed(() => {
  115 + // return userStore.platInfo?.logo;
  116 + // });
  117 + // const getTitle = computed(() => {
  118 + // // 设置icon
  119 + // let link = (document.querySelector("link[rel*='icon']") ||
  120 + // document.createElement('link')) as HTMLLinkElement;
  121 + // link.type = 'image/x-icon';
  122 + // link.rel = 'shortcut icon';
  123 + // link.href = userStore.platInfo?.icon ?? '/favicon.ico';
  124 + // document.getElementsByTagName('head')[0].appendChild(link);
  125 + // // logoUrl.value = userStore.platInfo?.background;
  126 + // // if (logoUrl.value !== undefined) {
  127 + // // ifCustom.value = false;
  128 + // // } else {
  129 + // // logoUrl.value = 'url(' + defaultShowLogoImg + ')';
  130 + // // }
  131 + // return userStore.platInfo?.name ?? title;
  132 + // });
131 // const globSetting = useGlobSetting(); 133 // const globSetting = useGlobSetting();
132 const { prefixCls } = useDesign('login'); 134 const { prefixCls } = useDesign('login');
133 const { t } = useI18n(); 135 const { t } = useI18n();