feat(landing): v1.4 方案 A+B 首屏与热门公开仓库

首屏改左文右图:渐变标题、口号、搜索、双按钮 + 毛玻璃分支图与 terminal 复制窗;新增热门公开仓库三卡(公开 API 取数,前端过滤 fork/镜像并排序);按方案 A 删除数字条,功能卡降级为收尾;补齐 1024/640 断点、暗色与 reduced-motion。
This commit is contained in:
QQ 2026-11-05 10:52:02 +08:00
parent 926b8fc9b0
commit bbce78ae2c
10 changed files with 2262 additions and 1082 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,274 @@
/*
* qq-home.js —— 未登录首页的两件小事(纯前端,无依赖)
* ---------------------------------------------------------------------------
* 1. 热门公开仓库:调 Gitea 公开 API → 前端过滤/排序 → 渲染 3 张卡片
* 2. terminal 小窗的「复制 clone 命令」按钮
*
* 只在首页存在 #qq-hot-repos 时启动;其余页面直接 return。
* 取数失败的策略是「静默隐藏整块」,不弹错、不留空框。
*/
(function () {
'use strict';
/* ---------------- 0. 小工具 ---------------- */
var HOT_LIMIT = 3; // 最终展示几条
var FETCH_LIMIT = 50; // 接口多取一些,前端再筛
var FETCH_TIMEOUT = 5000; // 5s 超时后静默隐藏
// 语言圆点:只用品牌蓝色阶(按语言名哈希取色),不用 Gitea 原生语言色
var DOT_COLORS = ['#1D4ED8', '#3B82F6', '#60A5FA', '#93C5FD'];
var reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
function make(tag, className, text) {
var node = document.createElement(tag);
if (className) node.className = className;
if (text != null) node.textContent = text;
return node;
}
function hashStr(str) {
var h = 0;
for (var i = 0; i < str.length; i++) {
h = (h * 31 + str.charCodeAt(i)) | 0;
}
return Math.abs(h);
}
function dotColor(language) {
if (!language) return DOT_COLORS[1];
return DOT_COLORS[hashStr(language) % DOT_COLORS.length];
}
/* 相对时间:刚刚 / N 分钟前 / N 小时前 / N 天前 / N 个月前 / N 年前 */
function relativeTime(iso) {
var t = Date.parse(iso || '');
if (isNaN(t)) return '';
var sec = Math.max(0, (Date.now() - t) / 1000);
if (sec < 60) return '刚刚';
if (sec < 3600) return Math.floor(sec / 60) + ' 分钟前';
if (sec < 86400) return Math.floor(sec / 3600) + ' 小时前';
if (sec < 2592000) return Math.floor(sec / 86400) + ' 天前';
if (sec < 31536000) return Math.floor(sec / 2592000) + ' 个月前';
return Math.floor(sec / 31536000) + ' 年前';
}
/* 过滤 + 排序:排除 fork / 镜像 / 私有 / 归档;星标降序,同星按更新时间降序 */
function pickRepos(list) {
return (list || []).filter(function (repo) {
return repo && repo.full_name && !repo.fork && !repo.mirror && !repo.private && !repo.archived;
}).sort(function (a, b) {
var byStars = (b.stars_count || 0) - (a.stars_count || 0);
if (byStars) return byStars;
return Date.parse(b.updated_at || 0) - Date.parse(a.updated_at || 0);
}).slice(0, HOT_LIMIT);
}
/* ---------------- 1. 热门公开仓库 ---------------- */
function initHotRepos() {
var section = document.getElementById('qq-hot-repos');
if (!section) return;
var grid = section.querySelector('[data-qq-hot-grid]');
if (!grid) return;
function hide() {
section.hidden = true;
grid.textContent = '';
}
function skeletonCard() {
var card = make('div', 'qq-repo-card qq-skeleton');
card.setAttribute('aria-hidden', 'true');
card.appendChild(make('span', 'qq-sk-bar qq-sk-title'));
card.appendChild(make('span', 'qq-sk-bar qq-sk-desc'));
card.appendChild(make('span', 'qq-sk-bar qq-sk-desc qq-sk-desc-2'));
var meta = make('div', 'qq-sk-meta');
meta.appendChild(make('span', 'qq-sk-bar qq-sk-pill'));
meta.appendChild(make('span', 'qq-sk-bar qq-sk-pill'));
meta.appendChild(make('span', 'qq-sk-bar qq-sk-pill qq-sk-pill-end'));
card.appendChild(meta);
return card;
}
function showSkeletons() {
grid.textContent = '';
for (var i = 0; i < HOT_LIMIT; i++) grid.appendChild(skeletonCard());
section.hidden = false;
}
function avatar(repo) {
var owner = (repo.owner && repo.owner.login) || (repo.full_name || '').split('/')[0] || '?';
var src = repo.owner && repo.owner.avatar_url;
if (src) {
var img = document.createElement('img');
img.className = 'qq-repo-avatar';
img.src = src;
img.alt = '';
img.width = 20;
img.height = 20;
img.loading = 'lazy';
img.decoding = 'async';
// 头像挂了就退回首字母,不出现破图
img.addEventListener('error', function () {
var fallback = make('span', 'qq-repo-avatar qq-repo-avatar-fallback', owner.charAt(0).toUpperCase());
if (img.parentNode) img.parentNode.replaceChild(fallback, img);
});
return img;
}
return make('span', 'qq-repo-avatar qq-repo-avatar-fallback', owner.charAt(0).toUpperCase());
}
function repoCard(repo) {
var card = document.createElement('a');
card.className = 'qq-repo-card';
card.href = repo.html_url || '#';
var head = make('div', 'qq-repo-head');
head.appendChild(avatar(repo));
var name = make('span', 'qq-repo-name');
var parts = String(repo.full_name).split('/');
name.appendChild(make('span', 'qq-repo-owner', parts[0] + '/'));
name.appendChild(make('span', 'qq-repo-repo', parts.slice(1).join('/')));
name.title = repo.full_name;
head.appendChild(name);
card.appendChild(head);
var desc = make('p', 'qq-repo-desc', repo.description || '暂无简介');
card.appendChild(desc);
var meta = make('div', 'qq-repo-meta');
var lang = make('span', 'qq-repo-lang');
var dot = make('span', 'qq-repo-dot');
dot.style.setProperty('--qq-dot', dotColor(repo.language));
lang.appendChild(dot);
lang.appendChild(make('span', 'qq-repo-lang-name', repo.language || '未标注语言'));
meta.appendChild(lang);
var stars = make('span', 'qq-repo-stat');
stars.appendChild(make('span', 'qq-repo-stat-icon', '★'));
stars.appendChild(make('span', null, String(repo.stars_count || 0)));
stars.title = '星标';
meta.appendChild(stars);
var forks = make('span', 'qq-repo-stat');
forks.appendChild(make('span', 'qq-repo-stat-icon', '⑂'));
forks.appendChild(make('span', null, String(repo.forks_count || 0)));
forks.title = '分支';
meta.appendChild(forks);
var updated = relativeTime(repo.updated_at);
meta.appendChild(make('span', 'qq-repo-time', updated ? updated + '更新' : ''));
card.appendChild(meta);
return card;
}
function render(list) {
if (!list.length) { hide(); return; }
grid.textContent = '';
list.forEach(function (repo) { grid.appendChild(repoCard(repo)); });
section.hidden = false;
}
/* 离线预览:不碰网络,直接用页面里的假数据 */
var demo = section.getAttribute('data-demo') === '1' && window.QQ_HOT_REPOS_DEMO;
if (demo) {
showSkeletons();
window.setTimeout(function () { render(pickRepos(window.QQ_HOT_REPOS_DEMO)); }, reduceMotion ? 0 : 320);
return;
}
var endpoint = section.getAttribute('data-endpoint');
if (!endpoint) { hide(); return; }
showSkeletons();
var controller = window.AbortController ? new window.AbortController() : null;
var settled = false;
var timer = window.setTimeout(function () {
if (settled) return;
settled = true;
if (controller) {
try { controller.abort(); } catch (e) { /* ignore */ }
}
hide();
}, FETCH_TIMEOUT);
function done() {
settled = true;
window.clearTimeout(timer);
}
var sep = endpoint.indexOf('?') === -1 ? '?' : '&';
var url = endpoint + sep + 'sort=updated&order=desc&limit=' + FETCH_LIMIT + '&mode=source';
window.fetch(url, {
method: 'GET',
credentials: 'same-origin',
headers: { Accept: 'application/json' },
signal: controller ? controller.signal : undefined
}).then(function (res) {
if (!res.ok) throw new Error('HTTP ' + res.status);
return res.json();
}).then(function (data) {
done();
render(pickRepos(data && data.data));
}).catch(function () {
if (settled) return;
done();
hide();
});
}
/* ---------------- 2. 复制 clone 命令 ---------------- */
function fallbackCopy(text) {
var area = document.createElement('textarea');
area.value = text;
area.setAttribute('readonly', '');
area.style.position = 'fixed';
area.style.top = '-1000px';
area.style.opacity = '0';
document.body.appendChild(area);
area.select();
var ok = false;
try { ok = document.execCommand('copy'); } catch (e) { ok = false; }
document.body.removeChild(area);
return ok;
}
function initCopy() {
var buttons = document.querySelectorAll('[data-qq-copy]');
Array.prototype.forEach.call(buttons, function (btn) {
var text = btn.getAttribute('data-qq-copy');
if (!text) return;
var tip = btn.parentNode ? btn.parentNode.querySelector('.qq-qc-tip') : null;
var resetTimer = 0;
function feedback() {
btn.classList.add('is-copied');
btn.setAttribute('aria-label', '已复制');
if (tip) {
tip.classList.add('is-on');
tip.textContent = '已复制';
}
window.clearTimeout(resetTimer);
resetTimer = window.setTimeout(function () {
btn.classList.remove('is-copied');
btn.setAttribute('aria-label', '复制 clone 命令');
if (tip) tip.classList.remove('is-on');
}, 1600);
}
btn.addEventListener('click', function () {
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(text).then(feedback, function () {
if (fallbackCopy(text)) feedback();
});
} else if (fallbackCopy(text)) {
feedback();
}
});
});
}
initHotRepos();
initCopy();
})();

