refactor: 重构项目目录结构并优化前后端代码

将项目结构调整为前后端分离的清晰目录布局,优化了代码组织和可维护性。主要变更包括:
- 将前端代码移至frontend目录
- 将后端代码移至backend目录
- 更新README.md以反映新的目录结构
- 优化.gitignore文件
- 修复部分文件路径问题
This commit is contained in:
2026-04-29 18:25:06 +08:00
parent d43d732c03
commit 1db57cd18c
25 changed files with 31 additions and 20 deletions

7
.gitignore vendored
View File

@@ -31,6 +31,13 @@ logs/
.env.local
.env.*.local
# Backend specific
backend/server/cert/
backend/server/node_modules/
# Frontend specific
frontend/node_modules/
# Debug
npm-debug.log*
yarn-debug.log*

View File

@@ -6,20 +6,25 @@
```
antiwear-web/
├── hwICSUiSdk/ # SDK 目录(已提供)
│ ├── HwICSUiSdk.esm.js # ESM 模块入口
│ ├── HwICSUiSdk.d.ts # TypeScript 类型定义
│ ├── HwICSUiSdk.css # SDK 样式
│ └── ...
├── server/ # 后端服务
│ ├── index.js # 后端主入口
│ └── package.json # 后端依赖
├── scripts/
│ ├── main.js # 主逻辑代码
│ └── api.js # 前端 API 调用模块
├── styles/
│ └── main.css # 自定义样式
├── index.html # 主页面
├── frontend/ # 前端项目
│ ├── index.html # 主页面
│ ├── styles/
│ │ └── main.css # 自定义样式
│ ├── scripts/
│ │ ├── main.js # 主逻辑代码
│ │ └── api.js # 前端 API 调用模块
│ └── hwICSUiSdk/ # SDK 目录(已提供)
│ ├── HwICSUiSdk.esm.js # ESM 模块入口
│ ├── HwICSUiSdk.d.ts # TypeScript 类型定义
│ ├── HwICSUiSdk.css # SDK 样式
│ └── ...
├── backend/ # 后端服务
│ └── server/
│ ├── index.js # 后端主入口
│ ├── .env # 环境变量配置
│ ├── package.json # 后端依赖
│ └── APIGW-javascript-sdk-2.0.6/ # 华为云签名SDK
├── .gitignore # Git 忽略配置
└── README.md # 项目说明
```
@@ -109,7 +114,7 @@ export HUAWEI_PROJECT_ID=your_project_id
#### 启动后端服务
```bash
cd server
cd backend/server
npm install
npm start
```
@@ -122,10 +127,11 @@ npm start
```bash
# 使用 Python 3
cd frontend
python -m http.server 8080
# 或使用 Node.js 的 http-server
npx http-server -p 8080
npx http-server frontend -p 8080
# 或使用 VS Code Live Server 插件
```
@@ -143,8 +149,8 @@ npx http-server -p 8080
### 6. 使用流程
1. **启动后端服务**:`cd server && npm start`
2. **启动前端服务器**:`python -m http.server 8080`
1. **启动后端服务**:`cd backend/server && npm start`
2. **启动前端服务器**:`cd frontend && python -m http.server 8080`
3. **获取授权码**:点击页面上的 "🔑 获取授权码" 按钮
4. **初始化 SDK**:点击 "初始化 SDK" 开始使用

View File

Before

Width:  |  Height:  |  Size: 2.6 MiB

After

Width:  |  Height:  |  Size: 2.6 MiB

View File

Before

Width:  |  Height:  |  Size: 808 KiB

After

Width:  |  Height:  |  Size: 808 KiB

View File

Before

Width:  |  Height:  |  Size: 351 KiB

After

Width:  |  Height:  |  Size: 351 KiB

View File

@@ -1,2 +0,0 @@
User Name,Access Key Id,Secret Access Key
"hid_4g9ydbgkwc1r19-",HPUAA6YLJPZRJC3H5GWM,QOM4wMxZavQZXCzOlWibwue8t9nNX0yHPkutlaLn
1 User Name Access Key Id Secret Access Key
2 hid_4g9ydbgkwc1r19- HPUAA6YLJPZRJC3H5GWM QOM4wMxZavQZXCzOlWibwue8t9nNX0yHPkutlaLn