Commit 87fa41e6690419a3eba479dc4501a85406de8783

Authored by fengwotao
1 parent d4ff1829

fix:修复平台定制背景图更换

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