yingsa/miniprogram/env-template.txt

41 lines
1.5 KiB
Plaintext
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.

================================================================================
影沙俱乐部小程序配置说明
================================================================================
【配置文件位置】
config.js
【开发环境配置】
在 config.js 中修改 devConfig:
- baseUrl: API 服务器地址,本地开发默认 http://localhost:3000
- wsUrl: WebSocket 地址,本地开发默认 ws://localhost:3000/ws
【生产环境配置】
在 config.js 中修改 prodConfig:
- baseUrl: 正式环境 API 地址,如 https://api.yingsha.com
- wsUrl: 正式环境 WebSocket 地址,如 wss://api.yingsha.com/ws
【微信小程序后台配置】
1. 登录微信公众平台 -> 开发管理 -> 开发设置
2. 服务器域名配置:
- request 合法域名: 添加你的 API 域名https://
- socket 合法域名: 添加你的 WebSocket 域名wss://
- uploadFile 合法域名: 添加你的上传文件域名
- downloadFile 合法域名: 添加你的下载文件域名
3. 业务域名配置(如需要 webview:
- 添加需要在 webview 中打开的域名
【本地开发调试】
1. 微信开发者工具中勾选"不校验合法域名"
2. 确保本地服务器已启动:
cd server
npm run dev
【注意事项】
- 正式环境必须使用 HTTPS 和 WSS
- 配置更改后需要重新编译小程序
- 首次发布需要在微信后台配置服务器域名
================================================================================