diff --git a/src-tauri/src/client.rs b/src-tauri/src/client.rs index 22534fcc..a7b7cdff 100644 --- a/src-tauri/src/client.rs +++ b/src-tauri/src/client.rs @@ -9,7 +9,8 @@ use url::Url; fn create_utils_menu() -> Menu { let retry_bridge = CustomMenuItem::new("retry".to_string(), "重试桥接"); let mock_touch = CustomMenuItem::new("mock_touch".to_string(), "模拟触摸"); - return Menu::new().add_item(retry_bridge).add_item(mock_touch); + let remove_overlay = CustomMenuItem::new("remove_overlay".to_string(), "移除遮罩"); + return Menu::new().add_item(retry_bridge).add_item(mock_touch).add_item(remove_overlay); } // 创建米游社客户端菜单 @@ -133,6 +134,16 @@ pub async fn create_mhy_client(handle: AppHandle, func: String, url: String) { })()"#; window.eval(&execute_js).ok().unwrap(); } + "remove_overlay" => { + let window = handle.get_window("mhy_client").unwrap(); + let execute_js = r#"javascript:(async function(){ + const arg = { + method: 'teyvat_remove', + } + await window.__TAURI__.event.emit('post_mhy_client',JSON.stringify(arg)); + })()"#; + window.eval(&execute_js).ok().unwrap(); + } _ => {} }); } diff --git a/src/utils/TGClient.ts b/src/utils/TGClient.ts index 3b64a66e..34e856a4 100644 --- a/src/utils/TGClient.ts +++ b/src/utils/TGClient.ts @@ -279,6 +279,9 @@ class TGClient { case "teyvat_open": createPost(arg.payload); break; + case "teyvat_remove": + await this.hideOverlay(); + break; case "teyvat_retry": { const executeJS = `javascript:(function(){ window.location.reload();