系统名称使用变量修正

This commit is contained in:
yaoyn
2025-05-30 11:29:54 +08:00
parent 88c193fc0e
commit e2d478c851
5 changed files with 17 additions and 9 deletions

6
.env
View File

@ -4,11 +4,13 @@ VITE_PORT = 3100
# spa-title
VITE_GLOB_APP_TITLE = 全代码平台
# spa shortname
# spa shortname(英文缩写)
VITE_GLOB_APP_SHORT_NAME = 全代码平台
# 应用名称
# 应用名称仅展示在登录页和左上角logo旁其他情况用VITE_GLOB_APP_TITLE
VITE_SYSTEM_NAME = 全代码平台
# 应用名称简写用于空间不足的界面显示左上角logo旁7个字以内超出变成...
# VITE_SYSTEM_SHORT_NAME = 全代码平台
# 响应式布局的表单宽度分界
VITE_RESP_LG_WIDTH = 1280

View File

@ -33,9 +33,11 @@
const { data } = await responseStream.json();
if (data.shortName) {
document.title = data.shortName;
if(document.getElementById('app-loading-title')){
document.getElementById('app-loading-title').innerText = data.shortName;
}
if (data.refreshLogoUrl) {
}
if (data.refreshLogoUrl&&document.getElementById('app-loading-logo')) {
document.getElementById('app-loading-logo').setAttribute('src', data.refreshLogoUrl);
}
} catch {

View File

@ -4,10 +4,10 @@
-->
<template>
<div class="anticon" :class="getAppLogoClass" @click="goHome">
<a href="https://fcdma.gdyditc.com/" target="_blank">
<a :href="sysImgGotoUrl" target="_blank">
<img :src="logoConfig.menuLogoUrl || logo" width="24" style="height: 36px" />
<div class="truncate md:opacity-100" :class="getTitleClass" v-show="showTitle">
{{ sysName }}
<div class="truncate md:opacity-100" :class="getTitleClass" v-show="showTitle" :title="sysShortName || sysName">
{{ sysShortName || sysName }}
</div>
</a>
</div>
@ -42,7 +42,9 @@
const go = useGo();
const appStore = useAppStore();
const logoConfig = appStore.getLogoConfig;
const sysShortName = ref(import.meta.env.VITE_SYSTEM_SHORT_NAME);
const sysName = ref(import.meta.env.VITE_SYSTEM_NAME);
const sysImgGotoUrl = ref(import.meta.env.VITE_SYSTEM_IMG_GOTO_URL);
const getAppLogoClass = computed(() => [prefixCls, props.theme, { 'collapsed-show-title': unref(getCollapsedShowTitle) }]);
const getTitleClass = computed(() => [

View File

@ -11,7 +11,7 @@ import { REDIRECT_NAME } from '/@/router/constant';
* Listening to page changes and dynamically changing site titles
*/
export function useTitle() {
const title = import.meta.env.VITE_SYSTEM_NAME;
const title = import.meta.env.VITE_GLOB_APP_TITLE;
const { t } = useI18n();
const { currentRoute } = useRouter();
const localeStore = useLocaleStore();

View File

@ -25,6 +25,7 @@
import { useUserStore } from '/@/store/modules/user';
import { useTabs } from '/@/hooks/web/useTabs';
import { useTitle } from '@vueuse/core';
import {useGlobSetting} from "/@/hooks/setting";
const loading = ref(true);
const desktop = reactive({ hasCustomDesktop: false, list: [] });
@ -39,6 +40,7 @@
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const { setTitle } = useTabs();
const { title } = useGlobSetting();
watch(
() => userInfo.desktopSchema,
@ -56,7 +58,7 @@
//设置Tab标题
setTitle(desktopSchema.name);
//设置浏览器标题
useTitle(` ${desktopSchema.name} `);
useTitle(` ${desktopSchema.name} - ${title} `);
desktop.hasCustomDesktop = true;
}
}