diff --git a/assets/langs/zh_CN.json b/assets/langs/zh_CN.json index 1f4de48..a240e55 100644 --- a/assets/langs/zh_CN.json +++ b/assets/langs/zh_CN.json @@ -556,7 +556,7 @@ "微信用户": "微信用户", "其他设备正在绑定中,是否终止其他设备绑定?": "其他设备正在绑定中,是否终止其他设备绑定?", "图形参考": "图像参考", - "正常心率窦性图": "正常心率窦性", + "正常心率窦性图": "正常窦性心率", "窦性心律不齐图": "窦性心律不齐", "持续性房颤图": "持续性房颤", "阵法性房颤图": "阵法性房颤", diff --git a/assets/langs/zh_TW.json b/assets/langs/zh_TW.json index 085b5e3..65248f9 100644 --- a/assets/langs/zh_TW.json +++ b/assets/langs/zh_TW.json @@ -551,7 +551,7 @@ "其他设备正在绑定中,是否终止其他设备绑定?": "其他設備正在綁定中,是否終止其他設備綁定?", "未配置网络提示": "當前設備未進行網路配置,是否確認跳過網路配置?", "图形参考": "圖形參考", - "正常心率窦性图": "正常心率竇性圖", + "正常心率窦性图": "正常竇性心率圖", "窦性心律不齐图": "竇性心律不齊圖", "持续性房颤图": "持續性房顫圖", "阵法性房颤图": "陣法性房顫圖", diff --git a/assets/miniapp/mhtControl_1.0.94.zip b/assets/miniapp/mhtControl_1.0.94.zip new file mode 100644 index 0000000..ce0746e Binary files /dev/null and b/assets/miniapp/mhtControl_1.0.94.zip differ diff --git a/lib/common/color/ServiceConstant.dart b/lib/common/color/ServiceConstant.dart index a4ce9d3..0288bb6 100644 --- a/lib/common/color/ServiceConstant.dart +++ b/lib/common/color/ServiceConstant.dart @@ -1,7 +1,7 @@ class ServiceConstant { // static const String baseHost = "zhmht.swes.com.cn:27021"; //服务地址 眠花糖测试地址 static String baseHost = "zhmht.swes.com.cn:27020"; //服务地址 眠花糖正式地址 - // static const String baseHost = "vsbs-test.he-info.cn"; //服务地址 本地测试地址 + // static String baseHost = "vsbs-test.he-info.cn"; //服务地址 本地测试地址 // static const String baseHost = "vsbst-api.he-info.com";//服务地址 // static const String service_address = "http://$baseHost"; static String service_address = "https://$baseHost"; diff --git a/lib/common/color/appConstants.dart b/lib/common/color/appConstants.dart index 8bacce6..ce0abe0 100644 --- a/lib/common/color/appConstants.dart +++ b/lib/common/color/appConstants.dart @@ -8,8 +8,8 @@ import 'package:vbvs_app/enum/APPPackageType.dart'; class AppConstants { // App-related constants - static const String zhmht_app_version = "SWES_1.2026.3.17"; //眠花糖 - static const String theh_app_version = "1.2603.23"; //太和 + static const String zhmht_app_version = "SWES_1.2026.3.30"; //眠花糖 + static const String theh_app_version = "1.2603.30"; //太和 // 1. 纯字符串列表格式 static const List integerTimeZones = [ diff --git a/lib/controller/device/device_type_controller.dart b/lib/controller/device/device_type_controller.dart index 1902a7a..b564267 100644 --- a/lib/controller/device/device_type_controller.dart +++ b/lib/controller/device/device_type_controller.dart @@ -54,6 +54,9 @@ class DeviceTypeController extends GetControllerEx { RxBool own = false.obs; //体验id RxString errmsg = "".obs; RxBool qcListLoading = true.obs; + RxBool qcDetailLoading = true.obs; // 详情加载状态(专门用于id不为空时的加载) + + int _requestSequence = 0; Future getDeviceType() async { ApiResponse apiResponse = ApiResponse(code: -1, msg: "请求失败".tr); @@ -128,7 +131,15 @@ class DeviceTypeController extends GetControllerEx { } Future getCheckHistory({required String mac, String? id}) async { - qcListLoading.value = true; + // 生成新的序列号 + final currentSeq = ++_requestSequence; + if (id == null || id.isEmpty) { + qcListLoading.value = true; + } else { + qcDetailLoading.value = true; + currentCq.value = {}; + } + String serviceAddress = ServiceConstant.qc_service_address; String serviceApi = ServiceConstant.getCheckHistory; String queryUrl = "$serviceAddress$serviceApi"; @@ -155,6 +166,11 @@ class DeviceTypeController extends GetControllerEx { method: MyHttpMethod.get, queryUrl: queryUrl, onSuccess: (res) { + if (_requestSequence != currentSeq) { + print('⚠️ 忽略过期请求 #$currentSeq,当前最新是 #$_requestSequence'); + return; + } + flag = true; // 判断返回数据类型 if (res.data is List) { @@ -164,16 +180,30 @@ class DeviceTypeController extends GetControllerEx { // 如果是Map,赋值给currentCq currentCq.value = res.data as Map; } - qcListLoading.value = false; + if (id == null || id.isEmpty) { + qcListLoading.value = false; + } else { + qcDetailLoading.value = false; + } + // qcListLoading.value = false; updateAll(); }, onFailure: (res) { + if (_requestSequence != currentSeq) { + print('⚠️ 忽略过期失败回调 #$currentSeq'); + return; + } + flag = false; - qcListLoading.value = false; + if (id == null || id.isEmpty) { + qcListLoading.value = false; + } else { + qcDetailLoading.value = false; + } currentCq.value = {}; NewTopSlideNotification.show( text: "数据加载失败", textColor: themeController.currentColor.sc9); - EasyDartModule.logger.error("快检报告数据加载失败-->${res.msg??'服务器错误'}"); + EasyDartModule.logger.error("快检报告数据加载失败-->${res.msg ?? '服务器错误'}"); }, ); return flag; diff --git a/lib/main.dart b/lib/main.dart index 32480a1..5e739d9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -141,8 +141,8 @@ Future main() async { void initServiceAddress() { if (AppConstants().ent_type == APPPackageType.MHT.code) { // 眠花糖 - // ServiceConstant.baseHost = "zhmht.swes.com.cn:27020"; - ServiceConstant.baseHost = "vsbs-test.he-info.cn"; + ServiceConstant.baseHost = "zhmht.swes.com.cn:27020"; + // ServiceConstant.baseHost = "vsbs-test.he-info.cn"; } else if (AppConstants().ent_type == APPPackageType.TH.code) { // 太和 // ServiceConstant.baseHost = "vsbst-api.he-info.com"; @@ -698,7 +698,7 @@ void initEasyDartModule() { EasyDartModule.init( loggerConfig: LoggerConfig( host: "https://zhmht.swes.com.cn:27020/vsbs_log", - serviceName: "太和e护test2026-03-23"), + serviceName: "太和e护test2026-03-30"), webSocketConfig: WebSocketConfig(ServiceConstant.webSocketService, (data) { // 接收到服务消息 diff --git a/lib/pages/device/component/HealthReportCard.dart b/lib/pages/device/component/HealthReportCard.dart index 9e44fa3..682824d 100644 --- a/lib/pages/device/component/HealthReportCard.dart +++ b/lib/pages/device/component/HealthReportCard.dart @@ -94,19 +94,28 @@ class _HealthReportCardWidgetState extends State { _formatTime(reportData['create_time']), onViewTap: () async { // 查看按钮点击事件 + edm.EasyDartModule.logger.info("快检报告查看按钮点击"); String ID = reportData['id']; DeviceTypeController deviceTypeController = Get.find(); - await deviceTypeController.getCheckHistory( - id: ID, mac: reportData['mac']); - if (deviceTypeController.currentCq.value == null || - deviceTypeController.currentCq.value.isEmpty) { - NewTopSlideNotification.show( - text: "未找到快检报告".tr, - textColor: themeController.currentColor.sc9); - return; - } - _onViewReport(deviceTypeController.currentCq.value); + Map data = { + 'id': ID, + 'mac': reportData['mac'], + }; + // await deviceTypeController.getCheckHistory( + // id: ID, mac: reportData['mac']); + // if (Get.currentRoute != '/healthExperienceHistory') + // return; + // if (deviceTypeController.currentCq.value == null || + // deviceTypeController.currentCq.value.isEmpty) { + // NewTopSlideNotification.show( + // text: "未找到快检报告".tr, + // textColor: themeController.currentColor.sc9); + // return; + // } + // _onViewReport(deviceTypeController.currentCq.value); + Get.toNamed('/healthQuickCheckReportPage', + arguments: data); }, ), ], diff --git a/lib/pages/device/health_experience.dart b/lib/pages/device/health_experience.dart index 29a38e4..8ab5bd6 100644 --- a/lib/pages/device/health_experience.dart +++ b/lib/pages/device/health_experience.dart @@ -1262,11 +1262,14 @@ class _HealthCheckPageState extends State progressNotifier.value = 0; edm.EasyDartModule.logger.info("快检结束,停止定时查询"); _checkStatusTimer?.cancel(); - await deviceTypeController.getCheckHistory( - id: deviceTypeController.experience_id.value, - mac: widget.personInfo['mac']); - Get.toNamed('/healthQuickCheckReportPage', - arguments: deviceTypeController.currentCq.value); + Map data = { + "id": deviceTypeController.experience_id.value, + "mac": widget.personInfo['mac'] + }; + // await deviceTypeController.getCheckHistory( + // id: deviceTypeController.experience_id.value, + // mac: widget.personInfo['mac']); + Get.toNamed('/healthQuickCheckReportPage', arguments: data); } catch (e) { edm.EasyDartModule.logger.error("快检报告页面加载失败---?${e.toString()}"); } diff --git a/lib/pages/device/health_experience_history.dart b/lib/pages/device/health_experience_history.dart index 1c28338..f80c3a5 100644 --- a/lib/pages/device/health_experience_history.dart +++ b/lib/pages/device/health_experience_history.dart @@ -10,7 +10,7 @@ import 'package:vbvs_app/controller/message/message_review_controller.dart'; import 'package:vbvs_app/pages/device/component/HealthReportCard.dart'; class HealthExperienceHistory extends StatefulWidget { - var data; //1.绑定时 2.绑定后 + var data; HealthExperienceHistory({super.key, required this.data}); @override diff --git a/lib/pages/sleep_report/quick_health_report_page.dart b/lib/pages/sleep_report/quick_health_report_page.dart index be1897f..87a3497 100644 --- a/lib/pages/sleep_report/quick_health_report_page.dart +++ b/lib/pages/sleep_report/quick_health_report_page.dart @@ -6,9 +6,11 @@ import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/component/tool/NewTopSlideNotification.dart'; import 'package:vbvs_app/controller/date/CalendarController.dart'; +import 'package:vbvs_app/controller/device/device_type_controller.dart'; import 'package:vbvs_app/controller/sleep/sleep_report_controller.dart'; import 'package:vbvs_app/pages/sleep_report/QcReportWidget.dart'; import 'package:vbvs_app/pages/sleep_report/chart/StatusBarWithIndicator.dart'; +import 'package:EasyDartModule/EasyDartModule.dart' as edm; class QuickHealthReportPage extends StatefulWidget { var data; @@ -27,6 +29,7 @@ class _QuickHealthReportPageState extends State { final GlobalKey breatheCardKey = GlobalKey(); final ScrollController _scrollController = ScrollController(); final RxBool isRightLimit = false.obs; + DeviceTypeController deviceTypeController = Get.find(); @override void didUpdateWidget(QuickHealthReportPage oldWidget) { @@ -47,249 +50,291 @@ class _QuickHealthReportPageState extends State { @override void initState() { super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) { + deviceTypeController + .getCheckHistory(id: widget.data['id'], mac: widget.data['mac']) + .then((res) { + if (deviceTypeController.currentCq.value == null || + deviceTypeController.currentCq.value.isEmpty) { + // NewTopSlideNotification.show( + // text: "未找到快检报告".tr, textColor: themeController.currentColor.sc9); + edm.EasyDartModule.logger.info("未找到快检报告"); + return; + } else { + deviceTypeController.updateAll(); + } + }); + }); } @override Widget build(BuildContext context) { - final healthLevelInfo = getHealthLevelInfo(widget.data); - double lineWidth = 150.rpx; try { - if (widget.data == null || widget.data.isEmpty) { - return LayoutBuilder( - builder: (context, bodySize) => GestureDetector( - child: Container( - decoration: BoxDecoration( - image: (widget.data['noBackImg'] != null && - widget.data['noBackImg'] == true) - ? null // ✅ 不要背景图 - : DecorationImage( - image: (widget.data['backgroundImg'] != null && - widget.data['backgroundImg'] - .toString() - .isNotEmpty) - ? AssetImage(widget.data['backgroundImg']) - : AssetImage(getBackgroundImageNoImage()) - as ImageProvider, - fit: BoxFit.fill, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, // 背景透明 - appBar: (widget.data['arrow'] != null && - widget.data['arrow'] == false) - ? null - : AppBar( - backgroundColor: widget.data['backgroundColor'] != null - ? widget.data['backgroundColor'].withOpacity(0.8) - : themeController.currentColor.sc5, - automaticallyImplyLeading: false, - iconTheme: IconThemeData( - color: themeController.currentColor.sc3), - titleSpacing: 0, - title: Container( - width: double.infinity, - height: 180.rpx, - child: Stack( - alignment: Alignment.center, - children: [ - /// 居中标题 - Text( - '快检报告'.tr, - style: TextStyle( - fontFamily: 'Readex Pro', - color: themeController.currentColor.sc3, - letterSpacing: 0, - fontSize: 30.rpx, + return Obx(() { + final healthLevelInfo = + getHealthLevelInfo(deviceTypeController.currentCq.value); + if (deviceTypeController.qcDetailLoading.value) { + return LayoutBuilder( + builder: (context, bodySize) => GestureDetector( + child: Container( + decoration: BoxDecoration( + image: (deviceTypeController.currentCq.value['noBackImg'] != + null && + deviceTypeController.currentCq.value['noBackImg'] == + true) + ? null // ✅ 不要背景图 + : DecorationImage( + image: (deviceTypeController + .currentCq.value['backgroundImg'] != + null && + deviceTypeController + .currentCq.value['backgroundImg'] + .toString() + .isNotEmpty) + ? AssetImage(deviceTypeController + .currentCq.value['backgroundImg']) + : AssetImage(getBackgroundImageNoImage()) + as ImageProvider, + fit: BoxFit.fill, + ), + ), + child: Scaffold( + backgroundColor: Colors.transparent, // 背景透明 + appBar: + (deviceTypeController.currentCq.value['arrow'] != null && + deviceTypeController.currentCq.value['arrow'] == + false) + ? null + : AppBar( + backgroundColor: deviceTypeController + .currentCq.value['backgroundColor'] != + null + ? deviceTypeController + .currentCq.value['backgroundColor'] + .withOpacity(0.8) + : themeController.currentColor.sc5, + automaticallyImplyLeading: false, + iconTheme: IconThemeData( + color: themeController.currentColor.sc3), + titleSpacing: 0, + title: Container( + width: double.infinity, + height: 180.rpx, + child: Stack( + alignment: Alignment.center, + children: [ + /// 居中标题 + Text( + '快检报告'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: themeController.currentColor.sc3, + letterSpacing: 0, + fontSize: 30.rpx, + ), + ), + + /// 左边返回按钮 + if (deviceTypeController + .currentCq.value['arrow'] == + null || + deviceTypeController + .currentCq.value['arrow'] == + true) + Positioned( + left: 0, + child: returnIconButtomNew(), + ), + ], ), ), - - /// 左边返回按钮 - if (widget.data['arrow'] == null || - widget.data['arrow'] == true) - Positioned( - left: 0, - child: returnIconButtomNew(), - ), - ], - ), - ), - ), - body: SafeArea( - top: true, - child: Text('无数据'.tr), + ), + body: SafeArea( + top: true, + child: Center( + child: CircularProgressIndicator( + color: themeController.currentColor.sc1, + )), + ), ), ), ), - ), - ); - } - return LayoutBuilder( - builder: (context, bodySize) => GestureDetector( - child: Container( - decoration: BoxDecoration( - image: (widget.data['noBackImg'] != null && - widget.data['noBackImg'] == true) - ? null // ✅ 不要背景图 - : DecorationImage( - image: (widget.data['backgroundImg'] != null && - widget.data['backgroundImg'] - .toString() - .isNotEmpty) - ? AssetImage(widget.data['backgroundImg']) - : AssetImage(getBackgroundImageNoImage()) - as ImageProvider, - fit: BoxFit.fill, - ), - ), - child: Scaffold( - backgroundColor: Colors.transparent, // 背景透明 - appBar: (widget.data['arrow'] != null && - widget.data['arrow'] == false) - ? null - : AppBar( - backgroundColor: widget.data['backgroundColor'] != null - ? widget.data['backgroundColor'].withOpacity(0.8) - : themeController.currentColor.sc5, - automaticallyImplyLeading: false, - iconTheme: IconThemeData( - color: themeController.currentColor.sc3), - titleSpacing: 0, - title: Container( - width: double.infinity, - height: 180.rpx, - child: Stack( - alignment: Alignment.center, - children: [ - /// 居中标题 - Text( - '快检报告'.tr, - style: TextStyle( - fontFamily: 'Readex Pro', - color: themeController.currentColor.sc3, - letterSpacing: 0, - fontSize: 30.rpx, - ), - ), - - /// 左边返回按钮 - if (widget.data['arrow'] == null || - widget.data['arrow'] == true) - Positioned( - left: 0, - child: returnIconButtomNew(), - ), - ], + ); + } else { + return LayoutBuilder( + builder: (context, bodySize) => GestureDetector( + child: Container( + decoration: BoxDecoration( + image: (deviceTypeController.currentCq.value['noBackImg'] != + null && + deviceTypeController.currentCq.value['noBackImg'] == + true) + ? null // ✅ 不要背景图 + : DecorationImage( + image: (deviceTypeController + .currentCq.value['backgroundImg'] != + null && + deviceTypeController + .currentCq.value['backgroundImg'] + .toString() + .isNotEmpty) + ? AssetImage(deviceTypeController + .currentCq.value['backgroundImg']) + : AssetImage(getBackgroundImageNoImage()) + as ImageProvider, + fit: BoxFit.fill, ), - ), - ), - body: SafeArea( - top: true, - child: SingleChildScrollView( - child: Column( - children: [ - Padding( - padding: - EdgeInsets.fromLTRB(30.rpx, 30.rpx, 30.rpx, 26.rpx), - child: Container( - width: double.infinity, - constraints: BoxConstraints( - minHeight: 90.rpx, // 最小高度 - ), - decoration: BoxDecoration( - // color: themeController.currentColor.sc5, // 背景色 - ), - child: Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 0.rpx, 0.rpx, 0.rpx, 0.rpx), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - // 左侧图标 - Container( - margin: EdgeInsets.only(right: 7.rpx), - child: Icon( - Icons.info_outline, - size: 26.rpx, - color: themeController.currentColor.sc8, - ), - ), - - // 中间可换行文字 - Expanded( - child: Container( - margin: EdgeInsets.only(right: 69.rpx), - child: Text( - '5分钟快速检测可能受到用户当前状态、过程中说话动作、精神紧张等情况影响,数据仅供参考。' - .tr, - style: TextStyle( - fontFamily: 'Inter', - fontSize: AppConstants() - .smaller_text_fontSize, - color: themeController.currentColor.sc8, - height: 1.4, - ), - softWrap: true, - ), - ), - ), - ], - ), - ), - ), - ), - Padding( - padding: EdgeInsets.fromLTRB(30.rpx, 0, 30.rpx, 0), - child: Container( - decoration: BoxDecoration( - color: themeController.currentColor.sc5, - borderRadius: BorderRadius.circular(16.rpx), - ), - child: Column( - children: [ - // 第一个容器 - 包含Row布局 - Container( + ), + child: Scaffold( + backgroundColor: Colors.transparent, // 背景透明 + appBar: + (deviceTypeController.currentCq.value['arrow'] != null && + deviceTypeController.currentCq.value['arrow'] == + false) + ? null + : AppBar( + backgroundColor: deviceTypeController + .currentCq.value['backgroundColor'] != + null + ? deviceTypeController + .currentCq.value['backgroundColor'] + .withOpacity(0.8) + : themeController.currentColor.sc5, + automaticallyImplyLeading: false, + iconTheme: IconThemeData( + color: themeController.currentColor.sc3), + titleSpacing: 0, + title: Container( width: double.infinity, - padding: EdgeInsets.all(30.rpx), - decoration: BoxDecoration( - // color: themeController.currentColor.sc5, - borderRadius: BorderRadius.circular(16.rpx), + height: 180.rpx, + child: Stack( + alignment: Alignment.center, + children: [ + /// 居中标题 + Text( + '快检报告'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: themeController.currentColor.sc3, + letterSpacing: 0, + fontSize: 30.rpx, + ), + ), + + /// 左边返回按钮 + if (deviceTypeController + .currentCq.value['arrow'] == + null || + deviceTypeController + .currentCq.value['arrow'] == + true) + Positioned( + left: 0, + child: returnIconButtomNew(), + ), + ], ), + ), + ), + body: SafeArea( + top: true, + child: SingleChildScrollView( + child: Column( + children: [ + Padding( + padding: EdgeInsets.fromLTRB( + 30.rpx, 30.rpx, 30.rpx, 26.rpx), + child: Container( + width: double.infinity, + constraints: BoxConstraints( + minHeight: 90.rpx, // 最小高度 + ), + decoration: BoxDecoration( + // color: themeController.currentColor.sc5, // 背景色 + ), + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 0.rpx, 0.rpx, 0.rpx, 0.rpx), child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ - // 左边的Column,包含五行文字 + // 左侧图标 + Container( + margin: EdgeInsets.only(right: 7.rpx), + child: Icon( + Icons.info_outline, + size: 26.rpx, + color: themeController.currentColor.sc8, + ), + ), + + // 中间可换行文字 Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - '${widget.data['person']['name']} (${widget.data['person']['gender']} ${widget.data['person']['age'].toInt()}岁)', - style: TextStyle( - fontSize: AppConstants() - .bigger_text_fontSize, - color: themeController - .currentColor.sc3, - // fontWeight: FontWeight.bold, - ), + child: Container( + margin: EdgeInsets.only(right: 69.rpx), + child: Text( + '5分钟快速检测可能受到用户当前状态、过程中说话动作、精神紧张等情况影响,数据仅供参考。' + .tr, + style: TextStyle( + fontFamily: 'Inter', + fontSize: AppConstants() + .smaller_text_fontSize, + color: themeController + .currentColor.sc8, + height: 1.4, ), - SizedBox(height: 18.rpx), - Text( - "快检得分:".tr + - '${widget.data['score']['score'].toInt()} 分', - style: TextStyle( - fontSize: AppConstants() - .small_an_text_fontSize, - color: themeController - .currentColor.sc3, - ), - ), - SizedBox(height: 18.rpx), - Row( + softWrap: true, + ), + ), + ), + ], + ), + ), + ), + ), + Padding( + padding: EdgeInsets.fromLTRB(30.rpx, 0, 30.rpx, 0), + child: Container( + decoration: BoxDecoration( + color: themeController.currentColor.sc5, + borderRadius: BorderRadius.circular(16.rpx), + ), + child: Column( + children: [ + // 第一个容器 - 包含Row布局 + Container( + width: double.infinity, + padding: EdgeInsets.all(30.rpx), + decoration: BoxDecoration( + // color: themeController.currentColor.sc5, + borderRadius: + BorderRadius.circular(16.rpx), + ), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + // 左边的Column,包含五行文字 + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Text( - "健康等级:".tr, + '${deviceTypeController.currentCq.value['person']['name']} (${deviceTypeController.currentCq.value['person']['gender']} ${deviceTypeController.currentCq.value['person']['age'].toInt()}岁)', + style: TextStyle( + fontSize: AppConstants() + .bigger_text_fontSize, + color: themeController + .currentColor.sc3, + // fontWeight: FontWeight.bold, + ), + ), + SizedBox(height: 18.rpx), + Text( + "快检得分:".tr + + '${deviceTypeController.currentCq.value['score']['score'].toInt()} 分', style: TextStyle( fontSize: AppConstants() .small_an_text_fontSize, @@ -297,156 +342,178 @@ class _QuickHealthReportPageState extends State { .currentColor.sc3, ), ), + SizedBox(height: 18.rpx), + Row( + children: [ + Text( + "健康等级:".tr, + style: TextStyle( + fontSize: AppConstants() + .small_an_text_fontSize, + color: themeController + .currentColor.sc3, + ), + ), + Text( + healthLevelInfo['text'], + style: TextStyle( + fontSize: AppConstants() + .small_an_text_fontSize, + color: healthLevelInfo[ + 'color'], + ), + ), + ], + ), + SizedBox(height: 18.rpx), Text( - healthLevelInfo['text'], + "设备ID:".tr + + '${deviceTypeController.currentCq.value['mac']}', style: TextStyle( fontSize: AppConstants() .small_an_text_fontSize, - color: - healthLevelInfo['color'], + color: themeController + .currentColor.sc3, + ), + ), + SizedBox(height: 18.rpx), + Text( + "快检时间:".tr + + '${MyUtils.timestampToDateString(deviceTypeController.currentCq.value['create_time'].toInt())}', + style: TextStyle( + fontSize: AppConstants() + .small_an_text_fontSize, + color: themeController + .currentColor.sc3, ), ), ], ), - SizedBox(height: 18.rpx), - Text( - "设备ID:".tr + - '${widget.data['mac']}', - style: TextStyle( - fontSize: AppConstants() - .small_an_text_fontSize, - color: themeController - .currentColor.sc3, - ), - ), - SizedBox(height: 18.rpx), - Text( - "快检时间:".tr + - '${MyUtils.timestampToDateString(widget.data['create_time'].toInt())}', - style: TextStyle( - fontSize: AppConstants() - .small_an_text_fontSize, - color: themeController - .currentColor.sc3, - ), - ), - ], - ), - ), - // SizedBox(width: 20.rpx), // 左边文字和右边图片的间距 - - // 右边的本地图片 - Container( - width: 120.rpx, - height: 190.rpx, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(12.rpx), - image: DecorationImage( - image: AssetImage( - 'assets/img/black_body_still.png'), // 替换为您的本地图片路径 - fit: BoxFit.cover, ), + // SizedBox(width: 20.rpx), // 左边文字和右边图片的间距 + + // 右边的本地图片 + Container( + width: 120.rpx, + height: 190.rpx, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(12.rpx), + image: DecorationImage( + image: AssetImage( + 'assets/img/black_body_still.png'), // 替换为您的本地图片路径 + fit: BoxFit.cover, + ), + ), + ), + ], + ), + ), + + SizedBox(height: 34.rpx), // 两个容器之间的间距 + + // 第二个容器 - 包含StatusBarWithIndicator todo接入报告数据 + Container( + width: double.infinity, + // height: 220.rpx, + decoration: BoxDecoration( + // color: themeController.currentColor.sc5, + borderRadius: + BorderRadius.circular(16.rpx), + ), + child: Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 30.rpx, 20.rpx, 30.rpx, 20.rpx), + child: StatusBarWithIndicator( + selectKey: deviceTypeController + .currentCq.value['score']['level'] + .toInt(), // 这里传入对应的 level 值 + showLabel: (deviceTypeController + .currentCq + .value['type']['score'] as List) + .map>((item) { + return { + 'key': item['level']?.toInt() ?? + 0, // 使用 level 作为 key + 'name': item['name'] ?? '', + 'color': stringToColor( + item['color'] ?? + ''), // 将颜色字符串转换为 Color + 'range': + item['range'] ?? '', // 添加范围数据 + }; + }).toList(), + showCurrentValue: true, // 显示当前值 + currentValueText: + '当前属于'.tr, // 或者根据实际值动态生成 + showRange: true, // 显示范围 ), ), - ], - ), + ), + + SizedBox(height: 25.rpx), // 两个容器之间的间距 + ], ), - - SizedBox(height: 34.rpx), // 两个容器之间的间距 - - // 第二个容器 - 包含StatusBarWithIndicator todo接入报告数据 - Container( - width: double.infinity, - // height: 220.rpx, - decoration: BoxDecoration( - // color: themeController.currentColor.sc5, - borderRadius: BorderRadius.circular(16.rpx), + ), + ), + Padding( + padding: EdgeInsets.fromLTRB(30.rpx, 0, 30.rpx, 0), + child: Container( + width: double.infinity, + // padding: EdgeInsets.all(30.rpx), + decoration: BoxDecoration( + // color: themeController.currentColor.sc5, + borderRadius: BorderRadius.circular(16.rpx), + ), + child: QcReportWidget( + deviceTypeController.currentCq.value), + ), + ), + Padding( + padding: EdgeInsets.fromLTRB(46.rpx, 0, 46.rpx, 0), + child: Column( + children: [ + // Text( + // "MAC号".tr + + // ": ${deviceTypeController.currentCq.value['mac'] ?? '未知数据'.tr}", + // style: TextStyle( + // color: themeController.currentColor.sc4, + // fontSize: + // AppConstants().smaller_text_fontSize, + // ), + // ), + SizedBox( + height: 4.rpx, ), - child: Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 30.rpx, 20.rpx, 30.rpx, 20.rpx), - child: StatusBarWithIndicator( - selectKey: widget.data['score']['level'] - .toInt(), // 这里传入对应的 level 值 - showLabel: - (widget.data['type']['score'] as List) - .map>((item) { - return { - 'key': item['level']?.toInt() ?? - 0, // 使用 level 作为 key - 'name': item['name'] ?? '', - 'color': stringToColor(item['color'] ?? - ''), // 将颜色字符串转换为 Color - 'range': item['range'] ?? '', // 添加范围数据 - }; - }).toList(), - showCurrentValue: true, // 显示当前值 - currentValueText: '当前属于'.tr, // 或者根据实际值动态生成 - showRange: true, // 显示范围 + Text( + "注:本页报告是基于心率、呼吸等体征波形数据,通过AI算法模型分析完成,其结果仅供参考;其中报告未见数据异常部分,并不代表没有潜在性的疾病风险,如有不适请及时就医。" + .tr, + style: TextStyle( + color: themeController.currentColor.sc4, + fontSize: + AppConstants().smaller_text_fontSize, ), ), - ), - - SizedBox(height: 25.rpx), // 两个容器之间的间距 - ], - ), - ), - ), - Padding( - padding: EdgeInsets.fromLTRB(30.rpx, 0, 30.rpx, 0), - child: Container( - width: double.infinity, - // padding: EdgeInsets.all(30.rpx), - decoration: BoxDecoration( - // color: themeController.currentColor.sc5, - borderRadius: BorderRadius.circular(16.rpx), - ), - child: QcReportWidget(widget.data), - ), - ), - Padding( - padding: EdgeInsets.fromLTRB(46.rpx, 0, 46.rpx, 0), - child: Column( - children: [ - // Text( - // "MAC号".tr + - // ": ${widget.data['mac'] ?? '未知数据'.tr}", - // style: TextStyle( - // color: themeController.currentColor.sc4, - // fontSize: - // AppConstants().smaller_text_fontSize, - // ), - // ), - SizedBox( - height: 4.rpx, + ], ), - Text( - "注:本页报告是基于心率、呼吸等体征波形数据,通过AI算法模型分析完成,其结果仅供参考;其中报告未见数据异常部分,并不代表没有潜在性的疾病风险,如有不适请及时就医。" - .tr, - style: TextStyle( - color: themeController.currentColor.sc4, - fontSize: AppConstants().smaller_text_fontSize, - ), - ), - ], - ), + ), + SizedBox( + height: 40.rpx, + ), + ] + .divide(SizedBox( + height: 25.rpx, + )) + .addToEnd(SizedBox(height: 25.rpx)), ), - SizedBox( - height: 40.rpx, - ), - ] - .divide(SizedBox( - height: 25.rpx, - )) - .addToEnd(SizedBox(height: 25.rpx)), + ), ), ), ), ), - ), - ), - ); + ); + } + }); } catch (e) { NewTopSlideNotification.show( text: '页面渲染失败:${e.toString()}'.tr, @@ -456,15 +523,20 @@ class _QuickHealthReportPageState extends State { builder: (context, bodySize) => GestureDetector( child: Container( decoration: BoxDecoration( - image: (widget.data['noBackImg'] != null && - widget.data['noBackImg'] == true) + image: (deviceTypeController.currentCq.value['noBackImg'] != + null && + deviceTypeController.currentCq.value['noBackImg'] == true) ? null // ✅ 不要背景图 : DecorationImage( - image: (widget.data['backgroundImg'] != null && - widget.data['backgroundImg'] + image: (deviceTypeController + .currentCq.value['backgroundImg'] != + null && + deviceTypeController + .currentCq.value['backgroundImg'] .toString() .isNotEmpty) - ? AssetImage(widget.data['backgroundImg']) + ? AssetImage(deviceTypeController + .currentCq.value['backgroundImg']) : AssetImage(getBackgroundImageNoImage()) as ImageProvider, fit: BoxFit.fill, @@ -472,12 +544,16 @@ class _QuickHealthReportPageState extends State { ), child: Scaffold( backgroundColor: Colors.transparent, // 背景透明 - appBar: (widget.data['arrow'] != null && - widget.data['arrow'] == false) + appBar: (deviceTypeController.currentCq.value['arrow'] != null && + deviceTypeController.currentCq.value['arrow'] == false) ? null : AppBar( - backgroundColor: widget.data['backgroundColor'] != null - ? widget.data['backgroundColor'].withOpacity(0.8) + backgroundColor: deviceTypeController + .currentCq.value['backgroundColor'] != + null + ? deviceTypeController + .currentCq.value['backgroundColor'] + .withOpacity(0.8) : themeController.currentColor.sc5, automaticallyImplyLeading: false, iconTheme: IconThemeData( @@ -501,8 +577,10 @@ class _QuickHealthReportPageState extends State { ), /// 左边返回按钮 - if (widget.data['arrow'] == null || - widget.data['arrow'] == true) + if (deviceTypeController.currentCq.value['arrow'] == + null || + deviceTypeController.currentCq.value['arrow'] == + true) Positioned( left: 0, child: returnIconButtomNew(),