feat(test): add wechat follow-card preview route

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Eric 2026-11-29 21:01:04 +08:00
parent 1058eca8af
commit a7c6c17c9e
3 changed files with 239 additions and 0 deletions

View File

@ -1,5 +1,7 @@
# Nomadro
> **Hub `.com` 已发布**:`20261128T165939Z`(本地 2026-11-29),门户 [nomadro.com/hub](https://nomadro.com/hub) + Hub API + [admin.nomadro.com](https://admin.nomadro.com/) 中文轨。构建 `OfO3HMXd-HIAPfsB7UgKC`;[检查、发布与回滚记录](docs/hub-audit-2026-11-29.md)。未同步 `.cn`、VIP hackrobot 或小程序。
> **管理后台域名铁律(永远禁止混淆)**
>
> | 域名 | 是什么 | 不是什么 |
@ -257,6 +259,11 @@ pnpm typecheck
pnpm clean # 清 .next / dist
```
测试入口(公众号关注卡片 / 非微信浏览器还原):
- 本地:`http://localhost:3000/test/wechat-card`
- 局域网(手机同网访问):`http://<你的局域网IP>:3000/test/wechat-card`
API 首次:
```bash

View File

@ -0,0 +1,71 @@
"use client";
import styles from "./wechat-card.module.css";
const FALLBACK_LINK = "https://mp.weixin.qq.com/";
// 公众号标识(你提供:nomadro)
const WECHAT_OFFICIAL_ACCOUNT_ID = "nomadro";
function openWechatProfile() {
const ua = navigator.userAgent.toLowerCase();
const isWechat = ua.includes("micromessenger");
if (isWechat && WECHAT_OFFICIAL_ACCOUNT_ID) {
// 微信内优先尝试拉起公众号主页;失败再回退 H5 链接
window.location.href = `weixin://profile/${WECHAT_OFFICIAL_ACCOUNT_ID}`;
window.setTimeout(() => {
window.location.href = FALLBACK_LINK;
}, 1200);
return;
}
window.location.href = FALLBACK_LINK;
}
export default function WechatCardTestPage() {
return (
<main className={styles.page}>
<section className={styles.panel}>
<h1 className={styles.title}>微信公众号关注卡片测试</h1>
<p className={styles.subtitle}>
非微信浏览器(如 Chrome)下的视觉还原预览。
</p>
<button
type="button"
className={styles.cardRoot}
onClick={openWechatProfile}
aria-label="异度世界 Official Account"
>
<div className={styles.cardInner}>
<div className={styles.cardBody}>
<div className={styles.profile}>
<div className={styles.avatarWrap}>
<img
src="http://mmbiz.qpic.cn/mmbiz_png/HWjX0DuFz6l48jovmpPQo33wAv66WJicxmendfA1QrZLHyibLIfybclQqA59UhricdqPSOmX1ycV6kkJwdaypcsoQ/300?wx_fmt=png&wxfrom=19"
alt=""
className={styles.avatar}
/>
</div>
<div className={styles.profileBody}>
<div className={styles.nicknameRow}>
<strong className={styles.nickname}>异度世界</strong>
<span className={styles.verify} aria-hidden>
✨
</span>
</div>
<div className={styles.desc}>出海⛵:Tiktok,Youtube,SaaS</div>
<div className={styles.tips}>89篇原创内容</div>
</div>
<span className={styles.arrow} aria-hidden>
›
</span>
</div>
</div>
<div className={styles.cardFooter}>Official Account</div>
</div>
</button>
</section>
</main>
);
}

View File

@ -0,0 +1,161 @@
.page {
min-height: 100vh;
padding: 32px 16px;
background: radial-gradient(circle at 20% 0%, #1b2440 0%, #0c0c0f 45%, #060608 100%);
color: #e5e7eb;
}
.panel {
width: 100%;
max-width: 760px;
margin: 0 auto;
padding: 20px;
border-radius: 18px;
background: rgba(17, 24, 39, 0.75);
border: 1px solid rgba(148, 163, 184, 0.2);
box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
}
.title {
margin: 0;
font-size: 24px;
line-height: 1.25;
}
.subtitle {
margin: 10px 0 22px;
font-size: 14px;
color: #cbd5e1;
}
.cardRoot {
display: block;
width: 100%;
max-width: 420px;
color: inherit;
text-decoration: none;
text-align: left;
background: transparent;
border: 0;
padding: 0;
cursor: pointer;
}
.cardInner {
overflow: hidden;
border-radius: 12px;
background: #f5f6f7;
color: #111827;
border: 1px solid #ebeef2;
transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.cardRoot:hover .cardInner,
.cardRoot:focus-visible .cardInner {
transform: translateY(-1px);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}
.cardBody {
padding: 14px 14px 12px;
}
.profile {
display: flex;
align-items: center;
gap: 10px;
}
.avatarWrap {
width: 48px;
height: 48px;
flex: 0 0 auto;
}
.avatar {
width: 100%;
height: 100%;
border-radius: 999px;
object-fit: cover;
}
.profileBody {
min-width: 0;
flex: 1;
}
.nicknameRow {
display: flex;
align-items: center;
gap: 4px;
}
.nickname {
font-size: 24px;
line-height: 1.1;
font-weight: 700;
letter-spacing: 0.01em;
}
.verify {
color: #f59e0b;
font-size: 14px;
}
.desc {
margin-top: 2px;
font-size: 15px;
line-height: 1.3;
color: #4b5563;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.tips {
margin-top: 2px;
font-size: 15px;
color: #6b7280;
}
.arrow {
color: #9ca3af;
font-size: 24px;
line-height: 1;
margin-left: 4px;
}
.cardFooter {
padding: 10px 14px 12px;
border-top: 1px solid #ebeef2;
color: #9ca3af;
font-size: 12px;
}
@media (max-width: 640px) {
.page {
padding: 18px 12px;
}
.panel {
padding: 14px;
border-radius: 14px;
}
.title {
font-size: 19px;
}
.cardRoot {
max-width: none;
}
.nickname {
font-size: 20px;
}
.desc,
.tips {
font-size: 14px;
}
}