feat: 后台管理页全量重构 + backoffice 共享模块 + 启动脚本优化

## 后台管理页重构
- admin 端: add_doctor / doctors / home / patients 四页重构
- doctor 端: consultations / dashboard / followup_edit / followups / home / patient_detail / patients / profile / report_detail / reports / settings 十一页重构
- 新增 backoffice 共享模块: backoffice_refresh_providers + backoffice_formatters + backoffice_ui

## 后端
- AdminService 增强(分页/搜索/统计)
- doctor_endpoints 微调
- appsettings.Development 调整
- 新增 admin_service_tests

## 前端其他
- 今日健康卡片 taskRow 行高 5->7(每行 44->48px)
- 健康仪表盘配色定 #4FACFE 纯色蓝
- admin_drawer / doctor_drawer 微调
- api_client IP 适配

## 启动脚本
- start-dev.bat: 加后端就绪检测(轮询 openapi 端点, 最多等 30s)

## 清理
- 删除旧品牌图(agent_welcome_abstract / login_background_v1)
- 删除 app_status_badge 组件
- 删除旧 HANDOFF 文档, 新增 07-17 版

## 测试
- 新增 backoffice_formatters / backoffice_refresh / backoffice_ui 三个测试
- app_router_test 扩展
This commit is contained in:
MingNian
2026-07-18 17:48:44 +08:00
parent e1f4a4b91f
commit ae94ced2d5
41 changed files with 1610 additions and 820 deletions

View File

@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../core/app_colors.dart';
import '../../providers/data_providers.dart' show adminServiceProvider;
import '../../utils/backoffice_formatters.dart';
import '../../widgets/backoffice_ui.dart';
class AdminPatientsPage extends ConsumerStatefulWidget {
const AdminPatientsPage({super.key});
@@ -16,6 +18,7 @@ class _AdminPatientsPageState extends ConsumerState<AdminPatientsPage> {
int _page = 1;
bool _loading = true;
bool _loadingMore = false;
String? _error;
@override
void initState() {
@@ -35,13 +38,15 @@ class _AdminPatientsPageState extends ConsumerState<AdminPatientsPage> {
setState(() {
_loading = true;
_patients = [];
_error = null;
});
}
try {
final res = await ref
.read(adminServiceProvider)
.getPatients(search: _searchCtrl.text.trim(), page: _page);
if (res['code'] == 0 && mounted) {
if (!mounted) return;
if (res['code'] == 0) {
final data = res['data'] as Map<String, dynamic>? ?? {};
setState(() {
_total = data['total'] ?? 0;
@@ -54,12 +59,19 @@ class _AdminPatientsPageState extends ConsumerState<AdminPatientsPage> {
_loading = false;
_loadingMore = false;
});
} else {
setState(() {
_loading = false;
_loadingMore = false;
_error = res['message']?.toString() ?? '患者列表加载失败';
});
}
} catch (_) {
} catch (e) {
if (mounted) {
setState(() {
_loading = false;
_loadingMore = false;
_error = '患者列表加载失败';
});
}
}
@@ -123,13 +135,14 @@ class _AdminPatientsPageState extends ConsumerState<AdminPatientsPage> {
// 患者列表
Expanded(
child: _loading
? const Center(child: CircularProgressIndicator())
? const BackofficeLoadingState(message: '正在加载患者')
: _error != null
? BackofficeErrorState(message: _error!, onRetry: _load)
: _patients.isEmpty
? const Center(
child: Text(
'暂无患者',
style: TextStyle(color: AppColors.textHint, fontSize: 16),
),
? const BackofficeEmptyState(
icon: Icons.people_outline,
title: '暂无患者',
description: '注册患者会显示在这里',
)
: NotificationListener<ScrollNotification>(
onNotification: (n) {
@@ -152,20 +165,14 @@ class _AdminPatientsPageState extends ConsumerState<AdminPatientsPage> {
);
}
final p = _patients[i];
return Card(
return BackofficeSectionCard(
margin: const EdgeInsets.only(bottom: 8),
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(14),
side: const BorderSide(color: AppColors.border),
),
padding: EdgeInsets.zero,
child: ListTile(
leading: CircleAvatar(
backgroundColor: AppColors.iconBg,
child: Text(
p['name']?.toString().isNotEmpty == true
? p['name']!.toString()[0]
: '?',
backofficeInitial(p['name']),
style: const TextStyle(color: AppColors.primary),
),
),