feat: 每日资讯置顶+每列10条+框内滚动
- 资讯移到首页最顶部(精选推荐之上) - 每列抓取 5→10 条(github/news/ai/it/stock) - 每列固定240px(恰好5条)超出框内滚动 验证: 顺序正确/10条/固定5条可见/框内滚动 ✓ CHANGELOG记录
This commit is contained in:
1 parent
cd0264acc2
commit
4d7c398510
3 files changed
+57
-36
No files matched your search
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. See [standa
|
||||
|
||||
## Version 2026.10.12-it-tools-pro
|
||||
|
||||
### 📰 每日资讯改版:置顶 + 每列 10 条 + 框内滚动
|
||||
- 「📰 每日资讯」移到首页最顶部(在精选推荐之上)
|
||||
- 每列抓取数量 5 → 10 条(GitHub/国际新闻/AI资讯/IT技术/股票)
|
||||
- 每列固定高度 240px(恰好显示 5 条),超出 5 条在框内滚动查看(细滚动条)
|
||||
- 验证:顺序资讯→精选推荐→近期新功能、每列10条、固定5条可见、框内滚动生效 ✓
|
||||
|
||||
|
||||
### 🚀 全站回到顶部火箭
|
||||
- 全站右下角悬浮绿色圆形 🚀 按钮,滚动超过 300px 出现,点击平滑回到顶部后自动隐藏
|
||||
- fixed 定位于视口右下角(不遮挡内容),悬浮微抬升动效,绑定内容滚动容器
|
||||
|
||||
@@ -2532,7 +2532,7 @@ _CST = _tz(_td(hours=8))
|
||||
_BBC_RSS = "https://feeds.bbci.co.uk/news/world/rss.xml"
|
||||
_TC_AI_RSS = "https://techcrunch.com/category/artificial-intelligence/feed/"
|
||||
_HN_RSS = "https://hnrss.org/frontpage"
|
||||
_STOCK_URL = ("https://push2.eastmoney.com/api/qt/clist/get?pn=1&pz=5&po=1&np=1"
|
||||
_STOCK_URL = ("https://push2.eastmoney.com/api/qt/clist/get?pn=1&pz=10&po=1&np=1"
|
||||
"&fltt=2&invt=2&fid=f3&fs=m:0+t:6,m:0+t:80,m:1+t:2,m:1+t:23&fields=f12,f14,f3")
|
||||
|
||||
|
||||
@@ -2564,7 +2564,7 @@ def _http_get(opener, url, timeout=20):
|
||||
return resp.read()
|
||||
|
||||
|
||||
def _parse_rss(data, limit=5):
|
||||
def _parse_rss(data, limit=10):
|
||||
"""RSS 2.0 / Atom -> [{title,url,time}]"""
|
||||
items = []
|
||||
try:
|
||||
@@ -2598,10 +2598,10 @@ def _parse_rss(data, limit=5):
|
||||
|
||||
def _fetch_github():
|
||||
q = (_cst_now() - _td(days=7)).strftime("%Y-%m-%d")
|
||||
url = f"https://api.github.com/search/repositories?q=created:%3E{q}&sort=stars&order=desc&per_page=5"
|
||||
url = f"https://api.github.com/search/repositories?q=created:%3E{q}&sort=stars&order=desc&per_page=10"
|
||||
j = json.loads(_http_get(OPENER_PROXY, url))
|
||||
out = []
|
||||
for r in j.get("items", [])[:5]:
|
||||
for r in j.get("items", [])[:10]:
|
||||
out.append({
|
||||
"title": f"{r.get('full_name','')} \u2b50{r.get('stargazers_count',0)}",
|
||||
"url": r.get("html_url", ""),
|
||||
@@ -2617,7 +2617,7 @@ def _fetch_stock():
|
||||
diff = list(diff.values())
|
||||
today = _cst_now().strftime("%m-%d")
|
||||
out = []
|
||||
for r in diff[:5]:
|
||||
for r in diff[:10]:
|
||||
name, code, pct = r.get("f14", ""), r.get("f12", ""), r.get("f3", 0)
|
||||
if not name:
|
||||
continue
|
||||
@@ -2673,7 +2673,7 @@ def _fetch_news():
|
||||
|
||||
def _col(key, title, icon, fn):
|
||||
try:
|
||||
items = (fn() or [])[:5]
|
||||
items = (fn() or [])[:10]
|
||||
except Exception as e: # noqa: BLE001
|
||||
print(f"[news] {key} failed: {e}", flush=True)
|
||||
items = []
|
||||
|
||||
+44
-30
@@ -87,6 +87,36 @@ function onUpdateFavoriteTools() {
|
||||
|
||||
<template>
|
||||
<div class="pt-50px">
|
||||
<!-- 每日 5 列资讯 -->
|
||||
<div v-if="newsCols.length" class="news-block">
|
||||
<div class="nf-head">
|
||||
<span class="nf-title">📰 每日资讯</span>
|
||||
<span class="nf-sub">每天 08:00 自动更新{{ newsDate ? ' · ' + newsDate : '' }}</span>
|
||||
</div>
|
||||
<div class="news-grid">
|
||||
<div v-for="col in newsCols" :key="col.key" class="news-col">
|
||||
<div class="news-col-head">
|
||||
<span class="news-col-icon">{{ col.icon }}</span>
|
||||
<span class="news-col-title">{{ col.title }}</span>
|
||||
</div>
|
||||
<div class="news-list">
|
||||
<a
|
||||
v-for="(it, i) in col.items"
|
||||
:key="i"
|
||||
class="news-item"
|
||||
:href="it.url"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<span class="news-title">{{ it.title }}</span>
|
||||
<span class="news-time">{{ it.time }}</span>
|
||||
</a>
|
||||
<div v-if="!col.items.length" class="news-empty">暂无内容</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 精选推荐(管理后台配置,置顶独立列表) -->
|
||||
<div v-if="recoList.length" class="nf-block reco-block">
|
||||
<div class="nf-head">
|
||||
@@ -121,36 +151,6 @@ function onUpdateFavoriteTools() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 每日 5 列资讯 -->
|
||||
<div v-if="newsCols.length" class="news-block">
|
||||
<div class="nf-head">
|
||||
<span class="nf-title">📰 每日资讯</span>
|
||||
<span class="nf-sub">每天 08:00 自动更新{{ newsDate ? ' · ' + newsDate : '' }}</span>
|
||||
</div>
|
||||
<div class="news-grid">
|
||||
<div v-for="col in newsCols" :key="col.key" class="news-col">
|
||||
<div class="news-col-head">
|
||||
<span class="news-col-icon">{{ col.icon }}</span>
|
||||
<span class="news-col-title">{{ col.title }}</span>
|
||||
</div>
|
||||
<div class="news-list">
|
||||
<a
|
||||
v-for="(it, i) in col.items"
|
||||
:key="i"
|
||||
class="news-item"
|
||||
:href="it.url"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<span class="news-title">{{ it.title }}</span>
|
||||
<span class="news-time">{{ it.time }}</span>
|
||||
</a>
|
||||
<div v-if="!col.items.length" class="news-empty">暂无内容</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid-wrapper">
|
||||
<div class="grid grid-cols-1 gap-12px lg:grid-cols-3 md:grid-cols-3 sm:grid-cols-2 xl:grid-cols-4">
|
||||
<ColoredCard v-if="config.showBanner" :title="$t('home.follow.title')" :icon="IconHeart">
|
||||
@@ -385,6 +385,20 @@ function onUpdateFavoriteTools() {
|
||||
.news-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
// 固定显示约 5 条的高度(每条约 48px),超出在框内滚动
|
||||
height: 240px;
|
||||
overflow-y: auto;
|
||||
overscroll-behavior: contain;
|
||||
scrollbar-width: thin;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: rgba(24, 160, 88, 0.35);
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
.news-item {
|
||||
|
||||
Reference in new issue
Block a user