View File

@ -15,4 +15,4 @@
动效层:只在首页(.page-content.home)和登录页(.page-content.user.signin)生效,
其它页面 qq-fx.js 里第一行就 return,不会加载 canvas、不会挂 rAF。
*/}}
<script src="{{AssetUrlPrefix}}/js/qq-fx.js" defer></script>
<script src="{{AssetUrlPrefix}}/js/qq-fx.js?v=2" defer></script>

View File

@ -6,7 +6,7 @@
<link rel="preload" href="{{AssetUrlPrefix}}/fonts/jetbrains-mono-latin-400-normal.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/qq-ui.css?v=29">
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/qq-fx.css?v=26">
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/qq-pages.css?v=29">
<link rel="stylesheet" href="{{AssetUrlPrefix}}/css/qq-pages.css?v=30">
<meta name="theme-color" content="#60A5FA" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#0D1117" media="(prefers-color-scheme: dark)">

View File

@ -1,34 +1,105 @@
{{/* home.tmpl —— 未登录首页(模板覆盖,不改源码;删掉本文件即回到官方首页)
版式参考 GitHub 首页:
· 居中的大标题 + 一句话说明 + 搜索框 + 主次按钮
· 下面一排功能卡片,再往下一条数字/事实带
· 品牌色仍是蓝白,动效(粒子星座 / 光雾)由 qq-fx.css + qq-fx.js 提供
v1.4 版式(方案 A + B 合并):
· 首屏左右分栏:左 7/12 标题/口号/搜索/按钮,右 5/12 毛玻璃分支图 + terminal 小窗
· 热门公开仓库:/api/v1/repos/search 取数,前端过滤排序后只留 3 条
· 三张功能卡收尾,数字条已按方案 A 删除
品牌色仍是蓝白;动效(粒子星座 / 光雾 / 打字机)由 qq-fx.css + qq-fx.js 提供。
i18n:新的标题/卡片文案是本项目自己的,直接写中文;Gitea 版本号用 {{AppVer}}。 */}}
{{template "base/head" .}}
<div role="main" aria-label="{{ctx.Locale.Tr "home"}}" class="page-content home qq-landing">
<section class="qq-lp-hero">
<div class="qq-logo-halo qq-lp-logo">
<img width="72" height="72" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{AppName}}">
<div class="qq-lp-hero-copy">
<p class="qq-lp-eyebrow">私有部署 · 轻量 · 全功能</p>
<h1 class="qq-lp-title">{{AppName}}</h1>
<p class="qq-lp-sub" data-qq-type="自己的代码,自己的地方。">自己的代码,自己的地方。</p>
<form class="qq-lp-search" action="{{AppSubUrl}}/explore/repos" method="get">
<input type="search" name="q" placeholder="搜索仓库、用户、组织…" aria-label="搜索仓库">
<button class="ui primary button" type="submit">搜索</button>
</form>
<div class="qq-lp-cta">
{{if .IsSigned}}
<a class="ui primary button" href="{{AppSubUrl}}/">进入控制台</a>
<a class="ui basic button" href="{{AppSubUrl}}/repo/create">新建仓库</a>
{{else}}
<a class="ui primary button" href="{{AppSubUrl}}/user/sign_up">免费注册</a>
<a class="ui basic button" href="{{AppSubUrl}}/user/login">登录</a>
{{end}}
<a class="qq-lp-link" href="{{AppSubUrl}}/explore/repos">浏览全部仓库 →</a>
</div>
</div>
<p class="qq-lp-eyebrow">私有部署 · 轻量 · 全功能</p>
<h1 class="qq-lp-title">{{AppName}}</h1>
<p class="qq-lp-sub">自己的代码,自己的地方。</p>
<form class="qq-lp-search" action="{{AppSubUrl}}/explore/repos" method="get">
<input type="search" name="q" placeholder="搜索仓库、用户、组织…" aria-label="搜索仓库">
<button class="ui primary button" type="submit">搜索</button>
</form>
<div class="qq-lp-visual">
<div class="qq-lp-graph" aria-hidden="true">
<svg class="qq-lp-graph-svg" viewBox="0 0 600 400" preserveAspectRatio="xMidYMid meet" focusable="false">
<defs>
<linearGradient id="qqg-line" x1="0" y1="1" x2="1" y2="0">
<stop offset="0%" stop-color="#1D4ED8"/>
<stop offset="55%" stop-color="#3B82F6"/>
<stop offset="100%" stop-color="#60A5FA"/>
</linearGradient>
</defs>
<g class="qqg-faint">
<path class="qqg-edge-faint" d="M46 300 C120 300 130 260 200 260 C280 260 300 300 370 300 C440 300 460 260 540 260"/>
<path class="qqg-edge-faint qqg-flow" d="M46 240 C120 240 120 150 200 150 C270 150 280 240 350 240 C420 240 430 150 510 150 C545 150 560 160 574 166"/>
<path class="qqg-link" d="M200 150 L200 260"/>
<path class="qqg-link" d="M350 240 L370 300"/>
<path class="qqg-link" d="M510 150 L540 260"/>
<circle class="qqg-node-soft" cx="46" cy="300" r="2.5"/>
<circle class="qqg-node-soft" cx="370" cy="300" r="2.5"/>
<circle class="qqg-node-soft" cx="540" cy="260" r="2.5"/>
</g>
<path class="qqg-edge" d="M46 240 C120 240 120 150 200 150 C270 150 280 240 350 240 C420 240 430 150 510 150 C545 150 560 160 574 166"/>
<path class="qqg-edge" d="M46 300 C120 300 130 260 200 260 C280 260 300 300 370 300 C440 300 460 260 540 260"/>
<path class="qqg-edge" d="M200 150 C235 150 240 205 275 205 C310 205 315 240 350 240"/>
<g class="qqg-nodes">
<circle class="qqg-node" cx="46" cy="240" r="5"/>
<circle class="qqg-node-core" cx="200" cy="150" r="6"/>
<circle class="qqg-node-core" cx="350" cy="240" r="6"/>
<circle class="qqg-node" cx="510" cy="150" r="5"/>
<circle class="qqg-node" cx="574" cy="166" r="4"/>
<circle class="qqg-node" cx="46" cy="300" r="5"/>
<circle class="qqg-node" cx="200" cy="260" r="4"/>
<circle class="qqg-node-core" cx="370" cy="300" r="6"/>
<circle class="qqg-node" cx="540" cy="260" r="4"/>
<circle class="qqg-node" cx="275" cy="205" r="4"/>
</g>
</svg>
</div>
<div class="qq-lp-cta">
{{if .IsSigned}}
<a class="ui primary button" href="{{AppSubUrl}}/">进入控制台</a>
<a class="ui basic button" href="{{AppSubUrl}}/repo/create">新建仓库</a>
{{else}}
<a class="ui primary button" href="{{AppSubUrl}}/user/sign_up">免费注册</a>
<a class="ui basic button" href="{{AppSubUrl}}/user/login">登录</a>
{{end}}
<a class="qq-lp-link" href="{{AppSubUrl}}/explore/repos">浏览全部仓库 →</a>
<div class="qq-lp-term">
<div class="qq-lp-term-bar" aria-hidden="true">
<span class="qq-lp-term-dots"><i></i><i></i><i></i></span>
<span class="qq-lp-term-title">terminal</span>
</div>
<div class="qq-lp-term-line">
<code class="qq-lp-term-code"><span class="qq-prompt">$</span> git clone <span class="qq-url">https://git.qyhhh.top/qq/repo.git</span></code>
<span class="qq-qc-tip" aria-hidden="true">已复制</span>
<button class="qq-lp-copy" type="button" data-qq-copy="git clone https://git.qyhhh.top/qq/repo.git" aria-label="复制 clone 命令">
<svg class="qq-copy-icon" viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<rect x="5.5" y="5.5" width="8" height="8" rx="1.6"/>
<path d="M10.5 5.5V4a1.5 1.5 0 0 0-1.5-1.5H4A1.5 1.5 0 0 0 2.5 4v5A1.5 1.5 0 0 0 4 10.5h1.5"/>
</svg>
<svg class="qq-copy-check" viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M3 8.5 6.2 11.7 13 4.5"/>
</svg>
</button>
</div>
</div>
</div>
</section>
<section class="qq-lp-hot" id="qq-hot-repos" data-endpoint="{{AppSubUrl}}/api/v1/repos/search" hidden>
<div class="qq-lp-sec-head">
<h2>热门公开仓库</h2>
<a class="qq-lp-more" href="{{AppSubUrl}}/explore/repos?sort=moststars">查看全部 →</a>
</div>
<div class="qq-hot-grid" data-qq-hot-grid>
<div class="qq-repo-card qq-skeleton" aria-hidden="true"><span class="qq-sk-bar qq-sk-title"></span><span class="qq-sk-bar qq-sk-desc"></span><span class="qq-sk-bar qq-sk-desc qq-sk-desc-2"></span><div class="qq-sk-meta"><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill qq-sk-pill-end"></span></div></div>
<div class="qq-repo-card qq-skeleton" aria-hidden="true"><span class="qq-sk-bar qq-sk-title"></span><span class="qq-sk-bar qq-sk-desc"></span><span class="qq-sk-bar qq-sk-desc qq-sk-desc-2"></span><div class="qq-sk-meta"><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill qq-sk-pill-end"></span></div></div>
<div class="qq-repo-card qq-skeleton" aria-hidden="true"><span class="qq-sk-bar qq-sk-title"></span><span class="qq-sk-bar qq-sk-desc"></span><span class="qq-sk-bar qq-sk-desc qq-sk-desc-2"></span><div class="qq-sk-meta"><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill qq-sk-pill-end"></span></div></div>
</div>
</section>
@ -50,24 +121,6 @@
</article>
</section>
<section class="qq-lp-stats">
<div class="qq-lp-stat">
<strong>{{AppVer}}</strong>
<span>Gitea 版本</span>
</div>
<div class="qq-lp-stat">
<strong>MIT</strong>
<span>开源协议</span>
</div>
<div class="qq-lp-stat">
<strong>MySQL</strong>
<span>独立数据库存储</span>
</div>
<div class="qq-lp-stat">
<strong>1 台</strong>
<span>服务器即可跑</span>
</div>
</section>
</div>
<script src="{{AssetUrlPrefix}}/js/qq-home.js?v=1" defer></script>
{{template "base/footer" .}}

