跳转logo更换
This commit is contained in:
parent
ad4346372f
commit
0328f85cb9
@ -65,7 +65,7 @@ const getGlobalI18n = computed(() => {
|
|||||||
let link: any = document.querySelector("link[rel*='icon']") || document.createElement("link");
|
let link: any = document.querySelector("link[rel*='icon']") || document.createElement("link");
|
||||||
link.type = "image/x-icon";
|
link.type = "image/x-icon";
|
||||||
link.rel = "shortcut icon";
|
link.rel = "shortcut icon";
|
||||||
link.href = themeConfig.logoMini||logoMini;
|
link.href = themeConfig.value.logoMini||logoMini;
|
||||||
document.getElementsByTagName("head")[0].appendChild(link);
|
document.getElementsByTagName("head")[0].appendChild(link);
|
||||||
|
|
||||||
// 设置初始化,防止刷新时恢复默认
|
// 设置初始化,防止刷新时恢复默认
|
||||||
|
@ -307,7 +307,7 @@
|
|||||||
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.logoSetting') }}</div>
|
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('message.layout.logoSetting') }}</div>
|
||||||
<div class="layout-breadcrumb-seting-bar-flex-value">
|
<div class="layout-breadcrumb-seting-bar-flex-value">
|
||||||
<el-upload ref="uploadRef" action="#" :limit="1" :auto-upload="false" @change="onWartermarkLogoUpload" :on-preview="handlePreview"
|
<el-upload ref="uploadRef" action="#" :limit="1" :auto-upload="false" @change="onWartermarkLogoUpload" :on-preview="handlePreview"
|
||||||
:file-list="getThemeConfig.logoMini?[{name:getThemeConfig.globalTitle,url:getThemeConfig.logoMini}]:[]" accept='image/*'>
|
:file-list="getThemeConfig.logoMini?[{name:getThemeConfig.globalTitle,url:getThemeConfig.logoMini}]:[]" accept='image/*' :on-remove="handleRemove">
|
||||||
<template #default>
|
<template #default>
|
||||||
<el-button v-if="!getThemeConfig.logoMini" class="logo-picture" type="text">上传文件</el-button>
|
<el-button v-if="!getThemeConfig.logoMini" class="logo-picture" type="text">上传文件</el-button>
|
||||||
</template>
|
</template>
|
||||||
@ -475,6 +475,7 @@ import commonFunction from '/@/utils/commonFunction';
|
|||||||
import other from '/@/utils/other';
|
import other from '/@/utils/other';
|
||||||
import mittBus from '/@/utils/mitt';
|
import mittBus from '/@/utils/mitt';
|
||||||
import { articleApi } from '/@/api/article';
|
import { articleApi } from '/@/api/article';
|
||||||
|
import logoMini from '/@/assets/logo-mini.svg';
|
||||||
|
|
||||||
// 定义变量内容
|
// 定义变量内容
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
@ -639,13 +640,24 @@ const dialogVisible = ref(false);
|
|||||||
const handlePreview: UploadProps['onPreview'] = (uploadFile) =>{
|
const handlePreview: UploadProps['onPreview'] = (uploadFile) =>{
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
};
|
};
|
||||||
|
const handleRemove: UploadProps['onRemove'] = (file, uploadFiles) => {
|
||||||
|
// onWartermarkLogoMiniInput('/src/assets/logo-mini.svg');
|
||||||
|
onWartermarkLogoMiniInput('');
|
||||||
|
uploadRef.value.clearFiles();
|
||||||
|
}
|
||||||
// 封面基本路径
|
// 封面基本路径
|
||||||
const viteUrl = import.meta.env.VITE_API_URL;
|
const viteUrl = import.meta.env.VITE_API_URL;
|
||||||
// 8、界面显示 --> logo设置
|
// 8、界面显示 --> logo设置
|
||||||
const onWartermarkLogoMiniInput = (val: string) => {
|
const onWartermarkLogoMiniInput = (val: string) => {
|
||||||
getThemeConfig.value.logoMini = verifyAndSpace(val);
|
getThemeConfig.value.logoMini = verifyAndSpace(val);
|
||||||
if (getThemeConfig.value.logoMini === '') return false;
|
// if (getThemeConfig.value.logoMini === '') return false;
|
||||||
if (getThemeConfig.value.isWartermark) Watermark.set(getThemeConfig.value.logoMini);
|
if (getThemeConfig.value.isWartermark) Watermark.set(getThemeConfig.value.logoMini);
|
||||||
|
// 设置网站图标
|
||||||
|
let link: any = document.querySelector("link[rel*='icon']") || document.createElement("link");
|
||||||
|
link.type = "image/x-icon";
|
||||||
|
link.rel = "shortcut icon";
|
||||||
|
link.href = themeConfig.value.logoMini||logoMini;
|
||||||
|
document.getElementsByTagName("head")[0].appendChild(link);
|
||||||
setLocalThemeConfig();
|
setLocalThemeConfig();
|
||||||
};
|
};
|
||||||
// 8、界面显示 --> logo上传
|
// 8、界面显示 --> logo上传
|
||||||
@ -917,4 +929,8 @@ defineExpose({
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 8px 15px 0;
|
padding: 8px 15px 0;
|
||||||
}
|
}
|
||||||
|
:deep(.el-upload-list__item){
|
||||||
|
margin-top: -20px;
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user