gaoluyang
17 小时以前 cd8b52bdf89a4d1101f72e0ece9f4df22a3d3f7a
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
44
45
<script lang="ts" setup>
import { computed, onMounted } from 'vue';
 
import { preferences, usePreferences } from '@vben/preferences';
 
import { useCompanyConfigStore } from '#/store/company-config';
import AuthenticationToolbar from '../packages/effects/layouts/src/authentication/toolbar.vue';
import AuthScene from './auth-scene.vue';
 
declare const __APP_LOGO__: string;
 
const companyConfigStore = useCompanyConfigStore();
const { isDark } = usePreferences();
 
onMounted(() => {
  // 登录页展示 loginTitle:启动加载走的是纯函数(不填 store),进入登录页时拉取一次
  companyConfigStore.loadFromServer();
});
 
const appName = computed(() => preferences.copyright.companyName);
// 登录页 logo 优先取数据库配置(preferences.logo.source),未配置时回退编译期默认 __APP_LOGO__
const logo = computed(() => {
  const source = (isDark.value && preferences.logo.sourceDark) || preferences.logo.source || __APP_LOGO__;
  // 未配置公司标志时不展示框架演示 Logo。
  return source?.includes('@vbenjs/static-source') ? '' : source;
});
const pageTitle = computed(() => companyConfigStore.loginTitle || '滋补品行业数字化管理平台');
const pageDescription = computed(() => companyConfigStore.loginDescription || '传承中医药精华 · 服务健康美好生活');
</script>
 
<template>
  <AuthScene
    :app-name="appName"
    :logo="logo"
    :platform-description="pageDescription"
    :platform-title="pageTitle"
  >
    <template #toolbar><AuthenticationToolbar :toolbar-list="['language', 'theme']" /></template>
    <RouterView v-slot="{ Component, route }">
      <KeepAlive :include="['Login']">
        <component :is="Component" :key="route.fullPath" />
      </KeepAlive>
    </RouterView>
  </AuthScene>
</template>