重构项目,方便开发

This commit is contained in:
super
2026-03-19 13:15:47 +08:00
parent fb2e5ccea5
commit 1e63ab291b
38 changed files with 5940 additions and 0 deletions

74
desktop/README.md Normal file
View File

@@ -0,0 +1,74 @@
# 桌面端启动
## Python 要求
桌面端当前依赖 `pywebview`,在 Windows 下建议使用:
- `Python 3.12`
- `Python 3.11`
不要直接用 `Python 3.14`。你当前遇到的 `pythonnet` 构建失败就是这个兼容性问题。
## 开发模式
前置条件:
- `frontend-vue` 的 Vite 开发服务已启动在 `http://127.0.0.1:5173`
- 后端 API 已启动在 `http://127.0.0.1:8000`
- 本机已安装 `Python 3.12``Python 3.11`
启动命令:
```powershell
cd F:\project\crawler-plugin
.\desktop\run_desktop_dev.ps1
```
脚本会自动:
- 选择兼容的 Python 解释器
- 安装 `desktop/requirements.txt`
- 启动 `pywebview` 桌面窗口
如果脚本检测不到兼容 Python会直接提示并退出不再继续错误安装。
## 发布模式
先构建前端:
```powershell
cd F:\project\crawler-plugin\frontend-vue
npm run build
```
再启动桌面端:
```powershell
cd F:\project\crawler-plugin
.\desktop\run_desktop_dist.ps1
```
## 手动安装依赖
如果要手动安装,请显式使用兼容版本,例如:
```powershell
py -3.12 -m pip install -r .\desktop\requirements.txt
```
## 当前桌面能力
- 选择品牌 Excel 文件
- 选择文件夹
- 选择保存目录
- 另存模板文件
- 按 URL 下载结果文件到本地
## 说明
发布模式下,桌面宿主会:
- 本地托管 `frontend-vue/dist`
-`/api``/login``/logout``/static` 代理到 `--backend-url`
所以后端仍然需要运行。