|
1 | | -# Tauri + React + Typescript |
| 1 | +# 智能黑板截图客户端 |
2 | 2 |
|
3 | | -This template should help get you started developing with Tauri, React and Typescript in Vite. |
| 3 | +一款用于学校智能黑板/多媒体设备的定时截图工具,支持云端上传和本地保存两种模式。 |
4 | 4 |
|
5 | | -## Recommended IDE Setup |
| 5 | +## 功能特性 |
6 | 6 |
|
7 | | -- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) |
| 7 | +- **定时截图**:按设定的时间间隔自动截取屏幕(默认10秒) |
| 8 | +- **双模式存储**: |
| 9 | + - 云端上传:登录后自动上传到管理平台 |
| 10 | + - 本地保存:离线时自动保存到本地磁盘 |
| 11 | +- **自动清理**:本地保存模式下自动清理7天前的旧截图 |
| 12 | +- **网络检测**:实时检测网络状态,自动切换上传/保存模式 |
| 13 | +- **配置灵活**:可自定义截图间隔、存储路径、API地址等 |
| 14 | + |
| 15 | +## 技术栈 |
| 16 | + |
| 17 | +- **Tauri 2.x** - 轻量级桌面应用框架 |
| 18 | +- **React** - 前端框架 |
| 19 | +- **TypeScript** - 类型安全 |
| 20 | +- **Rust** - 后端截屏和文件处理 |
| 21 | + |
| 22 | +## 环境要求 |
| 23 | + |
| 24 | +- Node.js 18+ |
| 25 | +- Rust 1.70+ |
| 26 | +- Windows 10/11 |
| 27 | + |
| 28 | +## 开发环境搭建 |
| 29 | + |
| 30 | +```bash |
| 31 | +# 1. 克隆仓库 |
| 32 | +git clone https://github.com/lengmodkx/screenshot-client.git |
| 33 | +cd screenshot-client |
| 34 | + |
| 35 | +# 2. 安装依赖 |
| 36 | +npm install |
| 37 | + |
| 38 | +# 3. 运行开发模式 |
| 39 | +npm run tauri dev |
| 40 | +``` |
| 41 | + |
| 42 | +## 构建发布 |
| 43 | + |
| 44 | +```bash |
| 45 | +# 构建生产版本 |
| 46 | +npm run tauri build |
| 47 | +``` |
| 48 | + |
| 49 | +构建产物位于 `src-tauri/target/release/` 目录: |
| 50 | +- `screenshot-client.exe` - 直接运行的exe文件 |
| 51 | +- `bundle/nsis/` - NSIS安装包 |
| 52 | +- `bundle/msi/` - MSI安装包 |
| 53 | + |
| 54 | +## 配置说明 |
| 55 | + |
| 56 | +配置文件位于 `%APPDATA%/ScreenshotClient/config.json` |
| 57 | + |
| 58 | +| 配置项 | 说明 | 默认值 | |
| 59 | +|--------|------|--------| |
| 60 | +| interval | 截图间隔(秒) | 10 | |
| 61 | +| mode | 存储模式(cloud/local) | local | |
| 62 | +| local_path | 本地保存路径 | 图片/Screenshots | |
| 63 | +| api_url | API服务器地址 | http://localhost:3000 | |
| 64 | +| retention_days | 本地保留天数 | 7 | |
| 65 | + |
| 66 | +## API接口 |
| 67 | + |
| 68 | +客户端需要管理后台提供以下接口: |
| 69 | + |
| 70 | +### 登录 |
| 71 | +``` |
| 72 | +POST /api/login |
| 73 | +Body: { username, password } |
| 74 | +Response: { token } |
| 75 | +``` |
| 76 | + |
| 77 | +### 上传截图 |
| 78 | +``` |
| 79 | +POST /api/screenshot/upload |
| 80 | +Header: Authorization: Bearer <token> |
| 81 | +Body: (multipart) image file |
| 82 | +``` |
| 83 | + |
| 84 | +### 健康检查(可选) |
| 85 | +``` |
| 86 | +GET /api/health |
| 87 | +``` |
| 88 | + |
| 89 | +## 使用说明 |
| 90 | + |
| 91 | +1. 首次运行默认使用本地保存模式 |
| 92 | +2. 点击"开始"按钮启动定时截图 |
| 93 | +3. 如需云端上传: |
| 94 | + - 在设置中切换到"云端上传"模式 |
| 95 | + - 点击"登录"输入账号密码 |
| 96 | +4. 截图默认保存在 `图片/Screenshots` 文件夹 |
| 97 | + |
| 98 | +## 项目结构 |
| 99 | + |
| 100 | +``` |
| 101 | +screenshot-client/ |
| 102 | +├── src/ # React前端源码 |
| 103 | +│ ├── App.tsx # 主应用组件 |
| 104 | +│ └── App.css # 样式文件 |
| 105 | +├── src-tauri/ # Rust后端源码 |
| 106 | +│ ├── src/ |
| 107 | +│ │ ├── lib.rs # 核心逻辑 |
| 108 | +│ │ └── main.rs # 入口文件 |
| 109 | +│ ├── Cargo.toml # Rust依赖 |
| 110 | +│ └── tauri.conf.json # Tauri配置 |
| 111 | +└── docs/ # 设计文档 |
| 112 | +``` |
| 113 | + |
| 114 | +## 许可证 |
| 115 | + |
| 116 | +MIT License |
0 commit comments