更新界面布局
This commit is contained in:
@@ -16,6 +16,8 @@ import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||
import 'package:vbvs_app/common/util/CheckNetwork.dart';
|
||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/date/CalendarController.dart';
|
||||
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
|
||||
import 'package:vbvs_app/controller/device/body_device_controller.dart';
|
||||
@@ -56,10 +58,9 @@ import 'package:vbvs_app/controller/time/countdown_controller.dart';
|
||||
import 'package:vbvs_app/controller/weather/weather_controller.dart';
|
||||
import 'package:vbvs_app/language/AppLanguage.dart';
|
||||
import 'package:vbvs_app/model/CustomThemeColor.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
import 'package:vbvs_app/model/user_data.dart';
|
||||
import 'package:vbvs_app/pages/device_control/BackMovement.dart';
|
||||
import 'package:vbvs_app/pages/device_control/MattressControl.dart';
|
||||
import 'package:vbvs_app/pages/device_control/people_info.dart';
|
||||
import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart';
|
||||
import 'package:vbvs_app/routers/mh_routers.dart';
|
||||
|
||||
@@ -208,12 +209,66 @@ Future<void> initLogin() async {
|
||||
// 根据token去请求
|
||||
// await userInfoController.autoLogin(token);
|
||||
EasyDartModule.dio.token = token;
|
||||
// await dealBindProcess();
|
||||
} else {
|
||||
// 如果没有 token,则将用户标记为未登录
|
||||
userInfoController.model.login = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//处理绑定未完成的数据
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
MyApp({super.key});
|
||||
final ThemeController themeController = Get.put(ThemeController());
|
||||
@@ -257,7 +312,6 @@ class MyApp extends StatelessWidget {
|
||||
Get.lazyPut(() => DeviceShareListController()),
|
||||
Get.lazyPut(() => DeviceCalibrationController()),
|
||||
Get.lazyPut(() => RepairController()),
|
||||
Get.lazyPut(() => PdfController()),
|
||||
]));
|
||||
}
|
||||
|
||||
@@ -286,7 +340,7 @@ class MyApp extends StatelessWidget {
|
||||
initialBinding: BindingsBuilder(() => [
|
||||
// Get.lazyPut(() => UserInfoController()),
|
||||
Get.put(GlobalController()),
|
||||
Get.put(WeatherModelController()),
|
||||
Get.put(WeatherModelController()),
|
||||
Get.lazyPut(() => MainPageController()),
|
||||
Get.lazyPut(() => BlueteethBindController()),
|
||||
Get.lazyPut(() => PersonController()),
|
||||
@@ -299,17 +353,17 @@ class MyApp extends StatelessWidget {
|
||||
Get.lazyPut(() => DeviceShareListController()),
|
||||
Get.lazyPut(() => DeviceCalibrationController()),
|
||||
Get.lazyPut(() => RepairController()),
|
||||
Get.lazyPut(() => UserPdfController()),
|
||||
Get.lazyPut(() => PrivacyPdfController()),
|
||||
Get.lazyPut(() => CalendarController()),
|
||||
Get.lazyPut(() => SleepReportController()),
|
||||
Get.lazyPut(() => MessageReviewController()),
|
||||
Get.lazyPut(() => MessageSettingController()),
|
||||
Get.lazyPut(() => CommonMessageSettingController()),
|
||||
Get.lazyPut(() => UserPdfController()),
|
||||
Get.lazyPut(() => PrivacyPdfController()),
|
||||
Get.lazyPut(() => CalendarController()),
|
||||
Get.lazyPut(() => SleepReportController()),
|
||||
Get.lazyPut(() => MessageReviewController()),
|
||||
Get.lazyPut(() => MessageSettingController()),
|
||||
Get.lazyPut(() => CommonMessageSettingController()),
|
||||
]));
|
||||
}
|
||||
|
||||
final selectapp = "mht";
|
||||
final selectapp = "th";
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
Reference in New Issue
Block a user