feat(h5): 小程序原生顶栏 + 本地联调与一键部署

nh=1 隐藏 H5 顶栏并由 cover 承载 logo;H5 仅 4px 顶距避免重复留白。新增 dev:mp、deploy:h5 与联调文档。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-25 01:38:32 +08:00
co-authored by Cursor
parent f4bd57ce1b
commit 57687de360
12 changed files with 188 additions and 10 deletions
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
# 本地小程序 + H5 联调:启动 Vite,并打印微信开发者工具所需地址
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
pick_ip() {
local addr=""
if command -v ipconfig >/dev/null 2>&1; then
addr="$(ipconfig getifaddr en0 2>/dev/null || ipconfig getifaddr en1 2>/dev/null || true)"
fi
if [ -z "$addr" ]; then
addr="$(hostname -I 2>/dev/null | awk '{print $1}' || true)"
fi
echo "$addr"
}
IP="$(pick_ip)"
IP="${IP:-127.0.0.1}"
echo ""
echo "══════════════════════════════════════════════════════════"
echo " 愈心魔方 · 本地 H5 联调"
echo "══════════════════════════════════════════════════════════"
echo " 1. 确认小程序 util/yxgConfig.local.js 中 LOCAL_H5_HOST 为:"
echo " ${IP}:5173"
echo " 2. digital-psychology 本窗口保持运行(Vite + API 代理 /psy/api → :8080"
echo " 需要接口时另开终端: npm run dev:api 或 npm run deps:up"
echo " 3. 微信开发者工具 → 详情 → 本地设置 → 勾选:"
echo " 「不校验合法域名、web-view(业务域名)、TLS 版本以及 HTTPS 证书」"
echo " 4. 编译运行小程序(开发模式),打开「愈心魔方」Tab"
echo ""
echo " 浏览器自测: http://${IP}:5173/psy/?mp=1&sbh=88"
echo "══════════════════════════════════════════════════════════"
echo ""
npm run dev:h5