调整 copyright 信息和展示逻辑

This commit is contained in:
hooray
2022-10-25 08:26:55 +08:00
parent 73a40ebd74
commit dde3407fb0
+10 -9
View File
@@ -1,20 +1,22 @@
import { createHtmlPlugin } from 'vite-plugin-html'
const copyright_common_style = 'font-size: 14px; margin-bottom: 2px; padding: 6px 8px; color: #fff;'
const copyright_main_style = `${copyright_common_style} background: #e24329;`
const copyright_sub_style = `${copyright_common_style} background: #707070;`
export default function createHtml(env, isBuild) {
const { VITE_APP_TITLE, VITE_APP_DEBUG_TOOL, VITE_APP_MODE } = env
let copyrightScript = `
let copyrightScript = ''
if (isBuild) {
const copyright_common_style = 'font-size: 14px; margin-bottom: 2px; padding: 6px 8px; color: #fff;'
const copyright_main_style = `${copyright_common_style} background: #e24329;`
const copyright_sub_style = `${copyright_common_style} background: #707070;`
copyrightScript += `
<script>
if ((navigator.language || navigator.browserLanguage).toLowerCase() === 'zh-cn') {
console.info('%c由%cFantastic-admin%c提供技术支持', '${copyright_sub_style}', '${copyright_main_style}', '${copyright_sub_style}', '\\nhttps://gitee.com/hooray/fantastic-admin');
console.info('%c由%cFantastic-admin%c驱动', '${copyright_sub_style}', '${copyright_main_style}', '${copyright_sub_style}', '\\nhttps://gitee.com/hooray/fantastic-admin');
} else {
console.info('%cPowered by%cFantastic-admin', '${copyright_sub_style}', '${copyright_main_style}', '\\nhttps://github.com/hooray/fantastic-admin');
}
</script>
`
`
}
if (VITE_APP_MODE === 'example') {
copyrightScript += `
<script>
@@ -72,7 +74,7 @@ if ((navigator.language || navigator.browserLanguage).toLowerCase() === 'zh-cn')
})()
</script>
`
const html = createHtmlPlugin({
return createHtmlPlugin({
inject: {
data: {
title: VITE_APP_TITLE,
@@ -83,5 +85,4 @@ if ((navigator.language || navigator.browserLanguage).toLowerCase() === 'zh-cn')
},
minify: isBuild,
})
return html
}