feat: 图标策略升级 + 引擎显隐就地切换 + 前后台一致性;界面美化
按反馈逐条处理: ① 界面美化 - 前台重做:品牌区(logo + 站名 + 副标题)、胶囊式引擎切换、圆角卡片与 悬停浮起、聚焦光晕、合集标签页淡入动画;版心改为 shell 变量 (--pad-x = max(gutter, (100% - wrap)/2)),与顶栏左右边缘严格对齐。 - 后台:表格窄屏可横向滚动、状态胶囊、自定义徽章、图标预览框。 ② 自动更新图标质量差 + 允许自定义图标 - 抓取改为阶梯择优:manifest 512/192 → apple-touch-icon → <link rel=icon> (按 sizes 降序,SVG 视为最高清)→ 第三方聚合服务(favicon.yandex.net 实测 100% 可用;icon.horse 可达时最高 256px)→ 站点自身 /favicon.ico。 - 逐个候选实测像素,达到 120px 即停;候选上限 8 个 + 10s 总预算,避免超时。 - 用 GD 只缩不放,统一存成 128×128 PNG;识别并丢弃第三方服务的 「灰底字母」占位块。 - 新增 sites.icon_custom 列(带幂等迁移):可上传图标或填图标地址; 一旦自定义,「全部更新」只刷新名称、跳过图标。 ③ 后台引擎「可见/不可见」不好用 - 小图标换成内联 SVG(原来用 emoji,跨字体显示成方块)。 - 切换改为 AJAX 原地生效 + 状态胶囊同步,不再点一下就跳页; 所有切换/移动表单都带 p 参数,无 JS 时也能正确回到当前页。 - 修掉一个隐蔽的成因:本站此前完全不发 Cache-Control/Expires/ETag, 浏览器只能自行猜测缓存策略,导致「改完刷新还是旧的」。现在所有动态页 统一发 no-store/no-cache。 ④ deploy/ 与 data/ 误入版本库 - 两目录整目录忽略,部署脚本移出仓库(存 _tooling/),已 git rm --cached。 (历史提交里仍含这些文件,如需彻底抹除需 git filter-repo,待确认。) 附带修复(线上实测驱动) - 服务器侧页面缓存:宝塔「网站加速」Apache(mod_lua) 版是一层基于 memcached 的 30 秒整页缓存,且**读不到 FastCGI 返回的 Cache-Control**,所以 no-store 挡不住它;唯一信号是请求 cookie X_CACHE=1。已在根 .htaccess 用 RequestHeader 在请求侧注入该标记(实测任何访客均 X-Cache: MISS), PHP 侧另发一颗 cookie 作为 Nginx 环境的兜底(BYPASS_PAGE_CACHE 开关)。 - 静态资源改为「长缓存 + 版本号」:asset()/icon_src() 拼 mtime+size, assets/.htaccess 与根 .htaccess 给出 max-age=31536000 immutable。 - 修 absolutize() 未还原 JSON 转义 \/ 导致部分图标 URL 抓不下来的问题。 - 修部署脚本 md5sum 在 Git Bash 下输出 "hash *path" 导致 38 项假「缺失文件」。
This commit is contained in:
+72
-4
@@ -1,7 +1,12 @@
|
||||
/* 简航 SimpleNav —— 后台样式 */
|
||||
:root {
|
||||
--wrap: 1140px;
|
||||
--gutter: 16px;
|
||||
--pad-x: max(var(--gutter), calc((100% - var(--wrap)) / 2));
|
||||
}
|
||||
body.admin { background: #eef0f3; color: #333; font-size: 14px; }
|
||||
.topbar {
|
||||
display: flex; align-items: center; gap: 16px; padding: 0 20px; height: 56px;
|
||||
display: flex; align-items: center; gap: 16px; padding: 0 var(--pad-x); height: 56px;
|
||||
background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 50;
|
||||
}
|
||||
.topbar .brand { font-size: 17px; font-weight: 700; }
|
||||
@@ -12,7 +17,7 @@ body.admin { background: #eef0f3; color: #333; font-size: 14px; }
|
||||
.topnav a:hover { background: #f2f4f7; }
|
||||
.topnav a.active { background: #2F6BF7; color: #fff; }
|
||||
.topright { display: flex; align-items: center; gap: 10px; color: #666; }
|
||||
.wrap { max-width: 1140px; margin: 20px auto 60px; padding: 0 16px; }
|
||||
.wrap { padding: 0 var(--pad-x); margin: 20px 0 60px; }
|
||||
|
||||
.card { background: #fff; border-radius: 12px; padding: 18px; margin-bottom: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
|
||||
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
|
||||
@@ -43,6 +48,8 @@ body.admin { background: #eef0f3; color: #333; font-size: 14px; }
|
||||
.alert.err { background: #fdecec; color: #c0392b; }
|
||||
|
||||
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
|
||||
/* 窄屏下表格自己横向滚动,绝不撑破页面 */
|
||||
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
|
||||
.tbl th, .tbl td { padding: 9px 8px; text-align: left; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
|
||||
.tbl th { color: #888; font-weight: 500; }
|
||||
.tbl tr:hover td { background: #fafbfc; }
|
||||
@@ -52,11 +59,68 @@ body.admin { background: #eef0f3; color: #333; font-size: 14px; }
|
||||
.mini { width: 26px; height: 26px; border-radius: 6px; object-fit: contain; background: #f4f5f7; }
|
||||
.mini.letter { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; }
|
||||
.inline { display: inline; }
|
||||
.ico-btn { border: none; background: #f2f4f7; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; color: #555; margin: 0 1px; }
|
||||
.ico-btn {
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
border: none; background: #f2f4f7; width: 28px; height: 28px; border-radius: 6px;
|
||||
cursor: pointer; color: #555; margin: 0 1px; padding: 0; transition: background .15s, color .15s;
|
||||
}
|
||||
.ico-btn:hover { background: #e6e9ee; }
|
||||
.ico-btn:disabled { opacity: .5; cursor: default; }
|
||||
.ico-btn.danger { color: #c0392b; }
|
||||
.ico-btn.danger:hover { background: #fdecec; }
|
||||
.ok-dot { color: #1a7f45; font-size: 12px; }
|
||||
|
||||
/* 显示 / 隐藏 切换按钮:绿=显示中,灰=已隐藏 */
|
||||
.ico-btn.toggle { color: #9aa3af; }
|
||||
.ico-btn.toggle:hover { background: #e6e9ee; color: #555; }
|
||||
.ico-btn.toggle.on { color: #1a7f45; background: #e8f6ee; }
|
||||
.ico-btn.toggle.on:hover { background: #d6efe1; }
|
||||
.ico-btn.toggle svg { display: block; }
|
||||
|
||||
/* 状态胶囊 */
|
||||
.state {
|
||||
display: inline-block; min-width: 52px; padding: 2px 8px; border-radius: 10px;
|
||||
font-size: 12px; line-height: 18px; text-align: center; vertical-align: middle;
|
||||
}
|
||||
.state.on { background: #e8f6ee; color: #1a7f45; }
|
||||
.state.off { background: #f1f3f5; color: #98a2b3; }
|
||||
|
||||
/* 「自定义图标」标记 */
|
||||
.badge {
|
||||
display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 8px;
|
||||
background: #eef3ff; color: #2F6BF7; font-size: 11px; line-height: 16px; vertical-align: middle;
|
||||
}
|
||||
|
||||
/* 图数字段 */
|
||||
.icon-field {
|
||||
display: flex; gap: 16px; align-items: flex-start; padding: 12px;
|
||||
border: 1px dashed #d9dde3; border-radius: 10px; background: #fafbfc;
|
||||
}
|
||||
.icon-field-preview { flex: 0 0 72px; }
|
||||
.icon-preview {
|
||||
display: flex; align-items: center; justify-content: center; width: 72px; height: 72px;
|
||||
border-radius: 14px; background: #fff; border: 1px solid #e6e9ee; overflow: hidden;
|
||||
}
|
||||
.icon-preview img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
|
||||
.icon-preview .ph { color: #bbb; font-size: 12px; }
|
||||
.icon-field-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
|
||||
.icon-field-title { font-size: 13px; color: #555; font-weight: 600; }
|
||||
.icon-field-body input[type=text] {
|
||||
height: 38px; padding: 0 10px; border: 1px solid #d9dde3; border-radius: 8px; font-size: 14px; width: 100%;
|
||||
}
|
||||
.icon-field-body input[type=text]:focus { outline: none; border-color: #2F6BF7; }
|
||||
.icon-row2 { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
|
||||
.icon-row2 .chk { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: #555; }
|
||||
.icon-row2 input[type=file] {
|
||||
font-size: 13px; color: #666; background: #fff; border: 1px solid #d9dde3;
|
||||
border-radius: 8px; padding: 6px 8px; max-width: 300px;
|
||||
}
|
||||
.icon-field .hint { line-height: 1.75; margin: 0; }
|
||||
.icon-field .hint b { color: #2F6BF7; }
|
||||
|
||||
/* 已隐藏的行稍作弱化 */
|
||||
.tbl tr.row-off td:first-child, .tbl tr.row-off td:nth-child(2) { color: #98a2b3; }
|
||||
|
||||
/* 登录页 */
|
||||
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
|
||||
.login-card { width: 340px; background: #fff; border-radius: 14px; padding: 30px 26px; box-shadow: 0 10px 30px rgba(0,0,0,.08); text-align: center; }
|
||||
@@ -69,6 +133,10 @@ body.admin { background: #eef0f3; color: #333; font-size: 14px; }
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.grid-form { grid-template-columns: 1fr; }
|
||||
.topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; }
|
||||
.topbar { flex-wrap: wrap; height: auto; padding: 10px var(--pad-x); }
|
||||
.tbl { min-width: 620px; }
|
||||
.tbl .ell { max-width: 120px; }
|
||||
.icon-field { flex-direction: column; }
|
||||
.icon-field-preview { flex: 0 0 auto; }
|
||||
.icon-row2 input[type=file] { max-width: 100%; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user