fix: 资源改用相对路径,页面在任意目录/本地都能正常打开

Browse Source
- 门户/下单页的 assets/tokens.css 由 /assets/... 改为相对路径
  (绝对路径只在部署在域名根目录时成立,本地打开或挂在子目录下样式会整个丢)
- 门户的 view_stats.json / hit 上报同改相对路径
- 下单页补一份 order/assets/tokens.css,两个子目录各自自足
- 说明文档新增「怎么在本地打开」一节(静态服务器 + 下单单开是半残属正常 + 反复重载要找 Console)
This commit is contained in:
Suda
2026-10-05 11:25:16 +08:00
parent ffdbb1d849
commit 82cbd2ff36
4 changed files with 103 additions and 4 deletions
+3 -3
View File
@@ -31,7 +31,7 @@
--> -->
<!-- 统一设计 tokens(金钻系四界面共用;必须放在本页 <style> 之前 —— <!-- 统一设计 tokens(金钻系四界面共用;必须放在本页 <style> 之前 ——
本页自己的 :root 会覆盖同名变量,所以既拿到共享动效 token,也不改现有观感) --> 本页自己的 :root 会覆盖同名变量,所以既拿到共享动效 token,也不改现有观感) -->
<link rel="stylesheet" href="/assets/tokens.css"> <link rel="stylesheet" href="assets/tokens.css">
<style> <style>
/* ========================================================================== /* ==========================================================================
0. 设计 token(2026-10-04 改:冷黑底 / 发丝白线 / 灰阶文字 / 翡翠绿强调;全部指向 tokens.css) 0. 设计 token(2026-10-04 改:冷黑底 / 发丝白线 / 灰阶文字 / 翡翠绿强调;全部指向 tokens.css)
@@ -3588,7 +3588,7 @@ function openBadge(g){
let VIEWSTATS = null; let VIEWSTATS = null;
function loadViewStats(){ function loadViewStats(){
try{ try{
fetch('/view_stats.json?_=' + Date.now(), {cache:'no-store'}) fetch('view_stats.json?_=' + Date.now(), {cache:'no-store'})
.then(r=> r.ok ? r.json() : null) .then(r=> r.ok ? r.json() : null)
.then(j=>{ .then(j=>{
VIEWSTATS = j || null; VIEWSTATS = j || null;
@@ -3618,7 +3618,7 @@ function viewBadge(g){
function hitArt(g){ function hitArt(g){
const k = openKeyOf(g); if(!k) return; const k = openKeyOf(g); if(!k) return;
try{ try{
const u = '/hit?k=' + encodeURIComponent(k) + '&_=' + Date.now(); const u = 'hit?k=' + encodeURIComponent(k) + '&_=' + Date.now();
if(navigator.sendBeacon) navigator.sendBeacon(u); if(navigator.sendBeacon) navigator.sendBeacon(u);
else fetch(u, {keepalive:true, cache:'no-store'}).catch(()=>{}); else fetch(u, {keepalive:true, cache:'no-store'}).catch(()=>{});
}catch(e){} }catch(e){}