140
docs/PLAN-landing-v1.4.md Normal file
View File

@ -0,0 +1,140 @@
# 规划 · 未登录首页 v1.4(方案 A 首屏 + 热门公开仓库)
> 状态:**仅规划,未动任何代码**(2026-11-05)
> 目标实例:`https://git.qyhhh.top`(Gitea 1.21.11)
> 铁律不变:只走 `custom/` 覆盖、先 `preview/` 后线上、蓝白配色、**禁止绿色**、大量留白。
---
## 1. 已确认的决策
| # | 问题 | 决定 |
| --- | --- | --- |
| 1 | 热门仓库放几个 | **单行 3 个**(宽屏 3 列 × 1 行) |
| 2 | 排序 | **星标优先**(同星数再按最近更新) |
| 3 | Fork / 镜像仓库 | **排除** |
| 4 | 数字条 | **待定**,默认建议:删除(见 §6) |
| 5 | 终端 `git clone` 示例 | **占位地址** `https://git.qyhhh.top/qq/repo.git` |
参考效果图:`dsh-image-gen/image-5f71a3ab.png`(方案 A)、`dsh-image-gen/image-c8208180.png`(方案 B 的仓库区)。
---
## 2. 页面结构(自上而下)
| 区块 | 内容 | 备注 |
| --- | --- | --- |
| 顶栏 | Gitea 原生顶栏 | 不动,沿用 `qq-ui.css` 毛玻璃 |
| ① 首屏 Hero(左右分栏) | **左 7/12**:渐变大标题 `{{AppName}}`、口号「自己的代码,自己的地方。」、搜索框(提交到 `/explore/repos`)、主按钮「免费注册」/ 次按钮「登录」/ 文字链「浏览全部仓库 →」<br>**右 5/12**:毛玻璃卡片,内含 SVG 提交分支图(蓝色节点 + 分叉线),右下叠终端小窗 `$ git clone https://git.qyhhh.top/qq/repo.git` + 复制按钮 | 方案 A |
| ② 热门公开仓库 | 标题「热门公开仓库」+ 右侧「查看全部 →」(`/explore/repos?sort=moststars`);**3 张卡片单行** | 方案 B 的仓库区 |
| ③ 功能卡 | 沿用现有三卡(版本控制 / 议题与看板 / 数据自持),视觉降一级作为收尾 | 文案不变 |
| ④ 数字条 | 待定(§6) | — |
| 页脚 | 左站点信息 / 中语言切换 / 右 ICP 备案号 | 不动 |
整体限宽 **1280px 居中**,与登录后控制台一致。
---
## 3. 仓库卡片规格
```
┌────────────────────────────────────┐
│ (头像20px) owner/仓库名 │
│ 描述文字,最多两行,超出省略…… │
│ ● 语言 ★ 12 ⑂ 3 3 天前更新 │
└────────────────────────────────────┘
```
- 语言圆点:**只用品牌蓝色阶**(`#1D4ED8` / `#3B82F6` / `#60A5FA` / `#93C5FD` 按语言名哈希取色),不用 Gitea 原生语言色(含绿色)。
- hover:上浮 2px,描边变主色 `#3B82F6`(深色 `#38BDF8`)。
- 深色模式:卡片底 `#161B22`,沿用 `qq-dark` 变量。
- 圆角 8px,字体 JetBrains Mono(数字/仓库名)。
---
## 4. 数据来源(关键技术点)
Gitea 1.21 的首页 handler **不给模板传仓库列表**,因此改为前端调用官方公开 API:
```
GET /api/v1/repos/search?sort=stars&order=desc&limit=10&mode=source
```
- 匿名调用只返回公开仓库,不会泄露私有仓库。
- 取多一些(10 个)在前端二次过滤:去掉 `fork === true`、`mirror === true`、`private === true`、`archived === true`(归档是否排除可再议),按 `stars_count` 降序、同星按 `updated_at` 降序,截取前 **3** 个。
- 使用字段:`full_name`、`html_url`、`description`、`language`、`stars_count`、`forks_count`、`updated_at`、`owner.avatar_url`。
- 状态处理:
- 加载中:3 张骨架卡占位(无闪烁时遵守 `prefers-reduced-motion`);
- 结果为 0:整块隐藏,只留首屏「浏览全部仓库 →」;
- 接口失败 / 超时(5s):静默隐藏,不报错。
- **前置条件**:需实测匿名能访问该接口(`REQUIRE_SIGNIN_VIEW=false` 且 API 未禁用)。若不可用,退路是只放「查看全部仓库」入口,不做卡片。
---
## 5. 涉及文件
| 文件 | 改动 |
| --- | --- |
| `custom/templates/home.tmpl` | 重写 Hero 为左右分栏;新增仓库区空容器 `#qq-hot-repos` + 3 张骨架卡;`<script defer src="{{AssetUrlPrefix}}/js/qq-home.js?v=…">` 仅在首页引入 |
| `custom/public/assets/css/qq-pages.css` | 新增 `.qq-lp-split` / `.qq-lp-graph` / `.qq-lp-term` / `.qq-repo-card` / `.qq-skeleton` 等样式,沿用 `.qq-lp-*` 前缀 |
| `custom/public/assets/js/qq-home.js`(新增) | 拉 API → 过滤排序 → 渲染卡片;复制 clone 命令(`navigator.clipboard`,失败回退 `execCommand`);相对时间格式化 |
| `custom/public/assets/js/qq-fx.js` | 光斑 / 打字机挂载点随新 Hero 结构调整(选择器更新) |
| `custom/public/assets/css/qq-fx.css` | 如有 Hero 相关选择器同步调整 |
| `preview/index.html`(+ `preview/app.js`) | 落地页段换成新版式,仓库区用**本地假数据**,不打线上 |
| `docs/TODO.md` | 新增「阶段 8 · 首页 v1.4」条目与部署记录 |
不新增模板钩子以外的任何覆盖,不改 `app.ini`。
---
## 6. 关于「数字条」(待确认)
数字条指当前首页最底部那一排四格:
| 1.21.11 | MIT | MySQL | 1 台 |
| --- | --- | --- | --- |
| Gitea 版本 | 开源协议 | 独立数据库存储 | 服务器即可跑 |
对访客价值不高,且新版已有仓库区和功能卡,页面会偏长。三个选项:
- **A. 删除(默认建议)**
- B. 缩成首屏标题下一行小字:`Gitea 1.21.11 · MIT · 自托管`
- C. 保持原样放在功能卡下面
未回复则按 **A** 执行。
---
## 7. 响应式与无障碍
| 断点 | 行为 |
| --- | --- |
| > 1024px | Hero 左右分栏;仓库 3 列 |
| 641–1024px | Hero 上下堆叠(分支图卡片在文字下方);仓库 3 列压缩 → 不足时 2 列 + 第三张换行 |
| ≤ 640px | 仓库 1 列;终端小窗缩为单行可横向滚动;分支图隐藏 |
- `prefers-reduced-motion`:分支图静止、骨架不闪、关闭光斑。
- 仓库卡片整卡为 `<a>`,有可见焦点环;复制按钮有 `aria-label` 和「已复制」反馈。
---
## 8. 执行步骤(待批准后进行)
1. **接口验证**:匿名 `curl https://git.qyhhh.top/api/v1/repos/search?sort=stars&order=desc&limit=10&mode=source`,确认可用并记录当前公开仓库数量。
2. **离线预览**:在 `preview/` 做出新版,截图 日间 / 夜间 / 375px 移动端 交 QQ 确认。
3. **接入模板**:改 `home.tmpl` / `qq-pages.css` / 新增 `qq-home.js`;跑 `scripts/audit_colors.py` 确认无绿色;提交并打 `v1.4-rc1`。
4. **部署**:`./scripts/deploy.sh` 预演 → QQ 批准 → `./scripts/deploy.sh --yes`(自动备份到 `/var/backups/`)→ 线上实拍复核 → 打 `v1.4-live`。
5. **回滚预案**:`./scripts/rollback.sh /var/backups/gitea-custom-<时间戳>.tar.gz`。
---
## 9. 验收清单
- [ ] 未登录访问首页:首屏左右分栏,分支图 + 终端正常显示
- [ ] 复制按钮可复制 `git clone https://git.qyhhh.top/qq/repo.git`
- [ ] 热门仓库显示 ≤3 个,按星标降序,无 fork / 镜像 / 私有仓库
- [ ] 无公开仓库或接口失败时整块隐藏,页面无报错
- [ ] 日间 / 夜间 / 跟随系统 三主题无绿色、无白边
- [ ] 375px 移动端无横向溢出
- [ ] 登录后首页仍为控制台,不受影响
- [ ] 页脚 ICP 备案号与语言切换正常

