fix(web): 首页只留下载、去登录/在线体验入口; 下载区改二维码; 修复网络版一直提示新版本
- Landing: 移除 header 登录/进入应用按钮、hero 在线体验入口 - 下载区: 复制链接行改为 qrcode.react 二维码 (扫码下载 APK) - 修复 '持续提示新版本可用' bug: vite 构建时把 BUILD_ID 写入 dist/.build-id, manifest-web 返回当前部署 dist 的 build_id, 与浏览器内置值同源比对; 此前返回 OTA 包 build_id (seq-<ts>) 与页面 BUILD_ID 永不一致 → 横幅常驻
This commit is contained in:
+17
-41
@@ -1,6 +1,5 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useNavigate, Link } from "react-router-dom";
|
||||
import { useAppStore } from "../stores/app";
|
||||
import { QRCodeSVG } from "qrcode.react";
|
||||
import { APP_VERSION, BUILD_ID } from "../version";
|
||||
import { checkOtaUpdate, reloadApp } from "../api/ota";
|
||||
|
||||
@@ -23,17 +22,6 @@ const STATS = [
|
||||
];
|
||||
|
||||
function DownloadSection() {
|
||||
const [copied, setCopied] = useState(false);
|
||||
const copy = async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(APK_URL);
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2000);
|
||||
} catch {
|
||||
setCopied(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<section style={styles.section}>
|
||||
<h2 style={styles.sectionTitle}>下载 Android 版</h2>
|
||||
@@ -45,13 +33,10 @@ function DownloadSection() {
|
||||
<p style={{ fontSize: 12, color: "var(--text-tertiary)", marginTop: 10 }}>
|
||||
版本 {APP_VERSION} · Android 8.0+ · 约 30 MB
|
||||
</p>
|
||||
<div style={{ marginTop: 16 }}>
|
||||
<p style={{ fontSize: 12, color: "var(--text-tertiary)", marginBottom: 6 }}>或复制下载链接(发给手机打开):</p>
|
||||
<div style={styles.linkRow}>
|
||||
<code style={styles.linkCode}>{APK_URL}</code>
|
||||
<button className="btn btn-secondary" style={{ padding: "6px 12px", fontSize: 12 }} onClick={copy}>
|
||||
{copied ? "已复制 ✓" : "复制"}
|
||||
</button>
|
||||
<div style={{ marginTop: 20 }}>
|
||||
<p style={{ fontSize: 12, color: "var(--text-tertiary)", marginBottom: 10 }}>手机扫码下载:</p>
|
||||
<div style={styles.qrWrap}>
|
||||
<QRCodeSVG value={APK_URL} size={168} level="M" style={{ display: "block" }} />
|
||||
</div>
|
||||
</div>
|
||||
<p style={{ fontSize: 12, color: "var(--text-tertiary)", marginTop: 16, lineHeight: 1.6 }}>
|
||||
@@ -93,23 +78,13 @@ function WebUpdateBanner() {
|
||||
}
|
||||
|
||||
export default function Landing() {
|
||||
const navigate = useNavigate();
|
||||
const user = useAppStore((s) => s.user);
|
||||
|
||||
return (
|
||||
<div style={{ minHeight: "100vh", background: "var(--bg)", color: "var(--text-primary)", userSelect: "text" }}>
|
||||
<header style={styles.header}>
|
||||
<Link to="/" style={styles.logo}>
|
||||
<div style={styles.logo}>
|
||||
<span style={styles.logoEmoji}>👗</span>
|
||||
<span style={{ fontWeight: 700, fontSize: 18 }}>Wardrobe</span>
|
||||
</Link>
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
style={{ padding: "8px 18px", fontSize: 14 }}
|
||||
onClick={() => (user ? navigate("/home") : navigate("/login"))}
|
||||
>
|
||||
{user ? "进入应用" : "登录"}
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div style={styles.container}>
|
||||
@@ -127,9 +102,6 @@ export default function Landing() {
|
||||
<a className="btn btn-primary" href={APK_URL} download="wardrobe.apk" style={styles.heroBtn}>
|
||||
⬇️ 下载 Android APK
|
||||
</a>
|
||||
<button className="btn btn-secondary" style={styles.heroBtn} onClick={() => navigate("/login")}>
|
||||
在线体验 →
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -182,14 +154,13 @@ export default function Landing() {
|
||||
|
||||
const styles: Record<string, React.CSSProperties> = {
|
||||
header: {
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "space-between",
|
||||
maxWidth: 960,
|
||||
margin: "0 auto",
|
||||
padding: "16px 20px",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
},
|
||||
logo: { display: "flex", alignItems: "center", gap: 8, textDecoration: "none", color: "var(--text-primary)" },
|
||||
logo: { display: "flex", alignItems: "center", gap: 8 },
|
||||
logoEmoji: { fontSize: 24 },
|
||||
container: { maxWidth: 960, margin: "0 auto", padding: "0 20px 60px" },
|
||||
hero: { textAlign: "center", padding: "64px 0 48px" },
|
||||
@@ -211,8 +182,13 @@ const styles: Record<string, React.CSSProperties> = {
|
||||
margin: "0 auto",
|
||||
},
|
||||
downloadBtn: { padding: "14px 32px", fontSize: 16 },
|
||||
linkRow: { display: "flex", alignItems: "center", gap: 8, justifyContent: "center", flexWrap: "wrap" },
|
||||
linkCode: { fontSize: 11, color: "var(--text-secondary)", wordBreak: "break-all" },
|
||||
qrWrap: {
|
||||
display: "inline-flex",
|
||||
padding: 10,
|
||||
background: "#fff",
|
||||
border: "1px solid var(--border)",
|
||||
borderRadius: "var(--radius)",
|
||||
},
|
||||
techRow: { display: "flex", gap: 10, justifyContent: "center", flexWrap: "wrap" },
|
||||
footer: { textAlign: "center", padding: "24px 16px", fontSize: 12, color: "var(--text-tertiary)" },
|
||||
};
|
||||
Reference in New Issue
Block a user