fix: 按UTC日期优化独立站日历筛选
2026-08-15:日历默认视图按当前 UTC 日期过滤与排序,未来和当天节点优先,已过节点降权;显式月份仍保留完整历史。日历页隐藏重复目标区域筛选,平台渲染模块独立拆分,更新静态资源版本号与测试契约,避免 Gitea/IIS/Nginx 部署命中旧缓存。
This commit is contained in:
+23
-5
@@ -10,11 +10,12 @@ test("独立首页只展示家纺情报并加载独立入口", async () => {
|
||||
const dongguanCss = await text("public/assets/fonts/dongguan-bold/result.css");
|
||||
assert.match(html, /三笙AI情报局/);
|
||||
assert.match(html, /assets\/js\/app\.js/);
|
||||
assert.match(html, /assets\/js\/app\.js\?v=20260814q/);
|
||||
assert.match(html, /assets\/js\/app\.js\?v=20260815a/);
|
||||
assert.match(html, /assets\/css\/base\.css\?v=20260814h/);
|
||||
assert.match(html, /assets\/css\/intelligence\.css\?v=20260814s/);
|
||||
assert.match(html, /assets\/css\/intelligence\.css\?v=20260815a/);
|
||||
assert.match(html, /<details[^>]+class="intelligence-metrics"/);
|
||||
assert.match(html, /<summary[^>]+class="intelligence-utility-row"/);
|
||||
assert.doesNotMatch(html, /id="intelligenceShareBtn"/);
|
||||
assert.match(html, /class="tool-icon"/);
|
||||
assert.match(html, /assets\/fonts\/dongguan-bold\/result\.css/);
|
||||
assert.doesNotMatch(html, /cn-font\.claude-code-best\.win/);
|
||||
@@ -33,7 +34,7 @@ test("数据快照不复用浏览器旧缓存", async () => {
|
||||
|
||||
test("七个业务入口与趋势四子类均保留", async () => {
|
||||
const renderer = await text("public/assets/js/render-intelligence.js");
|
||||
const modules = renderer + await text("public/assets/js/render-intelligence-core.js") + await text("public/assets/js/render-intelligence-scenes.js");
|
||||
const modules = renderer + await text("public/assets/js/render-intelligence-core.js") + await text("public/assets/js/render-intelligence-scenes.js") + await text("public/assets/js/render-intelligence-platforms.js");
|
||||
for (const label of ["今日必看", "备货日历", "展会通", "政策预警", "趋势雷达", "平台渠道", "跨境活动"]) {
|
||||
assert.match(modules, new RegExp(label));
|
||||
}
|
||||
@@ -59,6 +60,7 @@ test("所有外部业务链接使用新窗口和安全rel", async () => {
|
||||
await text("public/assets/js/render-intelligence.js"),
|
||||
await text("public/assets/js/render-intelligence-core.js"),
|
||||
await text("public/assets/js/render-intelligence-scenes.js"),
|
||||
await text("public/assets/js/render-intelligence-platforms.js"),
|
||||
await text("public/assets/js/render-intelligence-activities.js"),
|
||||
].join("\n");
|
||||
assert.match(files, /target\s*=\s*["']_blank["']/);
|
||||
@@ -67,7 +69,7 @@ test("所有外部业务链接使用新窗口和安全rel", async () => {
|
||||
|
||||
test("趋势分类读取真实 items 数组而不是分类对象", async () => {
|
||||
const renderer = await text("public/assets/js/render-intelligence.js");
|
||||
const modules = renderer + await text("public/assets/js/render-intelligence-core.js") + await text("public/assets/js/render-intelligence-scenes.js");
|
||||
const modules = renderer + await text("public/assets/js/render-intelligence-core.js") + await text("public/assets/js/render-intelligence-scenes.js") + await text("public/assets/js/render-intelligence-platforms.js");
|
||||
assert.match(modules, /category\.items/);
|
||||
assert.match(modules, /item\.image\s*\|\|\s*item\.thumbnail/);
|
||||
assert.match(modules, /function renderCalendarMonthGrid/);
|
||||
@@ -153,9 +155,23 @@ test("跨境活动按访问当天重新计算相对日期并排除已结束活
|
||||
assert.equal(activityDayOffset("2026-08-15", now), 1);
|
||||
});
|
||||
|
||||
test("日历按当前 UTC 日期优先展示未过期节点并把已过节点压到后面", async () => {
|
||||
const { calendarTodayIso, sortCalendarItems, calendarDefaultItems } = await import(new URL(`../public/assets/js/render-intelligence-core.js?calendar-date=${Date.now()}`, import.meta.url));
|
||||
const now = new Date("2026-08-15T00:30:00.000Z");
|
||||
const items = [
|
||||
{ id: "july", start_date: "2026-07-15", priority_score: 90 },
|
||||
{ id: "past-august", start_date: "2026-08-10", priority_score: 90 },
|
||||
{ id: "today", start_date: "2026-08-15", priority_score: 1 },
|
||||
{ id: "future", start_date: "2026-08-17", priority_score: 1 },
|
||||
];
|
||||
assert.equal(calendarTodayIso(now), "2026-08-15");
|
||||
assert.deepEqual(sortCalendarItems(items, now).map((item) => item.id), ["today", "future", "past-august", "july"]);
|
||||
assert.deepEqual(calendarDefaultItems(items, 2026, now).map((item) => item.id), ["today", "future"]);
|
||||
});
|
||||
|
||||
test("最新家纺交互与移动端契约已同步", async () => {
|
||||
const renderer = await text("public/assets/js/render-intelligence.js");
|
||||
const modules = renderer + await text("public/assets/js/render-intelligence-core.js") + await text("public/assets/js/render-intelligence-scenes.js");
|
||||
const modules = renderer + await text("public/assets/js/render-intelligence-core.js") + await text("public/assets/js/render-intelligence-scenes.js") + await text("public/assets/js/render-intelligence-platforms.js");
|
||||
const baseCss = await text("public/assets/css/base.css");
|
||||
const css = await text("public/assets/css/intelligence.css");
|
||||
assert.doesNotMatch(renderer, /displayLimit/);
|
||||
@@ -171,6 +187,8 @@ test("最新家纺交互与移动端契约已同步", async () => {
|
||||
assert.doesNotMatch(modules, /家纺成熟度|新兴参考/);
|
||||
assert.doesNotMatch(modules, /scope_type === "state\.region"|\["state\.region", "地区政策"\]/);
|
||||
assert.match(modules, /scope_type === "region"/);
|
||||
assert.match(renderer, /closest\("label"\)/);
|
||||
assert.match(renderer, /regionField\.hidden\s*=\s*state\.activeSection === "calendar"/);
|
||||
assert.match(css, /@media \(max-width: 680px\)/);
|
||||
assert.match(css, /\.intelligence-tabs\s*\{[^}]*grid-template-columns: repeat\(3/);
|
||||
assert.match(css, /min-height: 48px/);
|
||||
|
||||
Reference in New Issue
Block a user