83 lines
1.4 KiB
Markdown
Raw Permalink 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.

# YKT Friend Bridge H5
短信好友邀请中转页。发布包名为 `sms.zip`,默认短路径为 `/sms/{id}`
正式短信链接由后端生成随机短码,路径形态为 `/sms/{shortCode}`,例如 `/sms/K8q2Z`
## Local Dev
```bash
npm run dev
```
本地默认读取 `.env.development`
```text
api_url=http://localhost:8080
```
默认地址:
```text
http://localhost:5174/sms/{recordId}
```
运营商审核临时写死地址:
```text
https://ykt.youcan365.com/sms/7du4g
```
当前 `src/main.js` 开启 `REVIEW_MODE`,页面不请求后端接口,直接使用审核用好友链接数据。
本地服务端默认读取:
```text
http://localhost:8080/sms/friend-link/{recordId}/data
```
## Build
```bash
npm run build
npm run package
```
生产默认读取 `.env.production`
```text
api_url=https://ykt.youcan365.com
```
产物:
```text
dist/sms/
sms.zip
```
`sms.zip` 内部自带 `sms/` 目录,上传后解压到站点根目录即可:
```bash
unzip -o sms.zip -d /var/www
```
`api_url` 必须配置,页面内部接口只请求:
```text
/sms/friend-link/{recordId}/data
```
如需覆盖服务端域名,打包前传入:
```bash
api_url=https://your-api-domain.com npm run package
```
后端必须配置 H5 域名,生成短信链接时会使用短路径:
```text
CONFIG_SMS_FRIEND_LINK_BASE_URL=https://your-h5-domain.com
生成链接https://your-h5-domain.com/sms/{recordId}
```