You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
# szkp-map-h5
|
|
|
|
|
|
|
|
|
|
|
|
UniApp 用户端项目基础骨架(H5 + 微信小程序双端)。
|
|
|
|
|
|
|
|
|
|
|
|
## 已完成
|
|
|
|
|
|
|
|
|
|
|
|
- 基础目录结构(`src/api`、`src/services`、`src/stores`、`src/pages`)
|
|
|
|
|
|
- 统一请求封装:`src/api/http.ts`
|
|
|
|
|
|
- 微信能力封装:`src/services/wechat.ts`
|
|
|
|
|
|
- H5 微信 OAuth 跳转
|
|
|
|
|
|
- H5 微信 JSSDK 分享配置
|
|
|
|
|
|
- 小程序 `uni.login` 登录 code 换 token 预留
|
|
|
|
|
|
- 腾讯地图配置与接口封装:`src/services/map.ts`
|
|
|
|
|
|
- 使用同后端相同 Key:`CRFBZ-NTART-YU4XX-LCDGK-3J456-VKBK2`
|
|
|
|
|
|
- 走后端 `/map/search`、`/map/reverse-geocode`
|
|
|
|
|
|
|
|
|
|
|
|
## 环境变量
|
|
|
|
|
|
|
|
|
|
|
|
复制 `.env.example` 为 `.env.local` 并填写:
|
|
|
|
|
|
|
|
|
|
|
|
- `VITE_API_BASE_URL`
|
|
|
|
|
|
- `VITE_WECHAT_APP_ID`
|
|
|
|
|
|
|
|
|
|
|
|
## 命令行启动(不依赖 HBuilderX)
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
npm install
|
|
|
|
|
|
npm run dev:h5
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
微信小程序开发:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
npm run dev:mp-weixin
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
构建:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
npm run build:h5
|
|
|
|
|
|
npm run build:mp-weixin
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## 后端接口约定(后续接入)
|
|
|
|
|
|
|
|
|
|
|
|
- `POST /wechat/miniapp/login`(小程序 code 换 token)
|
|
|
|
|
|
- `GET /wechat/jssdk-signature?url=...`(公众号分享签名)
|