From 12c6a260c9db39d7cf6627ba76cf208f80ef76b2 Mon Sep 17 00:00:00 2001 From: wyf <494641114@qq.com> Date: Tue, 24 Jun 2025 19:51:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/taihe/mianhuatang/MainActivity.kt | 2 +- android/local.properties | 2 +- .../mh_controller/address_controller.dart | 13 +++---- .../component/HomeDeviceStausWidget.dart | 5 ++- lib/pages/mh_page/homepage/new_Home_page.dart | 34 ++++++++++++++++++- 5 files changed, 44 insertions(+), 12 deletions(-) diff --git a/android/app/src/main/kotlin/com/taihe/mianhuatang/MainActivity.kt b/android/app/src/main/kotlin/com/taihe/mianhuatang/MainActivity.kt index 38032ef..8537ae0 100644 --- a/android/app/src/main/kotlin/com/taihe/mianhuatang/MainActivity.kt +++ b/android/app/src/main/kotlin/com/taihe/mianhuatang/MainActivity.kt @@ -1,4 +1,4 @@ -package com.taihe.mh_app +package com.taihe.vbvs_app import io.flutter.embedding.android.FlutterActivity diff --git a/android/local.properties b/android/local.properties index ebc3f6f..ebcdb0b 100644 --- a/android/local.properties +++ b/android/local.properties @@ -1,6 +1,6 @@ sdk.dir=C:\\Users\\wyf\\AppData\\Local\\Android\\sdk flutter.sdk=D:\\flutter_res\\flutter -flutter.buildMode=release +flutter.buildMode=debug flutter.versionName=1.0.0 flutter.versionCode=1 flutter.minSdkVersion=21 diff --git a/lib/controller/mh_controller/address_controller.dart b/lib/controller/mh_controller/address_controller.dart index f675ffe..8805d68 100644 --- a/lib/controller/mh_controller/address_controller.dart +++ b/lib/controller/mh_controller/address_controller.dart @@ -9,7 +9,7 @@ import 'package:vbvs_app/common/util/requestWithLog.dart'; import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/model/user_data.dart'; -import 'package:lpinyin/lpinyin.dart'; +// import 'package:lpinyin/lpinyin.dart'; part 'address_controller.g.dart'; @JsonSerializable() @@ -209,10 +209,11 @@ class AddressController extends GetControllerEx { // 工具:中文首字母转大写英文(你也可以用更专业的拼音库) String _getLetter(String name) { - if (name.isEmpty) return "#"; - String pinyin = PinyinHelper.getPinyinE(name, - separator: '', defPinyin: '', format: PinyinFormat.WITHOUT_TONE); - if (pinyin.isEmpty) return "#"; - return pinyin[0].toUpperCase(); + return name; + // if (name.isEmpty) return "#"; + // String pinyin = PinyinHelper.getPinyinE(name, + // separator: '', defPinyin: '', format: PinyinFormat.WITHOUT_TONE); + // if (pinyin.isEmpty) return "#"; + // return pinyin[0].toUpperCase(); } } diff --git a/lib/pages/mh_page/homepage/component/HomeDeviceStausWidget.dart b/lib/pages/mh_page/homepage/component/HomeDeviceStausWidget.dart index 20e2a91..79c52cd 100644 --- a/lib/pages/mh_page/homepage/component/HomeDeviceStausWidget.dart +++ b/lib/pages/mh_page/homepage/component/HomeDeviceStausWidget.dart @@ -81,12 +81,11 @@ class _HomeDeviceStausWidgetState extends State { var future = webviewTestController.web.jsbridge?.dart .appToHtmlDevice(device); - Future.delayed(Duration(seconds: 5), () { - TopSlideNotification.show(context, text: "控制界面初始化中,请稍后再试".tr); + Future.delayed(Duration(seconds: 5), () { return; }); - await future; // 等待最终完成(即使超过 5 秒) + await future; MainPageBBottomChange.jumpTo(2); } catch (e) { print("发生异常: $e"); diff --git a/lib/pages/mh_page/homepage/new_Home_page.dart b/lib/pages/mh_page/homepage/new_Home_page.dart index f88b6dc..b35bdfc 100644 --- a/lib/pages/mh_page/homepage/new_Home_page.dart +++ b/lib/pages/mh_page/homepage/new_Home_page.dart @@ -115,6 +115,39 @@ class _NewHomePageState extends State { // deviceController.getSleepReport(); } }); + if (userInfoController.model.login == 1) { + //查询人员信息列表 + deviceController.getPersonList(); + //请求绑定设备列表 + // homeController.getSleepReport(); + deviceController.getDeviceNum().then((apiResponse) { + if (apiResponse.code != HttpStatusCodes.ok) { + TopSlideNotification.show( + Get.context!, + text: apiResponse.msg!, + textColor: themeController.currentColor.sc9, + ); + } + }); + deviceController.getDeviceList(group: 'room').then((apiResponse) { + if (apiResponse.code != HttpStatusCodes.ok) { + TopSlideNotification.show( + Get.context!, + text: apiResponse.msg!, + textColor: themeController.currentColor.sc9, + ); + } else { + //请求睡眠报告 + // deviceController.getSleepReport(); + } + }); + } + WidgetsBinding.instance.addPostFrameCallback((_) { + if (homeController.homeSleepDays.value.isNotEmpty) { + homeController.selectedDayIndex.value = + homeController.homeSleepDays.value.length - 1; + } + }); int login = userInfoController.model.login!; return GestureDetector( onTap: () => FocusScope.of(context).unfocus(), @@ -482,7 +515,6 @@ class _NewHomePageState extends State { isMultiSelect: false, ), ), - ), InkWell( onTap: () {