View File

@ -2,7 +2,7 @@
> 仓库里唯一持久化的进度清单。`[x]` 完成 `[~]` 进行中 `[ ]` 未开始 `[!]` 等待批准
## 当前状态(2026-11-03)
## 当前状态(2026-11-05)
| 项目 | 值 |
| --- | --- |
@ -10,6 +10,7 @@
| Gitea 版本 | 1.21.11(生产数据库:MySQL) |
| 生效主题 | `DEFAULT_THEME = qq-auto`(浅色 `qq-light` / 深色 `qq-dark` / 跟随系统 `qq-auto`) |
| 当前标签 | `v1.3.13-live`(搜索框去内框 + 最近动态首项直角修复) |
| 进行中 | `v1.4` 未登录落地页(方案 A 首屏 + 方案 B 仓库卡,见 `docs/PLAN-landing-v1.4.md`) |
| 源码仓库 | <https://github.com/newbieQQ/QQGit>(private) |
| 回滚方式 | `./scripts/rollback.sh /var/backups/gitea-custom-<时间戳>.tar.gz` |
@ -75,6 +76,16 @@
- [x] 7.6 提交 `dd19bbb`(tag `v1.1-rc1`)→ 部署 → 实拍复核 → 修布局 `25d8895`(tag `v1.1-live`)
- [x] 7.7 移动端 375px 适配:光斑横向溢出裁剪、光环与标题字号压缩
## 阶段 8 · 落地页 v1.4(方案 A + B)— 进行中,等待 QQ 批准上线
- [x] 8.1 按 `docs/PLAN-landing-v1.4.md` 重写 `custom/templates/home.tmpl`:首屏左 7 / 右 5 分栏(标题 / 口号 / 搜索 / 双按钮 + 毛玻璃分支图 + terminal 复制窗)
- [x] 8.2 新增 `custom/public/assets/js/qq-home.js`:公开 API 取数(`sort=updated`,客户端按星标→更新时间排序,排除 fork/镜像/私有/归档),骨架屏 → 3 张卡片;失败或 0 条静默隐藏
- [x] 8.3 `qq-pages.css` 重写落地页段(1280px 限宽、蓝白色阶、语言圆点仅品牌蓝、hover / 焦点环、暗色变量、1024 / 640 断点、reduced-motion);Dashboard 段原样保留
- [x] 8.4 删除数字条(方案 A);三张功能卡降级为分隔线下方收尾
- [x] 8.5 离线预览更新:`preview/index.html` 首页段 + 假数据 6 条、`?only=home&bare=1` 截图模式、`preview/mobile-frame.html` 供 375px 复核(headless Chrome 窗口宽度下限 500px)
- [x] 8.6 截图 1440 / 834 / 375 的浅色与深色;`audit_colors.py`、`check_preview.py` 全绿
- [!] 8.7 待 QQ 看过截图后:提交并打标签 `v1.4-rc1` → `./scripts/deploy.sh` 预演 → 批准后 `--yes` → 实拍复核 → 打标签 `v1.4-live`
## 部署记录
| 时间 | 动作 | 备份 |

View File

@ -31,16 +31,37 @@
})();
/* ?only=login —— 只显示登录页演示区(方便单独截图/对比) */
/* ?only=login | ?only=home —— 只显示某一演示区(方便单独截图/对比) */
(function () {
var only = new URLSearchParams(location.search).get('only');
if (only !== 'login') return;
var params = new URLSearchParams(location.search);
var only = params.get('only');
if (!only) return;
var id = { login: 'login-demo', home: 'landing-demo' }[only];
if (!id) return;
var page = document.querySelector('.page');
if (!page) return;
var keep = document.getElementById('login-demo');
var label = keep && keep.previousElementSibling;
var keep = document.getElementById(id);
if (!page || !keep) return;
var label = keep.previousElementSibling;
Array.prototype.forEach.call(page.children, function (el) {
if (el === keep || el === label) return;
el.style.display = 'none';
});
if (only === 'home') {
/* 让离线预览也按线上 1280px 的容器宽度呈现 */
page.style.maxWidth = '1320px';
page.style.paddingTop = '0';
keep.style.border = '0';
keep.style.background = 'transparent';
keep.style.borderRadius = '0';
if (label) label.style.display = 'none';
if (params.get('bare') === '1') {
/* 截图用:预览器自己的导航会撑宽小屏,隐藏它才能看到真实 375px 版式 */
page.style.padding = '0';
page.style.maxWidth = 'none';
['#navbar', '.switcher'].forEach(function (sel) {
var el = document.querySelector(sel);
if (el) el.style.display = 'none';
});
}
}
})();

