From a3b31f0ff9ed94c021d39a8aea85ac9feb3267d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=E6=98=B5=E7=A7=B0=E9=87=8D=E8=A6=81=E5=90=97O?= Date: Sun, 15 Mar 2026 11:32:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor(tauri):=20=E7=A7=BB=E9=99=A4=E6=8C=81?= =?UTF-8?q?=E4=B9=85=E5=8C=96=E5=AD=98=E5=82=A8=E5=92=8CHTTP=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E4=BC=98=E5=8C=96=E5=BA=94=E7=94=A8=E6=9E=B6=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了 tauri-plugin-persisted-scope 和 tauri-plugin-http 插件依赖 - 从桌面功能权限中移除了文件系统和HTTP访问权限 - 删除了相关的存储键常量定义 - 修改悬浮列表窗口创建逻辑,移除页面类型参数和动态计算功能 - 主窗口配置调整为非透明背景并设置白色背景色 - 移除了前端悬浮列表中互动课堂和智评会议相关功能组件 - 更新Cargo.lock移除相关依赖包确保构建一致性 --- index.html | 18 +- .../modules/websocket/meeting.websocket.ts | 1 + src-tauri/Cargo.lock | 357 +----------------- src-tauri/Cargo.toml | 19 +- src-tauri/capabilities/desktop.json | 22 +- src-tauri/src/constants/window.rs | 11 - src-tauri/src/lib.rs | 7 - src-tauri/src/storage/mod.rs | 3 - src-tauri/src/window/commands.rs | 4 +- .../src/window/create_float_list_window.rs | 97 +---- src-tauri/src/window/create_main_window.rs | 8 +- src-tauri/src/window/derive.rs | 4 - .../aa-components/floating-list.vue | 290 +++----------- .../use-tauri-session-storage.ts | 109 ------ .../meeting-room/meeting-room-teacher.vue | 90 ++++- 15 files changed, 167 insertions(+), 873 deletions(-) delete mode 100644 src/other_pages/floating-list-window/aa-components/use-tauri-session-storage.ts diff --git a/index.html b/index.html index f3673b4..34d1161 100644 --- a/index.html +++ b/index.html @@ -14,6 +14,8 @@ height: 100vh; width: 100vw; overflow: hidden; + background: #fff; + border-radius: 8px; } body > .html-body-app { margin: 0; @@ -115,23 +117,7 @@ } -
diff --git a/node_api/src/modules/websocket/meeting.websocket.ts b/node_api/src/modules/websocket/meeting.websocket.ts index 578c30a..11901cc 100644 --- a/node_api/src/modules/websocket/meeting.websocket.ts +++ b/node_api/src/modules/websocket/meeting.websocket.ts @@ -250,6 +250,7 @@ export class MeetingWebSocketGateway implements OnGatewayConnection, OnGatewayDi const shortUid = Number(socket.data.user?.shortUid || 0); const userName = socket.data.user?.userName || data.userName || '用户'; const isHost = socket.data.user?.role !== 0; + const joinMode: JoinMode = data?.joinMode === 'classroom' || data?.joinMode === 'monitor' || data?.joinMode === 'student' ? data.joinMode : isHost ? 'classroom' : 'student'; diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 01163dc..2a46492 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -262,15 +262,6 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - [[package]] name = "bit-set" version = "0.8.0" @@ -568,57 +559,10 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" dependencies = [ - "percent-encoding", "time", "version_check", ] -[[package]] -name = "cookie_store" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eac901828f88a5241ee0600950ab981148a18f2f756900ffba1b125ca6a3ef9" -dependencies = [ - "cookie", - "document-features", - "idna", - "log", - "publicsuffix", - "serde", - "serde_derive", - "serde_json", - "time", - "url", -] - -[[package]] -name = "cookie_store" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15b2c103cf610ec6cae3da84a766285b42fd16aad564758459e6ecf128c75206" -dependencies = [ - "cookie", - "document-features", - "idna", - "log", - "publicsuffix", - "serde", - "serde_derive", - "serde_json", - "time", - "url", -] - -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "core-foundation" version = "0.10.1" @@ -642,7 +586,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "064badf302c3194842cf2c5d61f56cc88e54a759313879cdf03abdd27d0c3b97" dependencies = [ "bitflags 2.11.0", - "core-foundation 0.10.1", + "core-foundation", "core-graphics-types", "foreign-types", "libc", @@ -655,7 +599,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" dependencies = [ "bitflags 2.11.0", - "core-foundation 0.10.1", + "core-foundation", "libc", ] @@ -898,12 +842,6 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" -[[package]] -name = "data-url" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" - [[package]] name = "deranged" version = "0.5.8" @@ -1067,15 +1005,6 @@ dependencies = [ "syn 2.0.117", ] -[[package]] -name = "document-features" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" -dependencies = [ - "litrs", -] - [[package]] name = "dom_query" version = "0.25.1" @@ -1583,10 +1512,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi 0.11.1+wasi-snapshot-preview1", - "wasm-bindgen", ] [[package]] @@ -1596,11 +1523,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", - "js-sys", "libc", "r-efi 5.3.0", "wasip2", - "wasm-bindgen", ] [[package]] @@ -1765,25 +1690,6 @@ dependencies = [ "syn 2.0.117", ] -[[package]] -name = "h2" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54" -dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http", - "indexmap 2.13.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "hashbrown" version = "0.12.3" @@ -1900,7 +1806,6 @@ dependencies = [ "bytes", "futures-channel", "futures-core", - "h2", "http", "http-body", "httparse", @@ -1926,7 +1831,6 @@ dependencies = [ "tokio", "tokio-rustls", "tower-service", - "webpki-roots 1.0.6", ] [[package]] @@ -1947,11 +1851,9 @@ dependencies = [ "percent-encoding", "pin-project-lite", "socket2", - "system-configuration", "tokio", "tower-service", "tracing", - "windows-registry", ] [[package]] @@ -2351,12 +2253,6 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" -[[package]] -name = "litrs" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" - [[package]] name = "lock_api" version = "0.4.14" @@ -2372,12 +2268,6 @@ version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" -[[package]] -name = "lru-slab" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" - [[package]] name = "mac" version = "0.1.1" @@ -3424,22 +3314,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "psl-types" -version = "2.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33cb294fe86a74cbcf50d4445b37da762029549ebeea341421c7c70370f86cac" - -[[package]] -name = "publicsuffix" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42ea446cab60335f76979ec15e12619a2165b5ae2c12166bef27d283a9fadf" -dependencies = [ - "idna", - "psl-types", -] - [[package]] name = "pxfm" version = "0.1.28" @@ -3455,61 +3329,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "quinn" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" -dependencies = [ - "bytes", - "cfg_aliases", - "pin-project-lite", - "quinn-proto", - "quinn-udp", - "rustc-hash", - "rustls", - "socket2", - "thiserror 2.0.18", - "tokio", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-proto" -version = "0.11.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098" -dependencies = [ - "bytes", - "getrandom 0.3.4", - "lru-slab", - "rand 0.9.2", - "ring", - "rustc-hash", - "rustls", - "rustls-pki-types", - "slab", - "thiserror 2.0.18", - "tinyvec", - "tracing", - "web-time", -] - -[[package]] -name = "quinn-udp" -version = "0.5.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" -dependencies = [ - "cfg_aliases", - "libc", - "once_cell", - "socket2", - "tracing", - "windows-sys 0.60.2", -] - [[package]] name = "quote" version = "1.0.45" @@ -3752,49 +3571,6 @@ version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" -[[package]] -name = "reqwest" -version = "0.12.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" -dependencies = [ - "base64 0.22.1", - "bytes", - "cookie", - "cookie_store 0.22.1", - "encoding_rs", - "futures-core", - "h2", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-rustls", - "hyper-util", - "js-sys", - "log", - "mime", - "percent-encoding", - "pin-project-lite", - "quinn", - "rustls", - "rustls-pki-types", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "tokio", - "tokio-rustls", - "tower", - "tower-http", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots 1.0.6", -] - [[package]] name = "reqwest" version = "0.13.2" @@ -3954,7 +3730,6 @@ version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" dependencies = [ - "web-time", "zeroize", ] @@ -3964,7 +3739,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d99feebc72bae7ab76ba994bb5e121b8d83d910ca40b36e0921f53becc41784" dependencies = [ - "core-foundation 0.10.1", + "core-foundation", "core-foundation-sys", "jni", "log", @@ -4002,12 +3777,6 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" -[[package]] -name = "ryu" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" - [[package]] name = "same-file" version = "1.0.6" @@ -4090,7 +3859,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" dependencies = [ "bitflags 2.11.0", - "core-foundation 0.10.1", + "core-foundation", "core-foundation-sys", "libc", "security-framework-sys", @@ -4248,18 +4017,6 @@ dependencies = [ "serde_core", ] -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - [[package]] name = "serde_with" version = "3.17.0" @@ -4755,27 +4512,6 @@ dependencies = [ "libc", ] -[[package]] -name = "system-configuration" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" -dependencies = [ - "bitflags 2.11.0", - "core-foundation 0.9.4", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "system-deps" version = "6.2.2" @@ -4797,7 +4533,7 @@ checksum = "6e06d52c379e63da659a483a958110bbde891695a0ecb53e48cc7786d5eda7bb" dependencies = [ "bitflags 2.11.0", "block2", - "core-foundation 0.10.1", + "core-foundation", "core-graphics", "crossbeam-channel", "dispatch2", @@ -4886,7 +4622,7 @@ dependencies = [ "percent-encoding", "plist", "raw-window-handle", - "reqwest 0.13.2", + "reqwest", "serde", "serde_json", "serde_repr", @@ -5027,30 +4763,6 @@ dependencies = [ "url", ] -[[package]] -name = "tauri-plugin-http" -version = "2.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8f069451c4e87e7e2636b7f065a4c52866c4ce5e60e2d53fa1038edb6d184dc" -dependencies = [ - "bytes", - "cookie_store 0.21.1", - "data-url", - "http", - "regex", - "reqwest 0.12.28", - "schemars 0.8.22", - "serde", - "serde_json", - "tauri", - "tauri-plugin", - "tauri-plugin-fs", - "thiserror 2.0.18", - "tokio", - "url", - "urlpattern", -] - [[package]] name = "tauri-plugin-os" version = "2.3.2" @@ -5069,22 +4781,6 @@ dependencies = [ "thiserror 2.0.18", ] -[[package]] -name = "tauri-plugin-persisted-scope" -version = "2.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb33765b205abc72a1384d0a73489a00bae6ca1e151c5e824ac80115949d2e1" -dependencies = [ - "aho-corasick", - "bincode", - "log", - "serde", - "serde_json", - "tauri", - "tauri-plugin-fs", - "thiserror 2.0.18", -] - [[package]] name = "tauri-plugin-process" version = "2.3.1" @@ -5126,7 +4822,7 @@ dependencies = [ "minisign-verify", "osakit", "percent-encoding", - "reqwest 0.13.2", + "reqwest", "rustls", "semver", "serde", @@ -5368,21 +5064,6 @@ dependencies = [ "zerovec", ] -[[package]] -name = "tinyvec" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "tokio" version = "1.50.0" @@ -6028,16 +5709,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "web-time" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "web_atoms" version = "0.2.3" @@ -6348,17 +6019,6 @@ dependencies = [ "windows-link 0.2.1", ] -[[package]] -name = "windows-registry" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" -dependencies = [ - "windows-link 0.2.1", - "windows-result 0.4.1", - "windows-strings 0.5.1", -] - [[package]] name = "windows-result" version = "0.3.4" @@ -7029,10 +6689,7 @@ dependencies = [ "tauri", "tauri-build", "tauri-plugin-dialog", - "tauri-plugin-fs", - "tauri-plugin-http", "tauri-plugin-os", - "tauri-plugin-persisted-scope", "tauri-plugin-process", "tauri-plugin-single-instance", "tauri-plugin-updater", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 9b039c5..3908dd9 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -27,7 +27,7 @@ prod_150_8080 = [] [dependencies] serde = { version = "1.0.228", features = ["derive"] } serde_json = { version = "1.0.149", features = ["raw_value"] } -tauri-plugin-persisted-scope = "2.3.5" +# tauri-plugin-persisted-scope = "2.3.5" # 已禁用,因为需要 fs 权限 log = "0.4.29" tauri = { version = "2.10.2", features = [ "macos-private-api", @@ -38,8 +38,6 @@ tauri = { version = "2.10.2", features = [ ] } tauri-plugin-os = "2.3.2" tauri-plugin-dialog = "2.6.0" -tauri-plugin-fs = "2.4.5" -tauri-plugin-http = "2.5.7" tauri-plugin-process = "2.3.1" tauri-plugin-websocket = "2.4.2" rodio = "0.22.1" @@ -51,20 +49,7 @@ tokio-cron-scheduler = "0.15.1" tracing = "0.1.44" thiserror = "2.0.18" bytes = "1.11.1" - -# Linux 平台依赖:获取工作区尺寸 -# [target.'cfg(target_os = "linux")'.dependencies] -# x11-dl = "2.21" - -# macOS 平台依赖 -# [target.'cfg(target_os = "macos")'.dependencies] -# objc2 = "0.6" -# objc2-foundation = "0.3" -# objc2-app-kit = "0.3" - -# Windows 平台依赖 -# [target.'cfg(target_os = "windows")'.dependencies] -# windows = { version = "0.58", features = ["Win32_UI_WindowsAndMessaging", "Win32_Foundation"] } + [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] tauri-plugin-updater = "2.10.0" diff --git a/src-tauri/capabilities/desktop.json b/src-tauri/capabilities/desktop.json index 78e6b35..4ea72e3 100644 --- a/src-tauri/capabilities/desktop.json +++ b/src-tauri/capabilities/desktop.json @@ -3,25 +3,5 @@ "identifier": "desktop-capability", "platforms": ["macOS", "windows", "linux"], "windows": ["main", "meeting", "meeting2", "popup", "float-list"], - "permissions": [ - "dialog:default", - "updater:default", - "process:default", - "process:allow-exit", - "fs:default", - "fs:allow-write-file", - "fs:allow-download-write", - "websocket:default", - { - "identifier": "http:default", - "allow": [ - { - "url": "http://*:*" - }, - { - "url": "https://*:*" - } - ] - } - ] + "permissions": ["dialog:default", "updater:default", "process:default", "process:allow-exit", "websocket:default"] } diff --git a/src-tauri/src/constants/window.rs b/src-tauri/src/constants/window.rs index b97297d..7462846 100644 --- a/src-tauri/src/constants/window.rs +++ b/src-tauri/src/constants/window.rs @@ -31,14 +31,3 @@ pub const PLACEMENT_LEFT: &str = "left"; /// 右侧放置 pub const PLACEMENT_RIGHT: &str = "right"; - -// ============ 存储键常量 ============ - -/// 用户信息存储键 -pub const STORAGE_KEY_USER_INFO: &str = "tauri_store_page_user_info"; - -/// 辅导信息存储键 -pub const STORAGE_KEY_TUTORSHIP: &str = "tauri_store_page_curr_tutorship"; - -/// 课程信息存储键 -pub const STORAGE_KEY_COURSE: &str = "tauri_store_page_curr_course"; diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 529c9aa..a278bda 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -15,7 +15,6 @@ mod app; mod audio; mod constants; -mod env; mod error; mod invoke; mod menu; @@ -47,16 +46,10 @@ pub fn run() { .plugin(tauri_plugin_os::init()) // dialog 插件 - 显示文件选择对话框等 .plugin(tauri_plugin_dialog::init()) - // fs 插件 - 文件系统访问 - .plugin(tauri_plugin_fs::init()) - // persisted_scope 插件 - 记住文件访问权限 - .plugin(tauri_plugin_persisted_scope::init()) // process 插件 - 进程相关信息 .plugin(tauri_plugin_process::init()) // updater 插件 - 应用自动更新 .plugin(tauri_plugin_updater::Builder::new().build()) - // http 插件 - HTTP 客户端请求 - .plugin(tauri_plugin_http::init()) // single_instance 插件 - 保证只启动一个应用实例 .plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| { let app_handle = app.clone(); diff --git a/src-tauri/src/storage/mod.rs b/src-tauri/src/storage/mod.rs index e52d1aa..609ad15 100644 --- a/src-tauri/src/storage/mod.rs +++ b/src-tauri/src/storage/mod.rs @@ -1,4 +1 @@ pub mod session_storage; - -// 重新导出存储结构和命令 -pub use session_storage::SessionStorage; diff --git a/src-tauri/src/window/commands.rs b/src-tauri/src/window/commands.rs index 59c04e6..b99f3c6 100644 --- a/src-tauri/src/window/commands.rs +++ b/src-tauri/src/window/commands.rs @@ -6,8 +6,8 @@ use tauri::{AppHandle, Window}; /// 创建悬浮列表窗口 #[tauri::command] -pub async fn create_float_list_window(app: AppHandle, page_type: &str) -> Result { - create_float_list_window_impl(std::sync::Arc::new(app), page_type).await.map(|_| "success".to_string()) +pub async fn create_float_list_window(app: AppHandle) -> Result { + create_float_list_window_impl(std::sync::Arc::new(app)).await.map(|_| "success".to_string()) } /// 创建弹出框窗口 diff --git a/src-tauri/src/window/create_float_list_window.rs b/src-tauri/src/window/create_float_list_window.rs index 6f2c18e..1319410 100644 --- a/src-tauri/src/window/create_float_list_window.rs +++ b/src-tauri/src/window/create_float_list_window.rs @@ -1,25 +1,22 @@ use std::sync::Arc; use crate::{ - constants::{common::*, window::*}, - storage::SessionStorage, + constants::common::*, window::{ WindowLabel, derive::FloatListInfo, util::{get_monitor_for_window, show_windows_by_label}, }, }; -use tauri::{AppHandle, LogicalPosition, LogicalSize, Manager, Runtime, WebviewUrl, WebviewWindowBuilder, utils::config::BackgroundThrottlingPolicy}; +use tauri::{AppHandle, LogicalPosition, LogicalSize, Runtime, WebviewUrl, WebviewWindowBuilder, utils::config::BackgroundThrottlingPolicy}; /// 创建悬浮列表窗口(内部实现) -pub async fn create_float_list_window_impl(app: Arc>, page_type: &str) -> Result<(), String> { - let app_handle = Arc::clone(&app); - let page_type_owned = page_type.to_string(); +pub async fn create_float_list_window_impl(app: Arc>) -> Result<(), String> { if show_windows_by_label(app.as_ref(), WindowLabel::FLOAT_LIST) { return Ok(()); } // 悬浮列表尺寸 - let float_info = calculate_float_info_sync(app.as_ref(), page_type); + let float_info = calculate_float_info_sync(); // 获取屏幕尺寸,优先为main窗口所在屏幕,主窗口没有打开时,才找主屏幕 let monitor = get_monitor_for_window(app.as_ref())?; // 获取屏幕缩放因子 @@ -27,10 +24,7 @@ pub async fn create_float_list_window_impl(app: Arc>, p let page_size: LogicalSize = monitor.work_area().size.to_logical(scale_factor); let screen_width = page_size.width; let screen_height = page_size.height; - let url = format!( - "floating-list-window.html?isShowInteraction={}&isShowTutorship={}", - float_info.is_show_interaction, float_info.is_show_tutorship - ); + let url = format!("floating-list-window.html"); let label = WindowLabel::FLOAT_LIST.as_ref(); // 创建悬浮球窗口,直接在初始化时设置好位置和尺寸 @@ -73,78 +67,15 @@ pub async fn create_float_list_window_impl(app: Arc>, p // 窗口显示后等待200毫秒再执行动画 tokio::spawn(async move { tokio::time::sleep(tokio::time::Duration::from_millis(200)).await; - let _ = animate_to_bottom_right(&app_handle, window, screen_width as i32, screen_height as i32, &page_type_owned).await; + let _ = animate_to_bottom_right(window, screen_width as i32, screen_height as i32).await; }); Ok(()) } /// 根据用户登录状态和课程选择情况动态计算弹出窗口高度 -pub fn calculate_float_info_sync(app: &AppHandle, page_type: &str) -> FloatListInfo { +pub fn calculate_float_info_sync() -> FloatListInfo { // 默认基础项目数 - let mut item_num = 4; - let mut is_show_interaction = false; - let mut is_show_tutorship = false; - - // 获取会话存储实例 - let storage = match app.try_state::() { - Some(s) => s, - None => { - log::error!("获取会话存储实例失败,使用默认值"); - let item_height = 64; - let popup_height = item_height * item_num + 40; - let popup_width = 60; - return FloatListInfo { - width: popup_width as u32, - height: popup_height as u32, - is_show_interaction, - is_show_tutorship, - }; - } - }; - - // 从会话存储中获取用户信息和课程信息来判断是否增加项目数 - let user_info_exists = match storage.get::(STORAGE_KEY_USER_INFO) { - Some(Ok(value)) => { - // 检查必要的字段是否存在 - value.get("id").is_some() - } - _ => false, - }; - let tutorship_info_exists = match storage.get::(STORAGE_KEY_TUTORSHIP) { - Some(Ok(value)) => { - // 检查必要的字段是否存在 - value.get("id").is_some() - } - _ => false, - }; - - let course_info_exists = match storage.get::(STORAGE_KEY_COURSE) { - Some(Ok(value)) => { - // 检查必要的字段是否存在 - value.get("id").is_some() - } - _ => false, - }; - - if user_info_exists { - if page_type == "interaction" { - is_show_interaction = true; - // 如果能获取到用户信息和课程信息,则增加项目数 - if course_info_exists { - item_num += 5; - } - } else if page_type == "tutorship" { - // 如果能获取到用户信息和课程信息,则增加项目数 - if course_info_exists { - is_show_interaction = true; - item_num += 5; - } - if tutorship_info_exists { - is_show_tutorship = true; - item_num += 3; - } - } - } + let item_num = 4; // 每个item高度 let item_height = 64; // 总高度 = item高度 * 项目数 + 额外用于移动按钮和时间部分的高度 @@ -155,19 +86,11 @@ pub fn calculate_float_info_sync(app: &AppHandle, page_type: &str FloatListInfo { width: popup_width as u32, height: popup_height as u32, - is_show_tutorship, - is_show_interaction, } } /// 使用抛物线动画将窗口移动到右下角 -pub async fn animate_to_bottom_right( - app: &AppHandle, - window: tauri::WebviewWindow, - screen_width: i32, - screen_height: i32, - page_type: &str, -) -> Result<(), String> { +pub async fn animate_to_bottom_right(window: tauri::WebviewWindow, screen_width: i32, screen_height: i32) -> Result<(), String> { // 获取当前窗口位置和大小 let current_position_physical = window.outer_position().map_err(|e| format!("获取窗口位置失败: {}", e))?; let current_size_physical = window.outer_size().map_err(|e| format!("获取窗口大小失败: {}", e))?; @@ -225,7 +148,7 @@ pub async fn animate_to_bottom_right( } // 确保最终位置准确, 再次获取窗口大小和缩放因子 - let float_info = calculate_float_info_sync(app, page_type); + let float_info = calculate_float_info_sync(); let current_size_physical = window.outer_size().map_err(|e| format!("获取窗口大小失败: {}", e))?; let scale_factor = window.scale_factor().map_err(|e| format!("获取缩放因子失败: {}", e))?; let current_size = current_size_physical.to_logical::(scale_factor); diff --git a/src-tauri/src/window/create_main_window.rs b/src-tauri/src/window/create_main_window.rs index 1452758..9afc72c 100644 --- a/src-tauri/src/window/create_main_window.rs +++ b/src-tauri/src/window/create_main_window.rs @@ -1,5 +1,7 @@ use crate::constants::{common::APP_NAME, window::*}; -use crate::window::{util::show_windows_by_label, WindowLabel}; +use crate::window::{WindowLabel, util::show_windows_by_label}; +use tauri::utils::config::BackgroundThrottlingPolicy; +use tauri::window::Color; use tauri::{AppHandle, Runtime, WebviewUrl, WebviewWindowBuilder}; /// 根据tauri.conf.json配置创建主窗口 @@ -17,7 +19,9 @@ pub async fn create_main_window_impl(app: &AppHandle) -> Result<( .resizable(true) .fullscreen(false) .decorations(false) - .transparent(true) + .transparent(false) + .background_throttling(BackgroundThrottlingPolicy::Disabled) + .background_color(Color(255, 255, 255, 255)) .always_on_top(false) .center() .shadow(true) diff --git a/src-tauri/src/window/derive.rs b/src-tauri/src/window/derive.rs index 14f01ad..986ca4c 100644 --- a/src-tauri/src/window/derive.rs +++ b/src-tauri/src/window/derive.rs @@ -29,10 +29,6 @@ pub struct FloatListInfo { pub width: u32, /// 弹出框的高度 pub height: u32, - /** 是否显示互动课堂相关按钮 */ - pub is_show_interaction: bool, - /** 是否显示智评会议相关按钮 */ - pub is_show_tutorship: bool, } /// 弹出框位置信息 diff --git a/src/other_pages/floating-list-window/aa-components/floating-list.vue b/src/other_pages/floating-list-window/aa-components/floating-list.vue index 5858a6c..46f2f03 100644 --- a/src/other_pages/floating-list-window/aa-components/floating-list.vue +++ b/src/other_pages/floating-list-window/aa-components/floating-list.vue @@ -8,166 +8,39 @@ >
-
-
- {{ timeData.hour }}:{{ timeData.minute }} -
-
- -
-