Files
WanderQ-MiniAPP2.0/apps/miniprogram/README.md
2026-07-23 18:45:48 +08:00

36 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 万趣微信小程序
这是唯一的用户端前台,基于 Taro + React + TypeScript覆盖探索、搜索、线路详情、收藏、最近浏览、微信登录、手机号授权、我的需求和原生企微“联系我”页。
小程序已声明企微官方插件 `wx104a1a20c3f81ec2`(版本 `1.4.3`)。`pages/contact/index` 内置企业微信后台创建的联系我 `config_id`,直接渲染 `plugin://contactPlugin/cell`H5 中的“企微联系”入口只负责跳转到该原生页。后端不参与联系我插件的配置、同步或回调。
## 本地开发
```bash
npm run dev:miniapp
```
用微信开发者工具打开 `apps/miniprogram`,并将 `project.config.json` 中的 `appid` 替换为真实小程序 AppID。API 本地内存模式可用:
```bash
MINIAPP_MEMORY_DB=1 npm run dev:api:memory
```
## 生产构建
在根目录环境中设置:
```bash
TARO_APP_API_BASE_URL="https://biz.wanderqtrip.com/api"
```
然后执行:
```bash
npm run build:miniapp
```
生产 API 需要配置 `WECHAT_APP_ID``WECHAT_APP_SECRET``DATABASE_URL``JWT_SECRET`,并将 API 域名与 OSS/CDN 域名加入微信小程序的 `request``downloadFile` 合法域名。联系我插件的 `config_id` 已随小程序代码发布,不需要后端企微密钥。图片统一使用 API 返回的 OSS WebP 公共 URL不打包本地图片素材。
数据库首次部署执行 `npm run db:migrate`,初始化内容执行 `npm run db:seed`