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 21 <div class="hidden min-h-full pl-4 mr-4 xl:flex xl:flex-col xl:w-6/12">
22 22 <!-- <AppLogo class="-enter-x" /> -->
23 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 25 <img style="width: 48px; height: 48px" v-else src="/src/assets/images/logo.png" />
30 26 <div
31 27 class="ml-2 truncate md:opacity-100"
... ... @@ -37,7 +33,7 @@
37 33 font-weight: 700;
38 34 "
39 35 >
40   - {{ defaultTitle || getTitle }}
  36 + {{ defaultTitle }}
41 37 </div>
42 38 </div>
43 39 <div v-if="ifCustom" class="my-auto">
... ... @@ -70,7 +66,7 @@
70 66 </div>
71 67 </template>
72 68 <script lang="ts" setup>
73   - import { computed, ref, onMounted } from 'vue';
  69 + import { ref, onMounted } from 'vue';
74 70 // import { AppLogo } from '/@/components/Application';
75 71 import { AppLocalePicker, AppDarkModeToggle } from '/@/components/Application';
76 72 import LoginForm from './LoginForm.vue';
... ... @@ -81,7 +77,7 @@
81 77 import { useI18n } from '/@/hooks/web/useI18n';
82 78 import { useDesign } from '/@/hooks/web/useDesign';
83 79 import { useLocaleStore } from '/@/store/modules/locale';
84   - import { useUserStore } from '/@/store/modules/user';
  80 + // import { useUserStore } from '/@/store/modules/user';
85 81 import { getPlatForm } from '/@/api/oem/index';
86 82 import defaultShowLogoImg from '/@/assets/svg/login-bg.svg';
87 83
... ... @@ -90,14 +86,21 @@
90 86 type: Boolean,
91 87 },
92 88 });
  89 + const { title } = useGlobSetting();
93 90 const defaultTitle = ref('');
94 91 const defaultLogo = ref('');
95 92 const logoUrl = ref('');
96 93 onMounted(async () => {
97 94 const res = await getPlatForm();
98 95 logoUrl.value = res?.background;
99   - defaultTitle.value = res?.name;
  96 + defaultTitle.value = res?.name || title;
100 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 104 if (logoUrl.value !== undefined) {
102 105 ifCustom.value = false;
103 106 } else {
... ... @@ -105,29 +108,28 @@
105 108 }
106 109 });
107 110
108   - const userStore = useUserStore();
  111 + // const userStore = useUserStore();
109 112
110 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 133 // const globSetting = useGlobSetting();
132 134 const { prefixCls } = useDesign('login');
133 135 const { t } = useI18n();
... ...