refactor(window): 移除会议窗口相关功能
- 删除会议窗口创建相关的常量定义 - 移除 create_meeting_window 模块及其命令注册 - 从窗口命令模块中移除会议窗口创建函数 - 删除前端调用会议窗口创建的 API 接口 - 清理画板窗口和实时字幕窗口的占位代码
This commit is contained in:
@ -44,12 +44,3 @@ pub const MSG_FAILED_BUILD_TAURI: &str = "构建 Tauri 应用程序时出现错
|
||||
|
||||
/// 创建悬浮球窗口失败消息
|
||||
pub const MSG_FAILED_CREATE_FLOATING_LIST: &str = "创建悬浮球窗口失败: {}";
|
||||
|
||||
/// 创建会议窗口失败消息
|
||||
pub const MSG_FAILED_CREATE_MEETING_WINDOW: &str = "创建会议窗口失败: {}";
|
||||
|
||||
/// 类型2会议窗口需要CourseID的错误消息
|
||||
pub const MSG_MEETING_TYPE_2_NEEDS_COURSE_ID: &str = "类型2的会议窗口需要提供CourseID";
|
||||
|
||||
/// 不支持的会议窗口类型错误消息
|
||||
pub const MSG_UNSUPPORTED_MEETING_WINDOW_TYPE: &str = "不支持的会议窗口类型";
|
||||
|
||||
@ -6,18 +6,6 @@ pub const MAIN_WINDOW_WIDTH: f64 = 1200.0;
|
||||
/// 主窗口默认高度(像素)
|
||||
pub const MAIN_WINDOW_HEIGHT: f64 = 700.0;
|
||||
|
||||
/// 类型1会议窗口宽度(像素)
|
||||
pub const MEETING_TYPE_1_WIDTH: f64 = 800.0;
|
||||
|
||||
/// 类型1会议窗口高度(像素)
|
||||
pub const MEETING_TYPE_1_HEIGHT: f64 = 600.0;
|
||||
|
||||
/// 类型2会议窗口宽度(像素)
|
||||
pub const MEETING_TYPE_2_WIDTH: f64 = 1400.0;
|
||||
|
||||
/// 类型2会议窗口高度(像素)
|
||||
pub const MEETING_TYPE_2_HEIGHT: f64 = 800.0;
|
||||
|
||||
// ============ 弹出窗口常量 ============
|
||||
|
||||
/// 窗口圆角半径
|
||||
|
||||
@ -39,7 +39,6 @@ pub fn register_commands(builder: Builder<tauri::Wry>) -> Builder<tauri::Wry> {
|
||||
create_float_list_window,
|
||||
create_popup_window,
|
||||
create_main_window,
|
||||
create_meeting_window,
|
||||
// 系统托盘相关命令
|
||||
update_tray_menu,
|
||||
])
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
use crate::window::create_float_list_window::create_float_list_window_impl;
|
||||
use crate::window::create_main_window::create_main_window_impl;
|
||||
use crate::window::create_meeting_window::create_meeting_window_impl;
|
||||
use crate::window::create_popup_window::create_popup_window_impl;
|
||||
use crate::window::derive::TargetLocation;
|
||||
use tauri::{AppHandle, Window};
|
||||
@ -36,9 +35,3 @@ pub async fn create_popup_window(app: AppHandle, window: Window) -> Result<Strin
|
||||
pub async fn create_main_window(app: AppHandle) -> Result<String, String> {
|
||||
create_main_window_impl(&app).await.map(|_| "success".to_string())
|
||||
}
|
||||
|
||||
/// 创建会议窗口(Tauri命令)
|
||||
#[tauri::command]
|
||||
pub async fn create_meeting_window(app: AppHandle, window_type: u8, course_id: Option<u64>) -> Result<String, String> {
|
||||
create_meeting_window_impl(&app, window_type, course_id).await.map(|_| "success".to_string())
|
||||
}
|
||||
|
||||
@ -1,59 +0,0 @@
|
||||
use crate::constants::{common::*, window::*};
|
||||
use crate::env::TEACHERCONTROL_JK_URL;
|
||||
use crate::window::WindowLabel;
|
||||
use tauri::{AppHandle, Manager, Runtime, WebviewUrl, WebviewWindowBuilder};
|
||||
|
||||
/// 创建会议窗口(内部实现)
|
||||
pub async fn create_meeting_window_impl<R: Runtime>(app: &AppHandle<R>, window_type: u8, course_id: Option<u64>) -> Result<(), String> {
|
||||
// 根据窗口类型定义label和url
|
||||
let (label, url, title, width, height, decorations, transparent) = match window_type {
|
||||
1 => {
|
||||
let label = WindowLabel::MEETING.as_ref();
|
||||
(
|
||||
label,
|
||||
WebviewUrl::App("/#/meeting".into()),
|
||||
"会议",
|
||||
MEETING_TYPE_1_WIDTH,
|
||||
MEETING_TYPE_1_HEIGHT,
|
||||
false,
|
||||
true,
|
||||
)
|
||||
}
|
||||
2 => {
|
||||
if let Some(id) = course_id {
|
||||
println!("创建会议窗口2: {}", TEACHERCONTROL_JK_URL);
|
||||
let url = format!("{}?CourseID={}", TEACHERCONTROL_JK_URL, id);
|
||||
let label = WindowLabel::MEETING2.as_ref();
|
||||
(
|
||||
label,
|
||||
WebviewUrl::External(url.parse().map_err(|_| "URL格式错误".to_string())?),
|
||||
"会议2",
|
||||
MEETING_TYPE_2_WIDTH,
|
||||
MEETING_TYPE_2_HEIGHT,
|
||||
true,
|
||||
false,
|
||||
)
|
||||
} else {
|
||||
return Err(MSG_MEETING_TYPE_2_NEEDS_COURSE_ID.to_string());
|
||||
}
|
||||
}
|
||||
_ => return Err(MSG_UNSUPPORTED_MEETING_WINDOW_TYPE.to_string()),
|
||||
};
|
||||
|
||||
// 如果窗口已存在,先关闭它
|
||||
if let Some(win) = app.get_webview_window(label) {
|
||||
let _ = win.close();
|
||||
}
|
||||
|
||||
// 创建窗口
|
||||
WebviewWindowBuilder::new(app, label, url)
|
||||
.title(title)
|
||||
.inner_size(width, height)
|
||||
.decorations(decorations)
|
||||
.transparent(transparent)
|
||||
.devtools(true)
|
||||
.build()
|
||||
.map_err(|e| format!("{} {}", MSG_FAILED_CREATE_MEETING_WINDOW, e))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
pub mod commands;
|
||||
pub mod create_float_list_window;
|
||||
pub mod create_main_window;
|
||||
pub mod create_meeting_window;
|
||||
pub mod create_popup_window;
|
||||
pub mod derive;
|
||||
pub mod label;
|
||||
|
||||
Reference in New Issue
Block a user