Ship unified miniprogram H5/weapp parity and XHS offline portal.
Align Taro pages with Next hub/nav/book/community/VIP, pack the single-index Xiaohongshu portal with host-chrome safe areas, and refresh shared book content plus portal README constraints. Co-authored-by: Cursor <cursoragent@cursor.com>
@ -2,13 +2,16 @@ import "@vip/app/globals.css";
|
||||
import { ThemeProvider } from "@vip/app/providers/ThemeProvider";
|
||||
import { httpsUpgradeScript } from "@vip/app/https-upgrade";
|
||||
import { themeInitScript } from "@vip/app/theme-init";
|
||||
import { ModuleBoundary } from "~/components/module-boundary";
|
||||
|
||||
export default function VipLayout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<div className="vip-root min-h-screen bg-[var(--background)] text-[var(--foreground)]">
|
||||
<script dangerouslySetInnerHTML={{ __html: httpsUpgradeScript }} />
|
||||
<script dangerouslySetInnerHTML={{ __html: themeInitScript }} />
|
||||
<ThemeProvider>{children}</ThemeProvider>
|
||||
</div>
|
||||
<ModuleBoundary moduleKey="vip">
|
||||
<div className="vip-root min-h-screen bg-[var(--background)] text-[var(--foreground)]">
|
||||
<script dangerouslySetInnerHTML={{ __html: httpsUpgradeScript }} />
|
||||
<script dangerouslySetInnerHTML={{ __html: themeInitScript }} />
|
||||
<ThemeProvider>{children}</ThemeProvider>
|
||||
</div>
|
||||
</ModuleBoundary>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,14 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { ModuleGate } from "~/components/module-gate";
|
||||
import { HomeClientLoader } from "./HomeClientLoader";
|
||||
|
||||
export default function VipPage() {
|
||||
return (
|
||||
<ModuleGate moduleKey="vip">
|
||||
<div className="min-h-screen bg-[var(--background)]">
|
||||
<HomeClientLoader />
|
||||
</div>
|
||||
</ModuleGate>
|
||||
<div className="min-h-screen bg-[var(--background)]">
|
||||
<HomeClientLoader />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# 游牧代码 · 电子书多端
|
||||
# 数字游民 · 电子书多端
|
||||
|
||||
本仓库包含 **网页电子书** 与 **微信 / 抖音 / 小红书** 三端小程序(或小工具)子项目,共用「Markdown 电子书 → 阅读体验 → 变现」主线。
|
||||
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
{
|
||||
"title": "游牧代码",
|
||||
"subtitle": "数字游民与 Homelab 生存指南",
|
||||
"title": "数字游民",
|
||||
"subtitle": "远程生活 · 自由工作入门",
|
||||
"author": "林远",
|
||||
"description": "一个程序员离开工位、带上电脑环游世界,同时把「家」装进机柜的故事。",
|
||||
"description": "离开工位、带着电脑去看世界——一边工作,一边把日子过成自己想要的样子。",
|
||||
"tagline": "在任意城市,过你想要的生活。",
|
||||
"coverGradient": "from-violet-950 via-fuchsia-900 to-orange-900",
|
||||
"readingMinutes": 45,
|
||||
"viralTags": ["数字游民", "Homelab", "远程办公", "Tailscale", "自由职业"],
|
||||
"viralTags": ["数字游民", "远程办公", "旅居生活", "自由职业", "边走边工作"],
|
||||
"stats": [
|
||||
{ "emoji": "🌍", "value": "7", "label": "章精华" },
|
||||
{ "emoji": "⏱️", "value": "45", "label": "分钟读完" },
|
||||
@ -14,15 +14,15 @@
|
||||
{ "emoji": "🔥", "value": "12", "label": "书摘片段" }
|
||||
],
|
||||
"hooks": [
|
||||
{ "emoji": "💻", "text": "远程办公的第一周,效率奇高。第二周,你开始分不清「工作结束」和「生活开始」。" },
|
||||
{ "emoji": "🌴", "text": "清迈的周二早晨:flat white + VS Code,旁边有人在写旅行博客。" },
|
||||
{ "emoji": "🗄️", "text": "Homelab 给你的锚,不是地理上的,是数字上的——文件在,服务在,随时等你回来。" },
|
||||
{ "emoji": "🔑", "text": "Tailscale:无论 IP 怎么变,你的设备永远在「同一个局域网」。" }
|
||||
{ "emoji": "☀️", "text": "远程办公的第一周,效率奇高。第二周,你开始分不清「工作结束」和「生活开始」。" },
|
||||
{ "emoji": "🌴", "text": "清迈的周二早晨:一杯咖啡、一台电脑,旁边有人在写旅行笔记。" },
|
||||
{ "emoji": "🏡", "text": "真正的安全感,是无论走到哪里,熟悉的文件与习惯都还在。" },
|
||||
{ "emoji": "🌏", "text": "城市可以换,节奏可以自己定——这才是边走边工作的味道。" }
|
||||
],
|
||||
"chapters": [
|
||||
{
|
||||
"slug": "00-preface",
|
||||
"title": "序:我为什么开始游牧",
|
||||
"title": "序:我想换一种活法",
|
||||
"emoji": "✈️",
|
||||
"hook": "我想要的不是更好的工位,而是可以选择坐在哪里。",
|
||||
"shareQuote": "数字游民是一种工作方式:产出不绑定在某个地理坐标上。"
|
||||
@ -31,36 +31,36 @@
|
||||
"slug": "01-first-remote",
|
||||
"title": "第一次远程办公的那个周五",
|
||||
"emoji": "🏠",
|
||||
"hook": "穿着睡衣开 Zoom,可能是当代最魔幻的上班方式。",
|
||||
"hook": "穿着睡衣开视频会,可能是当代最魔幻的上班方式。",
|
||||
"shareQuote": "异步沟通:不是「随时在线」,而是「明确预期」。"
|
||||
},
|
||||
{
|
||||
"slug": "02-chiangmai",
|
||||
"title": "清迈的周二早晨",
|
||||
"emoji": "☕",
|
||||
"hook": "游牧不是一个人流浪,是在流动中找到同类。",
|
||||
"hook": "旅居不是一个人流浪,是在流动中找到同类。",
|
||||
"shareQuote": "在这里,旅游和工作本来就不矛盾。"
|
||||
},
|
||||
{
|
||||
"slug": "03-gear",
|
||||
"title": "行囊里真正重要的东西",
|
||||
"emoji": "🎒",
|
||||
"hook": "带多了是负担,带少了会后悔——这是游牧者的永恒命题。",
|
||||
"hook": "带多了是负担,带少了会后悔——这是旅居者的永恒命题。",
|
||||
"shareQuote": "网络,比护照更重要。"
|
||||
},
|
||||
{
|
||||
"slug": "04-homelab",
|
||||
"title": "Homelab:把家装进一个机柜",
|
||||
"emoji": "🖥️",
|
||||
"hook": "几百块的旧电脑,可以成为整个数字生活的中枢。",
|
||||
"title": "把熟悉的数字生活带在身边",
|
||||
"emoji": "🗂️",
|
||||
"hook": "一张旧电脑、一套自己的空间,也能成为随时回去的「数字家」。",
|
||||
"shareQuote": "完美是优秀的敌人。先跑起来,再迭代。"
|
||||
},
|
||||
{
|
||||
"slug": "05-network",
|
||||
"title": "无论在哪,都能连回家",
|
||||
"emoji": "🔗",
|
||||
"hook": "人在巴厘岛,手在家里。",
|
||||
"shareQuote": "Homelab 服务默认不暴露公网——这是安全感的前提。"
|
||||
"hook": "人在巴厘岛,重要的东西仍在熟悉的地方。",
|
||||
"shareQuote": "安全访问,是远程生活的底气。"
|
||||
},
|
||||
{
|
||||
"slug": "06-epilogue",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# 序:我为什么开始游牧
|
||||
# 序:我想换一种活法
|
||||
|
||||
二〇二三年秋天,我在公司工位上坐满了三年。
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Homelab:把家装进一个机柜
|
||||
# 把熟悉的数字生活带在身边
|
||||
|
||||
二〇二二年,我还住在租来的单间里,床底下藏着一台 Dell OptiPlex 小主机。
|
||||
|
||||
|
||||
@ -14,12 +14,12 @@
|
||||
|
||||
---
|
||||
|
||||
## Homelab 与游牧的共生
|
||||
## 流动的生活,与随身的「数字家」
|
||||
|
||||
这两件事看起来方向相反:
|
||||
|
||||
- 游牧是**流动**
|
||||
- Homelab 是**固定**
|
||||
- 旅居是**流动**
|
||||
- 数字家是**固定**
|
||||
|
||||
但组合在一起,逻辑就通了:你在物理世界移动,数字世界的「家」保持不动。像蜗牛的壳,不是负担,是随身携带的秩序。
|
||||
|
||||
@ -31,8 +31,8 @@
|
||||
|
||||
你可以:
|
||||
|
||||
1. 先和团队谈一次 remote 的可能性
|
||||
2. 用一台旧电脑搭一个最小 Homelab
|
||||
1. 先和团队谈一次远程办公的可能性
|
||||
2. 整理一套自己常用的文件与备份习惯
|
||||
3. 选一个周末,带着电脑去邻城住两晚,测试「在别处工作」的感觉
|
||||
|
||||
**小步验证,比宏大计划更可靠。**
|
||||
@ -41,7 +41,7 @@
|
||||
|
||||
## 最后
|
||||
|
||||
游牧代码,写的不是「如何逃离」,而是「如何建造」——建造一种你真正想要的生活,并用技术和纪律去支撑它。
|
||||
《数字游民》写的不是「如何逃离」,而是「如何建造」——建造一种你真正想要的生活,并用节奏和纪律去支撑它。
|
||||
|
||||
书到这里结束。你的下一章,在自己手里。
|
||||
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
{
|
||||
"title": "Nomad Code",
|
||||
"subtitle": "A Digital Nomad & Homelab Survival Guide",
|
||||
"title": "Digital Nomad",
|
||||
"subtitle": "Remote Living · Work Freely",
|
||||
"author": "Lin Yuan",
|
||||
"description": "A programmer leaves the office, travels with a laptop, and packs \"home\" into a rack.",
|
||||
"description": "Leave the office desk, take your laptop to the world — work while living the life you actually want.",
|
||||
"tagline": "Live the life you want — from any city.",
|
||||
"coverGradient": "from-violet-950 via-fuchsia-900 to-orange-900",
|
||||
"readingMinutes": 45,
|
||||
"viralTags": ["DigitalNomad", "Homelab", "RemoteWork", "Tailscale", "Freelance"],
|
||||
"viralTags": ["DigitalNomad", "RemoteWork", "SlowTravel", "Freelance", "WorkFromAnywhere"],
|
||||
"stats": [
|
||||
{ "emoji": "🌍", "value": "7", "label": "Chapters" },
|
||||
{ "emoji": "⏱️", "value": "45", "label": "Min read" },
|
||||
@ -14,15 +14,15 @@
|
||||
{ "emoji": "🔥", "value": "12", "label": "Quotes" }
|
||||
],
|
||||
"hooks": [
|
||||
{ "emoji": "💻", "text": "Week one of remote work: productivity soars. Week two: you can't tell when work ends and life begins." },
|
||||
{ "emoji": "🌴", "text": "Tuesday morning in Chiang Mai: flat white + VS Code, someone writing a travel blog nearby." },
|
||||
{ "emoji": "🗄️", "text": "Homelab is your anchor — not geographic, but digital. Files stay, services stay, waiting for you." },
|
||||
{ "emoji": "🔑", "text": "Tailscale: no matter how IPs change, your devices stay on the same LAN." }
|
||||
{ "emoji": "☀️", "text": "Week one of remote work: productivity soars. Week two: you can't tell when work ends and life begins." },
|
||||
{ "emoji": "🌴", "text": "Tuesday morning in Chiang Mai: a coffee, a laptop, someone nearby writing travel notes." },
|
||||
{ "emoji": "🏡", "text": "Real security is knowing your familiar files and habits travel with you." },
|
||||
{ "emoji": "🌏", "text": "Cities can change; the pace is yours — that's the feel of working while moving." }
|
||||
],
|
||||
"chapters": [
|
||||
{
|
||||
"slug": "00-preface",
|
||||
"title": "Preface: Why I Started Nomading",
|
||||
"title": "Preface: I Wanted a Different Way to Live",
|
||||
"emoji": "✈️",
|
||||
"hook": "I didn't want a better desk — I wanted to choose where I sit.",
|
||||
"shareQuote": "Digital nomadism is a way of working: output isn't tied to a place."
|
||||
@ -31,14 +31,14 @@
|
||||
"slug": "01-first-remote",
|
||||
"title": "That First Remote Friday",
|
||||
"emoji": "🏠",
|
||||
"hook": "Zoom in pajamas might be the most surreal way to work today.",
|
||||
"hook": "Video calls in pajamas might be the most surreal way to work today.",
|
||||
"shareQuote": "Async communication: not \"always online\", but \"clear expectations\"."
|
||||
},
|
||||
{
|
||||
"slug": "02-chiangmai",
|
||||
"title": "Tuesday Morning in Chiang Mai",
|
||||
"emoji": "☕",
|
||||
"hook": "Nomading isn't wandering alone — it's finding your people on the move.",
|
||||
"hook": "Living on the move isn't wandering alone — it's finding your people.",
|
||||
"shareQuote": "Here, travel and work were never at odds."
|
||||
},
|
||||
{
|
||||
@ -50,17 +50,17 @@
|
||||
},
|
||||
{
|
||||
"slug": "04-homelab",
|
||||
"title": "Homelab: Home in a Rack",
|
||||
"emoji": "🖥️",
|
||||
"hook": "An old PC can become the hub of your digital life.",
|
||||
"title": "Bring Your Digital Home With You",
|
||||
"emoji": "🗂️",
|
||||
"hook": "An old computer and a space of your own can become a digital home you can return to anytime.",
|
||||
"shareQuote": "Perfect is the enemy of good. Ship first, iterate later."
|
||||
},
|
||||
{
|
||||
"slug": "05-network",
|
||||
"title": "Connect Home from Anywhere",
|
||||
"emoji": "🔗",
|
||||
"hook": "Body in Bali, hands at home.",
|
||||
"shareQuote": "Homelab services shouldn't face the public internet — that's the baseline for safety."
|
||||
"hook": "Body in Bali, the important things still waiting in a familiar place.",
|
||||
"shareQuote": "Safe access is the foundation of remote living."
|
||||
},
|
||||
{
|
||||
"slug": "06-epilogue",
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
"share": {
|
||||
"enabled": true,
|
||||
"campaign": "nomad-code",
|
||||
"defaultHashtags": ["数字游民", "Homelab", "远程办公"],
|
||||
"defaultHashtags": ["数字游民", "远程办公", "旅居生活"],
|
||||
"viralPrompt": {
|
||||
"enabled": true,
|
||||
"triggerPercent": 42
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"$comment": "品牌身份信息 — 模块开关和配置见 features.json",
|
||||
"brand": {
|
||||
"name": "游牧代码",
|
||||
"name": "数字游民",
|
||||
"xHandle": "@linyuan",
|
||||
"contactEmail": "hello@example.com"
|
||||
}
|
||||
|
||||
@ -92,7 +92,6 @@ export function CoverPage({
|
||||
<div className="relative mx-auto w-full max-w-6xl px-4 py-10 sm:px-6 sm:py-14 lg:py-16">
|
||||
<ScrollReveal>
|
||||
<div className="flex flex-wrap items-center justify-center gap-2 lg:justify-start">
|
||||
<span className="viral-free-badge">{t('cover.freeBadge')}</span>
|
||||
{book.viralTags.map((tag) => (
|
||||
<span key={tag} className="viral-tag">
|
||||
#{tag}
|
||||
|
||||
@ -31,7 +31,7 @@ export const messages = {
|
||||
moreChapters: '+ {n} 章…',
|
||||
startRead: '开始阅读',
|
||||
chaptersPreview: '章节预览',
|
||||
skillRadar: '游牧技能雷达',
|
||||
skillRadar: '旅居技能雷达',
|
||||
skillRemote: '远程协作',
|
||||
skillNetwork: '网络穿透',
|
||||
skillAsync: '异步沟通',
|
||||
|
||||
@ -39,7 +39,7 @@ export async function createSupportInvoice(amountUsd: number) {
|
||||
price_amount: amountUsd === 5 ? 5.5 : amountUsd,
|
||||
price_currency: 'usd',
|
||||
order_id: `support-${amountUsd}-${Date.now()}`,
|
||||
order_description: `Support Nomad Code — $${amountUsd}`,
|
||||
order_description: `Support Digital Nomad — $${amountUsd}`,
|
||||
ipn_callback_url: `${site}/api/pay/ipn`,
|
||||
success_url: `${site}/support/thanks`,
|
||||
cancel_url: site,
|
||||
|
||||
@ -113,10 +113,28 @@ npm run dev:weapp
|
||||
|
||||
## 虚拟支付
|
||||
|
||||
- 消息推送 URL:`https://api.nomadro.cn/api/pay/notify`
|
||||
- 消息推送 URL:`https://api.nomadro.cn/api/pay/notify`(**勿改**;微信后台仍指向此旧路径)
|
||||
- Token / EncodingAESKey:见 `backend/.env` 与微信公众平台配置(勿把生产密钥贴到公开文档副本)
|
||||
- 道具发布后约 10 分钟生效;查单兜底见 `app/jobs/reconcile.py`
|
||||
|
||||
### API 前缀对照
|
||||
|
||||
同一 SQLite(`nomadmini.db`)上挂两套等价路由;handlers / store 共享。
|
||||
|
||||
| 能力 | 老小程序(冻结) | 门户 `apps/miniprogram` |
|
||||
|------|------------------|-------------------------|
|
||||
| 登录 | `POST /api/auth/login` | `POST /api/ebook/auth/login` |
|
||||
| 书籍 meta | `GET /api/books/{id}` | `GET /api/ebook/books/{id}` |
|
||||
| 阅读 | `GET /api/books/{id}/read` | `GET /api/ebook/books/{id}/read` |
|
||||
| 解锁态 | `GET /api/books/{id}/access` | `GET /api/ebook/books/{id}/access` |
|
||||
| 下单 | `POST /api/pay/order` | `POST /api/ebook/pay/order` |
|
||||
| 轮询 | `POST /api/pay/status` | `POST /api/ebook/pay/status` |
|
||||
| 查单 | `POST /api/pay/query` | `POST /api/ebook/pay/query` |
|
||||
| 埋点 | `POST /api/track` | `POST /api/ebook/track` |
|
||||
| 健康 | `GET /health` | `GET /api/ebook/health` |
|
||||
| 支付回调 | `POST /api/pay/notify` | 同左(微信只配旧 URL;`/api/ebook/pay/notify` 可兼容但非主回调) |
|
||||
| 管理后台 | ` /api/admin/*` | 同左(不挂 `/api/ebook/admin`) |
|
||||
|
||||
---
|
||||
|
||||
## 运营通知(ntfy)
|
||||
|
||||
@ -35,14 +35,20 @@ app.add_middleware(
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
app.include_router(auth.router)
|
||||
app.include_router(books.router)
|
||||
app.include_router(pay.router)
|
||||
app.include_router(track.router)
|
||||
# 老小程序 / 微信回调:/api/*
|
||||
# 门户 miniprogram:/api/ebook/*(同进程别名,共享 store)
|
||||
for _api_prefix in ("/api", "/api/ebook"):
|
||||
app.include_router(auth.router, prefix=_api_prefix)
|
||||
app.include_router(books.router, prefix=_api_prefix)
|
||||
app.include_router(pay.router, prefix=_api_prefix)
|
||||
app.include_router(track.router, prefix=_api_prefix)
|
||||
|
||||
# Admin 仅挂 /api/admin(admin.nomadro.cn),避免双后台路径
|
||||
app.include_router(admin.router)
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
@app.get("/api/ebook/health")
|
||||
async def health():
|
||||
return {"ok": True, "service": "nomadmini-api"}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ from app.services.pocketbase import pb
|
||||
from app.services.store import store
|
||||
from app.services.wxpay import code2session
|
||||
|
||||
router = APIRouter(prefix="/api/auth", tags=["auth"])
|
||||
router = APIRouter(prefix="/auth", tags=["auth"])
|
||||
|
||||
# 兼容旧 import 路径
|
||||
__all__ = ["router", "get_current_openid", "LoginBody"]
|
||||
|
||||
@ -6,7 +6,7 @@ from app.core.deps import get_current_openid
|
||||
from app.domains.books import access_snapshot, is_free_unlock, public_book, truncate_by_percent
|
||||
from app.services.store import store
|
||||
|
||||
router = APIRouter(prefix="/api/books", tags=["books"])
|
||||
router = APIRouter(prefix="/books", tags=["books"])
|
||||
|
||||
|
||||
def _no_store(resp: Response) -> None:
|
||||
|
||||
@ -13,7 +13,7 @@ from app.schemas.pay import DevConfirmBody, OrderBody, StatusBody
|
||||
from app.services.store import store
|
||||
from app.services.wxpay import build_sign_data, calc_pay_sig, calc_signature, query_order
|
||||
|
||||
router = APIRouter(prefix="/api/pay", tags=["pay"])
|
||||
router = APIRouter(prefix="/pay", tags=["pay"])
|
||||
|
||||
|
||||
@router.post("/order")
|
||||
|
||||
@ -7,7 +7,7 @@ from app.schemas.track import TrackBatchBody
|
||||
from app.services.store import store
|
||||
from app.services.track import ingest_events
|
||||
|
||||
router = APIRouter(prefix="/api/track", tags=["track"])
|
||||
router = APIRouter(prefix="/track", tags=["track"])
|
||||
|
||||
|
||||
@router.post("")
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
| 旅居社群 | `apps/nomadweb/wemini` | `pages/community` `destinations` `destination` `meetups` `mine` |
|
||||
| VIP | nomadvip 商品 + 虚拟支付 | `pages/vip` |
|
||||
| 抖音 | `ebook/dymini` AppID / Taro tt | `pnpm build:tt` |
|
||||
| 小红书 | `navmini/xhs` + `ebook/redmini` | `xhs/`(导航 ZIP + book 资源) |
|
||||
| 小红书 | 统一门户离线 SPA | `xhs/` → `xhs/dist/nomadro-xhs-portal.zip` |
|
||||
|
||||
## 目标(全端)
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
| **Taro H5 / PC**(先验) | `pnpm dev:h5` → `:10086` | 视觉与路由对齐门户 Next(`/` `/nav` `/book` `/community` `/vip`) |
|
||||
| 微信小程序 | `pnpm dev:weapp` | 同套页面 + TabBar + 虚拟支付 |
|
||||
| 抖音小程序 | `pnpm dev:tt` | 同套页面 |
|
||||
| 小红书小工具 | `pnpm build:xhs` / `build:xhs-book` | 离线 ZIP(无 Taro 运行时) |
|
||||
| 小红书小工具 | `pnpm build:xhs` | **统一门户**离线 ZIP(首页+导航+小册+社群+VIP,无 Taro 运行时) |
|
||||
|
||||
**验收顺序**:Taro H5 → 微信 → 抖音 → 小红书。H5 过了再编三端。
|
||||
|
||||
@ -64,7 +64,17 @@ WX_LIVE_APPKEY=CBi5tdkkSWuvkDvWJNnSjrGmeYE3xlsg
|
||||
WX_PAY_ENV=1
|
||||
```
|
||||
|
||||
电子书后端仍用 `https://api.nomadro.cn`(与 `ebook/wemini` 相同 `/api/auth` `/api/pay` `/api/books`)。
|
||||
电子书后端仍用 `https://api.nomadro.cn`(`ebook/wemini` FastAPI)。
|
||||
门户小程序走新前缀 **`/api/ebook/*`**;已上线老微信小程序继续 **`/api/*`**;微信虚拟支付回调仍为 **`/api/pay/notify`**。两套路径共享同一 SQLite。
|
||||
|
||||
| 能力 | 门户 miniprogram |
|
||||
|------|------------------|
|
||||
| 登录 | `POST /api/ebook/auth/login` |
|
||||
| 书籍 / 阅读 / 解锁 | `GET /api/ebook/books/{id}` · `/read` · `/access` |
|
||||
| 下单 / 轮询 | `POST /api/ebook/pay/order` · `/status` |
|
||||
| 埋点 | `POST /api/ebook/track` |
|
||||
|
||||
H5 代理 `/ebook-api` 不变(反代到 `api.nomadro.cn`,path 带 `ebook`)。
|
||||
|
||||
## 开发
|
||||
|
||||
@ -84,9 +94,8 @@ pnpm dev:h5 # → http://localhost:10086/ (compiler: vite,远快于 we
|
||||
# ② H5 过了再编三端
|
||||
pnpm dev:weapp # → dist/weapp ,微信工具打开,AppID 见上
|
||||
pnpm dev:tt # → dist/tt ,抖音工具,AppID tt995defe007255b2701
|
||||
pnpm build:xhs # → xhs/dist/youmin-nav-xhs-tool.zip(离线纯前端包)
|
||||
pnpm build:xhs-book # → xhs/dist/yidu-xingqiu-xhs-tool.zip(电子书独立包)
|
||||
# 勿把 book/ 嵌进导航 zip:子目录 index.html 会被小红书当成入口报错
|
||||
pnpm build:xhs # → xhs/dist/nomadro-xhs-portal.zip(统一门户离线包)
|
||||
# build:xhs-book 已废弃:小册已并入门户包,勿再打独立 book zip
|
||||
```
|
||||
|
||||
**验收顺序**:Taro H5 → 微信 → 抖音 → 小红书(小红书无 Taro 运行时,用离线 zip)。
|
||||
@ -114,11 +123,40 @@ H5 首页视觉对齐门户 `app/hub.css`(`src/styles/hub.scss`);Tab:首
|
||||
2. [ ] 首页与 Tab 可开;导航 / 小册 / 社群不白屏
|
||||
3. [ ] 远程配置/离线兜底行为与微信一致(支付能力按抖音侧实际能力勾选)
|
||||
|
||||
### 小红书开发者工具(离线优先)
|
||||
### 小红书小工具(离线优先 · 统一门户)
|
||||
|
||||
1. `pnpm build:xhs`,导入 `xhs/release`(或按小红书工具要求的目录)
|
||||
2. [ ] **不依赖业务 API 也能打开**导航/小册资源
|
||||
3. [ ] 有网时尝试刷新配置;失败仍可用包内数据
|
||||
官方能力清单:https://miniapp-sandbox.xiaohongshu.com/minitool/doc
|
||||
|
||||
```bash
|
||||
cd apps/miniprogram
|
||||
pnpm build:xhs
|
||||
# 上传:xhs/dist/nomadro-xhs-portal.zip
|
||||
# 本地预览目录:xhs/release/(仅 index.html + app.js + styles.css + icons/)
|
||||
```
|
||||
|
||||
| 项 | 约定 |
|
||||
|---|---|
|
||||
| 产物 | **仅一个**根目录 `index.html`(另含 `app.js` / `styles.css` / `icons/`) |
|
||||
| 入口内容 | 首页 hub + 出海导航 + 数字游民小册 + 旅居社群 + VIP(SPA 切页) |
|
||||
| 源码 | `xhs/tool/` → `assemble.py` 合并 CSS/JS → `xhs/release/` → `pack.py` 打 zip |
|
||||
| 联网 | **禁止**;配置与文案走包内 `portal-data.js`,有网也不依赖业务 API |
|
||||
| 脚本 | **禁止**内联 `onclick` / 内联 `<script>`;事件一律 `addEventListener` |
|
||||
|
||||
#### 平台硬限制(上传 / 真机)
|
||||
|
||||
1. **禁止多个 HTML**:zip 内若出现 `nav.html` / `book.html` 等会部署失败——报错「仅允许保留一个入口文件 index.html」。
|
||||
2. **宿主返回键不可隐藏、不可自定义**:左上角 `<` 为容器原生控件,无微信式 `navigationStyle: custom`,页面 CSS/JS 无法盖住或改写。
|
||||
3. **宿主返回常直接退出小工具**:容器未把返回交给 WebView `popstate` 时,页面内 `history.pushState` 拦截无效。应用内回首页请用顶栏品牌旁 **「首页」**(或点 logo)。
|
||||
4. **勿再画第二颗 ←** 叠在宿主返回下(丑且易误触);顶栏与首页一致用透明底透出 mesh 色调。
|
||||
5. 导航分类抽屉从**左侧**滑出,汉堡按钮在顶栏**左侧**。
|
||||
|
||||
#### 验收清单
|
||||
|
||||
1. [ ] 上传 `nomadro-xhs-portal.zip` 成功(根目录仅一个 `index.html`)
|
||||
2. [ ] 断网可开:首页 / 导航 / 小册 / 社群 / VIP
|
||||
3. [ ] 子页点「首页」回到门户首页
|
||||
4. [ ] 导航:左侧菜单打开分类;上滑时顶栏不漏内容
|
||||
5. [ ] 小册 / 社群顶栏透明,顶部有与首页类似的光晕色调
|
||||
|
||||
## 部署前检查清单
|
||||
|
||||
@ -127,7 +165,7 @@ H5 首页视觉对齐门户 `app/hub.css`(`src/styles/hub.scss`);Tab:首
|
||||
3. [ ] iOS 微信 ≥ 8.0.68
|
||||
4. [ ] 现网 AppKey + `WX_PAY_ENV=0`
|
||||
5. [ ] 发货回调(ebook/wemini backend xpay notify)
|
||||
6. [ ] 抖音 / 小红书各自上传
|
||||
6. [ ] 抖音上传;小红书上传 **`xhs/dist/nomadro-xhs-portal.zip`**
|
||||
|
||||
## 目录
|
||||
|
||||
@ -141,5 +179,10 @@ src/utils/virtualPay.ts ← VIP 支付
|
||||
src/services/ebookApi.ts ← 电子书 API
|
||||
src/services/api.ts ← 社群 API + localCatalog
|
||||
src/services/remoteConfig.ts ← 冷启动预拉 + 离线兜底
|
||||
xhs/ ← 小红书离线包(导航+电子书资源)
|
||||
xhs/
|
||||
tool/ ← 离线 SPA 源(index.html / app.js / *.css)
|
||||
scripts/assemble.py ← 打 release
|
||||
scripts/pack.py ← 打 zip(强制仅一个根 index.html)
|
||||
release/ ← 组装产物(预览用)
|
||||
dist/nomadro-xhs-portal.zip ← 上传创作服务平台
|
||||
```
|
||||
|
||||
BIN
apps/miniprogram/assets/icons/_brand.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
apps/miniprogram/assets/icons/rpi.webp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
apps/miniprogram/assets/icons/safepal.webp
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
apps/miniprogram/assets/icons/smartproxy.webp
Normal file
|
After Width: | Height: | Size: 396 B |
BIN
apps/miniprogram/assets/icons/smmfollows.webp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
apps/miniprogram/assets/icons/srs.webp
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
apps/miniprogram/assets/icons/stripe.webp
Normal file
|
After Width: | Height: | Size: 750 B |
BIN
apps/miniprogram/assets/icons/tello.webp
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
apps/miniprogram/assets/icons/tiktok.webp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
apps/miniprogram/assets/icons/vcam.webp
Normal file
|
After Width: | Height: | Size: 928 B |
BIN
apps/miniprogram/assets/icons/voyracloud.webp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
apps/miniprogram/assets/icons/vultr.webp
Normal file
|
After Width: | Height: | Size: 944 B |
BIN
apps/miniprogram/assets/icons/wireguard.webp
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
apps/miniprogram/assets/icons/wise.webp
Normal file
|
After Width: | Height: | Size: 726 B |
BIN
apps/miniprogram/assets/icons/xorpay.webp
Normal file
|
After Width: | Height: | Size: 546 B |
BIN
apps/miniprogram/assets/icons/yesim.webp
Normal file
|
After Width: | Height: | Size: 968 B |
BIN
apps/miniprogram/assets/icons/yidu.webp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
apps/miniprogram/assets/icons/ykk.webp
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
apps/miniprogram/assets/icons/youtube.webp
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
apps/miniprogram/assets/icons/yt-auto-dismiss.webp
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
apps/miniprogram/assets/icons/zpay.webp
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
apps/miniprogram/assets/tab/book-active.png
Normal file
|
After Width: | Height: | Size: 251 B |
BIN
apps/miniprogram/assets/tab/book.png
Normal file
|
After Width: | Height: | Size: 251 B |
BIN
apps/miniprogram/assets/tab/community-active.png
Normal file
|
After Width: | Height: | Size: 420 B |
BIN
apps/miniprogram/assets/tab/community.png
Normal file
|
After Width: | Height: | Size: 420 B |
BIN
apps/miniprogram/assets/tab/home-active.png
Normal file
|
After Width: | Height: | Size: 379 B |
BIN
apps/miniprogram/assets/tab/home.png
Normal file
|
After Width: | Height: | Size: 379 B |
BIN
apps/miniprogram/assets/tab/mine-active.png
Normal file
|
After Width: | Height: | Size: 375 B |
BIN
apps/miniprogram/assets/tab/mine.png
Normal file
|
After Width: | Height: | Size: 375 B |
BIN
apps/miniprogram/assets/tab/nav-active.png
Normal file
|
After Width: | Height: | Size: 513 B |
BIN
apps/miniprogram/assets/tab/nav.png
Normal file
|
After Width: | Height: | Size: 513 B |
BIN
apps/miniprogram/assets/wechat-oa-qr.png
Normal file
|
After Width: | Height: | Size: 775 B |
@ -1,3 +1,16 @@
|
||||
const isH5 =
|
||||
process.env.TARO_APP_TARGET === 'h5' || process.env.TARO_ENV === 'h5'
|
||||
|
||||
module.exports = {
|
||||
presets: [['taro', { framework: 'react', ts: true, compiler: 'webpack5' }]],
|
||||
presets: [
|
||||
[
|
||||
'taro',
|
||||
{
|
||||
framework: 'react',
|
||||
ts: true,
|
||||
// H5 用 Vite;微信/抖音用 webpack5 —— 勿写死 vite,否则 weapp 解析 TS 会挂
|
||||
...(isH5 ? { compiler: 'vite' } : {}),
|
||||
},
|
||||
],
|
||||
],
|
||||
}
|
||||
|
||||
@ -40,13 +40,23 @@ const h5ViteProxy = {
|
||||
},
|
||||
}
|
||||
|
||||
/** H5 视觉 SoT:这些表用真实 px/rem,小程序端禁止 750→rpx(否则布局塌成蚂蚁字) */
|
||||
const pxExclude = (file: string) =>
|
||||
/[\\/]styles[\\/]hub\.scss/.test(file) ||
|
||||
/[\\/]styles[\\/]navmini\.scss/.test(file) ||
|
||||
/[\\/]styles[\\/]ebook-cover\.scss/.test(file) ||
|
||||
/[\\/]styles[\\/]community\.scss/.test(file) ||
|
||||
/[\\/]styles[\\/]community-navbar\.scss/.test(file) ||
|
||||
/[\\/]styles[\\/]portal-nav-h5\.scss/.test(file) ||
|
||||
/[\\/]styles[\\/]vip-landing\.scss/.test(file) ||
|
||||
/[\\/]styles[\\/]h5-theme\.scss/.test(file) ||
|
||||
/[\\/]styles[\\/]weapp-parity\.scss/.test(file) ||
|
||||
/[\\/]styles[\\/]page-rem\.scss/.test(file) ||
|
||||
/[\\/]pages[\\/]index[\\/]index\.scss/.test(file) ||
|
||||
/[\\/]pages[\\/]nav[\\/]index\.scss/.test(file) ||
|
||||
/[\\/]pages[\\/]book[\\/]index\.scss/.test(file)
|
||||
/[\\/]pages[\\/]book[\\/]index\.scss/.test(file) ||
|
||||
/[\\/]pages[\\/]community[\\/]index\.scss/.test(file) ||
|
||||
/[\\/]pages[\\/]vip[\\/]index\.scss/.test(file)
|
||||
|
||||
export default defineConfig(async (merge) => {
|
||||
const baseConfig: UserConfigExport = {
|
||||
@ -75,7 +85,8 @@ export default defineConfig(async (merge) => {
|
||||
copy: {
|
||||
patterns: [
|
||||
{ from: 'src/assets/', to: 'assets/' },
|
||||
{ from: 'src/public/icons/', to: 'icons/' },
|
||||
// 导航图标:内置 webp → 小程序包根 /icons/*
|
||||
{ from: path.resolve(__dirname, '..', 'src', 'public', 'icons'), to: 'icons' },
|
||||
],
|
||||
options: {},
|
||||
},
|
||||
@ -108,6 +119,23 @@ export default defineConfig(async (merge) => {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, '..', 'src'),
|
||||
},
|
||||
// 微信构建强制把 icons 拷进输出根(双保险,配合 postbuild 脚本)
|
||||
modifyWebpackChain(chain) {
|
||||
if (isH5) return
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
chain.plugin('nomadro-copy-icons').use(CopyWebpackPlugin, [
|
||||
{
|
||||
patterns: [
|
||||
{
|
||||
from: path.resolve(__dirname, '..', 'src', 'public', 'icons'),
|
||||
to: 'icons',
|
||||
noErrorOnMissing: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
},
|
||||
// Vite root=src,publicDir 默认 src/public → /icons/*
|
||||
modifyViteConfig(viteConfig: { publicDir?: string; appType?: string }) {
|
||||
if (!isH5) return
|
||||
@ -116,7 +144,13 @@ export default defineConfig(async (merge) => {
|
||||
},
|
||||
mini: {
|
||||
postcss: {
|
||||
pxtransform: { enable: true, config: {} },
|
||||
pxtransform: {
|
||||
enable: true,
|
||||
config: {
|
||||
// 与 H5 同源的 Next/门户样式保持 px/rem;阅读器等 750 稿仍走换算
|
||||
exclude: pxExclude,
|
||||
},
|
||||
},
|
||||
cssModules: { enable: false },
|
||||
},
|
||||
},
|
||||
@ -135,11 +169,9 @@ export default defineConfig(async (merge) => {
|
||||
postcss: {
|
||||
autoprefixer: { enable: true },
|
||||
cssModules: { enable: false },
|
||||
// H5 对齐 Next:用真实 px/rem,禁止 750 设计稿换算(否则 250px→6.25rem 地球塌掉)
|
||||
pxtransform: {
|
||||
enable: true,
|
||||
config: {
|
||||
exclude: pxExclude,
|
||||
},
|
||||
enable: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
BIN
apps/miniprogram/icons/1psim.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
apps/miniprogram/icons/3x-ui.webp
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
apps/miniprogram/icons/9esim.webp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
apps/miniprogram/icons/_brand.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
apps/miniprogram/icons/aapanel.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
apps/miniprogram/icons/action-cam.webp
Normal file
|
After Width: | Height: | Size: 794 B |
BIN
apps/miniprogram/icons/adsense.webp
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
apps/miniprogram/icons/ai-glasses.webp
Normal file
|
After Width: | Height: | Size: 682 B |
BIN
apps/miniprogram/icons/aliyun.webp
Normal file
|
After Width: | Height: | Size: 934 B |
BIN
apps/miniprogram/icons/bmc.webp
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
apps/miniprogram/icons/bwh.webp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
apps/miniprogram/icons/chatgpt.webp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
apps/miniprogram/icons/cloud-phone.webp
Normal file
|
After Width: | Height: | Size: 724 B |
BIN
apps/miniprogram/icons/cloudflare.webp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
apps/miniprogram/icons/colocrossing.webp
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
apps/miniprogram/icons/creem.webp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
apps/miniprogram/icons/drone.webp
Normal file
|
After Width: | Height: | Size: 772 B |
BIN
apps/miniprogram/icons/dsx.webp
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
apps/miniprogram/icons/ffmpeg.webp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
apps/miniprogram/icons/frp.webp
Normal file
|
After Width: | Height: | Size: 910 B |
BIN
apps/miniprogram/icons/ga.webp
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
apps/miniprogram/icons/gpu.webp
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
apps/miniprogram/icons/grok.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
apps/miniprogram/icons/iproyal.webp
Normal file
|
After Width: | Height: | Size: 522 B |
BIN
apps/miniprogram/icons/jms.webp
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
apps/miniprogram/icons/lineageos.webp
Normal file
|
After Width: | Height: | Size: 798 B |
BIN
apps/miniprogram/icons/lisa.webp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
apps/miniprogram/icons/mihomo.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
apps/miniprogram/icons/mini-pc.webp
Normal file
|
After Width: | Height: | Size: 370 B |
BIN
apps/miniprogram/icons/namesilo.webp
Normal file
|
After Width: | Height: | Size: 942 B |
BIN
apps/miniprogram/icons/nomad-book.webp
Normal file
|
After Width: | Height: | Size: 832 B |
BIN
apps/miniprogram/icons/nomadcna.webp
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
apps/miniprogram/icons/nomadlist.webp
Normal file
|
After Width: | Height: | Size: 600 B |
BIN
apps/miniprogram/icons/nomadro.webp
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
apps/miniprogram/icons/nowpayments.webp
Normal file
|
After Width: | Height: | Size: 236 B |
BIN
apps/miniprogram/icons/obs.webp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
apps/miniprogram/icons/okx.webp
Normal file
|
After Width: | Height: | Size: 926 B |
BIN
apps/miniprogram/icons/paypal.webp
Normal file
|
After Width: | Height: | Size: 616 B |
BIN
apps/miniprogram/icons/proxy-cheap.webp
Normal file
|
After Width: | Height: | Size: 1000 B |
BIN
apps/miniprogram/icons/qcloud.webp
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
apps/miniprogram/icons/racknerd.webp
Normal file
|
After Width: | Height: | Size: 776 B |
BIN
apps/miniprogram/icons/rpi.webp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
apps/miniprogram/icons/safepal.webp
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
apps/miniprogram/icons/smartproxy.webp
Normal file
|
After Width: | Height: | Size: 396 B |
BIN
apps/miniprogram/icons/smmfollows.webp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
apps/miniprogram/icons/srs.webp
Normal file
|
After Width: | Height: | Size: 2.4 KiB |