refactor: 抽离企业级微服务脚手架
- 删除业务特定模块(device-center, order-center, coupon-center, msg-center) - 保留核心通用模块(user-center, file-center, search-center, code-generator) - 创建 demo-center 示例模块 - 清理业务特定文档和前端项目 - 创建数据库初始化脚本 - 更新 README 和快速开始文档 - 保留所有 zlt-commons 公共组件库
@@ -1,8 +0,0 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
@@ -1,35 +0,0 @@
|
||||
# 景区地图仪表盘 - 环境变量配置示例
|
||||
# 复制此文件为 .env.local 并填入实际的API Key
|
||||
|
||||
# ========== 地图服务配置 ==========
|
||||
|
||||
# 高德地图API Key(必需)
|
||||
# 申请地址: https://console.amap.com/
|
||||
# 1. 注册/登录高德开放平台
|
||||
# 2. 进入控制台 > 应用管理 > 创建新应用
|
||||
# 3. 添加Key,选择"Web端(JS API)"
|
||||
# 4. 将获取的Key填入下方
|
||||
REACT_APP_AMAP_KEY=
|
||||
|
||||
# Cesium Ion Token(可选 - 用于高级3D功能)
|
||||
# Cesium是开源的,基本功能无需Token
|
||||
# 如需使用Cesium Ion的高级功能(如全球地形、卫星影像),可申请Token
|
||||
# 申请地址: https://cesium.com/ion/signup (国内可访问)
|
||||
# 注意: 不配置此项不影响3D地图基本功能
|
||||
# REACT_APP_CESIUM_TOKEN=
|
||||
|
||||
# ========== WebSocket服务配置 ==========
|
||||
|
||||
# 设备实时数据WebSocket地址
|
||||
# 开发环境示例: ws://localhost:8765/device
|
||||
# 预发布环境: ws://119.45.169.13:8848/device
|
||||
# 生产环境示例: wss://your-domain.com/device
|
||||
REACT_APP_DEVICE_WS_URL=ws://119.45.169.13:8848/device
|
||||
|
||||
# ========== 注意事项 ==========
|
||||
|
||||
# 1. 所有以 REACT_APP_ 开头的变量会被打包进前端代码,请勿存储敏感信息
|
||||
# 2. .env.local 文件不会被git追踪,适合存储本地开发配置
|
||||
# 3. Mapbox Token 是可选的,没有此Token只影响3D地图功能
|
||||
# 4. WebSocket地址在生产环境应使用WSS加密协议
|
||||
# 5. 高德地图Key需要在控制台配置域名白名单
|
||||
@@ -1,43 +0,0 @@
|
||||
# 景区地图仪表盘 - 环境变量配置示例
|
||||
# 复制此文件为 .env.local 并填入实际的API Key
|
||||
|
||||
# ========== 地图服务配置 ==========
|
||||
|
||||
# 高德地图API Key
|
||||
# 申请地址: https://console.amap.com/
|
||||
# 1. 注册/登录高德开放平台
|
||||
# 2. 进入控制台 > 应用管理 > 创建新应用
|
||||
# 3. 添加Key,选择"Web端(JS API)"
|
||||
# 4. 将获取的Key填入下方
|
||||
REACT_APP_AMAP_KEY=7df3685709e341daed76e877e417e5be
|
||||
|
||||
# Cesium Ion Token(可选 - 用于高级3D功能)
|
||||
# Cesium是开源的,基本功能无需Token
|
||||
# 如需使用Cesium Ion的高级功能(如全球地形、卫星影像),可申请Token
|
||||
# 申请地址: https://cesium.com/ion/signup (国内可访问)
|
||||
# 注意: 不配置此项不影响3D地图基本功能
|
||||
REACT_APP_CESIUM_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI5NjhjNDBlMS02OTBiLTQ5OWMtYjk3Mi04NjdiM2I4N2E4NDYiLCJpZCI6MzYxMzMzLCJpYXQiOjE3NjM0NDIxOTh9.PxIgncOzYVrDY17SWVJWD7U-9A1Wnomac8GEdcAYOeM
|
||||
|
||||
# ========== WebSocket服务配置 ==========
|
||||
|
||||
# 设备实时数据WebSocket地址
|
||||
# 开发环境示例: ws://localhost:8765/device
|
||||
# 生产环境示例: wss://your-domain.com/device
|
||||
REACT_APP_DEVICE_WS_URL=ws://119.45.169.13:8848/device
|
||||
|
||||
|
||||
# ========== 应用配置 ==========
|
||||
|
||||
# 运行环境: dev | test | pre | prod
|
||||
# REACT_APP_ENV=dev
|
||||
|
||||
# 应用基础路径(多应用部署时使用)
|
||||
# APP_BASE=/mgnt
|
||||
|
||||
# ========== 注意事项 ==========
|
||||
|
||||
# 1. 所有以 REACT_APP_ 开头的变量会被打包进前端代码,请勿存储敏感信息
|
||||
# 2. 生产环境建议使用环境变量或CI/CD工具注入,而非直接写入.env文件
|
||||
# 3. .env.local文件不会被git追踪,适合存储本地开发配置
|
||||
# 4. WebSocket地址在生产环境应使用WSS加密协议
|
||||
# 5. 高德地图Key需要在控制台配置域名白名单
|
||||
@@ -1,12 +0,0 @@
|
||||
# 预发布环境配置
|
||||
# 对应构建命令: npm run build:pre:mgnt
|
||||
|
||||
# 高德地图API Key (预发布环境 - 必需,用于2D地图)
|
||||
REACT_APP_AMAP_KEY=
|
||||
|
||||
# Cesium Ion Token (预发布环境 - 可选,用于高级3D功能)
|
||||
# Cesium基本3D功能无需Token,可留空
|
||||
# REACT_APP_CESIUM_TOKEN=
|
||||
|
||||
# WebSocket服务地址 (预发布环境)
|
||||
REACT_APP_DEVICE_WS_URL=ws://119.45.169.13:8848/device
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"printWidth": 100,
|
||||
"trailingComma": "all"
|
||||
}
|
||||
@@ -1,206 +0,0 @@
|
||||
# react-web-next(重构版)
|
||||
本项目是在不改动现有 `zlt-web/react-web` 的前提下,基于其功能与接口重新组织的“重构版”管理后台前端代码。目标:
|
||||
- 保持所有管理页面功能等价(逐步迁移),显著提升结构与可读性;
|
||||
- 为“每个页面”统一增加“租户 + 包含子租户”查询控制;
|
||||
- 优化主题与布局,使界面更现代、更一致;
|
||||
- 通过组件化与约定,降低后续页面维护成本。
|
||||
|
||||
## 目录结构
|
||||
|
||||
## 构建与部署(多环境)
|
||||
|
||||
- 前置要求:Node.js 16+、NPM 7+(或 Yarn/Pnpm)
|
||||
- 可访问目标环境网关(如 `http://119.45.169.13:9900`)
|
||||
|
||||
### 环境变量约定
|
||||
|
||||
- `REACT_APP_ENV=dev|test|pre`:仅用于本地开发选择 `config/proxy.ts` 的代理分支。
|
||||
- `GATEWAY_ORIGIN`:仅用于本地开发代理目标(统一转发 `/api-*`)。
|
||||
- `API_PREFIX`:构建时注入到 Umi 全局 `request.prefix`,用于 `dist` 包直连网关。
|
||||
- 测试/预发:设置为网关完整地址(如 `http://119.45.169.13:9900`)。
|
||||
- 生产:推荐留空,采用同域反向代理 `/api-*`。
|
||||
|
||||
### 本地开发(走代理)
|
||||
|
||||
- 安装依赖:`npm install`
|
||||
- 启动:`npm run start` | `npm run start:test` | `npm run start:pre`
|
||||
- 临时覆盖代理网关:
|
||||
- PowerShell:`$env:GATEWAY_ORIGIN="http://10.x.x.x:9900"; npm run start:test`
|
||||
- CMD:`set GATEWAY_ORIGIN=http://10.x.x.x:9900 && npm run start:test`
|
||||
|
||||
说明:开发环境不注入 `API_PREFIX`,所有 `/api-*` 由 `config/proxy.ts` + `GATEWAY_ORIGIN` 转发。
|
||||
|
||||
### 多环境构建(输出 dist)
|
||||
|
||||
- 基础构建:`npm run build`
|
||||
- 测试包:`npm run build:test`(默认 `API_PREFIX=http://119.45.169.13:9900`)
|
||||
- 预发包:`npm run build:pre`
|
||||
- 生产包:`npm run build:prod`(不注入前缀,推荐同域反代)
|
||||
|
||||
覆盖前缀示例:
|
||||
```bash
|
||||
API_PREFIX=http://10.x.x.x:9900 npm run build:test
|
||||
$env:API_PREFIX="http://10.x.x.x:9900"; npm run build:test
|
||||
```
|
||||
|
||||
### 部署方式
|
||||
|
||||
1) 跨域直连网关(需后端 CORS 放行)
|
||||
- 使用 `build:test`/`build:pre` 注入网关地址(如 `http://119.45.169.13:9900`)。
|
||||
- 将 `dist/` 上传到任意静态服务器(Nginx/OSS 等)。
|
||||
- 确保后端 CORS 允许当前前端域名。
|
||||
|
||||
2) 同域反向代理(推荐生产)
|
||||
- 使用 `build:prod`(`API_PREFIX` 为空)。
|
||||
- 由 Nginx 同域托管静态资源并将 `/api-*` 反代到网关。
|
||||
|
||||
Nginx 示例:
|
||||
```nginx
|
||||
server {
|
||||
listen 80;
|
||||
server_name your.domain.com;
|
||||
root /opt/apps/react-web-next/dist;
|
||||
index index.html;
|
||||
location / { try_files $uri $uri/ /index.html; }
|
||||
location /api- { proxy_pass http://127.0.0.1:9900; }
|
||||
}
|
||||
```
|
||||
|
||||
### 部署总结(测试环境)
|
||||
|
||||
- 构建:`npm run build:test:mgnt`
|
||||
- 等价:`cross-env APP_BASE=/mgnt REACT_APP_ENV=test API_PREFIX=http://119.45.169.13:9900 npm run build`
|
||||
- 部署:将 `dist/` 上传至服务器,按上方示例以 `/mgnt/` 路径托管并开启 history 回退。
|
||||
- 访问:`http://<服务器IP或域名>:9999/mgnt/`
|
||||
- 验证:
|
||||
- F12 Network 中 `*.async.js`/`*.js` 从 `/mgnt/` 根路径加载,状态 200、类型 `application/javascript`。
|
||||
- 接口请求直连 `API_PREFIX`(测试网关),若跨域需在网关开启 CORS。
|
||||
|
||||
### 验证清单与常见问题
|
||||
|
||||
- 刷新不 404(`try_files` 生效)。
|
||||
- CORS 报错:跨域直连需后端放行。
|
||||
- Mixed Content:HTTPS 站点勿注入 `http://` 前缀。
|
||||
- 资源 404:检查 `publicPath` 为 `./`,并确认 `dist/` 完整上传。
|
||||
|
||||
```
|
||||
react-web-next/
|
||||
├─ config/
|
||||
│ ├─ config.ts # Umi 配置(启用 routes、hash history、proxy)
|
||||
│ └─ routes.ts # 路由定义(按域分组)
|
||||
├─ src/
|
||||
│ ├─ layouts/
|
||||
│ │ └─ BasicLayout.tsx # 基础布局(含统一头部操作区)
|
||||
│ ├─ components/
|
||||
│ │ └─ TenantScopeFilter/ # 统一的租户/子租户过滤器
|
||||
│ ├─ pages/
|
||||
│ │ ├─ Welcome.tsx # 示例页(接入租户过滤器)
|
||||
│ │ └─ system/
|
||||
│ │ └─ TenantManage/ # 重构后的租户管理页(树型新增等)
|
||||
│ ├─ services/
|
||||
│ │ └─ tenant.ts # 租户相关 API(复用后端接口)
|
||||
│ ├─ utils/
|
||||
│ │ ├─ request.ts # 请求封装与拦截
|
||||
│ │ ├─ download.ts # 通用下载(支持 Content-Disposition)
|
||||
│ │ └─ export.ts # 前端导出 Excel
|
||||
│ ├─ app.tsx
|
||||
│ └─ global.less
|
||||
├─ package.json
|
||||
└─ tsconfig.json
|
||||
```
|
||||
|
||||
## 运行
|
||||
|
||||
1) 进入目录安装依赖:`npm install`(或 `pnpm i`/`yarn`)
|
||||
2) 开发:
|
||||
- dev(本地网关):`npm run start` 或 `npm run start:dev`
|
||||
- test(测试网关):`npm run start:test`
|
||||
- pre(预发网关):`npm run start:pre`
|
||||
- 临时覆盖网关地址:
|
||||
- PowerShell:`$env:GATEWAY_ORIGIN="http://10.x.x.x:9900"; npm run start:test`
|
||||
- CMD:`set GATEWAY_ORIGIN=http://10.x.x.x:9900 && npm run start:test`
|
||||
3) 构建:`npm run build`
|
||||
|
||||
> 说明:仅开发环境启用代理;生产由统一网关/容器转发。
|
||||
|
||||
## 迁移策略
|
||||
|
||||
- 按模块逐页迁移:
|
||||
1. 将旧页逻辑拆分为“表格 + 表单 + 服务”三个层次;
|
||||
2. 在表格 `toolBarRender` 中默认挂载 `TenantScopeFilter`;
|
||||
3. 保留原有接口地址/参数命名,避免改动后端;
|
||||
4. 体验层(样式/布局/反馈)用 Ant Design Pro 的推荐实践统一收敛。
|
||||
- 公共模式:
|
||||
- 统一请求封装(`src/utils/request.ts`)处理返回结构;
|
||||
- 统一主题变量与间距;
|
||||
- 统一“租户过滤”的行为:
|
||||
- 选择租户 → 调用 `/tenant/switch?tenantId=X` 设置锚点;
|
||||
- 勾选“包含子租户”→ 拦截器自动展开,无需改动每个接口;
|
||||
- 支持“一键重置”回默认租户。
|
||||
|
||||
## 环境与代理
|
||||
|
||||
- 统一代理:`config/proxy.ts` 仅配置一条规则,将所有 `/api-*` 转发到统一网关 `GATEWAY_ORIGIN`。
|
||||
- 环境选择:`REACT_APP_ENV=dev|test|pre` 选择 `proxy` 分支;默认 `dev`。
|
||||
- 启动脚本:见 package.json 的 `start:*`(已内置常用网关地址)。
|
||||
- 生产环境:不启用该代理,由 API 网关/容器转发到后端微服务。
|
||||
|
||||
## 下载与导出
|
||||
|
||||
- 下载(后端生成文件):
|
||||
- 使用 `src/utils/download.ts` 的 `download(res, defaultName)`
|
||||
- 示例:
|
||||
```ts
|
||||
const res = await request('/api-user/users/export', {
|
||||
method: 'POST', responseType: 'blob', getResponse: true,
|
||||
});
|
||||
download(res, 'user.xls'); // 将从 Content-Disposition 解析文件名
|
||||
```
|
||||
- 直接 URL 下载(无 CORS 或简单文件):
|
||||
- `downloadByUrl(url, filename?)`
|
||||
- 前端导出 Excel(内存数据 → xlsx):
|
||||
- 使用 `src/utils/export.ts` 的 `exportExcel({ data, header, fileName })`
|
||||
- header 示例:`[{ title: '用户名', dataIndex: 'username' }]`
|
||||
|
||||
## 已完成
|
||||
|
||||
- 基础框架/布局、主题与请求封装;
|
||||
- `TenantScopeFilter` 组件;
|
||||
- 租户管理页(树型添加/编辑/删除)重构版;
|
||||
- Welcome 示例接入过滤器;
|
||||
- 路由与文档;
|
||||
- 下载/导出工具与用户导出统一改造。
|
||||
|
||||
## 待办(按需推进)
|
||||
|
||||
- 逐步迁移原项目下系统、设备、订单等页面;
|
||||
- 页面级权限点与菜单项的细化;
|
||||
- 更精确的分页 total 透传(后端补齐后更新前端);
|
||||
- 单元测试、E2E 用例补充。
|
||||
|
||||
如需我继续迁移具体页面,请告知优先级(如 系统/订单/设备 等模块)。
|
||||
|
||||
|
||||
### 部署总结(生产环境)
|
||||
|
||||
- 构建:`npm run build:prod:mgnt`
|
||||
- 等价:`cross-env APP_BASE=/mgnt REACT_APP_ENV=prod npm run build`
|
||||
- Nginx:在 `/mgnt/` 托管静态资源,并增加接口反代:
|
||||
```nginx
|
||||
location = /mgnt { return 301 /mgnt/; }
|
||||
location /mgnt/ {
|
||||
alias /opt/apps/react-web-next/dist/;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /mgnt/index.html;
|
||||
}
|
||||
location /api- {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://127.0.0.1:9900; # 改为你的网关地址
|
||||
}
|
||||
```
|
||||
- 访问:`http://<服务器>:9999/mgnt/`
|
||||
- 验证:
|
||||
- 资源从 `/mgnt/` 加载为 JS(200)
|
||||
- 接口指向同域 `/api-*`,由 Nginx 反代到网关,无 CORS。
|
||||
@@ -1,65 +0,0 @@
|
||||
// Umi 3 基础配置(中文注释)
|
||||
// 目标:
|
||||
// - 显式启用 routes.ts(保持与原项目路径兼容,支持 *.html 路径)
|
||||
// - 使用 browser history,开发调试直达路径不 404;产物 publicPath 保持相对路径便于静态托管
|
||||
// - 开发环境走 proxy 转发后端,避免跨域
|
||||
import routes from './routes';
|
||||
import proxy from './proxy';
|
||||
|
||||
const { REACT_APP_ENV } = process.env as any;
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
// 构建期注入 API 前缀(生产包/测试包/预发包),开发环境走代理不加前缀
|
||||
const API_PREFIX = isDev ? '' : (process.env.API_PREFIX || '');
|
||||
const APP_BASE = isDev ? '/' : (process.env.APP_BASE || '/');
|
||||
|
||||
export default {
|
||||
hash: true,
|
||||
// 资源路径:开发用根路径,生产为相对路径
|
||||
publicPath: isDev ? '/' : (APP_BASE.endsWith('/') ? APP_BASE : APP_BASE + '/'),
|
||||
antd: {},
|
||||
// 页面 meta 标签
|
||||
metas: [
|
||||
{ charset: 'utf-8' },
|
||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' },
|
||||
],
|
||||
// 主题(现代风格 + 红绿配主色)
|
||||
theme: {
|
||||
'primary-color': '#ff4d4f',
|
||||
'border-radius-base': '8px',
|
||||
'box-shadow-base': '0 8px 32px rgba(0, 0, 0, 0.1)',
|
||||
'animation-duration-slow': '0.4s',
|
||||
'animation-duration-base': '0.3s',
|
||||
'animation-duration-fast': '0.2s',
|
||||
},
|
||||
// 关闭 i18n,多语言后续按需启用
|
||||
locale: { antd: false, default: 'zh-CN', baseNavigator: true },
|
||||
// 使用按需编译的动态导入,提升首屏
|
||||
dynamicImport: { loading: '@/components/PageLoading' },
|
||||
// 路由采用显式配置
|
||||
routes,
|
||||
// 历史模式
|
||||
history: { type: 'browser' },
|
||||
base: APP_BASE,
|
||||
// Dev 代理
|
||||
proxy: (proxy as any)[REACT_APP_ENV || 'dev'],
|
||||
// 向业务代码注入构建期常量
|
||||
define: {
|
||||
'process.env.API_PREFIX': API_PREFIX,
|
||||
'process.env.APP_BASE': APP_BASE,
|
||||
},
|
||||
// 构建优化
|
||||
nodeModulesTransform: { type: 'none' },
|
||||
mfsu: false,
|
||||
fastRefresh: {},
|
||||
// Cesium 静态资源配置
|
||||
chainWebpack: (config: any) => {
|
||||
// 配置 Cesium 资源路径
|
||||
config.plugin('define').tap((definitions: any) => {
|
||||
Object.assign(definitions[0], {
|
||||
'process.env.CESIUM_BASE_URL': JSON.stringify(isDev ? '/' : (APP_BASE.endsWith('/') ? APP_BASE : APP_BASE + '/')),
|
||||
});
|
||||
return definitions;
|
||||
});
|
||||
return config;
|
||||
},
|
||||
} as any;
|
||||
@@ -1,62 +0,0 @@
|
||||
/**
|
||||
* 开发代理配置(仅 dev 生效)
|
||||
* - 统一网关转发:仅代理 /api- 前缀到网关(/api-user、/api-uaa 等)
|
||||
* - 生产环境由网关/容器转发,此文件不生效
|
||||
*/
|
||||
const GATEWAY = process.env.GATEWAY_ORIGIN || 'http://localhost:9900';
|
||||
// SRS流媒体服务器地址
|
||||
const SRS_SERVER = process.env.SRS_SERVER || 'http://220.205.16.27:8024';
|
||||
|
||||
export default {
|
||||
dev: {
|
||||
// API 请求代理(HTTP)
|
||||
// 注意:WebSocket 在 deviceControlWs.ts 中直接连接网关,不经过此代理
|
||||
'/api-': {
|
||||
target: GATEWAY,
|
||||
changeOrigin: true,
|
||||
},
|
||||
// 3D模型CDN代理 - 解决跨域问题
|
||||
'/goflymodel': {
|
||||
target: 'https://minicdn.goflytec.com',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
},
|
||||
// SRS WebRTC WHEP 视频流代理
|
||||
'/rtc': {
|
||||
target: SRS_SERVER,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
},
|
||||
// SRS 登录认证接口代理
|
||||
'/terraform': {
|
||||
target: SRS_SERVER,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
},
|
||||
},
|
||||
test: {
|
||||
'/api-': {
|
||||
target: GATEWAY,
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
'/goflymodel': {
|
||||
target: 'https://minicdn.goflytec.com',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
},
|
||||
},
|
||||
pre: {
|
||||
'/api-': {
|
||||
target: GATEWAY,
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
},
|
||||
'/goflymodel': {
|
||||
target: 'https://minicdn.goflytec.com',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
export default [
|
||||
{ path: '/user/login', component: '@/pages/user/Login' },
|
||||
{
|
||||
path: '/',
|
||||
component: '@/layouts/BasicLayout',
|
||||
routes: [
|
||||
{ path: '/', redirect: '/welcome' },
|
||||
{ path: '/welcome', component: '@/pages/Welcome' },
|
||||
{
|
||||
path: '/system',
|
||||
routes: [
|
||||
{ path: '/system/tokens.html', component: '@/pages/system/Token' },
|
||||
{ path: '/system/menus.html', component: '@/pages/system/Menu' },
|
||||
{ path: '/system/role.html', component: '@/pages/system/Role' },
|
||||
{ path: '/system/user.html', component: '@/pages/system/User' },
|
||||
{ path: '/system/tenant.html', component: '@/pages/system/TenantManage' },
|
||||
{ path: '/system/miniApp.html', component: '@/pages/system/MiniApp' },
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/orders',
|
||||
routes: [
|
||||
{ path: '/orders/order.html', component: '@/pages/orders/Order' },
|
||||
{ path: '/orders/orderFiles.html', component: '@/pages/orders/OrderFile' },
|
||||
{ path: '/orders/tourism.html', component: '@/pages/orders/Tourism' },
|
||||
{ path: '/orders/tourismFile.html', component: '@/pages/orders/TourismFile' },
|
||||
{ path: '/orders/homeCarousel.html', component: '@/pages/orders/HomeCarousel' },
|
||||
{ path: '/orders/refund.html', component: '@/pages/orders/Refund' },
|
||||
{ path: '/orders/profitSharing.html', component: '@/pages/orders/ProfitSharing' },
|
||||
{ path: '/orders/profit-sharing/statistics.html', component: '@/pages/orders/ProfitSharing/Statistics' },
|
||||
{ path: '/orders/videoTemplate.html', component: '@/pages/orders/VideoTemplate' },
|
||||
{ path: '/orders/editTask.html', component: '@/pages/orders/EditTask' },
|
||||
{ path: '/orders/wxMessage.html', component: '@/pages/orders/WxMessage' },
|
||||
{ path: '/orders/coupon.html', component: '@/pages/orders/Coupon' },
|
||||
// 导游管理模块(包含导游列表、佣金明细、提现审核)
|
||||
{ path: '/orders/guide.html', component: '@/pages/orders/Guide' },
|
||||
// 二维码订单管理
|
||||
{ path: '/orders/qrcodeOrder.html', component: '@/pages/orders/QrcodeOrder' },
|
||||
// 天气规则管理
|
||||
{ path: '/orders/weatherRule.html', component: '@/pages/orders/WeatherRule' },
|
||||
// 携程订单管理
|
||||
{ path: '/orders/ctripOrder.html', component: '@/pages/orders/CtripOrder' },
|
||||
// 携程退款管理
|
||||
{ path: '/orders/ctripRefund.html', component: '@/pages/orders/CtripRefund' },
|
||||
// 订单状态超时监控配置
|
||||
{ path: '/orders/statusTimeoutConfig.html', component: '@/pages/orders/StatusTimeoutConfig' },
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/device',
|
||||
routes: [
|
||||
{ path: '/device/wayline.html', component: '@/pages/device/Wayline' },
|
||||
{ path: '/device/device.html', component: '@/pages/device/Device' },
|
||||
// 3D模型管理
|
||||
{ path: '/device/3dModel.html', name: '3D模型管理', component: '@/pages/device/ThreeDModel' },
|
||||
// 景区地图仪表盘
|
||||
{ path: '/device/mapDashboard.html', name: '地图仪表盘', component: '@/pages/device/mapDashboard', exact: true },
|
||||
{ path: '/device/mapDashboard/tourismDeviceDetail/:tourismId', component: '@/pages/device/mapDashboard/TourismDeviceDetail' },
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/log',
|
||||
routes: [
|
||||
{ path: '/log/sysLog.html', component: '@/pages/log/SysLog' },
|
||||
{ path: '/log/auditLog.html', component: '@/pages/log/AuditLog' },
|
||||
{ path: '/log/slowQueryLog.html', component: '@/pages/log/SlowSqlLog' },
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/search',
|
||||
routes: [
|
||||
{ path: '/search/index_manager.html', component: '@/pages/search/Index' },
|
||||
{ path: '/search/user_search.html', component: '@/pages/search/User' },
|
||||
],
|
||||
},
|
||||
{ path: '/message/message.html', component: '@/pages/message' },
|
||||
{
|
||||
path: '/files',
|
||||
routes: [
|
||||
{ path: '/files/files.html', component: '@/pages/files/File' },
|
||||
],
|
||||
},
|
||||
{ path: '/generator/list.html', component: '@/pages/system/Generator' },
|
||||
{ path: '/attestation/app.html', component: '@/pages/system/App' },
|
||||
{ path: '/system/myInfo.html', component: '@/pages/system/UserInfo' },
|
||||
{ component: '@/pages/404' },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,338 +0,0 @@
|
||||
# Cesium 三维地图说明
|
||||
|
||||
## 🎉 为什么选择Cesium?
|
||||
|
||||
### 优势对比
|
||||
|
||||
| 特性 | Cesium | Mapbox | 高德3D |
|
||||
|------|--------|--------|--------|
|
||||
| 国内访问 | ✅ 稳定 | ❌ 受限 | ✅ 稳定 |
|
||||
| 开源免费 | ✅ 是 | ❌ 否 | ❌ 否 |
|
||||
| 无需Token | ✅ 是 | ❌ 需要 | ✅ 是 |
|
||||
| 3D效果 | ✅✅✅ 强大 | ✅✅ 较好 | ✅ 一般 |
|
||||
| 地形支持 | ✅ 支持 | ✅ 支持 | ❌ 不支持 |
|
||||
| 倾斜摄影 | ✅ 支持 | ❌ 不支持 | ❌ 不支持 |
|
||||
|
||||
### Cesium的核心优势
|
||||
|
||||
1. **完全开源** - MIT许可证,商业使用无限制
|
||||
2. **国内可用** - 无需VPN,访问稳定
|
||||
3. **无需Token** - 基础功能开箱即用
|
||||
4. **功能强大** - 全球领先的3D地球引擎
|
||||
5. **社区活跃** - 大量文档和示例
|
||||
|
||||
---
|
||||
|
||||
## 📦 已集成的功能
|
||||
|
||||
### 当前实现
|
||||
|
||||
✅ **基础3D地球**
|
||||
- 3D球体渲染
|
||||
- 流畅的视角控制
|
||||
- 缩放、旋转、倾斜
|
||||
|
||||
✅ **景区标记**
|
||||
- 3D点标记
|
||||
- 文字标签
|
||||
- 悬停效果
|
||||
- 点击交互
|
||||
|
||||
✅ **地图底图**
|
||||
- 使用高德瓦片地图
|
||||
- 国内访问稳定
|
||||
- 无缝切换2D/3D
|
||||
|
||||
✅ **视角飞行**
|
||||
- 自动适配显示所有景区
|
||||
- 平滑的飞行动画
|
||||
- 最佳视角计算
|
||||
|
||||
✅ **UI控件**
|
||||
- 主页按钮
|
||||
- 2D/3D/哥伦布视图切换
|
||||
- 简洁的界面
|
||||
|
||||
---
|
||||
|
||||
## 🚀 使用方法
|
||||
|
||||
### 1. 安装依赖
|
||||
|
||||
```bash
|
||||
cd zlt-web/react-web-next
|
||||
npm install
|
||||
```
|
||||
|
||||
依赖会自动安装:
|
||||
- `cesium@^1.110.0` - Cesium核心库
|
||||
- `resium@^1.16.1` - React Cesium封装(备用)
|
||||
- `@types/cesium@^1.110.0` - TypeScript类型定义
|
||||
|
||||
### 2. 配置环境变量
|
||||
|
||||
**最简配置(推荐):**
|
||||
```bash
|
||||
# .env.local
|
||||
REACT_APP_AMAP_KEY=你的高德Key
|
||||
REACT_APP_DEVICE_WS_URL=ws://119.45.169.13:8848/device
|
||||
|
||||
# Cesium Token可选,无需配置
|
||||
```
|
||||
|
||||
**如需高级功能:**
|
||||
```bash
|
||||
# 额外配置Cesium Ion Token
|
||||
REACT_APP_CESIUM_TOKEN=你的Cesium Token
|
||||
```
|
||||
|
||||
### 3. 启动项目
|
||||
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
|
||||
访问: http://localhost:8000/device/mapDashboard
|
||||
|
||||
### 4. 切换3D地图
|
||||
|
||||
在页面工具栏点击 **"Cesium 3D"** 按钮即可切换到3D地图。
|
||||
|
||||
---
|
||||
|
||||
## 🎨 功能特性
|
||||
|
||||
### 3D视图模式
|
||||
|
||||
Cesium提供三种视图模式:
|
||||
|
||||
1. **3D模式(默认)**
|
||||
- 真实的3D地球
|
||||
- 支持倾斜视角
|
||||
- 立体感最强
|
||||
|
||||
2. **2D模式**
|
||||
- 平面地图
|
||||
- 类似传统地图
|
||||
- 性能最优
|
||||
|
||||
3. **哥伦布视图**
|
||||
- 2.5D视图
|
||||
- 兼顾立体感和性能
|
||||
- 适合大范围浏览
|
||||
|
||||
### 交互操作
|
||||
|
||||
**鼠标操作:**
|
||||
- **左键拖拽** - 旋转地球
|
||||
- **右键拖拽** - 平移视图
|
||||
- **滚轮** - 缩放
|
||||
- **中键拖拽** - 倾斜视角
|
||||
|
||||
**景区标记:**
|
||||
- **点击** - 跳转到景区设备列表
|
||||
- **悬停** - 标记放大,显示指针
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ 高级配置
|
||||
|
||||
### 使用Cesium Ion Token(可选)
|
||||
|
||||
如需使用Cesium Ion的高级功能:
|
||||
|
||||
**步骤1:** 注册Cesium Ion账号
|
||||
|
||||
访问 https://cesium.com/ion/signup
|
||||
|
||||
**步骤2:** 获取Token
|
||||
|
||||
1. 登录后进入 https://cesium.com/ion/tokens
|
||||
2. 使用默认Token或创建新Token
|
||||
3. 复制Token
|
||||
|
||||
**步骤3:** 配置到项目
|
||||
|
||||
```bash
|
||||
# .env.local
|
||||
REACT_APP_CESIUM_TOKEN=你的Token
|
||||
```
|
||||
|
||||
**步骤4:** 修改代码(如需使用)
|
||||
|
||||
在 `CesiumContainer.tsx` 中取消注释:
|
||||
|
||||
```typescript
|
||||
// 配置Cesium Ion Token
|
||||
Cesium.Ion.defaultAccessToken = process.env.REACT_APP_CESIUM_TOKEN || '';
|
||||
```
|
||||
|
||||
### 解锁的高级功能
|
||||
|
||||
配置Token后可使用:
|
||||
|
||||
✅ **全球地形数据**
|
||||
```typescript
|
||||
terrainProvider: Cesium.createWorldTerrain({
|
||||
requestWaterMask: true,
|
||||
requestVertexNormals: true,
|
||||
}),
|
||||
```
|
||||
|
||||
✅ **Cesium OSM Buildings(全球建筑3D)**
|
||||
```typescript
|
||||
const buildingTileset = viewer.scene.primitives.add(
|
||||
Cesium.createOsmBuildings()
|
||||
);
|
||||
```
|
||||
|
||||
✅ **Bing Maps卫星影像**
|
||||
```typescript
|
||||
imageryProvider: new Cesium.IonImageryProvider({ assetId: 3 }),
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔧 自定义配置
|
||||
|
||||
### 更换底图
|
||||
|
||||
**使用天地图:**
|
||||
```typescript
|
||||
imageryProvider: new Cesium.WebMapTileServiceImageryProvider({
|
||||
url: 'http://t{s}.tianditu.gov.cn/img_w/wmts?tk=你的天地图Key',
|
||||
layer: 'img',
|
||||
style: 'default',
|
||||
format: 'tiles',
|
||||
tileMatrixSetID: 'w',
|
||||
subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
|
||||
}),
|
||||
```
|
||||
|
||||
**使用百度地图:**
|
||||
```typescript
|
||||
// 需要坐标转换
|
||||
imageryProvider: new Cesium.UrlTemplateImageryProvider({
|
||||
url: 'https://maponline{s}.bdimg.com/tile/?qt=vtile&x={x}&y={y}&z={z}',
|
||||
subdomains: ['0', '1', '2', '3'],
|
||||
}),
|
||||
```
|
||||
|
||||
### 添加建筑3D
|
||||
|
||||
```typescript
|
||||
// 使用3D Tiles
|
||||
const tileset = viewer.scene.primitives.add(
|
||||
new Cesium.Cesium3DTileset({
|
||||
url: '你的3D Tiles URL',
|
||||
})
|
||||
);
|
||||
```
|
||||
|
||||
### 优化性能
|
||||
|
||||
```typescript
|
||||
// 启用请求渲染模式
|
||||
requestRenderMode: true,
|
||||
maximumRenderTimeChange: Infinity,
|
||||
|
||||
// 降低细节层次
|
||||
terrainProvider: Cesium.createWorldTerrain({
|
||||
requestWaterMask: false, // 关闭水面
|
||||
requestVertexNormals: false, // 关闭法线
|
||||
}),
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📊 性能对比
|
||||
|
||||
### 资源占用
|
||||
|
||||
| 项目 | Cesium 3D | 高德2D |
|
||||
|------|-----------|--------|
|
||||
| 初始加载 | ~8MB | ~2MB |
|
||||
| 内存占用 | 150-300MB | 50-100MB |
|
||||
| GPU占用 | 中等 | 低 |
|
||||
| 适用场景 | 展示/演示 | 日常使用 |
|
||||
|
||||
### 优化建议
|
||||
|
||||
1. **大量景区时**: 使用聚合或分级显示
|
||||
2. **性能受限时**: 关闭地形和建筑3D
|
||||
3. **移动端**: 建议使用2D地图
|
||||
|
||||
---
|
||||
|
||||
## 🐛 常见问题
|
||||
|
||||
### Q1: Cesium加载慢怎么办?
|
||||
|
||||
**原因**: Cesium库较大(~8MB)
|
||||
|
||||
**解决**:
|
||||
1. 使用CDN加速
|
||||
2. 配置Gzip压缩
|
||||
3. 使用懒加载(已实现)
|
||||
|
||||
### Q2: 地图显示空白?
|
||||
|
||||
**检查**:
|
||||
1. 网络连接是否正常
|
||||
2. 浏览器控制台是否有错误
|
||||
3. 高德底图是否可访问
|
||||
|
||||
### Q3: 性能卡顿怎么办?
|
||||
|
||||
**优化**:
|
||||
1. 关闭地形: 使用`new Cesium.EllipsoidTerrainProvider()`
|
||||
2. 减少标记数量
|
||||
3. 降低画质设置
|
||||
|
||||
### Q4: 如何使用离线地图?
|
||||
|
||||
**方案**:
|
||||
1. 部署私有地图服务器
|
||||
2. 预下载瓦片数据
|
||||
3. 配置本地URL
|
||||
|
||||
---
|
||||
|
||||
## 📚 参考资源
|
||||
|
||||
### 官方文档
|
||||
- Cesium官网: https://cesium.com/
|
||||
- API文档: https://cesium.com/docs/
|
||||
- 示例代码: https://sandcastle.cesium.com/
|
||||
|
||||
### 社区资源
|
||||
- GitHub: https://github.com/CesiumGS/cesium
|
||||
- 中文教程: http://cesium.xin/
|
||||
- 论坛: https://community.cesium.com/
|
||||
|
||||
---
|
||||
|
||||
## 🎯 后续规划
|
||||
|
||||
### 待实现功能
|
||||
|
||||
- [ ] 景区范围多边形
|
||||
- [ ] 飞行路线展示
|
||||
- [ ] 设备实时位置追踪
|
||||
- [ ] 历史轨迹回放
|
||||
- [ ] 热力图展示
|
||||
- [ ] 3D建筑模型(如有数据)
|
||||
- [ ] 倾斜摄影集成(如有数据)
|
||||
|
||||
### 进阶功能
|
||||
|
||||
- [ ] 自定义shader效果
|
||||
- [ ] 粒子系统(如雨雪)
|
||||
- [ ] 时间动画
|
||||
- [ ] 地形分析
|
||||
- [ ] 视域分析
|
||||
|
||||
---
|
||||
|
||||
**最后更新:** 2025-11-18
|
||||
**技术支持:** 开发团队
|
||||
@@ -1,126 +0,0 @@
|
||||
# 景区地图配置快速指南
|
||||
|
||||
## ⚡ 快速开始(只需2步)
|
||||
|
||||
### 1️⃣ 申请高德地图API Key
|
||||
|
||||
访问 https://console.amap.com/
|
||||
|
||||
- 注册/登录账号
|
||||
- 创建应用,选择"Web端(JS API)"
|
||||
- 复制生成的Key
|
||||
|
||||
### 2️⃣ 配置环境变量
|
||||
|
||||
复制 `.env.example` 为 `.env.local`:
|
||||
```bash
|
||||
cp .env.example .env.local
|
||||
```
|
||||
|
||||
编辑 `.env.local`,填入你的高德地图Key:
|
||||
```bash
|
||||
# 必需配置
|
||||
REACT_APP_AMAP_KEY=你的高德地图Key
|
||||
|
||||
# Cesium Token是可选的,可以留空(3D地图仍然可用)
|
||||
# REACT_APP_CESIUM_TOKEN=
|
||||
|
||||
# WebSocket地址
|
||||
REACT_APP_DEVICE_WS_URL=ws://119.45.169.13:8848/device
|
||||
```
|
||||
|
||||
### 3️⃣ 启动项目
|
||||
|
||||
```bash
|
||||
npm install # 首次运行需要
|
||||
npm start
|
||||
```
|
||||
|
||||
访问: http://localhost:8000/device/mapDashboard
|
||||
|
||||
---
|
||||
|
||||
## 🗺️ 关于地图功能
|
||||
|
||||
### 当前支持的地图
|
||||
|
||||
✅ **高德2D地图**(必需配置)
|
||||
- 国内访问稳定
|
||||
- 平面地图展示
|
||||
- 需配置 `REACT_APP_AMAP_KEY`
|
||||
|
||||
✅ **Cesium 3D地图**(无需额外配置)
|
||||
- ✅ 开源免费,国内可用
|
||||
- ✅ 无需Token即可使用
|
||||
- ✅ 真正的3D地球展示
|
||||
- ✅ 支持视角飞行
|
||||
- ✅ 使用高德底图(国内稳定)
|
||||
|
||||
### 功能说明
|
||||
|
||||
**只配置高德地图Key(推荐):**
|
||||
- ✅ 2D平面地图
|
||||
- ✅ 3D地球地图(Cesium)
|
||||
- ✅ 可自由切换2D/3D
|
||||
- ✅ 景区标记正常
|
||||
- ✅ 所有功能完整
|
||||
|
||||
**额外配置Cesium Token(可选):**
|
||||
- ✅ 解锁Cesium Ion高级功能
|
||||
- ✅ 全球高精度地形
|
||||
- ✅ 卫星影像
|
||||
- ℹ️ 基本功能无需Token
|
||||
|
||||
---
|
||||
|
||||
## 🔧 构建配置
|
||||
|
||||
根据你的构建命令配置环境变量:
|
||||
|
||||
### 预发布环境
|
||||
```bash
|
||||
# 编辑 .env.pre 文件
|
||||
REACT_APP_AMAP_KEY=你的Key
|
||||
|
||||
# 构建
|
||||
npm run build:pre:mgnt
|
||||
```
|
||||
|
||||
### CI/CD配置
|
||||
在GitLab/Jenkins中配置环境变量:
|
||||
- `REACT_APP_AMAP_KEY` - 高德地图Key
|
||||
- `REACT_APP_DEVICE_WS_URL` - WebSocket地址
|
||||
|
||||
---
|
||||
|
||||
## ❓ 常见问题
|
||||
|
||||
**Q: 必须配置Cesium Token吗?**
|
||||
A: 不需要。Cesium基本3D功能无需Token,开箱即用。
|
||||
|
||||
**Q: 不配置Cesium Token会怎样?**
|
||||
A: 3D地图照常工作,只是不能使用Cesium Ion的高级功能(如全球地形)。
|
||||
|
||||
**Q: 如何获取高德地图Key?**
|
||||
A: 访问 https://console.amap.com/ 免费申请。
|
||||
|
||||
**Q: 高德地图需要付费吗?**
|
||||
A: 有免费额度,个人开发和测试足够使用。
|
||||
|
||||
**Q: WebSocket地址是什么?**
|
||||
A: 用于设备实时数据连接,默认使用 `ws://119.45.169.13:8848/device`
|
||||
|
||||
---
|
||||
|
||||
## 📝 总结
|
||||
|
||||
**最简配置(推荐):**
|
||||
```bash
|
||||
# .env.local
|
||||
REACT_APP_AMAP_KEY=你的高德Key
|
||||
REACT_APP_DEVICE_WS_URL=ws://119.45.169.13:8848/device
|
||||
```
|
||||
|
||||
只需这两个配置,系统即可正常运行!
|
||||
|
||||
详细配置请查看: [环境配置说明.md](环境配置说明.md)
|
||||
@@ -1,170 +0,0 @@
|
||||
# 环境配置说明
|
||||
|
||||
## 当前项目的构建命令
|
||||
|
||||
根据 `package.json`,项目有以下构建命令:
|
||||
|
||||
### 测试环境
|
||||
```bash
|
||||
npm run build:test # API: http://119.45.169.13:9900
|
||||
npm run build:test:mgnt # 管理端,API: https://socket.goflytec.com
|
||||
```
|
||||
|
||||
### 预发布环境(Pre)
|
||||
```bash
|
||||
npm run build:pre # API: http://119.45.169.13:9900
|
||||
npm run build:pre:mgnt # 管理端,API: https://local.goflytec.com,BASE: /mgnt
|
||||
```
|
||||
|
||||
### 生产环境
|
||||
```bash
|
||||
npm run build:prod # 生产环境
|
||||
npm run build:prod:mgnt # 管理端,BASE: /mgnt
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 地图配置方案
|
||||
|
||||
### 快速配置(开发/测试)
|
||||
|
||||
**步骤1:** 复制环境变量模板
|
||||
```bash
|
||||
cp .env.example .env.local
|
||||
```
|
||||
|
||||
**步骤2:** 编辑 `.env.local`,填入你的API Key
|
||||
```bash
|
||||
REACT_APP_AMAP_KEY=你的高德地图Key
|
||||
REACT_APP_MAPBOX_TOKEN=你的Mapbox Token
|
||||
REACT_APP_DEVICE_WS_URL=ws://119.45.169.13:8848/device
|
||||
```
|
||||
|
||||
**步骤3:** 启动或构建
|
||||
```bash
|
||||
# 开发环境
|
||||
npm start
|
||||
|
||||
# 构建(使用你实际的构建命令)
|
||||
npm run build:pre:mgnt
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 预发布环境配置
|
||||
|
||||
**方式1: 使用 .env.pre 文件**
|
||||
|
||||
编辑 `.env.pre` 文件:
|
||||
```bash
|
||||
REACT_APP_AMAP_KEY=你的Key
|
||||
REACT_APP_MAPBOX_TOKEN=你的Token
|
||||
REACT_APP_DEVICE_WS_URL=ws://119.45.169.13:8848/device
|
||||
```
|
||||
|
||||
然后构建:
|
||||
```bash
|
||||
npm run build:pre:mgnt
|
||||
```
|
||||
|
||||
**方式2: 命令行注入(推荐)**
|
||||
|
||||
Windows:
|
||||
```cmd
|
||||
set REACT_APP_AMAP_KEY=你的Key && set REACT_APP_MAPBOX_TOKEN=你的Token && npm run build:pre:mgnt
|
||||
```
|
||||
|
||||
Linux/Mac:
|
||||
```bash
|
||||
REACT_APP_AMAP_KEY=你的Key REACT_APP_MAPBOX_TOKEN=你的Token npm run build:pre:mgnt
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### CI/CD配置
|
||||
|
||||
**GitLab CI/CD 示例:**
|
||||
```yaml
|
||||
build:pre:
|
||||
stage: build
|
||||
only:
|
||||
- develop
|
||||
script:
|
||||
- npm ci
|
||||
- npm run build:pre:mgnt
|
||||
variables:
|
||||
REACT_APP_AMAP_KEY: $PRE_AMAP_KEY
|
||||
REACT_APP_MAPBOX_TOKEN: $PRE_MAPBOX_TOKEN
|
||||
artifacts:
|
||||
paths:
|
||||
- dist/
|
||||
```
|
||||
|
||||
在 GitLab Settings → CI/CD → Variables 中配置:
|
||||
- `PRE_AMAP_KEY`
|
||||
- `PRE_MAPBOX_TOKEN`
|
||||
|
||||
---
|
||||
|
||||
## 环境变量说明
|
||||
|
||||
### 必需配置
|
||||
- `REACT_APP_AMAP_KEY` - 高德地图API Key(必需)
|
||||
- `REACT_APP_DEVICE_WS_URL` - WebSocket服务地址(必需)
|
||||
|
||||
### 可选配置(增强功能)
|
||||
- `REACT_APP_CESIUM_TOKEN` - Cesium Ion Token(可选,用于高级3D功能)
|
||||
- ✅ **无需配置**: Cesium基本3D功能无需Token,开箱即用
|
||||
- ✅ **国内可用**: Cesium是开源的,国内访问正常
|
||||
- 仅在需要Cesium Ion高级功能(全球地形、卫星影像)时才需要Token
|
||||
|
||||
### 可选配置
|
||||
- `GATEWAY_ORIGIN` - API网关地址(已在构建命令中配置)
|
||||
- `APP_BASE` - 应用基础路径(已在构建命令中配置)
|
||||
|
||||
---
|
||||
|
||||
## API Key 申请
|
||||
|
||||
### 高德地图(必需)
|
||||
1. 访问 https://console.amap.com/
|
||||
2. 创建应用,选择"Web端(JS API)"
|
||||
3. 配置域名白名单
|
||||
4. 复制Key到环境变量
|
||||
|
||||
### Cesium Ion Token(可选 - 高级功能)
|
||||
✅ **好消息**: Cesium基本3D功能**无需Token**,开箱即用!
|
||||
|
||||
**Cesium基本功能(无需Token):**
|
||||
- ✅ 3D地球展示
|
||||
- ✅ 景区3D标记
|
||||
- ✅ 视角飞行
|
||||
- ✅ 2D/3D/哥伦布视图切换
|
||||
- ✅ 使用高德底图(国内稳定)
|
||||
|
||||
**仅需Token的高级功能(可选):**
|
||||
- 全球高精度地形
|
||||
- Cesium Ion卫星影像
|
||||
- 建筑3D Tiles
|
||||
|
||||
**如需Token:**
|
||||
1. 访问 https://cesium.com/ion/signup (国内可访问)
|
||||
2. 注册免费账号
|
||||
3. 获取Access Token
|
||||
4. 配置到 `REACT_APP_CESIUM_TOKEN`
|
||||
|
||||
**注意**: 即使不配置Token,3D地图也能正常使用!
|
||||
|
||||
---
|
||||
|
||||
## 常见问题
|
||||
|
||||
**Q: 构建后地图显示空白?**
|
||||
A: 检查环境变量是否正确注入,查看浏览器控制台错误
|
||||
|
||||
**Q: 开发环境正常,构建后不正常?**
|
||||
A: 确认构建时环境变量已设置,检查 `dist/` 中的代码是否包含正确的Key
|
||||
|
||||
---
|
||||
|
||||
**最后更新:** 2025-11-18
|
||||
@@ -1,63 +0,0 @@
|
||||
{
|
||||
"name": "react-web-next",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"copy:cesium": "node scripts/copy-cesium-assets.js",
|
||||
"prestart": "npm run copy:cesium",
|
||||
"prestart:dev": "npm run copy:cesium",
|
||||
"prestart:test": "npm run copy:cesium",
|
||||
"prestart:pre": "npm run copy:cesium",
|
||||
"prebuild": "npm run copy:cesium",
|
||||
"prebuild:test": "npm run copy:cesium",
|
||||
"prebuild:pre": "npm run copy:cesium",
|
||||
"prebuild:prod": "npm run copy:cesium",
|
||||
"prebuild:test:mgnt": "npm run copy:cesium",
|
||||
"prebuild:pre:mgnt": "npm run copy:cesium",
|
||||
"prebuild:prod:mgnt": "npm run copy:cesium",
|
||||
"start": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=dev GATEWAY_ORIGIN=http://localhost:9900 umi dev",
|
||||
"start:dev": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=dev GATEWAY_ORIGIN=http://localhost:9900 umi dev",
|
||||
"start:test": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=test GATEWAY_ORIGIN=https://test.goflytec.com umi dev",
|
||||
"start:pre": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=pre GATEWAY_ORIGIN=http://119.45.169.13:9900 umi dev",
|
||||
"build": "cross-env NODE_OPTIONS=--openssl-legacy-provider umi build",
|
||||
"build:test": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=test API_PREFIX=http://119.45.169.13:9900 umi build",
|
||||
"build:pre": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=pre API_PREFIX=http://119.45.169.13:9900 umi build",
|
||||
"build:prod": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=prod umi build",
|
||||
"build:test:mgnt": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=test APP_BASE=/mgnt API_PREFIX=https://test.goflytec.com umi build",
|
||||
"build:pre:mgnt": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=pre APP_BASE=/mgnt API_PREFIX=https://local.goflytec.com umi build",
|
||||
"build:prod:mgnt": "cross-env NODE_OPTIONS=--openssl-legacy-provider REACT_APP_ENV=prod APP_BASE=/mgnt umi build",
|
||||
"lint": "eslint --ext .ts,.tsx src",
|
||||
"tsc": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/plots": "^2.6.5",
|
||||
"@ant-design/pro-components": "1.1.1",
|
||||
"@ant-design/pro-layout": "^7.22.7",
|
||||
"antd": "^4.20.0",
|
||||
"cesium": "^1.110.0",
|
||||
"file-saver": "^2.0.5",
|
||||
"jsencrypt": "^3.5.4",
|
||||
"jszip": "^3.10.1",
|
||||
"lodash": "^4.17.21",
|
||||
"moment": "^2.29.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"spark-md5": "^3.0.2",
|
||||
"umi": "^3.5.0",
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/file-saver": "^2.0.7",
|
||||
"@types/react": "^17.0.0",
|
||||
"@types/react-dom": "^17.0.0",
|
||||
"@types/spark-md5": "^3.0.5",
|
||||
"@umijs/preset-react": "^2.1.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"typescript": "^4.5.0"
|
||||
},
|
||||
"overrides": {
|
||||
"path-to-regexp": "^3.3.0",
|
||||
"postcss": "^7.0.39",
|
||||
"@babel/runtime": "^7.26.10"
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
(占位文件)此目录用于存放静态资源(如 favicon、静态图标)。
|
||||
本项目主要通过 src/assets 引入资源;若无静态文件需求,此目录可保持为空。
|
||||
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 191 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 9.4 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 12 KiB |
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0">
|
||||
<Title>NE2_HR_LC_SR_W_DR_recolored.tif</Title>
|
||||
<Abstract></Abstract>
|
||||
<SRS>EPSG:4326</SRS>
|
||||
<BoundingBox miny="-90.00000000000000" minx="-180.00000000000000" maxy="90.00000000000000" maxx="180.00000000000000"/>
|
||||
<Origin y="-90.00000000000000" x="-180.00000000000000"/>
|
||||
<TileFormat width="256" height="256" mime-type="image/jpg" extension="jpg"/>
|
||||
<TileSets profile="geodetic">
|
||||
<TileSet href="0" units-per-pixel="0.70312500000000" order="0"/>
|
||||
<TileSet href="1" units-per-pixel="0.35156250000000" order="1"/>
|
||||
<TileSet href="2" units-per-pixel="0.17578125000000" order="2"/>
|
||||
</TileSets>
|
||||
</TileMap>
|
||||
|
Before Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 149 KiB |
|
Before Width: | Height: | Size: 164 KiB |
|
Before Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 149 KiB |
|
Before Width: | Height: | Size: 149 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |