refactor(window): 移除会议窗口相关功能
- 删除会议窗口创建相关的常量定义 - 移除 create_meeting_window 模块及其命令注册 - 从窗口命令模块中移除会议窗口创建函数 - 删除前端调用会议窗口创建的 API 接口 - 清理画板窗口和实时字幕窗口的占位代码
This commit is contained in:
@ -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