data-page模板补「返回应用」FAB(评审方案按库内实际修正):returnToApp优先级链=APK JS桥(Android.backToApp/webkit handler)→?from=(限站内绝对路径,堵开放重定向)→history.back→根路径——不写死'/chat'(本库主界面是public根,已核实),纯浏览器自然落在回上一页/首页无需环境判断;位置选FAB弃footer(桌面优先方针下footer吃垂直空间,看板列高/长表分页首当其冲);图标用内联SVG(⌂码位WebView字体不保证);SKILL.md成文:每个app/*.html(含index)必带,检查清单同步;线上四页一并补齐
This commit is contained in:
@@ -68,8 +68,17 @@ dialog::backdrop { background: rgba(0,0,0,0.35); }
|
||||
.acts .pri { background: var(--accent); color: #fff; border-color: var(--accent); }
|
||||
.acts .pri:hover { background: var(--accent-h); }
|
||||
@media (max-width: 480px) {
|
||||
body { padding: 8px; } th, td { padding: 8px 12px; font-size: 13px; }
|
||||
body { padding: 8px; padding-bottom: calc(64px + env(safe-area-inset-bottom)); } th, td { padding: 8px 12px; font-size: 13px; }
|
||||
}
|
||||
/* 返回应用 FAB:固定右下、零版面占用(桌面优先方针下 footer 会吃掉长表/看板的垂直空间)。
|
||||
图标用内联 SVG 不用 ⌂ 字符——WebView 字体不保证有该码位,缺字即变豆腐块。 */
|
||||
.fab { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
|
||||
width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: #fff;
|
||||
border: none; box-shadow: 0 4px 12px rgba(0,113,227,0.3); cursor: pointer; z-index: 100;
|
||||
display: flex; align-items: center; justify-content: center; }
|
||||
.fab:hover { filter: brightness(1.08); }
|
||||
.fab:active { transform: scale(0.94); }
|
||||
body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -97,6 +106,10 @@ dialog::backdrop { background: rgba(0,0,0,0.35); }
|
||||
</form>
|
||||
</dialog>
|
||||
|
||||
<button class="fab" aria-label="返回应用" title="返回应用" onclick="returnToApp()">
|
||||
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 10.5 12 3l9 7.5"/><path d="M5 9.5V21h14V9.5"/></svg>
|
||||
</button>
|
||||
|
||||
<script>
|
||||
const CONFIG = {
|
||||
table: 'items', // ← 修改为你的表名
|
||||
@@ -266,6 +279,19 @@ document.getElementById('dlgForm').onsubmit = async e => {
|
||||
} catch (e) { alert('新增失败:' + e.message); }
|
||||
};
|
||||
|
||||
// 返回应用主界面(APK WebView 场景):① APK 注册的 JS 桥(Android.backToApp / iOS handler,有则最干净)
|
||||
// ② ?from=(限站内绝对路径,防开放重定向)③ history.back ④ 根路径(agent 主界面)。
|
||||
// 纯浏览器里 ③④ 恰好落在「回上一页/首页」,无需环境判断也行为合理。
|
||||
function returnToApp() {
|
||||
if (window.Android && typeof window.Android.backToApp === 'function') { window.Android.backToApp(); return; }
|
||||
if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.backToApp) {
|
||||
window.webkit.messageHandlers.backToApp.postMessage({}); return;
|
||||
}
|
||||
const from = new URLSearchParams(location.search).get('from');
|
||||
if (from && /^\/(?!\/)/.test(from)) { location.href = from; return; }
|
||||
if (history.length > 1) history.back(); else location.href = '/';
|
||||
}
|
||||
|
||||
load();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user