云
17 小时以前 c2e8526f8f857be5e3a8c6f2b39c5efd424de33e
src/layouts/auth.vue
@@ -1,15 +1,16 @@
<script lang="ts" setup>
import { computed, onMounted } from 'vue';
import { AuthPageLayout } from '@vben/layouts';
import { preferences } from '@vben/preferences';
import { preferences, usePreferences } from '@vben/preferences';
import { $t } from '#/locales';
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),进入登录页时拉取一次
@@ -18,22 +19,27 @@
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(() => $t('authentication.pageTitle'));
const pageDescription = computed(() => $t('authentication.pageDesc'));
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>
  <AuthPageLayout
  <AuthScene
    :app-name="appName"
    :logo="logo"
    :logo-dark="logoDark"
    :page-description="pageDescription"
    :page-title="pageTitle"
    :platform-description="pageDescription"
    :platform-title="pageTitle"
  >
    <!-- 自定义工具栏 -->
    <!-- <template #toolbar></template> -->
  </AuthPageLayout>
    <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>