fix: 🧩 删除不需要内容

This commit is contained in:
bunny 2024-11-12 18:29:52 +08:00
parent 6646f13259
commit 31225dfc4a
14 changed files with 217 additions and 224 deletions

View File

@ -22,13 +22,5 @@ VITE_BASE_API_RETRY=5
# 失败重试时间 # 失败重试时间
VITE_BASE_API_RETRY_DELAY=3000 VITE_BASE_API_RETRY_DELAY=3000
# 是否在打包时使用cdn替换本地库 替换 true 不替换 false
VITE_CDN=false
# 是否启用gzip压缩或brotli压缩分两种情况删除原始文件和不删除原始文件
# 压缩时不删除原始文件的配置gzip、brotli、both同时开启 gzip 与 brotli 压缩、none不开启压缩默认
# 压缩时删除原始文件的配置gzip-clear、brotli-clear、both-clear同时开启 gzip 与 brotli 压缩、none不开启压缩默认
VITE_COMPRESSION="none"
# 开发环境读取配置文件路径 # 开发环境读取配置文件路径
VITE_PUBLIC_PATH=/ VITE_PUBLIC_PATH=/

View File

@ -7,9 +7,6 @@ VITE_ROUTER_HISTORY="hash"
# 基础请求路径 # 基础请求路径
VITE_BASE_API=/admin VITE_BASE_API=/admin
# 跨域代理地址
VITE_APP_URL=http://localhost:8000
# mock地址 # mock地址
VITE_MOCK_BASE_API=/mock VITE_MOCK_BASE_API=/mock

View File

