fix: 全链路问题修复 — 编辑器返回/Tab导航/数据库编码/Token注入
修复内容:
- 编辑器返回按钮: 所有 context.go('/editor') 改为 context.push(),pop() 加安全守卫 fallback 到 /home
- Tab 导航: Web 平台强制使用移动端底部 TabBar 布局 (kIsWeb 守卫)
- 数据库编码: db.rs 自动追加 client_encoding=utf8 参数,修复中文 display_name 乱码
- AuthBloc token: 清理冗余 TODO,token 注入已在 AuthRepository 中正常工作
- 影响 9 个文件的编辑器导航调用点统一修改
This commit is contained in:
@@ -4,7 +4,15 @@ use std::time::Duration;
|
||||
use crate::config::DatabaseConfig;
|
||||
|
||||
pub async fn connect(config: &DatabaseConfig) -> anyhow::Result<DatabaseConnection> {
|
||||
let mut opt = ConnectOptions::new(&config.url);
|
||||
// 确保 URL 包含 client_encoding=utf8,防止 Windows 上编码错乱
|
||||
let url = if config.url.contains("client_encoding") {
|
||||
config.url.clone()
|
||||
} else {
|
||||
let separator = if config.url.contains('?') { '&' } else { '?' };
|
||||
format!("{}{}client_encoding=utf8", config.url, separator)
|
||||
};
|
||||
|
||||
let mut opt = ConnectOptions::new(&url);
|
||||
opt.max_connections(config.max_connections)
|
||||
.min_connections(config.min_connections)
|
||||
.connect_timeout(Duration::from_secs(10))
|
||||
|
||||
Reference in New Issue
Block a user