diff --git a/zlt-web/pom.xml b/zlt-web/pom.xml index 0c037918..27e28783 100644 --- a/zlt-web/pom.xml +++ b/zlt-web/pom.xml @@ -14,6 +14,5 @@ - react-web diff --git a/zlt-web/react-web/.gitignore b/zlt-web/react-web/.gitignore deleted file mode 100644 index 785af5ed..00000000 --- a/zlt-web/react-web/.gitignore +++ /dev/null @@ -1,45 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -**/node -**/node_modules -# roadhog-api-doc ignore -/src/utils/request-temp.js -_roadhog-api-doc - -# production -**/dist - - -# misc -.DS_Store -npm-debug.log* -yarn-error.log - -/coverage -.idea -yarn.lock -package-lock.json -pnpm-lock.yaml -*bak - - -# visual studio code -.vscode -.history -*.log -functions/* -.temp/** - -# umi -.umi -.umi-production - -# screenshot -screenshot -.firebase -.eslintcache - -# maven -target -build diff --git a/zlt-web/react-web/pom.xml b/zlt-web/react-web/pom.xml deleted file mode 100644 index cd02070d..00000000 --- a/zlt-web/react-web/pom.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - zlt-web - com.zlt - 6.0.0 - - 4.0.0 - - react-web - React开发的前端(Ant Design) - - - v16.13.2 - v1.22.19 - - - - - \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/.editorconfig b/zlt-web/react-web/src/main/frontend/.editorconfig deleted file mode 100644 index 7e3649ac..00000000 --- a/zlt-web/react-web/src/main/frontend/.editorconfig +++ /dev/null @@ -1,16 +0,0 @@ -# http://editorconfig.org -root = true - -[*] -indent_style = space -indent_size = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -trim_trailing_whitespace = false - -[Makefile] -indent_style = tab diff --git a/zlt-web/react-web/src/main/frontend/.eslintignore b/zlt-web/react-web/src/main/frontend/.eslintignore deleted file mode 100644 index 8336e935..00000000 --- a/zlt-web/react-web/src/main/frontend/.eslintignore +++ /dev/null @@ -1,8 +0,0 @@ -/lambda/ -/scripts -/config -.history -public -dist -.umi -mock \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/.eslintrc.js b/zlt-web/react-web/src/main/frontend/.eslintrc.js deleted file mode 100644 index b882c20e..00000000 --- a/zlt-web/react-web/src/main/frontend/.eslintrc.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - extends: [require.resolve('@umijs/fabric/dist/eslint')], - globals: { - ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true, - page: true, - REACT_APP_ENV: true, - }, -}; diff --git a/zlt-web/react-web/src/main/frontend/.prettierignore b/zlt-web/react-web/src/main/frontend/.prettierignore deleted file mode 100644 index d17efb44..00000000 --- a/zlt-web/react-web/src/main/frontend/.prettierignore +++ /dev/null @@ -1,23 +0,0 @@ -**/*.svg -package.json -.umi -.umi-production -/dist -.dockerignore -.DS_Store -.eslintignore -*.png -*.toml -docker -.editorconfig -Dockerfile* -.gitignore -.prettierignore -LICENSE -.eslintcache -*.lock -yarn-error.log -.history -CNAME -/build -/public \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/.prettierrc.js b/zlt-web/react-web/src/main/frontend/.prettierrc.js deleted file mode 100644 index 7b597d78..00000000 --- a/zlt-web/react-web/src/main/frontend/.prettierrc.js +++ /dev/null @@ -1,5 +0,0 @@ -const fabric = require('@umijs/fabric'); - -module.exports = { - ...fabric.prettier, -}; diff --git a/zlt-web/react-web/src/main/frontend/.stylelintrc.js b/zlt-web/react-web/src/main/frontend/.stylelintrc.js deleted file mode 100644 index a1184de4..00000000 --- a/zlt-web/react-web/src/main/frontend/.stylelintrc.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - extends: [require.resolve('@umijs/fabric/dist/stylelint')], -}; diff --git a/zlt-web/react-web/src/main/frontend/Dockerfile b/zlt-web/react-web/src/main/frontend/Dockerfile deleted file mode 100644 index d559c4c4..00000000 --- a/zlt-web/react-web/src/main/frontend/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -# 使用轻量级的 nginx 镜像 -FROM nginx:alpine - -# 复制构建后的文件到 nginx 目录 -COPY dist/ /usr/share/nginx/html/ - -# 复制 nginx 配置文件 -COPY nginx.conf /etc/nginx/conf.d/default.conf - -# 设置正确的权限 -RUN chown -R nginx:nginx /usr/share/nginx/html && \ - chmod -R 755 /usr/share/nginx/html - -# 暴露 8080 端口 -EXPOSE 8080 \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/README.md b/zlt-web/react-web/src/main/frontend/README.md deleted file mode 100644 index 71a9e809..00000000 --- a/zlt-web/react-web/src/main/frontend/README.md +++ /dev/null @@ -1,59 +0,0 @@ -# Central-Platform UI - -这个项目是基于`企业级微服务框架`后端 API 所开发的前端代码。 - -技术采用 - -## Environment Prepare - -Install `node_modules`: - -```bash -npm install -``` - -or - -```bash -yarn -``` - -## Provided Scripts - -Ant Design Pro provides some useful script to help you quick start and build with web project, code style check and test. - -Scripts provided in `package.json`. It's safe to modify or add additional script: - -### Start project - -```bash -npm start -``` - -### Build project - -```bash -npm run build -``` - -### Check code style - -```bash -npm run lint -``` - -You can also use script to auto fix some lint error: - -```bash -npm run lint:fix -``` - -### Test code - -```bash -npm test -``` - -## More - -You can view full document on our [official website](https://pro.ant.design). And welcome any feedback in our [github](https://github.com/ant-design/ant-design-pro). diff --git a/zlt-web/react-web/src/main/frontend/WebSocket接口协议文档.md b/zlt-web/react-web/src/main/frontend/WebSocket接口协议文档.md deleted file mode 100644 index deb6fc90..00000000 --- a/zlt-web/react-web/src/main/frontend/WebSocket接口协议文档.md +++ /dev/null @@ -1,606 +0,0 @@ -# WebSocket接口协议文档 - -## 概述 - -本文档描述了设备运维平台中使用的WebSocket接口协议,用于实时设备监控、控制和数据通信。 - -## 服务器信息 - -- **WebSocket服务器地址**: `ws://119.45.169.13:8848/messaging/{token}` -- **Token获取地址**: `http://119.45.169.13:9900/api-device/token/query` -- **Token有效期**: 默认3600秒(1小时),可配置 - -## 连接流程 - -### 1. 获取Token - -**请求方式**: GET -**URL**: `/api-device/token/query` -**参数**: -- `expires`: Token有效期(秒),可选,默认3600 - -**响应格式**: -```json -{ - "resp_code": 0, - "resp_msg": "success", - "data": { - "result": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", - "message": "success", - "status": 200, - "timestamp": 1640995200000, - "expires": 3600 - } -} -``` - -### 2. 建立WebSocket连接 - -**连接URL**: `ws://119.45.169.13:8848/messaging/{token}` - -**连接状态**: -- `WebSocket.OPEN`: 连接已建立 -- `WebSocket.CLOSED`: 连接已关闭 -- `WebSocket.CONNECTING`: 正在连接 -- `WebSocket.CLOSING`: 正在关闭 - -## 消息格式 - -### 通用消息结构 - -所有WebSocket消息都遵循以下JSON格式: - -```json -{ - "type": "消息类型", - "topic": "主题路径", - "parameter": { - "messageType": "消息类型", - "properties": { - "method": "方法名", - "data": {} - }, - "headers": { - "async": false - } - }, - "id": "唯一标识符" -} -``` - -## 消息类型 - -### 1. 订阅消息 (sub) - -用于订阅设备状态、属性上报、事件等消息。 - -#### 设备属性上报订阅 -```json -{ - "type": "sub", - "topic": "/device/*/*/message/property/report", - "parameter": {}, - "id": "sub_property_all_{timestamp}" -} -``` - -#### 设备事件订阅 -```json -{ - "type": "sub", - "topic": "/device/*/*/message/event/fire_alarm", - "parameter": {}, - "id": "sub_event_all_{timestamp}" -} -``` - -#### 设备上线状态订阅 -```json -{ - "type": "sub", - "topic": "/device/*/*/online", - "parameter": {}, - "id": "sub_online_all_{timestamp}" -} -``` - -#### 设备离线状态订阅 -```json -{ - "type": "sub", - "topic": "/device/*/*/offline", - "parameter": {}, - "id": "sub_offline_all_{timestamp}" -} -``` - -#### 指定设备订阅 -```json -{ - "type": "sub", - "topic": "/device/*/{deviceSn}/message/property/report", - "parameter": {}, - "id": "property-sub-{timestamp}-{deviceSn}" -} -``` - -### 2. 取消订阅消息 (unsub) - -用于取消已订阅的消息。 - -```json -{ - "type": "unsub", - "id": "订阅ID" -} -``` - -### 3. 设备控制消息 - -用于向设备发送控制指令。 - -#### 通用控制指令 -```json -{ - "type": "sub", - "topic": "/device-message-sender/D-Dock2/{deviceSn}", - "parameter": { - "messageType": "WRITE_PROPERTY", - "properties": { - "method": "方法名", - "data": {} - }, - "headers": { - "async": false - } - }, - "id": "control_{method}_{deviceSn}_{timestamp}" -} -``` - -#### 摇杆控制指令 -```json -{ - "type": "sub", - "topic": "/device-message-sender/D-Dock2/{deviceSn}", - "parameter": { - "messageType": "WRITE_PROPERTY", - "properties": { - "method": "stick_control", - "data": { - "roll": 1024, // 右手左右控制(范围:0-2048,1024为中立位) - "pitch": 1024, // 右手上下控制(范围:0-2048,1024为中立位) - "throttle": 1024, // 左手上下控制(范围:0-2048,1024为中立位) - "yaw": 1024, // 左手左右控制(范围:1024±100) - "gimbal_pitch": 1024 // 云台画面上下划(范围:0-2048,1024为中立位) - } - }, - "headers": { - "async": false - } - }, - "id": "control_stick_control_{deviceSn}_{timestamp}" -} -``` - -### 4. 心跳消息 (ping/pong) - -用于保持连接活跃。 - -**发送心跳**: -```json -{ - "type": "ping", - "timestamp": 1640995200000 -} -``` - -**心跳响应**: -```json -{ - "type": "pong" -} -``` - -## 响应消息 - -### 1. 订阅结果响应 - -```json -{ - "type": "result", - "topic": "/device/{productId}/{deviceSn}/message/property/report", - "payload": { - "headers": { - "deviceName": "设备名称", - "productName": "产品名称", - "productId": "产品ID" - }, - "messageId": "消息ID", - "deviceId": "设备ID", - "timestamp": 1640995200000, - "data": { - "data": { - // 环境数据 - "temperature": 25.5, - "humidity": 60.2, - "wind_speed": 3.2, - "rainfall": 0.0, - "environment_temperature": 26.1, - "latitude": 39.9042, - "longitude": 116.4074, - "height": 100.5, - "heading": 180.0, - - // 设备状态 - "drone_charge_state": { - "capacity_percent": 85, - "state": 1 - }, - "position_state": { - "is_calibration": 0, - "rtk_number": 8, - "gps_number": 12, - "is_fixed": 1, - "quality": 95 - }, - "network_state": { - "rate": 1000, - "type": 1, - "quality": 90 - }, - "drone_in_dock": 1, - - // 飞行任务数据 - "flighttask_step_code": 0, - "sdr": { - "frequency_band": 2, - "up_quality": 95, - "down_quality": 92 - }, - "tilt_angle": { - "valid": 1, - "value": 0.5 - }, - "wireless_link": { - "sdr_link_state": 1, - "4g_freq_band": 1, - "4g_quality": 85, - "link_workmode": 1, - "sdr_quality": 90, - "4g_uav_quality": 88, - "sdr_freq_band": 2, - "4g_link_state": 1, - "4g_gnd_quality": 87, - "dongle_number": 1 - } - }, - "deviceId": "设备ID", - "timestamp": 1640995200000 - }, - "messageType": "REPORT_PROPERTY" - } -} -``` - -### 2. 设备事件响应 - -```json -{ - "type": "result", - "topic": "/device/{productId}/{deviceSn}/message/event/fire_alarm", - "payload": { - "headers": { - "deviceName": "设备名称", - "productName": "产品名称", - "productId": "产品ID" - }, - "messageId": "消息ID", - "deviceId": "设备ID", - "timestamp": 1640995200000, - "event": "fire_alarm", - "data": { - "alarm_level": 1, - "alarm_type": "smoke", - "location": "building_1", - "description": "烟雾报警" - } - } -} -``` - -### 3. 设备状态响应 - -#### 设备上线 -```json -{ - "type": "result", - "topic": "/device/{productId}/{deviceSn}/online", - "payload": { - "deviceId": "设备ID", - "timestamp": 1640995200000, - "status": "online" - } -} -``` - -#### 设备离线 -```json -{ - "type": "result", - "topic": "/device/{productId}/{deviceSn}/offline", - "payload": { - "deviceId": "设备ID", - "timestamp": 1640995200000, - "status": "offline" - } -} -``` - -## 主题路径说明 - -### 主题格式 - -``` -/device/{productId}/{deviceSn}/{messageType}/{eventType} -``` - -### 主题示例 - -- `/device/D-Dock2/DEVICE001/message/property/report` - 设备属性上报 -- `/device/D-Dock2/DEVICE001/message/event/fire_alarm` - 火警事件 -- `/device/D-Dock2/DEVICE001/online` - 设备上线 -- `/device/D-Dock2/DEVICE001/offline` - 设备离线 - -### 通配符使用 - -- `*` - 匹配任意字符串 -- `/device/*/*/message/property/report` - 订阅所有设备的属性上报 -- `/device/*/*/online` - 订阅所有设备的上线状态 - -## 错误处理 - -### 连接错误 - -当WebSocket连接出现错误时,系统会自动尝试重连: - -1. 连接断开后等待5秒 -2. 自动重新获取Token -3. 重新建立WebSocket连接 -4. 重新订阅之前的消息 - -### 消息错误 - -如果消息格式错误或处理失败,服务器会返回错误响应: - -```json -{ - "type": "error", - "id": "消息ID", - "error": { - "code": "ERROR_CODE", - "message": "错误描述" - } -} -``` - -## 最佳实践 - -### 1. 连接管理 - -- 实现自动重连机制 -- 定期发送心跳保持连接 -- 在页面卸载时正确关闭连接 - -### 2. 消息处理 - -- 为每个消息生成唯一的ID -- 实现消息超时处理 -- 正确处理异步消息 - -### 3. 错误处理 - -- 实现完善的错误处理机制 -- 记录错误日志便于调试 -- 提供用户友好的错误提示 - -### 4. 性能优化 - -- 合理使用通配符订阅 -- 及时取消不需要的订阅 -- 避免频繁发送控制指令 - -## 示例代码 - -### JavaScript/TypeScript 示例 - -```typescript -class WebSocketClient { - private ws: WebSocket | null = null; - private token: string = ''; - private reconnectTimer: NodeJS.Timeout | null = null; - private heartbeatTimer: NodeJS.Timeout | null = null; - - // 获取Token - async getToken(): Promise { - const response = await fetch('/api-device/token/query?expires=3600'); - const data = await response.json(); - if (data.resp_code === 0) { - return data.data.result; - } - throw new Error('获取Token失败'); - } - - // 连接WebSocket - async connect(): Promise { - try { - this.token = await this.getToken(); - const wsUrl = `ws://119.45.169.13:8848/messaging/${this.token}`; - - this.ws = new WebSocket(wsUrl); - - this.ws.onopen = () => { - console.log('WebSocket连接已建立'); - this.startHeartbeat(); - this.subscribeToMessages(); - }; - - this.ws.onmessage = (event) => { - const data = JSON.parse(event.data); - this.handleMessage(data); - }; - - this.ws.onclose = () => { - console.log('WebSocket连接已关闭'); - this.scheduleReconnect(); - }; - - this.ws.onerror = (error) => { - console.error('WebSocket错误:', error); - }; - } catch (error) { - console.error('连接失败:', error); - this.scheduleReconnect(); - } - } - - // 发送消息 - sendMessage(message: any): void { - if (this.ws && this.ws.readyState === WebSocket.OPEN) { - this.ws.send(JSON.stringify(message)); - } - } - - // 订阅消息 - subscribeToMessages(): void { - const subscriptions = [ - { - type: 'sub', - topic: '/device/*/*/message/property/report', - id: `sub_property_${Date.now()}` - }, - { - type: 'sub', - topic: '/device/*/*/online', - id: `sub_online_${Date.now()}` - } - ]; - - subscriptions.forEach(sub => this.sendMessage(sub)); - } - - // 发送控制指令 - sendControlCommand(deviceSn: string, method: string, data: any = {}): void { - const message = { - type: 'sub', - topic: `/device-message-sender/D-Dock2/${deviceSn}`, - parameter: { - messageType: 'WRITE_PROPERTY', - properties: { method, data }, - headers: { async: false } - }, - id: `control_${method}_${deviceSn}_${Date.now()}` - }; - - this.sendMessage(message); - } - - // 心跳检测 - startHeartbeat(): void { - this.heartbeatTimer = setInterval(() => { - this.sendMessage({ - type: 'ping', - timestamp: Date.now() - }); - }, 30000); - } - - // 重连机制 - scheduleReconnect(): void { - if (this.reconnectTimer) { - clearTimeout(this.reconnectTimer); - } - - this.reconnectTimer = setTimeout(() => { - console.log('尝试重新连接...'); - this.connect(); - }, 5000); - } - - // 处理消息 - handleMessage(data: any): void { - switch (data.type) { - case 'result': - this.handleResultMessage(data); - break; - case 'pong': - console.log('收到心跳响应'); - break; - case 'error': - console.error('收到错误消息:', data.error); - break; - default: - console.log('收到未知消息:', data); - } - } - - // 处理结果消息 - handleResultMessage(data: any): void { - const { topic, payload } = data; - - if (topic.includes('/message/property/report')) { - console.log('设备属性上报:', payload); - } else if (topic.includes('/online')) { - console.log('设备上线:', payload); - } else if (topic.includes('/offline')) { - console.log('设备离线:', payload); - } - } - - // 关闭连接 - disconnect(): void { - if (this.heartbeatTimer) { - clearInterval(this.heartbeatTimer); - } - if (this.reconnectTimer) { - clearTimeout(this.reconnectTimer); - } - if (this.ws) { - this.ws.close(); - } - } -} - -// 使用示例 -const wsClient = new WebSocketClient(); -wsClient.connect(); - -// 发送控制指令 -wsClient.sendControlCommand('DEVICE001', 'stick_control', { - roll: 1024, - pitch: 1024, - throttle: 1024, - yaw: 1024 -}); - -// 页面卸载时关闭连接 -window.addEventListener('beforeunload', () => { - wsClient.disconnect(); -}); -``` - -## 注意事项 - -1. **Token管理**: Token有过期时间,需要定期刷新 -2. **连接稳定性**: 实现自动重连和心跳机制 -3. **消息处理**: 正确处理各种类型的消息 -4. **错误处理**: 完善的错误处理机制 -5. **资源清理**: 及时清理定时器和连接 -6. **安全性**: 确保Token的安全性,不要在客户端存储敏感信息 - -## 更新日志 - -- **v1.0.0**: 初始版本,包含基本的连接、订阅、控制功能 -- **v1.1.0**: 添加心跳机制和自动重连 -- **v1.2.0**: 完善错误处理和消息格式 -- **v1.3.0**: 添加设备状态监控和事件处理 \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/build.bat b/zlt-web/react-web/src/main/frontend/build.bat deleted file mode 100644 index 10da9ff7..00000000 --- a/zlt-web/react-web/src/main/frontend/build.bat +++ /dev/null @@ -1 +0,0 @@ -npm run build \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/config/config.dev.ts b/zlt-web/react-web/src/main/frontend/config/config.dev.ts deleted file mode 100644 index ab0e590f..00000000 --- a/zlt-web/react-web/src/main/frontend/config/config.dev.ts +++ /dev/null @@ -1,15 +0,0 @@ -// https://umijs.org/config/ -import { defineConfig } from 'umi'; - -export default defineConfig({ - plugins: [ - // https://github.com/zthxxx/react-dev-inspector - 'react-dev-inspector/plugins/umi/react-inspector', - ], - // https://github.com/zthxxx/react-dev-inspector#inspector-loader-props - inspectorConfig: { - exclude: [], - babelPlugins: [], - babelOptions: {}, - }, -}); diff --git a/zlt-web/react-web/src/main/frontend/config/config.ts b/zlt-web/react-web/src/main/frontend/config/config.ts deleted file mode 100644 index 3879f6bc..00000000 --- a/zlt-web/react-web/src/main/frontend/config/config.ts +++ /dev/null @@ -1,80 +0,0 @@ -// https://umijs.org/config/ -import { defineConfig } from 'umi'; -import { join } from 'path'; - -import defaultSettings from './defaultSettings'; -import proxy from './proxy'; -import routes from './routes'; - -const { REACT_APP_ENV } = process.env; - -export default defineConfig({ - hash: true, - publicPath:"./", - antd: {}, - dva: { - hmr: true, - }, - layout: { - // https://umijs.org/zh-CN/plugins/plugin-layout - locale: false, - siderWidth: 208, - ...defaultSettings, - }, - // https://umijs.org/zh-CN/plugins/plugin-locale - locale: { - // default zh-CN - default: 'zh-CN', - antd: true, - // default true, when it is true, will use `navigator.language` overwrite default - baseNavigator: true, - }, - dynamicImport: { - loading: '@ant-design/pro-layout/es/PageLoading', - }, - targets: { - ie: 11, - }, - // umi routes: https://umijs.org/docs/routing - routes, - access: {}, - // Theme for antd: https://ant.design/docs/react/customize-theme-cn - theme: { - // 如果不想要 configProvide 动态设置主题需要把这个设置为 default - // 只有设置为 variable, 才能使用 configProvide 动态设置主色调 - // https://ant.design/docs/react/customize-theme-variable-cn - 'root-entry-name': 'variable', - }, - // esbuild is father build tools - // https://umijs.org/plugins/plugin-esbuild - esbuild: {}, - title: false, - ignoreMomentLocale: true, - proxy: proxy[REACT_APP_ENV || 'dev'], - manifest: { - basePath: '/', - }, - // Fast Refresh 热更新 - fastRefresh: {}, - openAPI: [ - { - requestLibPath: "import { request } from 'umi'", - // 或者使用在线的版本 - // schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json" - schemaPath: join(__dirname, 'oneapi.json'), - mock: false, - }, - { - requestLibPath: "import { request } from 'umi'", - schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json', - projectName: 'swagger', - }, - ], - nodeModulesTransform: { type: 'none' }, - mfsu: false, - webpack5: {}, - exportStatic: {}, - history: { - type: 'hash', - }, -}); diff --git a/zlt-web/react-web/src/main/frontend/config/defaultSettings.ts b/zlt-web/react-web/src/main/frontend/config/defaultSettings.ts deleted file mode 100644 index 6ea9bca8..00000000 --- a/zlt-web/react-web/src/main/frontend/config/defaultSettings.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Settings as LayoutSettings } from '@ant-design/pro-components'; - -const Settings: LayoutSettings & { - pwa?: boolean; - logo?: string; -} = { - navTheme: 'dark', - // 拂晓蓝 - primaryColor: '#1890ff', - layout: 'mix', - contentWidth: 'Fluid', - fixedHeader: false, - fixSiderbar: true, - colorWeak: false, - title: 'G-Fly', - pwa: false, - logo: './logo.png', - iconfontUrl: '', -}; - -export default Settings; diff --git a/zlt-web/react-web/src/main/frontend/config/oneapi.json b/zlt-web/react-web/src/main/frontend/config/oneapi.json deleted file mode 100644 index 78e6b3f7..00000000 --- a/zlt-web/react-web/src/main/frontend/config/oneapi.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "zlt-web", - "version": "1.0.0" - }, - "servers": [ - { - "url": "http://localhost:8000/" - }, - { - "url": "https://localhost:8000/" - } - ], - "paths": {} -} diff --git a/zlt-web/react-web/src/main/frontend/config/proxy.ts b/zlt-web/react-web/src/main/frontend/config/proxy.ts deleted file mode 100644 index 8022a190..00000000 --- a/zlt-web/react-web/src/main/frontend/config/proxy.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * 在生产环境 代理是无法生效的,所以这里没有生产环境的配置 - * ------------------------------- - * The agent cannot take effect in the production environment - * so there is no configuration of the production environment - * For details, please see - * https://pro.ant.design/docs/deploy - */ - export default { - dev: { - '/api-uaa/': { - // target: 'http://119.45.169.13:9900', - target: 'http://local.goflytec.com:9900', - changeOrigin: true, - }, - '/api-user/': { - // target: 'http://119.45.169.13:9900', - target: 'http://local.goflytec.com:9900', - changeOrigin: true, - }, - '/api-log/': { - // target: 'http://119.45.169.13:9900', - target: 'http://local.goflytec.com:9900', - changeOrigin: true, - }, - '/api-search/': { - // target: 'http://119.45.169.13:9900', - target: 'http://local.goflytec.com:9900', - changeOrigin: true, - }, - '/api-generator/': { - // target: 'http://119.45.169.13:9900', - target: 'http://local.goflytec.com:9900', - changeOrigin: true, - }, - '/api-file/': { - // target: 'http://119.45.169.13:9900', - target: 'http://local.goflytec.com:9900', - changeOrigin: true, - }, - '/api-order/': { - // target: 'http://119.45.169.13:9900', - target: 'http://local.goflytec.com:9900', - changeOrigin: true, - }, - '/api-device/': { - //target: 'http://119.45.169.13:9900', - target: 'http://local.goflytec.com:9900', - changeOrigin: true, - }, - }, - test: { - '/api/': { - target: 'https://proapi.azurewebsites.net', - changeOrigin: true, - pathRewrite: { '^': '' }, - }, - }, - pre: { - '/api/': { - target: 'your pre url', - changeOrigin: true, - pathRewrite: { '^': '' }, - }, - }, -}; diff --git a/zlt-web/react-web/src/main/frontend/config/routes.ts b/zlt-web/react-web/src/main/frontend/config/routes.ts deleted file mode 100644 index a0f6e860..00000000 --- a/zlt-web/react-web/src/main/frontend/config/routes.ts +++ /dev/null @@ -1,237 +0,0 @@ -export default [ - { - path: '/user', - layout: false, - routes: [ - { - name: 'login', - path: '/user/login', - component: './user/Login', - }, - { - component: './404', - }, - ], - }, - { - path: '/system', - routes: [ - { - path: '/system/user.html', - component: './system/User', - }, - { - path: '/system/tenant.html', - component: './system/TenantManage', - }, - { - path: '/system/role.html', - component: './system/Role', - }, - { - path: '/system/tokens.html', - component: './system/Token', - }, - { - path: '/system/menus.html', - component: './system/Menu', - }, - { - path: '/system/myInfo.html', - component: './system/UserInfo', - }, - { - path: '/system/miniApp.html', - component: './system/MiniApp', - }, - ], - }, - { - path: '/files', - routes: [ - { - path: '/files/files.html', - component: './files/File', - } - ], - }, - { - path: '/device', - routes: [ - { - path: '/device/wayline.html', - component: './device/Wayline', - }, - { - path: '/device/device.html', - component: './device/Device', - }, - ] - }, - { - path: '/message', - routes: [ - { - path: '/message/message.html', - component: './message/index', - } - ], - }, - { - path: '/orders', - routes: [ - { - path: '/orders/order.html', - component: './orders/Order', - }, - { - path: '/orders/orderFiles.html', - component: './orders/OrderFile', - }, - { - path: '/orders/tourism.html', - component: './orders/Tourism', - }, - { - path: '/orders/qrcode.html', - component: './orders/Qrcode', - }, - { - path: '/orders/tourismFile.html', - component: './orders/TourismFile', - }, - { - path: '/orders/homeCarousel.html', - component: './orders/HomeCarousel', - }, - { - path: '/orders/refund.html', - component: './orders/Refund', - }, - { - path: '/orders/statistics.html', - component: './orders/statistics', - }, - { - path: '/orders/profitSharing.html', - component: './orders/ProfitSharing', - }, - { - path: '/orders/profit-sharing/statistics.html', - component: './orders/ProfitSharing/Statistics', - }, - { - path: '/orders/videoTemplate.html', - component: './orders/VideoTemplate', - }, - { - path: '/orders/editTask.html', - component: './orders/EditTask', - }, - { - path: '/orders/wxMessage.html', - component: './orders/WxMessage', - }, - ], - }, - { - path: '/search', - routes: [ - { - path: '/search/index_manager.html', - component: './search/Index', - }, - { - path: '/search/user_search.html', - component: './search/User', - }, - ], - }, - { - path: '/log', - routes: [ - { - path: '/log/sysLog.html', - component: './log/SysLog', - }, - { - path: '/log/auditLog.html', - component: './log/AuditLog', - }, - { - path: '/log/slowQueryLog.html', - component: './log/SlowSqlLog', - }, - ], - }, - { - path: '/attestation/app.html', - component: './system/App', - }, - { - path: '/generator/list.html', - component: './system/Generator', - }, - { - path: '/welcome', - name: 'welcome', - icon: 'smile', - component: './Welcome', - }, - { - path: '/', - redirect: '/welcome', - }, - { - path: '/orders/edit-task', - name: '剪辑任务管理', - icon: 'VideoCameraOutlined', - component: './orders/EditTask', - }, - { - path: '/device-ops', - name: '设备运维', - icon: 'monitor', - routes: [ - { - path: '/device-ops/device.html', - name: '设备管理', - component: './device-ops/device', - }, - { - path: '/device-ops/map-dashboard.html', - name: '地图仪表板', - component: './device-ops/map-dashboard', - }, - { - path: '/device-ops/device/:id', - name: '设备详情', - component: './device-ops/device/detail', - hideInMenu: true, - }, - { - path: '/device-ops/group.html', - name: '分组管理', - component: './device-ops/group', - }, - { - path: '/device-ops/maintenance.html', - name: '运维管理', - component: './device-ops/maintenance', - }, - { - path: '/device-ops/monitor.html', - name: '设备监控', - component: './device-ops/monitor', - }, - { - path: '/device-ops/statistics.html', - name: '统计分析', - component: './device-ops/statistics', - }, - ], - }, - { - component: './404', - }, -]; diff --git a/zlt-web/react-web/src/main/frontend/deploy.sh b/zlt-web/react-web/src/main/frontend/deploy.sh deleted file mode 100644 index ee875270..00000000 --- a/zlt-web/react-web/src/main/frontend/deploy.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -echo "开始部署前端项目..." - -# 首先构建项目 -echo "构建前端项目..." -npm run build - -# 检查构建是否成功 -if [ ! -d "dist" ]; then - echo "错误:dist 目录不存在,构建可能失败" - exit 1 -fi - -# 检查必要文件 -if [ ! -f "dist/index.html" ]; then - echo "错误:index.html 不存在,构建可能不完整" - exit 1 -fi - -echo "开始 Docker 部署..." - -# 停止并删除旧容器 -docker compose down - -# 清理旧的构建缓存 -docker builder prune -f - -# 重新构建并启动 -docker compose up -d --build - -# 检查容器状态 -docker compose ps - -# 验证部署 -echo "验证部署..." -curl -I http://localhost:8080 - -echo "部署完成!项目已启动在 8080 端口" - -# 显示容器日志 -docker compose logs frontend - -# 进入容器检查文件 -docker exec frontend ls -la /usr/share/nginx/html - -# 检查 nginx 配置 -docker exec frontend nginx -t - -# 查看 nginx 日志 -docker exec frontend cat /var/log/nginx/error.log \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/dist.zip b/zlt-web/react-web/src/main/frontend/dist.zip deleted file mode 100644 index e16e8acb..00000000 Binary files a/zlt-web/react-web/src/main/frontend/dist.zip and /dev/null differ diff --git a/zlt-web/react-web/src/main/frontend/docker-compose.yml b/zlt-web/react-web/src/main/frontend/docker-compose.yml deleted file mode 100644 index 5c0c1a8b..00000000 --- a/zlt-web/react-web/src/main/frontend/docker-compose.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: '3' -services: - frontend: - build: - context: . - dockerfile: Dockerfile - container_name: frontend - ports: - - "8080:8080" - volumes: - - ./nginx.conf:/etc/nginx/conf.d/default.conf - restart: always - networks: - - app-network - -networks: - app-network: - driver: bridge \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/install_node_modules.bat b/zlt-web/react-web/src/main/frontend/install_node_modules.bat deleted file mode 100644 index b66c116a..00000000 --- a/zlt-web/react-web/src/main/frontend/install_node_modules.bat +++ /dev/null @@ -1 +0,0 @@ -npm install \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/jest.config.js b/zlt-web/react-web/src/main/frontend/jest.config.js deleted file mode 100644 index 47295738..00000000 --- a/zlt-web/react-web/src/main/frontend/jest.config.js +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = { - testURL: 'http://localhost:8000', - verbose: false, - extraSetupFiles: ['./tests/setupTests.js'], - globals: { - ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: false, - localStorage: null, - }, -}; diff --git a/zlt-web/react-web/src/main/frontend/jsconfig.json b/zlt-web/react-web/src/main/frontend/jsconfig.json deleted file mode 100644 index 197bee5d..00000000 --- a/zlt-web/react-web/src/main/frontend/jsconfig.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "compilerOptions": { - "jsx": "react-jsx", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "baseUrl": ".", - "paths": { - "@/*": ["./src/*"] - } - } -} diff --git a/zlt-web/react-web/src/main/frontend/mock/listTableList.ts b/zlt-web/react-web/src/main/frontend/mock/listTableList.ts deleted file mode 100644 index 08ed86de..00000000 --- a/zlt-web/react-web/src/main/frontend/mock/listTableList.ts +++ /dev/null @@ -1,174 +0,0 @@ -import { Request, Response } from 'express'; -import moment from 'moment'; -import { parse } from 'url'; - -// mock tableListDataSource -const genList = (current: number, pageSize: number) => { - const tableListDataSource: API.RuleListItem[] = []; - - for (let i = 0; i < pageSize; i += 1) { - const index = (current - 1) * 10 + i; - tableListDataSource.push({ - key: index, - disabled: i % 6 === 0, - href: 'https://ant.design', - avatar: [ - 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png', - 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png', - ][i % 2], - name: `TradeCode ${index}`, - owner: '曲丽丽', - desc: '这是一段描述', - callNo: Math.floor(Math.random() * 1000), - status: Math.floor(Math.random() * 10) % 4, - updatedAt: moment().format('YYYY-MM-DD'), - createdAt: moment().format('YYYY-MM-DD'), - progress: Math.ceil(Math.random() * 100), - }); - } - tableListDataSource.reverse(); - return tableListDataSource; -}; - -let tableListDataSource = genList(1, 100); - -function getRule(req: Request, res: Response, u: string) { - let realUrl = u; - if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') { - realUrl = req.url; - } - const { current = 1, pageSize = 10 } = req.query; - const params = parse(realUrl, true).query as unknown as API.PageParams & - API.RuleListItem & { - sorter: any; - filter: any; - }; - - let dataSource = [...tableListDataSource].slice( - ((current as number) - 1) * (pageSize as number), - (current as number) * (pageSize as number), - ); - if (params.sorter) { - const sorter = JSON.parse(params.sorter); - dataSource = dataSource.sort((prev, next) => { - let sortNumber = 0; - Object.keys(sorter).forEach((key) => { - if (sorter[key] === 'descend') { - if (prev[key] - next[key] > 0) { - sortNumber += -1; - } else { - sortNumber += 1; - } - return; - } - if (prev[key] - next[key] > 0) { - sortNumber += 1; - } else { - sortNumber += -1; - } - }); - return sortNumber; - }); - } - if (params.filter) { - const filter = JSON.parse(params.filter as any) as { - [key: string]: string[]; - }; - if (Object.keys(filter).length > 0) { - dataSource = dataSource.filter((item) => { - return Object.keys(filter).some((key) => { - if (!filter[key]) { - return true; - } - if (filter[key].includes(`${item[key]}`)) { - return true; - } - return false; - }); - }); - } - } - - if (params.name) { - dataSource = dataSource.filter((data) => data?.name?.includes(params.name || '')); - } - const result = { - data: dataSource, - total: tableListDataSource.length, - success: true, - pageSize, - current: parseInt(`${params.current}`, 10) || 1, - }; - - return res.json(result); -} - -function postRule(req: Request, res: Response, u: string, b: Request) { - let realUrl = u; - if (!realUrl || Object.prototype.toString.call(realUrl) !== '[object String]') { - realUrl = req.url; - } - - const body = (b && b.body) || req.body; - const { method, name, desc, key } = body; - - switch (method) { - /* eslint no-case-declarations:0 */ - case 'delete': - tableListDataSource = tableListDataSource.filter((item) => key.indexOf(item.key) === -1); - break; - case 'post': - (() => { - const i = Math.ceil(Math.random() * 10000); - const newRule: API.RuleListItem = { - key: tableListDataSource.length, - href: 'https://ant.design', - avatar: [ - 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png', - 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png', - ][i % 2], - name, - owner: '曲丽丽', - desc, - callNo: Math.floor(Math.random() * 1000), - status: Math.floor(Math.random() * 10) % 2, - updatedAt: moment().format('YYYY-MM-DD'), - createdAt: moment().format('YYYY-MM-DD'), - progress: Math.ceil(Math.random() * 100), - }; - tableListDataSource.unshift(newRule); - return res.json(newRule); - })(); - return; - - case 'update': - (() => { - let newRule = {}; - tableListDataSource = tableListDataSource.map((item) => { - if (item.key === key) { - newRule = { ...item, desc, name }; - return { ...item, desc, name }; - } - return item; - }); - return res.json(newRule); - })(); - return; - default: - break; - } - - const result = { - list: tableListDataSource, - pagination: { - total: tableListDataSource.length, - }, - }; - - res.json(result); -} - -export default { - 'GET /api/rule': getRule, - 'POST /api/rule': postRule, -}; diff --git a/zlt-web/react-web/src/main/frontend/mock/notices.ts b/zlt-web/react-web/src/main/frontend/mock/notices.ts deleted file mode 100644 index 732dd584..00000000 --- a/zlt-web/react-web/src/main/frontend/mock/notices.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { Request, Response } from 'express'; - -const getNotices = (req: Request, res: Response) => { - res.json({ - data: [ - { - id: '000000001', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', - title: '你收到了 14 份新周报', - datetime: '2017-08-09', - type: 'notification', - }, - { - id: '000000002', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/OKJXDXrmkNshAMvwtvhu.png', - title: '你推荐的 曲妮妮 已通过第三轮面试', - datetime: '2017-08-08', - type: 'notification', - }, - { - id: '000000003', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/kISTdvpyTAhtGxpovNWd.png', - title: '这种模板可以区分多种通知类型', - datetime: '2017-08-07', - read: true, - type: 'notification', - }, - { - id: '000000004', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/GvqBnKhFgObvnSGkDsje.png', - title: '左侧图标用于区分不同的类型', - datetime: '2017-08-07', - type: 'notification', - }, - { - id: '000000005', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ThXAXghbEsBCCSDihZxY.png', - title: '内容不要超过两行字,超出时自动截断', - datetime: '2017-08-07', - type: 'notification', - }, - { - id: '000000006', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', - title: '曲丽丽 评论了你', - description: '描述信息描述信息描述信息', - datetime: '2017-08-07', - type: 'message', - clickClose: true, - }, - { - id: '000000007', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', - title: '朱偏右 回复了你', - description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', - datetime: '2017-08-07', - type: 'message', - clickClose: true, - }, - { - id: '000000008', - avatar: 'https://gw.alipayobjects.com/zos/rmsportal/fcHMVNCjPOsbUGdEduuv.jpeg', - title: '标题', - description: '这种模板用于提醒谁与你发生了互动,左侧放『谁』的头像', - datetime: '2017-08-07', - type: 'message', - clickClose: true, - }, - { - id: '000000009', - title: '任务名称', - description: '任务需要在 2017-01-12 20:00 前启动', - extra: '未开始', - status: 'todo', - type: 'event', - }, - { - id: '000000010', - title: '第三方紧急代码变更', - description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', - extra: '马上到期', - status: 'urgent', - type: 'event', - }, - { - id: '000000011', - title: '信息安全考试', - description: '指派竹尔于 2017-01-09 前完成更新并发布', - extra: '已耗时 8 天', - status: 'doing', - type: 'event', - }, - { - id: '000000012', - title: 'ABCD 版本发布', - description: '冠霖提交于 2017-01-06,需在 2017-01-07 前完成代码变更任务', - extra: '进行中', - status: 'processing', - type: 'event', - }, - ], - }); -}; - -export default { - 'GET /api/notices': getNotices, -}; diff --git a/zlt-web/react-web/src/main/frontend/mock/route.ts b/zlt-web/react-web/src/main/frontend/mock/route.ts deleted file mode 100644 index 418d10f1..00000000 --- a/zlt-web/react-web/src/main/frontend/mock/route.ts +++ /dev/null @@ -1,5 +0,0 @@ -export default { - '/api/auth_routes': { - '/form/advanced-form': { authority: ['admin', 'user'] }, - }, -}; diff --git a/zlt-web/react-web/src/main/frontend/mock/user.ts b/zlt-web/react-web/src/main/frontend/mock/user.ts deleted file mode 100644 index 75edd340..00000000 --- a/zlt-web/react-web/src/main/frontend/mock/user.ts +++ /dev/null @@ -1,203 +0,0 @@ -import { Request, Response } from 'express'; - -const waitTime = (time: number = 100) => { - return new Promise((resolve) => { - setTimeout(() => { - resolve(true); - }, time); - }); -}; - -async function getFakeCaptcha(req: Request, res: Response) { - await waitTime(2000); - return res.json('captcha-xxx'); -} - -const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION } = process.env; - -/** - * 当前用户的权限,如果为空代表没登录 - * current user access, if is '', user need login - * 如果是 pro 的预览,默认是有权限的 - */ -let access = ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site' ? 'admin' : ''; - -const getAccess = () => { - return access; -}; - -// 代码中会兼容本地 service mock 以及部署站点的静态数据 -export default { - // 支持值为 Object 和 Array - 'GET /api/currentUser': (req: Request, res: Response) => { - if (!getAccess()) { - res.status(401).send({ - data: { - isLogin: false, - }, - errorCode: '401', - errorMessage: '请先登录!', - success: true, - }); - return; - } - res.send({ - success: true, - data: { - name: 'Serati Ma', - avatar: 'https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png', - userid: '00000001', - email: 'antdesign@alipay.com', - signature: '海纳百川,有容乃大', - title: '交互专家', - group: '蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED', - tags: [ - { - key: '0', - label: '很有想法的', - }, - { - key: '1', - label: '专注设计', - }, - { - key: '2', - label: '辣~', - }, - { - key: '3', - label: '大长腿', - }, - { - key: '4', - label: '川妹子', - }, - { - key: '5', - label: '海纳百川', - }, - ], - notifyCount: 12, - unreadCount: 11, - country: 'China', - access: getAccess(), - geographic: { - province: { - label: '浙江省', - key: '330000', - }, - city: { - label: '杭州市', - key: '330100', - }, - }, - address: '西湖区工专路 77 号', - phone: '0752-268888888', - }, - }); - }, - // GET POST 可省略 - 'GET /api/users': [ - { - key: '1', - name: 'John Brown', - age: 32, - address: 'New York No. 1 Lake Park', - }, - { - key: '2', - name: 'Jim Green', - age: 42, - address: 'London No. 1 Lake Park', - }, - { - key: '3', - name: 'Joe Black', - age: 32, - address: 'Sidney No. 1 Lake Park', - }, - ], - 'POST /api/login/account': async (req: Request, res: Response) => { - const { password, username, type } = req.body; - await waitTime(2000); - if (password === 'ant.design' && username === 'admin') { - res.send({ - status: 'ok', - type, - currentAuthority: 'admin', - }); - access = 'admin'; - return; - } - if (password === 'ant.design' && username === 'user') { - res.send({ - status: 'ok', - type, - currentAuthority: 'user', - }); - access = 'user'; - return; - } - if (type === 'mobile') { - res.send({ - status: 'ok', - type, - currentAuthority: 'admin', - }); - access = 'admin'; - return; - } - - res.send({ - status: 'error', - type, - currentAuthority: 'guest', - }); - access = 'guest'; - }, - 'POST /api/login/outLogin': (req: Request, res: Response) => { - access = ''; - res.send({ data: {}, success: true }); - }, - 'POST /api/register': (req: Request, res: Response) => { - res.send({ status: 'ok', currentAuthority: 'user', success: true }); - }, - 'GET /api/500': (req: Request, res: Response) => { - res.status(500).send({ - timestamp: 1513932555104, - status: 500, - error: 'error', - message: 'error', - path: '/base/category/list', - }); - }, - 'GET /api/404': (req: Request, res: Response) => { - res.status(404).send({ - timestamp: 1513932643431, - status: 404, - error: 'Not Found', - message: 'No message available', - path: '/base/category/list/2121212', - }); - }, - 'GET /api/403': (req: Request, res: Response) => { - res.status(403).send({ - timestamp: 1513932555104, - status: 403, - error: 'Forbidden', - message: 'Forbidden', - path: '/base/category/list', - }); - }, - 'GET /api/401': (req: Request, res: Response) => { - res.status(401).send({ - timestamp: 1513932555104, - status: 401, - error: 'Unauthorized', - message: 'Unauthorized', - path: '/base/category/list', - }); - }, - - 'GET /api/login/captcha': getFakeCaptcha, -}; diff --git a/zlt-web/react-web/src/main/frontend/nginx.conf b/zlt-web/react-web/src/main/frontend/nginx.conf deleted file mode 100644 index fe1c34a1..00000000 --- a/zlt-web/react-web/src/main/frontend/nginx.conf +++ /dev/null @@ -1,122 +0,0 @@ -server { - listen 8080; - server_name localhost; - - # gzip 配置 - gzip on; - gzip_min_length 1k; - gzip_comp_level 6; - gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml; - gzip_vary on; - gzip_proxied any; - - root /usr/share/nginx/html/react-web; - index index.html; - - # 支持 history 路由 - location / { - try_files $uri $uri/ /index.html; - - # 添加必要的跨域和缓存控制头 - add_header Access-Control-Allow-Origin *; - # 调整缓存策略,例如对于静态资源可以缓存 - location ~* \.(css|js|svg|png|jpg|jpeg)$ { - expires 365d; - } - - # 添加安全相关头 - add_header X-Frame-Options SAMEORIGIN; - add_header X-Content-Type-Options nosniff; - add_header X-XSS-Protection "1; mode=block"; - } - - # API-UAA 服务代理 - location /api-uaa/ { - proxy_pass http://119.45.169.13:9900/api-uaa/; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - - # 确保 Authorization 头可以传递 - proxy_set_header Authorization $http_authorization; - proxy_pass_header Authorization; - - # 处理 OPTIONS 请求 - if ($request_method = 'OPTIONS') { - add_header Access-Control-Allow-Origin *; - add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS'; - add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'; - return 204; - } - } - - # 用户服务代理 - location /api-user/ { - proxy_pass http://119.45.169.13:9900/api-user/; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - - # 确保 Authorization 头可以传递 - proxy_set_header Authorization $http_authorization; - proxy_pass_header Authorization; - - # 处理 OPTIONS 请求 - if ($request_method = 'OPTIONS') { - add_header Access-Control-Allow-Origin *; - add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS'; - add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'; - return 204; - } - } - - # 其他 API 服务代理(如果需要) - location /api/ { - proxy_pass http://119.45.169.13:9900/; # 替换为实际的后端地址 - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - - # 添加跨域头 - add_header Access-Control-Allow-Origin *; - add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS'; - add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'; - - # 处理 OPTIONS 请求 - if ($request_method = 'OPTIONS') { - return 204; - } - } - - # API 代理配置 - location /api-order/ { - proxy_pass http://119.45.169.13:9900/api-order/; # 替换为您的后端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; - - # 处理 OPTIONS 请求 - if ($request_method = 'OPTIONS') { - add_header Access-Control-Allow-Origin *; - add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS'; - add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'; - return 204; - } - } - - # API 代理配置 - location /api-device/ { - proxy_pass http://119.45.169.13:9900/api-device/; # 替换为您的后端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; - - # 处理 OPTIONS 请求 - if ($request_method = 'OPTIONS') { - add_header Access-Control-Allow-Origin *; - add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS'; - add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'; - return 204; - } - } -} \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/package.json b/zlt-web/react-web/src/main/frontend/package.json deleted file mode 100644 index 15dd030f..00000000 --- a/zlt-web/react-web/src/main/frontend/package.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "name": "zlt-web", - "version": "1.0.0", - "private": true, - "scripts": { - "analyze": "cross-env ANALYZE=1 umi build", - "build": "set NODE_OPTIONS=--openssl-legacy-provider && umi build", - "deploy": "npm run build && npm run gh-pages", - "dev": "npm run start:dev", - "gh-pages": "gh-pages -d dist", - "i18n-remove": "pro i18n-remove --locale=zh-CN --write", - "postinstall": "umi g tmp", - "lint": "umi g tmp && npm run lint:js && npm run lint:style && npm run lint:prettier && npm run tsc", - "lint-staged": "lint-staged", - "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ", - "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src && npm run lint:style", - "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src", - "lint:prettier": "prettier -c --write \"src/**/*\" --end-of-line auto", - "lint:style": "stylelint --fix \"src/**/*.less\" --syntax less", - "openapi": "umi openapi", - "playwright": "playwright install && playwright test", - "prettier": "prettier -c --write \"src/**/*\"", - "serve": "umi-serve", - "start": "set NODE_OPTIONS=--openssl-legacy-provider && cross-env UMI_ENV=dev umi dev --port=8066", - "start:dev": "set NODE_OPTIONS=--openssl-legacy-provider && cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev umi dev", - "start:no-mock": "cross-env MOCK=none UMI_ENV=dev umi dev", - "start:no-ui": "cross-env UMI_UI=none UMI_ENV=dev umi dev", - "start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev umi dev", - "start:test": "cross-env REACT_APP_ENV=test MOCK=none UMI_ENV=dev umi dev", - "test": "umi test", - "test:component": "umi test ./src/components", - "test:e2e": "node ./tests/run-tests.js", - "tsc": "tsc --noEmit" - }, - "lint-staged": { - "**/*.less": "stylelint --syntax less", - "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js", - "**/*.{js,jsx,tsx,ts,less,md,json}": [ - "prettier --write" - ] - }, - "browserslist": [ - "> 1%", - "last 2 versions", - "not ie <= 10" - ], - "dependencies": { - "@amap/amap-react": "^0.1.5", - "@ant-design/charts": "^1.4.2", - "@ant-design/icons": "^4.7.0", - "@ant-design/pro-components": "1.1.1", - "@babel/runtime": "^7.27.0", - "@types/file-saver": "^2.0.7", - "@types/styled-components": "^5.1.34", - "@umijs/route-utils": "^2.0.0", - "antd": "^4.20.0", - "classnames": "^2.3.0", - "echarts": "^5.6.0", - "echarts-for-react": "^3.0.2", - "file-saver": "^2.0.5", - "lodash": "^4.17.21", - "moment": "^2.29.0", - "omit.js": "^2.0.2", - "rc-menu": "^9.1.0", - "rc-resize-observer": "^1.2.0", - "rc-util": "^5.16.0", - "react": "^17.0.0", - "react-dev-inspector": "^1.7.0", - "react-dom": "^17.0.0", - "react-helmet-async": "^1.2.0", - "react-intl": "6.4.4", - "react-json-tree": "^0.17.0", - "react-player": "^2.16.0", - "spark-md5": "^3.0.2", - "styled-components": "^6.1.18", - "treeify-js": "^1.0.8", - "umi": "^3.5.0", - "uuid": "^9.0.0", - "xlsx": "^0.18.5" - }, - "devDependencies": { - "@ant-design/pro-cli": "^2.1.0", - "@playwright/test": "^1.17.0", - "@types/classnames": "^2.3.1", - "@types/express": "^4.17.0", - "@types/history": "^4.7.0", - "@types/jest": "^26.0.0", - "@types/lodash": "^4.14.0", - "@types/react": "^17.0.0", - "@types/react-dom": "^17.0.0", - "@types/react-helmet": "^6.1.0", - "@types/uuid": "^8.3.4", - "@umijs/fabric": "^2.11.1", - "@umijs/openapi": "^1.6.0", - "@umijs/plugin-blocks": "^2.2.0", - "@umijs/plugin-esbuild": "^1.4.0", - "@umijs/plugin-openapi": "^1.3.3", - "@umijs/preset-ant-design-pro": "^1.3.0", - "@umijs/preset-dumi": "^1.1.0", - "@umijs/preset-react": "^2.1.0", - "cross-env": "^7.0.3", - "cross-port-killer": "^1.3.0", - "detect-installer": "^1.0.0", - "eslint": "^7.32.0", - "gh-pages": "^3.2.0", - "jsdom-global": "^3.0.0", - "lint-staged": "^10.0.0", - "mockjs": "^1.1.0", - "prettier": "^2.5.0", - "stylelint": "^13.0.0", - "swagger-ui-dist": "^4.12.0", - "typescript": "^4.5.0", - "umi-serve": "^1.9.10" - }, - "engines": { - "node": ">=12.0.0" - } -} diff --git a/zlt-web/react-web/src/main/frontend/playwright.config.ts b/zlt-web/react-web/src/main/frontend/playwright.config.ts deleted file mode 100644 index ec1b31db..00000000 --- a/zlt-web/react-web/src/main/frontend/playwright.config.ts +++ /dev/null @@ -1,22 +0,0 @@ -// playwright.config.ts -import type { PlaywrightTestConfig } from '@playwright/test'; -import { devices } from '@playwright/test'; - -const config: PlaywrightTestConfig = { - forbidOnly: !!process.env.CI, - retries: process.env.CI ? 2 : 0, - use: { - trace: 'on-first-retry', - }, - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - { - name: 'firefox', - use: { ...devices['Desktop Firefox'] }, - }, - ], -}; -export default config; diff --git a/zlt-web/react-web/src/main/frontend/public/CNAME b/zlt-web/react-web/src/main/frontend/public/CNAME deleted file mode 100644 index 30c2d4d3..00000000 --- a/zlt-web/react-web/src/main/frontend/public/CNAME +++ /dev/null @@ -1 +0,0 @@ -preview.pro.ant.design \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/public/campaign.svg b/zlt-web/react-web/src/main/frontend/public/campaign.svg deleted file mode 100644 index 71aa12f3..00000000 --- a/zlt-web/react-web/src/main/frontend/public/campaign.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/public/favicon.ico b/zlt-web/react-web/src/main/frontend/public/favicon.ico deleted file mode 100644 index e2e93252..00000000 Binary files a/zlt-web/react-web/src/main/frontend/public/favicon.ico and /dev/null differ diff --git a/zlt-web/react-web/src/main/frontend/public/icons/icon-128x128.png b/zlt-web/react-web/src/main/frontend/public/icons/icon-128x128.png deleted file mode 100644 index 3d563c5f..00000000 Binary files a/zlt-web/react-web/src/main/frontend/public/icons/icon-128x128.png and /dev/null differ diff --git a/zlt-web/react-web/src/main/frontend/public/icons/icon-192x192.png b/zlt-web/react-web/src/main/frontend/public/icons/icon-192x192.png deleted file mode 100644 index f44a0f0b..00000000 Binary files a/zlt-web/react-web/src/main/frontend/public/icons/icon-192x192.png and /dev/null differ diff --git a/zlt-web/react-web/src/main/frontend/public/icons/icon-512x512.png b/zlt-web/react-web/src/main/frontend/public/icons/icon-512x512.png deleted file mode 100644 index 00e3b022..00000000 Binary files a/zlt-web/react-web/src/main/frontend/public/icons/icon-512x512.png and /dev/null differ diff --git a/zlt-web/react-web/src/main/frontend/public/logo.png b/zlt-web/react-web/src/main/frontend/public/logo.png deleted file mode 100644 index da27b6b0..00000000 Binary files a/zlt-web/react-web/src/main/frontend/public/logo.png and /dev/null differ diff --git a/zlt-web/react-web/src/main/frontend/public/logo.svg b/zlt-web/react-web/src/main/frontend/public/logo.svg deleted file mode 100644 index 239bf69f..00000000 --- a/zlt-web/react-web/src/main/frontend/public/logo.svg +++ /dev/null @@ -1 +0,0 @@ -Group 28 Copy 5Created with Sketch. \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/public/pro_icon.svg b/zlt-web/react-web/src/main/frontend/public/pro_icon.svg deleted file mode 100644 index e075b78d..00000000 --- a/zlt-web/react-web/src/main/frontend/public/pro_icon.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/src/access.ts b/zlt-web/react-web/src/main/frontend/src/access.ts deleted file mode 100644 index c1c63a90..00000000 --- a/zlt-web/react-web/src/main/frontend/src/access.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @see https://umijs.org/zh-CN/plugins/plugin-access - * */ - export default function access(initialState: { currentUser?: API.CurrentUser } | undefined) { - const { currentUser } = initialState ?? {}; - return { - canAdmin: currentUser , - }; -} diff --git a/zlt-web/react-web/src/main/frontend/src/app.tsx b/zlt-web/react-web/src/main/frontend/src/app.tsx deleted file mode 100644 index 83cb7eee..00000000 --- a/zlt-web/react-web/src/main/frontend/src/app.tsx +++ /dev/null @@ -1,316 +0,0 @@ -import Footer from '@/components/Footer'; -import RightContent from '@/components/RightContent'; -import { - AppstoreOutlined, - MenuOutlined, - TeamOutlined, - SettingOutlined, - UserOutlined, - CaretDownFilled, - CrownOutlined, -} from '@ant-design/icons'; -import type { MenuDataItem, Settings as LayoutSettings } from '@ant-design/pro-components'; -import { PageLoading, SettingDrawer } from '@ant-design/pro-components'; -import { Divider, Dropdown, Menu, Space } from 'antd'; -import type { RequestConfig, RunTimeLayoutConfig } from 'umi'; -import { history } from 'umi'; -import defaultSettings from '../config/defaultSettings'; -import { currentUser as queryCurrentUser, fetchMenuData } from './services/login/api'; - -const isDev = process.env.NODE_ENV === 'development'; -const loginPath = '/user/login'; - -/** 获取用户信息比较慢的时候会展示一个 loading */ -export const initialStateConfig = { - loading: , -}; - -/** - * @see https://umijs.org/zh-CN/plugins/plugin-initial-state - * */ -export async function getInitialState(): Promise<{ - settings?: Partial; - currentUser?: API.CurrentUser; - loading?: boolean; - fetchUserInfo?: () => Promise; -}> { - const fetchUserInfo = async () => { - try { - const msg = await queryCurrentUser(); - // TODO - return msg.data; - } catch (error) { - history.push(loginPath); - } - return undefined; - }; - // 如果不是登录页面,执行 - if (history.location.pathname !== loginPath) { - const currentUser = await fetchUserInfo(); - return { - fetchUserInfo, - currentUser, - settings: defaultSettings, - }; - } - return { - fetchUserInfo, - settings: defaultSettings, - }; -} - -// ProLayout 支持的api https://procomponents.ant.design/components/layout -export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) => { - return { - rightContentRender: () => , - disableContentMargin: false, - waterMarkProps: { - content: initialState?.currentUser?.username, - }, - footerRender: () =>