更新特殊处理测试账号

This commit is contained in:
wyf
2025-10-17 10:46:38 +08:00
parent 5e93369dd0
commit cd7ab904ac
3 changed files with 139 additions and 102 deletions

View File

@@ -718,11 +718,11 @@ Future<void> 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);

View File

@@ -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<DeviceDataComponentWidget> {
),
];
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<DeviceDataComponentWidget> {
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(

View File

@@ -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<Color>(
themeController.currentColor.sc1,
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(
themeController.currentColor.sc1,
),
),
),
);
}
return Container();
@@ -368,11 +405,11 @@ class _SingleBlueteethDeviceCompoentWidgetState
width: 24.rpx,
height: 24.rpx,
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(
themeController.currentColor.sc1,
),
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(
themeController.currentColor.sc1,
),
),
);
}
return Container();