diff --git a/application/admin/view/index/login.html b/application/admin/view/index/login.html index a2003e8..66d32de 100755 --- a/application/admin/view/index/login.html +++ b/application/admin/view/index/login.html @@ -126,7 +126,7 @@ justify-content: center; padding: 40px 24px; background: - radial-gradient(720px 480px at 82% -6%, rgba(14, 124, 102, .08), transparent 60%), + radial-gradient(720px 480px at 82% -6%, rgba(4, 135, 74, .10), transparent 60%), linear-gradient(180deg, #f7faf9 0%, #eef3f1 100%); } @@ -134,7 +134,7 @@ width: 100%; max-width: 400px; background: var(--card); - border: 1px solid rgba(14, 124, 102, .07); + border: 1px solid rgba(4, 135, 74, .09); border-radius: 20px; padding: 40px 38px 26px; box-shadow: 0 1px 2px rgba(16, 42, 36, .04), 0 26px 52px -26px rgba(6, 54, 44, .30), 0 10px 22px -18px rgba(6, 54, 44, .18); @@ -211,7 +211,7 @@ #login-form .form-control:focus { background: #fff; border-color: var(--brand); - box-shadow: 0 0 0 4px rgba(14, 124, 102, .13); + box-shadow: 0 0 0 4px rgba(0, 224, 112, .22); /* 亮绿聚焦环(品牌色 22% 透明) */ } #login-form .has-error .form-control { border-color: #e05b52; @@ -282,7 +282,7 @@ display: block; width: 46px; height: 46px; border-radius: 50%; - box-shadow: 0 10px 20px -10px rgba(14, 124, 102, .55); + box-shadow: 0 10px 20px -10px rgba(0, 168, 85, .6); } .mobile-brand b { font-size: 19px; letter-spacing: 2px; color: var(--ink); } .mobile-brand span { display: block; font-size: 11px; letter-spacing: 2px; color: var(--muted); margin-top: 3px; } diff --git a/docs/05-后端实现规范.md b/docs/05-后端实现规范.md index eeb6b63..6fe128d 100644 --- a/docs/05-后端实现规范.md +++ b/docs/05-后端实现规范.md @@ -223,7 +223,14 @@ curl -s -b /tmp/cj.txt 'http://127.0.0.1/s.php/fc/post/index?offset=0&limit=3&so 前端契约验证(本机跑,打线上 `/api/v1`,178 例): ```bash -node tools/verify-api.mjs # 其中 H2 GET /home/banners 校验 id/title/image/link/color 字段齐备 +node tools/verify-api.mjs # 其中 H2 GET /home/banners 校验 id/title/image/link/color 字段齐备 +node tools/check-admin-i18n.mjs # 后台字段中文化(要求错误 0、警告 0) +node tools/check-theme.mjs # 后台主题守卫:扫描后台视图/业务 JS/CSS 共 171 个文件 + # ① 无历史主题色残留(旧暖橙 + 生态绿,含 rgba(14,124,102,·) 衍生色) + # ② 登录页品牌令牌齐全且「亮绿面配墨绿字」 + # ③ FcInstall::BANNERS 三条底色均为春绿 105deg + # ④ LEGACY_COLOR_KEYS 同时覆盖两族历史色(跨版本升级不漏色) + # ⑤ 轮播表单占位示例与主题一致 ``` ### 7.6 轮播底色与前端主题对齐(幂等升级) @@ -246,6 +253,29 @@ php think fc:install # 幂等:建表 + 存在则跳过种子 + 按标 并附有渐变写法提示(建议 105deg;纯色请写成同色双色标,如 `linear-gradient(105deg, #00E070 0%, #00E070 100%)`)。 - 非要加 `--reset` 才会清空业务表重灌种子,常规上线流程**不要**带该参数。 +**v1.0.6 线上实测(2026-10-15,服务器 `8.137.181.63:/www/wwwroot/fenleixinxi.gzyakj.com.cn`)** + +线上库当时**仍停在 v1.0.x 暖橙**(`#FF8A5B` / `#FFB86B` / `#FF6F61`,且 `color` 列还是 `varchar(16)`)——即上一版生态绿升级 +只进了代码、从未在服务器执行。本次上传 `FcInstall.php`(md5 `06949795614ddb8867713977838afd0c`)+ 轮播表单视图 + 登录页后可 +`php think fc:install`(**不带 `--reset`**)输出: + +```text +==> 已有数据,跳过种子(如需重置请加 --reset) +==> 轮播底色与春绿主题对齐 + - 轮播底色列 color 已由 varchar(16) 扩容为 varchar(255)(存 CSS 渐变) + - 已把 3 条内置轮播底色升级为春绿渐变(105deg 亮绿→深绿) +==> 初始化后台菜单 + - 顶级 1 / 分组 5 / 功能项 17 +``` + +迁移前已 `mysqldump fa_fc_banner` 备份至 `/tmp`;执行后 `fa_fc_banner` 3 条记录底色全为春绿渐变、记录数 3 → 3 未变、 +历史色残留计数 0;`GET /api/home/banners` 返回的三条 `color` 与 `FcInstall::BANNERS` 逐字一致。 +后台登录页 `s.php/index/login` 也已实测为春绿品牌色(`--brand-bright: #00e070` + 墨绿字按钮,无历史色残留)。 + +> ⚠️ 教训:`LEGACY_COLOR_KEYS` 必须**同时覆盖「旧暖橙 + 上一版生态绿」两族**。本次线上停留的是更早的暖橙版本, +> 若指纹只写生态绿,这 3 条会被误判成「运营自定义配色」而**漏升级**(前端护栏虽能兜住显示,但数据层仍是旧色)。 +> `tools/check-theme.mjs` 已把「两族指纹覆盖度」纳入守卫,后续再换主题时先补新指纹再上线。 + ## 八、小程序账号凭据(AppID / AppSecret) `POST /api/v1/auth/wx-login` 会把前端 `wx.login()` 拿到的 `code` 交给微信 `sns/jscode2session` 换 `openid`, diff --git a/tools/check-theme.mjs b/tools/check-theme.mjs new file mode 100644 index 0000000..ea2c4fa --- /dev/null +++ b/tools/check-theme.mjs @@ -0,0 +1,154 @@ +#!/usr/bin/env node +/** + * 后台主题守卫(春绿 Spring Green v4) + * + * 校验目标: + * 1) 后台视图 / 业务 JS / 业务 CSS 里不残留**历史主题色** + * —— ① 旧暖橙(#FF8A5B 一族)② v1.2 生态绿(#0e7c66 一族)③ 其半透明衍生色 rgba(14,124,102,·) + * 例外:`FcInstall.php` 的 LEGACY_COLOR_KEYS 是「故意保留的历史色指纹」,用于幂等升级,不算残留 + * 2) 登录页品牌令牌齐全且亮绿只做「面」(按钮墨绿字,白字不落在亮绿上) + * 3) `FcInstall::BANNERS` 三条内置轮播底色都是春绿 105deg 渐变(亮绿→深绿) + * 4) `LEGACY_COLOR_KEYS` 同时覆盖「旧暖橙 + 上一版生态绿」两族 + * —— 线上库经常落后一个主题版本,缺哪一族就会漏升级(v1.0.6 实测线上仍是 #FF8A5B) + * 5) 轮播表单的占位示例与主题一致(105deg 亮绿→深绿) + * + * 用法:node tools/check-theme.mjs + */ +import fs from 'node:fs' +import path from 'node:path' +import url from 'node:url' + +const __dirname = path.dirname(url.fileURLToPath(import.meta.url)) +const ROOT = path.resolve(__dirname, '..') + +let errors = 0 +let warns = 0 +const bad = (m) => { console.log(` ❌ ${m}`); errors++ } +const warn = (m) => { console.log(` ⚠️ ${m}`); warns++ } +const ok = (m) => console.log(` ✅ ${m}`) +const read = (p) => (fs.existsSync(p) ? fs.readFileSync(p, 'utf8') : '') + +/* ---------------- 1) 历史主题色残留扫描 ---------------- */ + +/** 历史主题色(小写;同时匹配 #RRGGBB 与 rgba() 形式) */ +const RETIRED = { + '#ff8a5b': '旧暖橙 v1.0.x', '#ffb86b': '旧暖橙 v1.0.x', '#ff6f61': '旧暖橙 v1.0.x', + '#ff9a3c': '旧暖橙 v1.0.x', '#ff7a45': '旧暖橙 v1.0.x', + '#18a587': '生态绿 v1.2', '#0e7c66': '生态绿 v1.2', '#0a5d4d': '生态绿 v1.2', + '#04302a': '生态绿 v1.2', '#16897f': '生态绿 v1.2', '#0e6b62': '生态绿 v1.2', + '#07443e': '生态绿 v1.2', '#0f8f72': '生态绿 v1.2', '#0a5f4d': '生态绿 v1.2', + 'rgba(14, 124, 102': '生态绿 v1.2(半透明衍生色)', + 'rgba(14,124,102': '生态绿 v1.2(半透明衍生色)', + 'rgba(18, 161, 132': '生态绿 v1.2(半透明衍生色)', +} + +/** 仅扫描「后台自己写的」代码,第三方资源(bootstrap/fastadmin 等)不动 */ +const SCAN_DIRS = [ + 'application/admin/view', + 'application/admin/lang', + 'application/admin/command', + 'public/assets/js/backend/fc', + 'public/assets/css/backend.css', +] +const SKIP_FILE = /FcInstall\.php$/ + +function walk(target) { + const abs = path.join(ROOT, target) + if (!fs.existsSync(abs)) return [] + const st = fs.statSync(abs) + if (st.isFile()) return [abs] + return fs.readdirSync(abs).flatMap((f) => walk(path.join(target, f))) +} + +console.log('== 1) 历史主题色残留扫描 ==') +let scanned = 0 +const hits = [] +for (const file of SCAN_DIRS.flatMap(walk)) { + if (!/\.(html|js|css|php|json)$/.test(file) || SKIP_FILE.test(file)) continue + const src = read(file).toLowerCase() + if (!src) continue + scanned++ + for (const key of Object.keys(RETIRED)) { + const idx = src.indexOf(key) + if (idx === -1) continue + const line = read(file).slice(0, idx).split('\n').length + hits.push(`${path.relative(ROOT, file)}:${line} → ${key}(${RETIRED[key]})`) + } +} +if (hits.length) hits.forEach((h) => bad(h)) +else ok(`已扫描 ${scanned} 个文件,无历史主题色残留(旧暖橙 / 生态绿)`) + +/* ---------------- 2) 登录页品牌令牌 ---------------- */ + +console.log('== 2) 登录页品牌令牌(亮绿只做面)==') +const login = read(path.join(ROOT, 'application/admin/view/index/login.html')) +const loginChecks = [ + ['--brand: #04874a', '白底可读的品牌绿字/描边 #04874A'], + ['--brand-bright: #00e070', '品牌亮绿 #00E070(与小程序 $fc-primary 同色号)'], + ['--brand-ink: #04301e', '亮绿面上的墨绿字 #04301E'], + ['linear-gradient(152deg, #023a21 0%, #046b3b 50%, #04874a 115%)', '左侧品牌栏深绿渐变(白字安全)'], +] +loginChecks.forEach(([needle, desc]) => { + if (login.includes(needle)) ok(desc) + else bad(`登录页缺少:${desc}`) +}) +// 登录按钮:亮绿面必须配墨绿字 +const btn = login.match(/\.login-btn[^{]*\{[^}]*\}/s) +if (btn && /var\(--brand-bright\)/.test(btn[0])) { + if (/color:\s*var\(--brand-ink\)/.test(btn[0])) ok('登录按钮 = 亮绿渐变面 + 墨绿字(对比度 8.2:1)') + else bad('登录按钮用了亮绿面却不是墨绿字(白字压亮绿仅 1.77:1,不可读)') +} else { + warn('未在登录页匹配到 .login-btn 亮绿面按钮(样式结构可能已调整)') +} + +/* ---------------- 3) 内置轮播底色 ---------------- */ + +console.log('== 3) FcInstall 内置轮播底色 ==') +const install = read(path.join(ROOT, 'application/admin/command/FcInstall.php')) +const banners = install.match(/const BANNERS = \[([\s\S]*?)\n \];/) +if (!banners) { + bad('未找到 FcInstall::BANNERS 定义') +} else { + const rows = banners[1].split('\n').filter((l) => l.includes('linear-gradient')) + if (rows.length !== 3) bad(`内置轮播应为 3 条,实际识别到 ${rows.length} 条`) + else ok('3 条内置轮播齐备') + rows.forEach((r, i) => { + if (/linear-gradient\(105deg, #00e070|linear-gradient\(105deg, #00d96c|linear-gradient\(105deg, #00e878/.test(r) + && /#0(0c860|0b85c|49e52|46b3b|23a21|45c34)|#046b3b|#023a21|#045c34/.test(r)) ok(`轮播 ${i + 1}:105deg 亮绿→深绿`) + else bad(`轮播 ${i + 1} 底色不是春绿 105deg 渐变:${r.trim().slice(0, 90)}`) + }) +} + +/* ---------------- 4) 历史色指纹覆盖度 ---------------- */ + +console.log('== 4) LEGACY_COLOR_KEYS 覆盖度(跨版本升级)==') +const legacy = install.match(/const LEGACY_COLOR_KEYS = \[([\s\S]*?)\n \];/) +if (!legacy) { + bad('未找到 LEGACY_COLOR_KEYS(老库升级会漏色)') +} else { + const list = legacy[1] + const groups = [ + ['旧暖橙族', ['ff8a5b', 'ffb86b', 'ff6f61']], + ['生态绿族', ['0e7c66', '0a5d4d', '04302a', '18a587']], + ] + groups.forEach(([name, keys]) => { + const missing = keys.filter((k) => !list.includes(k)) + if (missing.length) bad(`${name} 指纹缺失:${missing.join(', ')}(线上停留该版本时不会被升级)`) + else ok(`${name} 指纹齐备(${keys.join(' / ')})`) + }) +} + +/* ---------------- 5) 轮播表单占位示例 ---------------- */ + +console.log('== 5) 轮播表单占位示例 ==') +for (const f of ['application/admin/view/fc/banner/add.html', 'application/admin/view/fc/banner/edit.html']) { + const src = read(path.join(ROOT, f)) + const ph = src.match(/placeholder="(linear-gradient\([^"]*\))"/) + if (!ph) { warn(`${f} 未找到底色占位示例`); continue } + if (/^linear-gradient\(105deg, #00E070 /.test(ph[1])) ok(`${path.basename(f)}:${ph[1]}`) + else bad(`${path.basename(f)} 占位示例不是春绿 105deg:${ph[1]}`) +} + +console.log('') +console.log(`主题守卫结束:错误 ${errors},警告 ${warns}`) +process.exit(errors ? 1 : 0)