diff --git a/assets/miniapp/mhtControl_1.0.0.zip b/assets/miniapp/mhtControl_1.0.0.zip index 1c4afae..1ad0088 100644 Binary files a/assets/miniapp/mhtControl_1.0.0.zip and b/assets/miniapp/mhtControl_1.0.0.zip differ diff --git a/lib/pages/mh_page/device/component/DeviceComponentWidget.dart b/lib/pages/mh_page/device/component/DeviceComponentWidget.dart index 10de659..9306481 100644 --- a/lib/pages/mh_page/device/component/DeviceComponentWidget.dart +++ b/lib/pages/mh_page/device/component/DeviceComponentWidget.dart @@ -541,7 +541,8 @@ class _DeviceComponentWidgetState extends State { DailyLogUtils.printLog("蓝牙获取MAC失败:$e"); TopSlideNotification.show( context, - text: "设备连接失败,请重试".tr, + // text: e.message ?? "设备连接失败,请重试".tr, + text: "获取不到传感器mac,请重试".tr, textColor: themeController.currentColor.sc9, ); rethrow; @@ -632,6 +633,12 @@ class _DeviceComponentWidgetState extends State { try { final mac = await completer.future.timeout(timeout); + if (mac == null || mac.isEmpty) { + throw Exception("获取MAC失败"); + } + if (mac == "000000000000") { + throw Exception("获取MAC失败"); + } await subscription.cancel(); return mac; } catch (_) { diff --git a/lib/pages/mh_page/test/WebviewTestModel.dart b/lib/pages/mh_page/test/WebviewTestModel.dart index bee48fb..87158b8 100644 --- a/lib/pages/mh_page/test/WebviewTestModel.dart +++ b/lib/pages/mh_page/test/WebviewTestModel.dart @@ -31,10 +31,11 @@ class WebviewTestController extends GetControllerEx { var bluetooth = 0; List personList = []; List instantData = []; + RxBool initFlag = false.obs; WebviewTestController() : super(WebviewTestModel()) { web = WebviewHelper( - isheadless: true, + isheadless: false, jsbridge: buildsdk( // father: this, // clientId: '494641114', @@ -161,6 +162,16 @@ class WebviewTestController extends GetControllerEx { } return true; }); + bridge.sdk.webPageBuild((args) async { + ef.log('网页加载完成: $args[0]'); + try { + initFlag.value = true; + return true; + } catch (e) { + ef.log("[网页加载失败]:$e"); + } + return true; + }); }); } catch (e, s) { ef.log('$e,$s'); @@ -392,11 +403,11 @@ class WebviewTestView extends GetComponent { child: Expanded( child: Align( alignment: Alignment.topLeft, - child: Obx( - () => controller.ready.value + child: Obx(() { + return controller.ready.value ? controller.web.build() - : Container(), - ), + : Container(); + }), ), )); }),