更新
This commit is contained in:
@@ -2,10 +2,12 @@ import 'package:ef/ef.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:flutterflow_ui/flutterflow_ui.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/appConstants.dart';
|
||||||
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||||
|
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||||
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
|
import 'package:vbvs_app/component/NullDataComponentWidget.dart';
|
||||||
import 'package:vbvs_app/component/home_page/DynamicReportDetailWidget.dart';
|
import 'package:vbvs_app/component/home_page/DynamicReportDetailWidget.dart';
|
||||||
import 'package:vbvs_app/component/home_page/SleepDataModuleWidget.dart';
|
import 'package:vbvs_app/component/home_page/SleepDataModuleWidget.dart';
|
||||||
@@ -1079,22 +1081,21 @@ class _HomePageState extends State<HomePage> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
sleepDataModuleWidgets:
|
sleepDataModuleWidgets: stateModule
|
||||||
stateModule.isNotEmpty
|
.isNotEmpty
|
||||||
? List.generate(
|
? List.generate(
|
||||||
stateModule.length,
|
stateModule.length,
|
||||||
(j) {
|
(j) {
|
||||||
stateModule[j]['onto'] = true;
|
stateModule[j]['onto'] = true;
|
||||||
stateModule[j]['time'] =
|
stateModule[j]['time'] =
|
||||||
currentTime;
|
currentTime;
|
||||||
stateModule[j]['mac'] =
|
stateModule[j]['mac'] = goalMac;
|
||||||
goalMac;
|
return SleepDataModuleWidget(
|
||||||
return SleepDataModuleWidget(
|
data: stateModule[j],
|
||||||
data: stateModule[j],
|
);
|
||||||
);
|
},
|
||||||
},
|
)
|
||||||
)
|
: [],
|
||||||
: [],
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -1231,4 +1232,57 @@ class _HomePageState extends State<HomePage> {
|
|||||||
showNextDialog();
|
showNextDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//处理绑定未完成的数据
|
||||||
|
Future<void> dealBindProcess() async {
|
||||||
|
UserInfoController userInfoController = Get.find();
|
||||||
|
String serviceAddress = ServiceConstant.service_address;
|
||||||
|
String serviceName = ServiceConstant.server_service;
|
||||||
|
String serviceApi = ServiceConstant.device_list;
|
||||||
|
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?bindType=1";
|
||||||
|
userInfoController.device_bind_status = [];
|
||||||
|
|
||||||
|
try {
|
||||||
|
final res = await requestWithLog(
|
||||||
|
logTitle: "查询设备绑定列表",
|
||||||
|
method: MyHttpMethod.get,
|
||||||
|
queryUrl: queryUrl,
|
||||||
|
);
|
||||||
|
|
||||||
|
List data = res.data ?? [];
|
||||||
|
if (data.isNotEmpty) {
|
||||||
|
// 使用 Future.wait 等待所有设备的查询完成
|
||||||
|
await Future.wait(
|
||||||
|
data.map((element) async {
|
||||||
|
String mac = element['mac'];
|
||||||
|
String type = "device_bind_status_$mac";
|
||||||
|
String queryUrl =
|
||||||
|
"${serviceAddress}${serviceName}${ServiceConstant.user_setting}?type=${type}";
|
||||||
|
|
||||||
|
try {
|
||||||
|
final res = await requestWithLog(
|
||||||
|
logTitle: "查询绑定流程",
|
||||||
|
method: MyHttpMethod.get,
|
||||||
|
queryUrl: queryUrl,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (res.data != null && res.data.isNotEmpty) {
|
||||||
|
bool celibration = res.data['celibration'];
|
||||||
|
bool person_info = res.data['person_info'];
|
||||||
|
bool wifi = res.data['wifi'];
|
||||||
|
if (!celibration || !person_info || !wifi) {
|
||||||
|
res.data['device_info'] = element;
|
||||||
|
userInfoController.device_bind_status.add(res.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print("查询绑定流程失败: $e");
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print("查询设备绑定列表失败: $e");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user