From cd7ab904acf9a890ba684b939a799ec6faabc5d6 Mon Sep 17 00:00:00 2001 From: wyf <494641114@qq.com> Date: Fri, 17 Oct 2025 10:46:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=B9=E6=AE=8A=E5=A4=84?= =?UTF-8?q?=E7=90=86=E6=B5=8B=E8=AF=95=E8=B4=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 10 +- .../component/DeviceDataComponentWidget.dart | 170 +++++++++--------- .../SingleBlueteethDeviceCompoentWidget.dart | 61 +++++-- 3 files changed, 139 insertions(+), 102 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index ffd79ca..6999b8e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -718,11 +718,11 @@ Future initLogin() async { if (userMap != null) { UserModel user = UserModel.fromJson(userMap); userInfoController.model.user = user; - if (user.test != null && (user.test)!) { - AppConstants.is_test_account = true; - } else { - AppConstants.is_test_account = false; - } + // if (user.test != null && (user.test)!) { + // AppConstants.is_test_account = true; + // } else { + // AppConstants.is_test_account = false; + // } } } catch (e) { print(e); diff --git a/lib/pages/device/component/DeviceDataComponentWidget.dart b/lib/pages/device/component/DeviceDataComponentWidget.dart index bd46306..70eb009 100644 --- a/lib/pages/device/component/DeviceDataComponentWidget.dart +++ b/lib/pages/device/component/DeviceDataComponentWidget.dart @@ -6,7 +6,6 @@ import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart'; -import 'package:vbvs_app/common/color/ServiceConstant.dart'; import 'package:vbvs_app/common/color/appConstants.dart'; import 'package:vbvs_app/common/color/app_uri_status.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; @@ -275,7 +274,7 @@ class _DeviceDataComponentWidgetState extends State { ), ]; - if (widget.device['bind_type'] == BindType.active.code) { + if (widget.device['bind_type'] == BindType.active.code && !AppConstants.is_test_account) { items.addAll([ _buildMenuItem( text: "WIFI配置".tr, @@ -1266,91 +1265,92 @@ class _DeviceDataComponentWidgetState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - Expanded( - child: CustomCard( - borderRadius: AppConstants().button_container_radius, - onTap: () async { - if (widget.device['person'] != null) { - personController.currentPersonId.value = - widget.device['_id']; - personController.name.value = - widget.device['person']['name']; - personController.update_person_mac.value = - widget.device['mac']; - personController.gender.value = - widget.device['person']['gender'] ?? 1; - personController.weight?.value = - widget.device['person']['weight'] == null - ? '' - : widget.device['person']['weight'] - .toString(); + // Expanded( + // child: CustomCard( + // borderRadius: AppConstants().button_container_radius, + // onTap: () async { + // if (widget.device['person'] != null) { + // personController.currentPersonId.value = + // widget.device['_id']; + // personController.name.value = + // widget.device['person']['name']; + // personController.update_person_mac.value = + // widget.device['mac']; + // personController.gender.value = + // widget.device['person']['gender'] ?? 1; + // personController.weight?.value = + // widget.device['person']['weight'] == null + // ? '' + // : widget.device['person']['weight'] + // .toString(); - personController.height.value = - widget.device['person']['height'] == null - ? '' - : widget.device['person']['height'] - .toString(); + // personController.height.value = + // widget.device['person']['height'] == null + // ? '' + // : widget.device['person']['height'] + // .toString(); - personController.selectedDiseaseIds.value = - widget.device['person']['disease'] ?? []; - personController.birthday.value = - widget.device['person']['birthday'] ?? ''; - personController.dateTime = - MyUtils.formatBirthdayTime( - widget.device['person']['birthday']); - } else { - personController.update_person_mac.value = - widget.device['mac']; - personController.currentPersonId.value = - widget.device['_id']; - personController.name.value = ""; - personController.gender.value = 1; - personController.dateTime = null; - personController.height.value = ""; - personController.weight.value = ""; - personController.diseaseList.value = []; - } - await Get.toNamed("/updatePersonPage", - arguments: widget.device['bind_type']); - bodyDeviceController.getDeviceList(); - }, - colors: [ - themeController.currentColor.sc1, - themeController.currentColor.sc2, - ], - child: Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 0.rpx, 0.rpx, 0.rpx, 0.rpx), - child: Container( - alignment: Alignment.center, - height: MediaQuery.sizeOf(context).height * 0.0037, - constraints: BoxConstraints( - minWidth: 143.rpx, - minHeight: 61.rpx, - ), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "体征检测设备.人员资料".tr, - style: TextStyle( - color: themeController.currentColor.sc3, - fontFamily: 'Inter', - fontSize: - AppConstants().normal_text_fontSize, - letterSpacing: 0.0, - ), - ), - ].divide(SizedBox(width: 17.rpx)), - ), - ), - ), - ), - ), - SizedBox( - width: 20.rpx, - ), + // personController.selectedDiseaseIds.value = + // widget.device['person']['disease'] ?? []; + // personController.birthday.value = + // widget.device['person']['birthday'] ?? ''; + // personController.dateTime = + // MyUtils.formatBirthdayTime( + // widget.device['person']['birthday']); + // } else { + // personController.update_person_mac.value = + // widget.device['mac']; + // personController.currentPersonId.value = + // widget.device['_id']; + // personController.name.value = ""; + // personController.gender.value = 1; + // personController.dateTime = null; + // personController.height.value = ""; + // personController.weight.value = ""; + // personController.diseaseList.value = []; + // } + // await Get.toNamed("/updatePersonPage", + // arguments: widget.device['bind_type']); + // bodyDeviceController.getDeviceList(); + // }, + // colors: [ + // themeController.currentColor.sc1, + // themeController.currentColor.sc2, + // ], + // child: Padding( + // padding: EdgeInsetsDirectional.fromSTEB( + // 0.rpx, 0.rpx, 0.rpx, 0.rpx), + // child: Container( + // alignment: Alignment.center, + // height: MediaQuery.sizeOf(context).height * 0.0037, + // constraints: BoxConstraints( + // minWidth: 143.rpx, + // minHeight: 61.rpx, + // ), + // child: Row( + // mainAxisSize: MainAxisSize.max, + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // Text( + // "体征检测设备.人员资料".tr, + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontFamily: 'Inter', + // fontSize: + // AppConstants().normal_text_fontSize, + // letterSpacing: 0.0, + // ), + // ), + // ].divide(SizedBox(width: 17.rpx)), + // ), + // ), + // ), + // ), + // ), + + // SizedBox( + // width: 20.rpx, + // ), Expanded( // 使用 Expanded 来占据屏幕宽度的一半 child: CustomCard( diff --git a/lib/pages/device_bind/componnet/SingleBlueteethDeviceCompoentWidget.dart b/lib/pages/device_bind/componnet/SingleBlueteethDeviceCompoentWidget.dart index adeb89b..d45418b 100644 --- a/lib/pages/device_bind/componnet/SingleBlueteethDeviceCompoentWidget.dart +++ b/lib/pages/device_bind/componnet/SingleBlueteethDeviceCompoentWidget.dart @@ -4,6 +4,7 @@ import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:vbvs_app/common/color/ServiceConstant.dart'; +import 'package:vbvs_app/common/color/appConstants.dart'; import 'package:vbvs_app/common/color/app_uri_status.dart'; import 'package:vbvs_app/common/util/DailyLogUtils.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; @@ -11,6 +12,8 @@ import 'package:vbvs_app/common/util/requestWithLog.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart'; import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart'; +import 'package:vbvs_app/controller/device/body_device_controller.dart'; +import 'package:vbvs_app/controller/home/home_controller.dart'; import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/model/BleDeviceData.dart'; import 'package:vbvs_app/model/api_response.dart'; @@ -95,9 +98,43 @@ class _SingleBlueteethDeviceCompoentWidgetState if (response.code == HttpStatusCodes.ok) { //更新设备绑定流程 updateDeviceBindStatus(device); - Get.toNamed("/wifiPage"); - THapp bledevice = THapp(device: widget.bleDevice.device); - blueteethBindController.currentDevice = bledevice; + if (AppConstants.is_test_account) { + BlueteethBindController blueteethBindController = + Get.find(); + if (blueteethBindController.returnPage == 0) { + HomeController homeController = Get.find(); + BodyDeviceController deviceController = Get.find(); + if (true) { + homeController.getSleepReport(); + deviceController + .getDeviceNum() + .then((apiResponse) { + if (apiResponse.code != HttpStatusCodes.ok) {} + }); + deviceController + .getDeviceList() + .then((apiResponse) { + if (apiResponse.code != HttpStatusCodes.ok) { + } else { + //请求睡眠报告 + deviceController.getSleepReport(); + } + }); + } + Get.until((route) => + Get.currentRoute == "/mianPageBottomChange"); + } else { + // Get.offNamed("/bodyDevice"); + // Get.offNamedUntil(page, predicate); + Get.until( + (route) => Get.currentRoute == "/bodyDevice"); + } + } else { + Get.toNamed("/wifiPage"); + THapp bledevice = THapp(device: widget.bleDevice.device); + blueteethBindController.currentDevice = bledevice; + } + // blueteethBindController.currentDeviceMac.value = ""; } else { blueteethBindController.currentDeviceMac.value = ""; @@ -152,12 +189,12 @@ class _SingleBlueteethDeviceCompoentWidgetState return SizedBox( width: 24.rpx, height: 24.rpx, - child:CircularProgressIndicator( - strokeWidth: 2, - valueColor: AlwaysStoppedAnimation( - themeController.currentColor.sc1, + child: CircularProgressIndicator( + strokeWidth: 2, + valueColor: AlwaysStoppedAnimation( + themeController.currentColor.sc1, + ), ), - ), ); } return Container(); @@ -368,11 +405,11 @@ class _SingleBlueteethDeviceCompoentWidgetState width: 24.rpx, height: 24.rpx, child: CircularProgressIndicator( - strokeWidth: 2, - valueColor: AlwaysStoppedAnimation( - themeController.currentColor.sc1, - ), + strokeWidth: 2, + valueColor: AlwaysStoppedAnimation( + themeController.currentColor.sc1, ), + ), ); } return Container();