新增笔记功能 图标更新

This commit is contained in:
2026-09-23 14:20:23 +08:00
parent a6e02ccbf3
commit e4cdfbc42f
34 changed files with 2511 additions and 0 deletions
+18
View File
@@ -29,3 +29,21 @@ String get baseUrl {
if (!kDebugMode) return kProdBaseUrl;
return kLocalBaseUrl;
}
/// 静态资源根地址(去掉 `/api` 后缀)
///
/// 笔记附件由后端以 `/uploads/2026/09/22/xxx.png` 这种相对路径返回,
/// 客户端要拼上 host 才能加载。
String get assetBaseUrl {
const suffix = '/api';
return baseUrl.endsWith(suffix)
? baseUrl.substring(0, baseUrl.length - suffix.length)
: baseUrl;
}
/// 把后端返回的资源地址补成绝对地址(已经是 http(s) 的原样返回)
String resolveAssetUrl(String path) {
if (path.isEmpty) return path;
if (path.startsWith('http://') || path.startsWith('https://')) return path;
return path.startsWith('/') ? '$assetBaseUrl$path' : '$assetBaseUrl/$path';
}