feat(auth): 登录页改为 ymb 品牌并支持后台配置背景图

This commit is contained in:
Vicky authored and trae-solo-agent committed 2026-10-30 17:14:30 +08:00
1 parent 22cc669bbe
commit e7399fa3fd
24 files changed
+378 -188

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
// Author: fruit.com.cn
import 'api_client.dart';
/// 启动配置:`GET /app/config`(匿名,后台只下发白名单键)。
class ConfigApi {
const ConfigApi(this._client);
final ApiClient _client;
/// 白名单配置表;结构异常时返回空表,调用方按本地默认处理。
Future<Map<String, dynamic>> appConfig() async {
final data = await _client.get('/app/config');
return data is Map<String, dynamic> ? data : const <String, dynamic>{};
}
}
@@ -0,0 +1,31 @@
// Author: fruit.com.cn
import 'package:flutter/foundation.dart';
import '../remote/config_api.dart';
/// 后台下发的启动配置。
///
/// 失败一律静默:拿不到就用 App 内置默认,不阻塞启动、不弹错。
class AppConfigController extends ChangeNotifier {
AppConfigController(this._api);
final ConfigApi _api;
String _loginBackgroundUrl = '';
/// 登录页整屏背景图;空串表示用本地默认图。
String get loginBackgroundUrl => _loginBackgroundUrl;
Future<void> load() async {
try {
final config = await _api.appConfig();
final url = (config['loginBackgroundUrl'] as String? ?? '').trim();
if (url == _loginBackgroundUrl) return;
_loginBackgroundUrl = url;
notifyListeners();
} catch (error) {
debugPrint('[config] load failed: $error');
}
}
}