View File

@ -1,245 +1,326 @@
<!DOCTYPE html>
<html lang="zh-CN" data-theme="auto">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>QQGit 外观预览 · 蓝白 ins 风</title>
<!-- 三套主题:同一份标记,切换 <link> 的 disabled 即可对比 -->
<link id="css-auto" rel="stylesheet" href="../custom/public/assets/css/theme-qq-auto.css">
<link id="css-light" rel="stylesheet" href="../custom/public/assets/css/theme-qq-light.css" disabled>
<link id="css-dark" rel="stylesheet" href="../custom/public/assets/css/theme-qq-dark.css" disabled>
<link rel="stylesheet" href="../custom/public/assets/css/qq-ui.css">
<link rel="stylesheet" href="../custom/public/assets/css/qq-fx.css">
<link rel="stylesheet" href="../custom/public/assets/css/qq-pages.css">
<link rel="stylesheet" href="preview.css">
</head>
<body>
<!-- ============ 切换器 ============ -->
<div class="switcher" role="group" aria-label="主题切换">
<button data-mode="light">浅色</button>
<button data-mode="auto" class="on">自动</button>
<button data-mode="dark">深色</button>
</div>
<!-- ============ 顶栏(复刻 #navbar 结构) ============ -->
<nav id="navbar">
<a id="navbar-logo" href="#"><img src="../custom/public/assets/img/logo.svg" alt="logo"></a>
<a class="nav-item active" href="#">概览</a>
<a class="nav-item" href="#">探索</a>
<a class="nav-item" href="#">议题</a>
<a class="nav-item" href="#">合并请求</a>
<a class="nav-item" href="#">组织</a>
<span class="nav-spacer"></span>
<input type="search" placeholder="搜索仓库…" style="max-width:200px;margin-right:10px">
<span class="avatar">Q</span>
</nav>
<div class="page">
<!-- ============ 1. 未登录首页 ============ -->
<div class="section-label">首页(未登录 · custom/templates/home.tmpl)</div>
<div class="segment" style="padding:0">
<div class="page-content home qq-landing" style="padding-top:24px">
<section class="qq-lp-hero">
<div class="qq-logo-halo qq-lp-logo"><img src="../custom/public/assets/img/logo.svg" alt="logo"></div>
<p class="qq-lp-eyebrow">私有部署 · 轻量 · 全功能</p>
<h1 class="qq-lp-title">QQGit</h1>
<p class="qq-lp-sub" data-qq-type="自己的代码,自己的地方。">自己的代码,自己的地方。</p>
<form class="qq-lp-search" onsubmit="return false">
<input type="search" placeholder="搜索仓库、用户、组织…">
<button class="ui primary button" type="submit">搜索</button>
</form>
<div class="qq-lp-cta">
<a class="ui primary button" href="#">免费注册</a>
<a class="ui basic button" href="#">登录</a>
<a class="qq-lp-link" href="#">浏览全部仓库 →</a>
</div>
</section>
<section class="qq-lp-grid">
<article class="qq-lp-card">
<span class="qq-lp-icon"><svg viewBox="0 0 16 16" width="20" height="20" fill="currentColor" aria-hidden="true"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.492 2.492 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"/></svg></span>
<h2>版本控制</h2>
<p>Git 仓库、分支、标签、合并请求与代码评审,一套齐全。</p>
</article>
<article class="qq-lp-card">
<span class="qq-lp-icon"><svg viewBox="0 0 16 16" width="20" height="20" fill="currentColor" aria-hidden="true"><path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"/><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"/></svg></span>
<h2>议题与看板</h2>
<p>Issues、里程碑、标签与看板,把待办和进展放在同一个地方。</p>
</article>
<article class="qq-lp-card">
<span class="qq-lp-icon"><svg viewBox="0 0 16 16" width="20" height="20" fill="currentColor" aria-hidden="true"><path d="m8.533.133 5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667l5.25-1.68a1.748 1.748 0 0 1 1.066 0Zm-.61 1.429.001.001-5.25 1.68a.251.251 0 0 0-.174.237V7c0 1.275.259 2.518 1.008 3.66.749 1.14 2.028 2.29 4.294 3.255a.197.197 0 0 0 .155 0c2.266-.965 3.545-2.115 4.294-3.255C13.75 9.518 14 8.275 14 7V3.48a.25.25 0 0 0-.173-.237l-5.25-1.68a.25.25 0 0 0-.155 0Z"/></svg></span>
<h2>数据自持</h2>
<p>跑在自己的服务器上,仓库、用户与备份都由自己掌握。</p>
</article>
</section>
<section class="qq-lp-stats">
<div class="qq-lp-stat"><strong>1.21.11</strong><span>Gitea 版本</span></div>
<div class="qq-lp-stat"><strong>MIT</strong><span>开源协议</span></div>
<div class="qq-lp-stat"><strong>SQLite</strong><span>零依赖存储</span></div>
<div class="qq-lp-stat"><strong>1 台</strong><span>服务器即可跑</span></div>
</section>
</div>
</div>
<!-- ============ 2. 仓库列表 ============ -->
<div class="section-label">仓库列表(explore/repos)</div>
<div class="segment">
<div class="segment-header">最近更新的仓库</div>
<div class="repo-row">
<div class="dot">Q</div>
<div style="flex:1">
<h4><a href="#">qq/gitea-font</a> <span class="lang">· 私有</span></h4>
<div class="repo-meta">更新于 3 分钟前 · ★ 12 · 分支 2 · 标签 3</div>
<p class="repo-desc">Gitea 蓝白 ins 风外观定制:主题、模板钩子与 Logo 套件。</p>
</div>
<span class="label label-primary">CSS</span>
</div>
<div class="repo-row">
<div class="dot">N</div>
<div style="flex:1">
<h4><a href="#">qq/neovim-config</a></h4>
<div class="repo-meta">更新于 2 小时前 · ★ 48 · 分支 4</div>
<p class="repo-desc">个人 Neovim 配置,JetBrains Mono Nerd Font + LSP 全套。</p>
</div>
<span class="label label-primary">Lua</span>
</div>
<div class="repo-row">
<div class="dot">M</div>
<div style="flex:1">
<h4><a href="#">qq/materials-notes</a></h4>
<div class="repo-meta">更新于 昨天 · ★ 6</div>
<p class="repo-desc">材料科学论文笔记与数据整理。</p>
</div>
<span class="label label-primary">Markdown</span>
</div>
</div>
<!-- ============ 3. 代码文件视图 ============ -->
<div class="section-label">仓库文件页(repo/file)</div>
<div class="segment">
<div class="segment-header" style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
<span class="mono" style="font-weight:500">qq / gitea-font</span>
<span class="label">main</span>
<span class="mono sha">62b45b2</span>
<span style="flex:1"></span>
<span class="btn">复制</span>
<span class="btn btn-primary">克隆</span>
</div>
<table>
<thead>
<tr><th style="width:36px">·</th><th>文件</th><th style="width:130px">最近提交</th><th style="width:90px">时间</th></tr>
</thead>
<tbody>
<tr><td>▸</td><td><a href="#">custom/</a></td><td class="mono" style="color:var(--color-text-light-2)">chore: 主题与模板</td><td class="repo-meta">2 分钟前</td></tr>
<tr><td>▸</td><td><a href="#">preview/</a></td><td class="mono" style="color:var(--color-text-light-2)">feat: 离线预览</td><td class="repo-meta">2 分钟前</td></tr>
<tr><td>▤</td><td><a href="#">README.md</a></td><td class="mono" style="color:var(--color-text-light-2)">docs: 铁律与工作流</td><td class="repo-meta">5 分钟前</td></tr>
<tr><td>▤</td><td><a href="#">scripts/deploy.sh</a></td><td class="mono" style="color:var(--color-text-light-2)">feat: 一键部署</td><td class="repo-meta">8 分钟前</td></tr>
</tbody>
</table>
</div>
<div class="segment" style="margin-top:16px">
<div class="segment-header">scripts/build_theme.py</div>
<pre><code><span style="color:var(--color-text-light-3)"># 从二进制里导出的官方 CSS 派生主题变量,改一个主色整族跟着变</span>
LIGHT_PRIMARY = <span style="color:var(--color-primary)">"#3B82F6"</span>
DARK_PRIMARY = <span style="color:var(--color-primary)">"#38BDF8"</span>
<span style="color:var(--color-text-light-3)">def</span> <span style="color:var(--color-primary)">mix</span>(a, b, t):
<span style="color:var(--color-text-light-3)">"""把 a 向 b 混合 t(0..1)"""</span>
ra, rb = hex_to_rgb(a), hex_to_rgb(b)
<span style="color:var(--color-text-light-3)">return</span> rgb_to_hex(tuple(ra[i] + (rb[i] - ra[i]) * t <span style="color:var(--color-text-light-3)">for</span> i <span style="color:var(--color-text-light-3)">in</span> range(3)))</code></pre>
</div>
<!-- ============ 4. 组件状态 ============ -->
<div class="section-label">组件与状态色</div>
<div class="grid grid-2">
<div class="segment">
<div class="segment-header">按钮 / 标签</div>
<div class="segment-body" style="display:flex;flex-wrap:wrap;gap:10px;align-items:center">
<span class="btn btn-primary">新建仓库</span>
<span class="btn">取消</span>
<span class="label label-primary">open</span>
<span class="label label-success">checks passed</span>
<span class="label">v1.0-rc1</span>
</div>
</div>
<div class="segment">
<div class="segment-header">输入框 / 搜索</div>
<div class="segment-body" style="display:flex;flex-direction:column;gap:10px">
<input type="text" placeholder="仓库名称">
<input type="search" placeholder="在 qq/gitea-font 中搜索">
<span class="repo-meta">提示:聚焦时边框使用主色 <span class="mono">--color-primary</span></span>
</div>
</div>
</div>
<!-- ============ 5. Logo 双底色校验 ============ -->
<div class="section-label">Logo 在浅色 / 深色顶栏上的表现(圆外零白边)</div>
<div class="logo-strip">
<div class="logo-chip on-white">
<img src="../custom/public/assets/img/logo-light.svg" alt="light logo">
<div><div style="font-weight:600">#FFFFFF 顶栏</div><small>日间版 · #60A5FA 圆章</small></div>
</div>
<div class="logo-chip on-dark">
<img src="../custom/public/assets/img/logo-light.svg" alt="light logo on dark">
<div><div style="font-weight:600">#0D1117 顶栏(日间版)</div><small>圆章自带底,深色下依旧清晰</small></div>
</div>
<div class="logo-chip on-dark">
<img src="../custom/public/assets/img/logo-dark.svg" alt="dark logo">
<div><div style="font-weight:600">#0D1117 顶栏(夜间版)</div><small>夜间版 · #38BDF8 圆章</small></div>
</div>
</div>
<!-- ============ 6. 登录页(/user/login) ============ -->
<div class="section-label">登录页(user/login · 纯 CSS 改造,不覆盖模板)</div>
<div class="segment" id="login-demo" style="padding:26px 20px 30px">
<div class="page-content user signin">
<div class="new-menu navbar" style="display:flex;gap:4px;justify-content:center">
<a class="item active">登录</a>
<a class="item">注册帐号</a>
<a class="item">OpenID</a>
</div>
<div class="ui middle very relaxed page grid">
<div class="ui container column fluid">
<h4 class="ui top attached header center">登录</h4>
<div class="ui attached segment">
<form class="ui form">
<div class="required inline field">
<label for="p-user">用户名或邮箱</label>
<input id="p-user" type="text" placeholder="">
</div>
<div class="required inline field">
<label for="p-pass">密码</label>
<input id="p-pass" type="password">
</div>
<div class="inline field">
<div class="ui checkbox"><input type="checkbox" id="p-remember"><label for="p-remember">记住此设备</label></div>
</div>
<div class="inline field">
<button class="ui primary button" type="button">登录</button>
<a href="#" style="margin-left:10px">忘记密码?</a>
</div>
<div class="inline field">
<a href="#">还没帐户?马上注册。</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="page-footer qq-icp-footer">
<a class="qq-icp" href="https://beian.miit.gov.cn/">闽ICP备2023002932号</a>
</div>
</div>
<script src="../custom/public/assets/js/qq-fx.js" defer></script>
<script src="app.js"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="zh-CN" data-theme="auto">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>QQGit 外观预览 · 蓝白 ins 风</title>
<!-- 三套主题:同一份标记,切换 <link> 的 disabled 即可对比 -->
<link id="css-auto" rel="stylesheet" href="../custom/public/assets/css/theme-qq-auto.css">
<link id="css-light" rel="stylesheet" href="../custom/public/assets/css/theme-qq-light.css" disabled>
<link id="css-dark" rel="stylesheet" href="../custom/public/assets/css/theme-qq-dark.css" disabled>
<link rel="stylesheet" href="../custom/public/assets/css/qq-ui.css">
<link rel="stylesheet" href="../custom/public/assets/css/qq-fx.css">
<link rel="stylesheet" href="../custom/public/assets/css/qq-pages.css">
<link rel="stylesheet" href="preview.css">
</head>
<body>
<!-- ============ 切换器 ============ -->
<div class="switcher" role="group" aria-label="主题切换">
<button data-mode="light">浅色</button>
<button data-mode="auto" class="on">自动</button>
<button data-mode="dark">深色</button>
</div>
<!-- ============ 顶栏(复刻 #navbar 结构) ============ -->
<nav id="navbar">
<a id="navbar-logo" href="#"><img src="../custom/public/assets/img/logo.svg" alt="logo"></a>
<a class="nav-item active" href="#">概览</a>
<a class="nav-item" href="#">探索</a>
<a class="nav-item" href="#">议题</a>
<a class="nav-item" href="#">合并请求</a>
<a class="nav-item" href="#">组织</a>
<span class="nav-spacer"></span>
<input type="search" placeholder="搜索仓库…" style="max-width:200px;margin-right:10px">
<span class="avatar">Q</span>
</nav>
<div class="page">
<!-- ============ 1. 未登录首页 ============ -->
<div class="section-label">首页(未登录 · custom/templates/home.tmpl)</div>
<div class="segment" id="landing-demo" style="padding:0">
<div class="page-content home qq-landing">
<section class="qq-lp-hero">
<div class="qq-lp-hero-copy">
<p class="qq-lp-eyebrow">私有部署 · 轻量 · 全功能</p>
<h1 class="qq-lp-title">QQGit</h1>
<p class="qq-lp-sub" data-qq-type="自己的代码,自己的地方。">自己的代码,自己的地方。</p>
<form class="qq-lp-search" onsubmit="return false">
<input type="search" placeholder="搜索仓库、用户、组织…">
<button class="ui primary button" type="submit">搜索</button>
</form>
<div class="qq-lp-cta">
<a class="ui primary button" href="#">免费注册</a>
<a class="ui basic button" href="#">登录</a>
<a class="qq-lp-link" href="#">浏览全部仓库 →</a>
</div>
</div>
<div class="qq-lp-visual">
<div class="qq-lp-graph" aria-hidden="true">
<svg class="qq-lp-graph-svg" viewBox="0 0 600 400" preserveAspectRatio="xMidYMid meet" focusable="false">
<defs>
<linearGradient id="qqg-line" x1="0" y1="1" x2="1" y2="0">
<stop offset="0%" stop-color="#1D4ED8"/>
<stop offset="55%" stop-color="#3B82F6"/>
<stop offset="100%" stop-color="#60A5FA"/>
</linearGradient>
</defs>
<g class="qqg-faint">
<path class="qqg-edge-faint" d="M46 300 C120 300 130 260 200 260 C280 260 300 300 370 300 C440 300 460 260 540 260"/>
<path class="qqg-edge-faint qqg-flow" d="M46 240 C120 240 120 150 200 150 C270 150 280 240 350 240 C420 240 430 150 510 150 C545 150 560 160 574 166"/>
<path class="qqg-link" d="M200 150 L200 260"/>
<path class="qqg-link" d="M350 240 L370 300"/>
<path class="qqg-link" d="M510 150 L540 260"/>
<circle class="qqg-node-soft" cx="46" cy="300" r="2.5"/>
<circle class="qqg-node-soft" cx="370" cy="300" r="2.5"/>
<circle class="qqg-node-soft" cx="540" cy="260" r="2.5"/>
</g>
<path class="qqg-edge" d="M46 240 C120 240 120 150 200 150 C270 150 280 240 350 240 C420 240 430 150 510 150 C545 150 560 160 574 166"/>
<path class="qqg-edge" d="M46 300 C120 300 130 260 200 260 C280 260 300 300 370 300 C440 300 460 260 540 260"/>
<path class="qqg-edge" d="M200 150 C235 150 240 205 275 205 C310 205 315 240 350 240"/>
<g class="qqg-nodes">
<circle class="qqg-node" cx="46" cy="240" r="5"/>
<circle class="qqg-node-core" cx="200" cy="150" r="6"/>
<circle class="qqg-node-core" cx="350" cy="240" r="6"/>
<circle class="qqg-node" cx="510" cy="150" r="5"/>
<circle class="qqg-node" cx="574" cy="166" r="4"/>
<circle class="qqg-node" cx="46" cy="300" r="5"/>
<circle class="qqg-node" cx="200" cy="260" r="4"/>
<circle class="qqg-node-core" cx="370" cy="300" r="6"/>
<circle class="qqg-node" cx="540" cy="260" r="4"/>
<circle class="qqg-node" cx="275" cy="205" r="4"/>
</g>
</svg>
</div>
<div class="qq-lp-term">
<div class="qq-lp-term-bar" aria-hidden="true">
<span class="qq-lp-term-dots"><i></i><i></i><i></i></span>
<span class="qq-lp-term-title">terminal</span>
</div>
<div class="qq-lp-term-line">
<code class="qq-lp-term-code"><span class="qq-prompt">$</span> git clone <span class="qq-url">https://git.qyhhh.top/qq/repo.git</span></code>
<span class="qq-qc-tip" aria-hidden="true">已复制</span>
<button class="qq-lp-copy" type="button" data-qq-copy="git clone https://git.qyhhh.top/qq/repo.git" aria-label="复制 clone 命令">
<svg class="qq-copy-icon" viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<rect x="5.5" y="5.5" width="8" height="8" rx="1.6"/>
<path d="M10.5 5.5V4a1.5 1.5 0 0 0-1.5-1.5H4A1.5 1.5 0 0 0 2.5 4v5A1.5 1.5 0 0 0 4 10.5h1.5"/>
</svg>
<svg class="qq-copy-check" viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M3 8.5 6.2 11.7 13 4.5"/>
</svg>
</button>
</div>
</div>
</div>
</section>
<section class="qq-lp-hot" id="qq-hot-repos" data-demo="1" hidden>
<div class="qq-lp-sec-head">
<h2>热门公开仓库</h2>
<a class="qq-lp-more" href="#">查看全部 →</a>
</div>
<div class="qq-hot-grid" data-qq-hot-grid>
<div class="qq-repo-card qq-skeleton" aria-hidden="true"><span class="qq-sk-bar qq-sk-title"></span><span class="qq-sk-bar qq-sk-desc"></span><span class="qq-sk-bar qq-sk-desc qq-sk-desc-2"></span><div class="qq-sk-meta"><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill qq-sk-pill-end"></span></div></div>
<div class="qq-repo-card qq-skeleton" aria-hidden="true"><span class="qq-sk-bar qq-sk-title"></span><span class="qq-sk-bar qq-sk-desc"></span><span class="qq-sk-bar qq-sk-desc qq-sk-desc-2"></span><div class="qq-sk-meta"><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill qq-sk-pill-end"></span></div></div>
<div class="qq-repo-card qq-skeleton" aria-hidden="true"><span class="qq-sk-bar qq-sk-title"></span><span class="qq-sk-bar qq-sk-desc"></span><span class="qq-sk-bar qq-sk-desc qq-sk-desc-2"></span><div class="qq-sk-meta"><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill"></span><span class="qq-sk-bar qq-sk-pill qq-sk-pill-end"></span></div></div>
</div>
</section>
<section class="qq-lp-grid">
<article class="qq-lp-card">
<span class="qq-lp-icon"><svg viewBox="0 0 16 16" width="20" height="20" fill="currentColor" aria-hidden="true"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.492 2.492 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"/></svg></span>
<h2>版本控制</h2>
<p>Git 仓库、分支、标签、合并请求与代码评审,一套齐全。</p>
</article>
<article class="qq-lp-card">
<span class="qq-lp-icon"><svg viewBox="0 0 16 16" width="20" height="20" fill="currentColor" aria-hidden="true"><path d="M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"/><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"/></svg></span>
<h2>议题与看板</h2>
<p>Issues、里程碑、标签与看板,把待办和进展放在同一个地方。</p>
</article>
<article class="qq-lp-card">
<span class="qq-lp-icon"><svg viewBox="0 0 16 16" width="20" height="20" fill="currentColor" aria-hidden="true"><path d="m8.533.133 5.25 1.68A1.75 1.75 0 0 1 15 3.48V7c0 1.566-.32 3.182-1.303 4.682-.983 1.498-2.585 2.813-5.032 3.855a1.697 1.697 0 0 1-1.33 0c-2.447-1.042-4.049-2.357-5.032-3.855C1.32 10.182 1 8.566 1 7V3.48a1.75 1.75 0 0 1 1.217-1.667l5.25-1.68a1.748 1.748 0 0 1 1.066 0Zm-.61 1.429.001.001-5.25 1.68a.251.251 0 0 0-.174.237V7c0 1.275.259 2.518 1.008 3.66.749 1.14 2.028 2.29 4.294 3.255a.197.197 0 0 0 .155 0c2.266-.965 3.545-2.115 4.294-3.255C13.75 9.518 14 8.275 14 7V3.48a.25.25 0 0 0-.173-.237l-5.25-1.68a.25.25 0 0 0-.155 0Z"/></svg></span>
<h2>数据自持</h2>
<p>跑在自己的服务器上,仓库、用户与备份都由自己掌握。</p>
</article>
</section>
</div>
</div>
<!-- ============ 2. 仓库列表 ============ -->
<div class="section-label">仓库列表(explore/repos)</div>
<div class="segment">
<div class="segment-header">最近更新的仓库</div>
<div class="repo-row">
<div class="dot">Q</div>
<div style="flex:1">
<h4><a href="#">qq/gitea-font</a> <span class="lang">· 私有</span></h4>
<div class="repo-meta">更新于 3 分钟前 · ★ 12 · 分支 2 · 标签 3</div>
<p class="repo-desc">Gitea 蓝白 ins 风外观定制:主题、模板钩子与 Logo 套件。</p>
</div>
<span class="label label-primary">CSS</span>
</div>
<div class="repo-row">
<div class="dot">N</div>
<div style="flex:1">
<h4><a href="#">qq/neovim-config</a></h4>
<div class="repo-meta">更新于 2 小时前 · ★ 48 · 分支 4</div>
<p class="repo-desc">个人 Neovim 配置,JetBrains Mono Nerd Font + LSP 全套。</p>
</div>
<span class="label label-primary">Lua</span>
</div>
<div class="repo-row">
<div class="dot">M</div>
<div style="flex:1">
<h4><a href="#">qq/materials-notes</a></h4>
<div class="repo-meta">更新于 昨天 · ★ 6</div>
<p class="repo-desc">材料科学论文笔记与数据整理。</p>
</div>
<span class="label label-primary">Markdown</span>
</div>
</div>
<!-- ============ 3. 代码文件视图 ============ -->
<div class="section-label">仓库文件页(repo/file)</div>
<div class="segment">
<div class="segment-header" style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
<span class="mono" style="font-weight:500">qq / gitea-font</span>
<span class="label">main</span>
<span class="mono sha">62b45b2</span>
<span style="flex:1"></span>
<span class="btn">复制</span>
<span class="btn btn-primary">克隆</span>
</div>
<table>
<thead>
<tr><th style="width:36px">·</th><th>文件</th><th style="width:130px">最近提交</th><th style="width:90px">时间</th></tr>
</thead>
<tbody>
<tr><td>▸</td><td><a href="#">custom/</a></td><td class="mono" style="color:var(--color-text-light-2)">chore: 主题与模板</td><td class="repo-meta">2 分钟前</td></tr>
<tr><td>▸</td><td><a href="#">preview/</a></td><td class="mono" style="color:var(--color-text-light-2)">feat: 离线预览</td><td class="repo-meta">2 分钟前</td></tr>
<tr><td>▤</td><td><a href="#">README.md</a></td><td class="mono" style="color:var(--color-text-light-2)">docs: 铁律与工作流</td><td class="repo-meta">5 分钟前</td></tr>
<tr><td>▤</td><td><a href="#">scripts/deploy.sh</a></td><td class="mono" style="color:var(--color-text-light-2)">feat: 一键部署</td><td class="repo-meta">8 分钟前</td></tr>
</tbody>
</table>
</div>
<div class="segment" style="margin-top:16px">
<div class="segment-header">scripts/build_theme.py</div>
<pre><code><span style="color:var(--color-text-light-3)"># 从二进制里导出的官方 CSS 派生主题变量,改一个主色整族跟着变</span>
LIGHT_PRIMARY = <span style="color:var(--color-primary)">"#3B82F6"</span>
DARK_PRIMARY = <span style="color:var(--color-primary)">"#38BDF8"</span>
<span style="color:var(--color-text-light-3)">def</span> <span style="color:var(--color-primary)">mix</span>(a, b, t):
<span style="color:var(--color-text-light-3)">"""把 a 向 b 混合 t(0..1)"""</span>
ra, rb = hex_to_rgb(a), hex_to_rgb(b)
<span style="color:var(--color-text-light-3)">return</span> rgb_to_hex(tuple(ra[i] + (rb[i] - ra[i]) * t <span style="color:var(--color-text-light-3)">for</span> i <span style="color:var(--color-text-light-3)">in</span> range(3)))</code></pre>
</div>
<!-- ============ 4. 组件状态 ============ -->
<div class="section-label">组件与状态色</div>
<div class="grid grid-2">
<div class="segment">
<div class="segment-header">按钮 / 标签</div>
<div class="segment-body" style="display:flex;flex-wrap:wrap;gap:10px;align-items:center">
<span class="btn btn-primary">新建仓库</span>
<span class="btn">取消</span>
<span class="label label-primary">open</span>
<span class="label label-success">checks passed</span>
<span class="label">v1.0-rc1</span>
</div>
</div>
<div class="segment">
<div class="segment-header">输入框 / 搜索</div>
<div class="segment-body" style="display:flex;flex-direction:column;gap:10px">
<input type="text" placeholder="仓库名称">
<input type="search" placeholder="在 qq/gitea-font 中搜索">
<span class="repo-meta">提示:聚焦时边框使用主色 <span class="mono">--color-primary</span></span>
</div>
</div>
</div>
<!-- ============ 5. Logo 双底色校验 ============ -->
<div class="section-label">Logo 在浅色 / 深色顶栏上的表现(圆外零白边)</div>
<div class="logo-strip">
<div class="logo-chip on-white">
<img src="../custom/public/assets/img/logo-light.svg" alt="light logo">
<div><div style="font-weight:600">#FFFFFF 顶栏</div><small>日间版 · #60A5FA 圆章</small></div>
</div>
<div class="logo-chip on-dark">
<img src="../custom/public/assets/img/logo-light.svg" alt="light logo on dark">
<div><div style="font-weight:600">#0D1117 顶栏(日间版)</div><small>圆章自带底,深色下依旧清晰</small></div>
</div>
<div class="logo-chip on-dark">
<img src="../custom/public/assets/img/logo-dark.svg" alt="dark logo">
<div><div style="font-weight:600">#0D1117 顶栏(夜间版)</div><small>夜间版 · #38BDF8 圆章</small></div>
</div>
</div>
<!-- ============ 6. 登录页(/user/login) ============ -->
<div class="section-label">登录页(user/login · 纯 CSS 改造,不覆盖模板)</div>
<div class="segment" id="login-demo" style="padding:26px 20px 30px">
<div class="page-content user signin">
<div class="new-menu navbar" style="display:flex;gap:4px;justify-content:center">
<a class="item active">登录</a>
<a class="item">注册帐号</a>
<a class="item">OpenID</a>
</div>
<div class="ui middle very relaxed page grid">
<div class="ui container column fluid">
<h4 class="ui top attached header center">登录</h4>
<div class="ui attached segment">
<form class="ui form">
<div class="required inline field">
<label for="p-user">用户名或邮箱</label>
<input id="p-user" type="text" placeholder="">
</div>
<div class="required inline field">
<label for="p-pass">密码</label>
<input id="p-pass" type="password">
</div>
<div class="inline field">
<div class="ui checkbox"><input type="checkbox" id="p-remember"><label for="p-remember">记住此设备</label></div>
</div>
<div class="inline field">
<button class="ui primary button" type="button">登录</button>
<a href="#" style="margin-left:10px">忘记密码?</a>
</div>
<div class="inline field">
<a href="#">还没帐户?马上注册。</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="page-footer qq-icp-footer">
<a class="qq-icp" href="https://beian.miit.gov.cn/">闽ICP备2023002932号</a>
</div>
</div>
<script>
/* 离线预览用的假数据:字段与 /api/v1/repos/search 保持一致 */
(function () {
var h = 3600e3, d = 24 * h;
function ago(ms) { return new Date(Date.now() - ms).toISOString(); }
window.QQ_HOT_REPOS_DEMO = [
{ full_name: 'newbie/QQgit', html_url: '#', description: 'Gitea 蓝白 ins 风外观定制:主题、模板钩子与 Logo 套件。', language: 'CSS', stars_count: 12, forks_count: 2, updated_at: ago(2 * h), fork: false, mirror: false, private: false, archived: false, owner: { login: 'newbie' } },
{ full_name: 'newbie/Actuators', html_url: '#', description: '执行器选型笔记、固件脚本与实测数据整理。', language: 'Python', stars_count: 8, forks_count: 1, updated_at: ago(9 * d), fork: false, mirror: false, private: false, archived: false, owner: { login: 'newbie' } },
{ full_name: 'newbie/OMZ', html_url: '#', description: 'oh-my-zsh 个人配置:主题、插件与常用别名。', language: 'Shell', stars_count: 5, forks_count: 0, updated_at: ago(23 * d), fork: false, mirror: false, private: false, archived: false, owner: { login: 'newbie' } },
{ full_name: 'Skills/YYCangle-skill', html_url: '#', description: '角度/姿态相关的技能脚本与文档。', language: 'Markdown', stars_count: 3, forks_count: 0, updated_at: ago(40 * d), fork: false, mirror: false, private: false, archived: false, owner: { login: 'Skills' } },
{ full_name: 'newbie/nvim', html_url: '#', description: 'Neovim 配置,JetBrains Mono Nerd Font + LSP 全套。', language: 'Lua', stars_count: 2, forks_count: 0, updated_at: ago(60 * d), fork: false, mirror: false, private: false, archived: false, owner: { login: 'newbie' } },
{ full_name: 'Skills/QQzot-skill', html_url: '#', description: 'Zotero 文献库操作与 AI 笔记生成的技能封装。', language: 'Python', stars_count: 1, forks_count: 0, updated_at: ago(70 * d), fork: false, mirror: false, private: false, archived: false, owner: { login: 'Skills' } }
];
})();
</script>
<script src="../custom/public/assets/js/qq-home.js" defer></script>
<script src="../custom/public/assets/js/qq-fx.js" defer></script>
<script src="app.js"></script>
</body>
</html>

18
preview/mobile-frame.html Normal file
View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>QQGit 预览 · 375px frame</title>
<style>
html, body { margin: 0; padding: 0; background: #fff; }
iframe { display: block; width: 375px; height: 2400px; border: 0; }
</style>
</head>
<body>
<iframe id="f" src="index.html?only=home&amp;bare=1&amp;theme=light"></iframe>
<script>
var t = new URLSearchParams(location.search).get('theme') || 'light';
document.getElementById('f').src = 'index.html?only=home&bare=1&theme=' + t;
</script>
</body>
</html>