chore: 初始化项目基础结构和资源文件
- 添加项目图标文件(app-icon.png、各平台图标) - 配置开发环境文件(.env、.nvmrc、.npmrc) - 添加静态资源文件(背景图片、字体、音频) - 初始化Tauri后端结构(build.rs、main.rs、模块文件) - 配置前端项目结构(TypeScript、Vue组件、样式) - 添加Node.js API服务基础结构 - 配置构建和开发工具(vite、prettier、gitignore)
This commit is contained in:
44
src-tauri/src/window/commands.rs
Normal file
44
src-tauri/src/window/commands.rs
Normal file
@ -0,0 +1,44 @@
|
||||
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};
|
||||
|
||||
/// 创建悬浮列表窗口
|
||||
#[tauri::command]
|
||||
pub async fn create_float_list_window(app: AppHandle, page_type: &str) -> Result<String, String> {
|
||||
create_float_list_window_impl(std::sync::Arc::new(app), page_type).await.map(|_| "success".to_string())
|
||||
}
|
||||
|
||||
/// 创建弹出框窗口
|
||||
#[tauri::command]
|
||||
pub async fn create_popup_window(app: AppHandle, window: Window) -> Result<String, 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))?;
|
||||
|
||||
// 获取缩放因子
|
||||
let scale_factor = window.scale_factor().map_err(|e| format!("获取缩放因子失败: {}", e))?;
|
||||
|
||||
// 转换为逻辑位置和大小
|
||||
let current_position = current_position_physical.to_logical::<i32>(scale_factor);
|
||||
let current_size = current_size_physical.to_logical::<i32>(scale_factor);
|
||||
let target = TargetLocation {
|
||||
x: current_position.x,
|
||||
y: current_position.y,
|
||||
width: current_size.width as u32,
|
||||
height: current_size.height as u32,
|
||||
};
|
||||
create_popup_window_impl(&app, &target, "auto").await.map(|_| "success".to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
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())
|
||||
}
|
||||
Reference in New Issue
Block a user