feat: GUI 端新增解码功能 — 选择图片解码 QR 码

- 新增 decode_qr Tauri command(接收图片字节,返回解码文本)
- ExportPanel 新增「选择图片解码」按钮 + 解码结果展示
- fs:allow-read-file 权限,支持 /c/Users/33644 和 C:\Users\33644\AppData\Local\Temp 路径
This commit is contained in:
2026-06-19 20:39:07 +08:00
parent effc88c6d7
commit 11fbe20102
4 changed files with 57 additions and 3 deletions
+7
View File
@@ -104,6 +104,12 @@ fn load_history(state: tauri::State<AppState>) -> Result<Vec<HistoryEntry>, Stri
Ok(history.clone())
}
/// 解码 QR 码图片,返回文本内容
#[tauri::command]
fn decode_qr(image_bytes: Vec<u8>) -> Result<String, String> {
qr_core::decoder::decode_image(&image_bytes).map(|r| r.text)
}
/// 清空历史记录
#[tauri::command]
fn clear_history(state: tauri::State<AppState>) -> Result<(), String> {
@@ -125,6 +131,7 @@ pub fn run() {
.invoke_handler(tauri::generate_handler![
encode_qr,
export_png,
decode_qr,
save_history,
load_history,
clear_history,