refactor: 重构项目目录结构并优化前后端代码
将项目结构调整为前后端分离的清晰目录布局,优化了代码组织和可维护性。主要变更包括: - 将前端代码移至frontend目录 - 将后端代码移至backend目录 - 更新README.md以反映新的目录结构 - 优化.gitignore文件 - 修复部分文件路径问题
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -31,6 +31,13 @@ logs/
|
|||||||
.env.local
|
.env.local
|
||||||
.env.*.local
|
.env.*.local
|
||||||
|
|
||||||
|
# Backend specific
|
||||||
|
backend/server/cert/
|
||||||
|
backend/server/node_modules/
|
||||||
|
|
||||||
|
# Frontend specific
|
||||||
|
frontend/node_modules/
|
||||||
|
|
||||||
# Debug
|
# Debug
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
|
|||||||
32
README.md
32
README.md
@@ -6,20 +6,25 @@
|
|||||||
|
|
||||||
```
|
```
|
||||||
antiwear-web/
|
antiwear-web/
|
||||||
├── hwICSUiSdk/ # SDK 目录(已提供)
|
├── frontend/ # 前端项目
|
||||||
|
│ ├── index.html # 主页面
|
||||||
|
│ ├── styles/
|
||||||
|
│ │ └── main.css # 自定义样式
|
||||||
|
│ ├── scripts/
|
||||||
|
│ │ ├── main.js # 主逻辑代码
|
||||||
|
│ │ └── api.js # 前端 API 调用模块
|
||||||
|
│ └── hwICSUiSdk/ # SDK 目录(已提供)
|
||||||
│ ├── HwICSUiSdk.esm.js # ESM 模块入口
|
│ ├── HwICSUiSdk.esm.js # ESM 模块入口
|
||||||
│ ├── HwICSUiSdk.d.ts # TypeScript 类型定义
|
│ ├── HwICSUiSdk.d.ts # TypeScript 类型定义
|
||||||
│ ├── HwICSUiSdk.css # SDK 样式
|
│ ├── HwICSUiSdk.css # SDK 样式
|
||||||
│ └── ...
|
│ └── ...
|
||||||
├── server/ # 后端服务
|
├── backend/ # 后端服务
|
||||||
|
│ └── server/
|
||||||
│ ├── index.js # 后端主入口
|
│ ├── index.js # 后端主入口
|
||||||
│ └── package.json # 后端依赖
|
│ ├── .env # 环境变量配置
|
||||||
├── scripts/
|
│ ├── package.json # 后端依赖
|
||||||
│ ├── main.js # 主逻辑代码
|
│ └── APIGW-javascript-sdk-2.0.6/ # 华为云签名SDK
|
||||||
│ └── api.js # 前端 API 调用模块
|
├── .gitignore # Git 忽略配置
|
||||||
├── styles/
|
|
||||||
│ └── main.css # 自定义样式
|
|
||||||
├── index.html # 主页面
|
|
||||||
└── README.md # 项目说明
|
└── README.md # 项目说明
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -109,7 +114,7 @@ export HUAWEI_PROJECT_ID=your_project_id
|
|||||||
#### 启动后端服务
|
#### 启动后端服务
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd server
|
cd backend/server
|
||||||
npm install
|
npm install
|
||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
@@ -122,10 +127,11 @@ npm start
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 使用 Python 3
|
# 使用 Python 3
|
||||||
|
cd frontend
|
||||||
python -m http.server 8080
|
python -m http.server 8080
|
||||||
|
|
||||||
# 或使用 Node.js 的 http-server
|
# 或使用 Node.js 的 http-server
|
||||||
npx http-server -p 8080
|
npx http-server frontend -p 8080
|
||||||
|
|
||||||
# 或使用 VS Code Live Server 插件
|
# 或使用 VS Code Live Server 插件
|
||||||
```
|
```
|
||||||
@@ -143,8 +149,8 @@ npx http-server -p 8080
|
|||||||
|
|
||||||
### 6. 使用流程
|
### 6. 使用流程
|
||||||
|
|
||||||
1. **启动后端服务**:`cd server && npm start`
|
1. **启动后端服务**:`cd backend/server && npm start`
|
||||||
2. **启动前端服务器**:`python -m http.server 8080`
|
2. **启动前端服务器**:`cd frontend && python -m http.server 8080`
|
||||||
3. **获取授权码**:点击页面上的 "🔑 获取授权码" 按钮
|
3. **获取授权码**:点击页面上的 "🔑 获取授权码" 按钮
|
||||||
4. **初始化 SDK**:点击 "初始化 SDK" 开始使用
|
4. **初始化 SDK**:点击 "初始化 SDK" 开始使用
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 2.6 MiB |
|
Before Width: | Height: | Size: 808 KiB After Width: | Height: | Size: 808 KiB |
|
Before Width: | Height: | Size: 351 KiB After Width: | Height: | Size: 351 KiB |
@@ -1,2 +0,0 @@
|
|||||||
User Name,Access Key Id,Secret Access Key
|
|
||||||
"hid_4g9ydbgkwc1r19-",HPUAA6YLJPZRJC3H5GWM,QOM4wMxZavQZXCzOlWibwue8t9nNX0yHPkutlaLn
|
|
||||||
|
Reference in New Issue
Block a user