@ -8,8 +8,6 @@ Pure-admin文档https://pure-admin.github.io/pure-admin-doc
# 项目预览 # 项目预览
不知道为什么图床用的使自己的Gitee就是不显示其它GitHub和Gitea都能显示就Gitee显示不出来如果想用Gitee就把ReadMe文件下载下来也行或者把项目clone下来看也可以
**线上地址** **线上地址**
- 正式线上预览地址http://bunny-web.site/#/welcome - 正式线上预览地址http://bunny-web.site/#/welcome
@ -19,6 +17,10 @@ Pure-admin文档https://pure-admin.github.io/pure-admin-doc
- 测试预览地址http://106.15.251.123/#/welcome - 测试预览地址http://106.15.251.123/#/welcome
- 服务器到期时间12月30日 - 服务器到期时间12月30日
**打包视频**
https://www.bilibili.com/video/BV1AYm8YSEKY/
**Github地址** **Github地址**
- [前端地址](https://github.com/BunnyMaster/bunny-admin-web.git) - [前端地址](https://github.com/BunnyMaster/bunny-admin-web.git)

View File

@ -1,63 +1,57 @@
import type { Plugin } from "vite"; import type { Plugin } from 'vite';
import { isArray } from "@pureadmin/utils"; import { isArray } from '@pureadmin/utils';
import compressPlugin from "vite-plugin-compression"; import compressPlugin from 'vite-plugin-compression';
export const configCompressPlugin = ( export const configCompressPlugin = (compress: ViteCompression): Plugin | Plugin[] => {
compress: ViteCompression if (compress === 'none') return null;
): Plugin | Plugin[] => {
if (compress === "none") return null;
const gz = { const gz = {
// 生成的压缩包后缀 // 生成的压缩包后缀
ext: ".gz", ext: '.gz',
// 体积大于threshold才会被压缩 // 体积大于threshold才会被压缩
threshold: 0, threshold: 0,
// 默认压缩.js|mjs|json|css|html后缀文件设置成true压缩全部文件 // 默认压缩.js|mjs|json|css|html后缀文件设置成true压缩全部文件
filter: () => true, filter: () => true,
// 压缩后是否删除原始文件 // 压缩后是否删除原始文件
deleteOriginFile: false deleteOriginFile: false,
}; };
const br = { const br = {
ext: ".br", ext: '.br',
algorithm: "brotliCompress", algorithm: 'brotliCompress',
threshold: 0, threshold: 0,
filter: () => true, filter: () => true,
deleteOriginFile: false deleteOriginFile: false,
}; };
const codeList = [ const codeList = [
{ k: "gzip", v: gz }, { k: 'gzip', v: gz },
{ k: "brotli", v: br }, { k: 'brotli', v: br },
{ k: "both", v: [gz, br] } { k: 'both', v: [gz, br] },
]; ];
const plugins: Plugin[] = []; const plugins: Plugin[] = [];
codeList.forEach(item => { codeList.forEach(item => {
if (compress.includes(item.k)) { if (compress.includes(item.k)) {
if (compress.includes("clear")) { if (compress.includes('clear')) {
if (isArray(item.v)) { if (isArray(item.v)) {
item.v.forEach(vItem => { item.v.forEach(vItem => {
plugins.push( plugins.push(compressPlugin(Object.assign(vItem, { deleteOriginFile: true })));
compressPlugin(Object.assign(vItem, { deleteOriginFile: true })) });
); } else {
}); plugins.push(compressPlugin(Object.assign(item.v, { deleteOriginFile: true })));
} else { }
plugins.push( } else {
compressPlugin(Object.assign(item.v, { deleteOriginFile: true })) if (isArray(item.v)) {
); item.v.forEach(vItem => {
} plugins.push(compressPlugin(vItem));
} else { });
if (isArray(item.v)) { } else {
item.v.forEach(vItem => { plugins.push(compressPlugin(item.v));
plugins.push(compressPlugin(vItem)); }
}); }
} else { }
plugins.push(compressPlugin(item.v)); });
}
}
}
});
return plugins; return plugins;
}; };

View File

@ -1,62 +1,53 @@
import type { Plugin } from "vite"; import type { Plugin } from 'vite';
import { getPackageSize } from "./utils"; import { getPackageSize } from './utils';
import dayjs, { type Dayjs } from "dayjs"; import dayjs, { type Dayjs } from 'dayjs';
import duration from "dayjs/plugin/duration"; import duration from 'dayjs/plugin/duration';
import gradientString from "gradient-string"; import gradientString from 'gradient-string';
import boxen, { type Options as BoxenOptions } from "boxen"; import boxen, { type Options as BoxenOptions } from 'boxen';
dayjs.extend(duration); dayjs.extend(duration);
const welcomeMessage = (VITE_PORT: number) => { const welcomeMessage = (VITE_PORT: number) => {
return gradientString("cyan", "magenta").multiline( return gradientString('cyan', 'magenta').multiline(
`您好! 欢迎使用 bunny 系列开发模板 `您好! 欢迎使用 bunny 系列开发模板
访 访
http://localhost:${VITE_PORT}` http://localhost:${VITE_PORT}`,
); );
}; };
const boxenOptions: BoxenOptions = { const boxenOptions: BoxenOptions = {
padding: 0.5, padding: 0.5,
borderColor: "cyan", borderColor: 'cyan',
borderStyle: "round" borderStyle: 'round',
}; };
export function viteBuildInfo(VITE_PORT: number): Plugin { export function viteBuildInfo(VITE_PORT: number): Plugin {
let config: { command: string }; let config: { command: string };
let startTime: Dayjs; let startTime: Dayjs;
let endTime: Dayjs; let endTime: Dayjs;
let outDir: string; let outDir: string;
return { return {
name: "vite:buildInfo", name: 'vite:buildInfo',
configResolved(resolvedConfig) { configResolved(resolvedConfig) {
config = resolvedConfig; config = resolvedConfig;
outDir = resolvedConfig.build?.outDir ?? "dist"; outDir = resolvedConfig.build?.outDir ?? 'dist';
}, },
buildStart() { buildStart() {
console.log(boxen(welcomeMessage(VITE_PORT), boxenOptions)); console.log(boxen(welcomeMessage(VITE_PORT), boxenOptions));
if (config.command === "build") { if (config.command === 'build') {
startTime = dayjs(new Date()); startTime = dayjs(new Date());
} }
}, },
closeBundle() { closeBundle() {
if (config.command === "build") { if (config.command === 'build') {
endTime = dayjs(new Date()); endTime = dayjs(new Date());
getPackageSize({ getPackageSize({
folder: outDir, folder: outDir,
callback: (size: string) => { callback: (size: string) => {
console.log( console.log(boxen(gradientString('cyan', 'magenta').multiline(`🎉 恭喜打包完成(总用时${dayjs.duration(endTime.diff(startTime)).format('mm分ss秒')},打包后的大小为${size}`), boxenOptions));
boxen( },
gradientString("cyan", "magenta").multiline( });
`🎉 恭喜打包完成(总用时${dayjs }
.duration(endTime.diff(startTime)) },
.format("mm分ss秒")}${size}` };
),
boxenOptions
)
);
}
});
}
}
};
} }

View File

@ -4,31 +4,12 @@
* include里vite 使 node_modules/.vite * include里vite 使 node_modules/.vite
* 使 src/main.ts include vite node_modules/.vite * 使 src/main.ts include vite node_modules/.vite
*/ */
const include = [ const include = ['qs', 'mitt', 'dayjs', 'axios', 'pinia', 'vue-i18n', 'vue-types', 'js-cookie', 'vue-tippy', 'pinyin-pro', 'sortablejs', '@vueuse/core', '@pureadmin/utils', 'responsive-storage'];
"qs",
"mitt",
"dayjs",
"axios",
"pinia",
"vue-i18n",
"vue-types",
"js-cookie",
"vue-tippy",
"pinyin-pro",
"sortablejs",
"@vueuse/core",
"@pureadmin/utils",
"responsive-storage"
];
/** /**
* *
* `@iconify-icons/` `exclude` 使 * `@iconify-icons/` `exclude` 使
*/ */
const exclude = [ const exclude = ['@iconify-icons/ep', '@iconify-icons/ri', '@pureadmin/theme/dist/browser-utils'];
"@iconify-icons/ep",
"@iconify-icons/ri",
"@pureadmin/theme/dist/browser-utils"
];
export { include, exclude }; export { include, exclude };

View File

@ -6,10 +6,10 @@ RUN rm /etc/nginx/conf.d/default.conf
# 将自定义的 Nginx 配置文件复制到容器中 # 将自定义的 Nginx 配置文件复制到容器中
COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/default.conf
#COPY bunny-web.site.csr /etc/nginx/bunny-web.site.csr COPY bunny-web.site.csr /etc/nginx/bunny-web.site.csr
#COPY bunny-web.site.key /etc/nginx/bunny-web.site.key COPY bunny-web.site.key /etc/nginx/bunny-web.site.key
#COPY bunny-web.site_bundle.crt /etc/nginx/bunny-web.site_bundle.crt COPY bunny-web.site_bundle.crt /etc/nginx/bunny-web.site_bundle.crt
#COPY bunny-web.site_bundle.pem /etc/nginx/bunny-web.site_bundle.pem COPY bunny-web.site_bundle.pem /etc/nginx/bunny-web.site_bundle.pem
# 设置时区,构建镜像时执行的命令 # 设置时区,构建镜像时执行的命令
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
@ -25,6 +25,7 @@ COPY dist/ /etc/nginx/html
# 暴露 Nginx 的默认端口 # 暴露 Nginx 的默认端口
EXPOSE 80 EXPOSE 80
EXPOSE 443
# 自动启动 Nginx # 自动启动 Nginx
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]

View File

@ -3,10 +3,59 @@ map $http_upgrade $connection_upgrade {
'' close; '' close;
} }
server {
#SSL 默认访问端口号为 443
listen 443 ssl;
#请填写绑定证书的域名
server_name localhost;
#请填写证书文件的相对路径或绝对路径
ssl_certificate bunny-web.site_bundle.crt;
#请填写私钥文件的相对路径或绝对路径
ssl_certificate_key bunny-web.site.key;
ssl_session_timeout 5m;
#请按照以下协议配置
ssl_protocols TLSv1.2 TLSv1.3;
#请按照以下套件配置,配置加密套件,写法遵循 openssl 标准。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location / {
root /etc/nginx/html;
index index.html index.htm;
try_files $uri /index.html;
}
# 后端跨域请求
location ~/admin/ {
proxy_pass http://172.17.0.1:8000;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# 后端跨域请求
location ~/api/v1/ {
proxy_pass http://129.211.31.58:3000;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect http:// https://;
}
error_page 404 404.html;
location = /50x.html {
root html;
}
}
server { server {
listen 80 ; listen 80 ;
listen [::]:80; listen [::]:80;
server_name localhost; server_name localhost;
return 301 https://$host$request_uri;
location / { location / {
root /etc/nginx/html; root /etc/nginx/html;

View File

@ -8,7 +8,7 @@
如果遇到http和https混用问题可以使将全部的htp都转成https 但是如果都不支持 如果遇到http和https混用问题可以使将全部的htp都转成https 但是如果都不支持
如果对方服务器可以支持https可以试下这个方案 如果对方服务器可以支持https可以试下这个方案
如果不支持需要修改代码,将请求修改成/api/xxx的形式之后使用NGINX做反向代理 如果不支持需要修改代码,将请求修改成/api/xxx的形式之后使用NGINX做反向代理
--> -->
<!--<meta content="upgrade-insecure-requests" http-equiv="Content-Security-Policy" />--> <!--<meta content="upgrade-insecure-requests" http-equiv="Content-Security-Policy" />-->
<meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport" /> <meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport" />
<title>bunny-admin</title> <title>bunny-admin</title>

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" class="icon" viewBox="0 0 1024 1024"><path fill="#386BF3" d="M410.558.109c0 210.974-300.876 361.752-300.876 633.548 0 174.943 134.704 316.787 300.876 316.787s300.877-141.817 300.877-316.787C711.408 361.752 410.558 210.974 410.558.109"/><path fill="#C3D2FB" d="M613.469 73.665c0 211.055-300.877 361.914-300.877 633.547C312.592 882.156 447.296 1024 613.47 1024s300.876-141.817 300.876-316.788C914.29 435.58 613.469 284.72 613.469 73.665"/><path fill="#303F5B" d="M312.592 707.212c0-183.713 137.636-312.171 226.723-441.39 81.702 106.112 172.12 218.74 172.12 367.726A309.755 309.755 0 0 1 420.36 950.064a323.1 323.1 0 0 1-107.769-242.852z"/></svg>

Before

Width:  |  Height:  |  Size: 706 B

View File

@ -9,7 +9,6 @@ const Copyright = getConfig('Copyright');
<footer class="layout-footer text-[rgba(0,0,0,0.6)] dark:text-[rgba(220,220,242,0.8)]"> <footer class="layout-footer text-[rgba(0,0,0,0.6)] dark:text-[rgba(220,220,242,0.8)]">
{{ Copyright }} {{ Copyright }}
<a class="hover:text-primary" href="https://github.com/pure-admin" target="_blank"> &nbsp;{{ TITLE }} </a> <a class="hover:text-primary" href="https://github.com/pure-admin" target="_blank"> &nbsp;{{ TITLE }} </a>
<a href="https://beian.miit.gov.cn/" target="_blank">&nbsp;&nbsp;苏ICP备2023044078号-1</a>
</footer> </footer>
</template> </template>

View File

@ -1,96 +1,96 @@
.wave { .wave {
position: fixed; position: fixed;
height: 100%; height: 100%;
width: 80%; width: 80%;
left: 0; left: 0;
bottom: 0; bottom: 0;
z-index: -1; z-index: -1;
} }
.login-container { .login-container {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
max-width: 100%; max-width: 100%;
display: grid; display: grid;
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
grid-gap: 18rem; grid-gap: 18rem;
padding: 0 2rem; padding: 0 2rem;
} }
.img { .img {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;
} }
.img img { .img img {
width: 500px; width: 500px;
} }
.login-box { .login-box {
display: flex; display: flex;
align-items: center; align-items: center;
text-align: center; text-align: center;
overflow: hidden; overflow: hidden;
} }
.login-form { .login-form {
width: 360px; width: 360px;
} }
.avatar { .avatar {
width: 350px; width: 80px;
height: 80px; height: 80px;
} }
.login-form h2 { .login-form h2 {
text-transform: uppercase; text-transform: uppercase;
margin: 15px 0; margin: 15px 0;
color: #999; color: #999;
font: font:
bold 200% Consolas, bold 200% Consolas,
Monaco, Monaco,
monospace; monospace;
} }
@media screen and (max-width: 1180px) { @media screen and (max-width: 1180px) {
.login-container { .login-container {
grid-gap: 9rem; grid-gap: 9rem;
} }
.login-form { .login-form {
width: 290px; width: 290px;
} }
.login-form h2 { .login-form h2 {
font-size: 2.4rem; font-size: 2.4rem;
margin: 8px 0; margin: 8px 0;
} }
.img img { .img img {
width: 360px; width: 360px;
} }
.avatar { .avatar {
width: 280px; width: 280px;
height: 80px; height: 80px;
} }
} }
@media screen and (max-width: 968px) { @media screen and (max-width: 968px) {
.wave { .wave {
display: none; display: none;
} }
.img { .img {
display: none; display: none;
} }
.login-container { .login-container {
grid-template-columns: 1fr; grid-template-columns: 1fr;
} }
.login-box { .login-box {
justify-content: center; justify-content: center;
} }
} }

View File

@ -3,7 +3,6 @@ import Motion from './utils/motion';
import { useNav } from '@/layout/hooks/useNav'; import { useNav } from '@/layout/hooks/useNav';
import { useLayout } from '@/layout/hooks/useLayout'; import { useLayout } from '@/layout/hooks/useLayout';
import bg from '@/assets/login/bg.png'; import bg from '@/assets/login/bg.png';
import avatar from '@/assets/login/avatar.svg?component';
import illustration from '@/assets/login/illustration.svg?component'; import illustration from '@/assets/login/illustration.svg?component';
import { onMounted, toRaw } from 'vue'; import { onMounted, toRaw } from 'vue';
import { useTranslationLang } from '@/layout/hooks/useTranslationLang'; import { useTranslationLang } from '@/layout/hooks/useTranslationLang';
@ -65,7 +64,7 @@ onMounted(() => {
</div> </div>
<div class="login-box"> <div class="login-box">
<div class="login-form"> <div class="login-form">
<avatar class="avatar" /> <img alt="logo" class="avatar" src="/logo.png" />
<Motion> <Motion>
<h2 class="outline-none">{{ title }}</h2> <h2 class="outline-none">{{ title }}</h2>
</Motion> </Motion>
@ -77,10 +76,6 @@ onMounted(() => {
</div> </div>
</div> </div>
</div> </div>
<footer>
<a href="https://beian.miit.gov.cn/" target="_blank">&nbsp;&nbsp;苏ICP备2023044078号-1</a>
</footer>
</template> </template>
<style scoped> <style scoped>
@ -88,13 +83,6 @@ onMounted(() => {
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
footer {
position: fixed;
bottom: 0;
width: 100%;
text-align: center;
}
:deep(.el-input-group__append, .el-input-group__prepend) { :deep(.el-input-group__append, .el-input-group__prepend) {
padding: 0; padding: 0;
} }

View File

@ -15,9 +15,9 @@ onMounted(() => {
</script> </script>
<template> <template>
<el-descriptions :column="4" border direction="vertical" title="系统已缓存内容"> <el-descriptions :column="2" border direction="vertical" title="系统已缓存内容">
<el-descriptions-item v-for="cache in caches" :key="cache.key" :label="cache.key">{{ cache.value }} </el-descriptions-item> <el-descriptions-item v-for="cache in caches" :key="cache.key" :label="cache.key" style="overflow: auto">
{{ cache.value }}
</el-descriptions-item>
</el-descriptions> </el-descriptions>
</template> </template>
<style lang="scss" scoped></style>