liu
4 天以前 6373c12e97dc5d52ad87271d1adb6743b0052607
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<script lang="ts" setup>
import { computed, onMounted } from 'vue';
 
import { AuthPageLayout } from '@vben/layouts';
import { preferences } from '@vben/preferences';
 
import { $t } from '#/locales';
import { useCompanyConfigStore } from '#/store/company-config';
 
declare const __APP_LOGO__: string;
 
const companyConfigStore = useCompanyConfigStore();
 
onMounted(() => {
  // 登录页展示 loginTitle:启动加载走的是纯函数(不填 store),进入登录页时拉取一次
  companyConfigStore.loadFromServer();
});
 
const appName = computed(() => preferences.copyright.companyName);
// 登录页 logo 优先取数据库配置(preferences.logo.source),未配置时回退编译期默认 __APP_LOGO__
const logo = computed(() => preferences.logo.source || __APP_LOGO__);
const logoDark = computed(() => preferences.logo.sourceDark);
// 登录页标题/描述优先取后端配置,未配置时回退到 i18n 默认
const pageTitle = computed(
  () => companyConfigStore.loginTitle || $t('authentication.pageTitle'),
);
const pageDescription = computed(
  () => companyConfigStore.loginDescription || $t('authentication.pageDesc'),
);
</script>
 
<template>
  <AuthPageLayout
    :app-name="appName"
    :logo="logo"
    :logo-dark="logoDark"
    :page-description="pageDescription"
    :page-title="pageTitle"
  >
    <!-- 自定义工具栏 -->
    <!-- <template #toolbar></template> -->
  </AuthPageLayout>
</template>