Merge branch 'master' of http://10.20.2.7:8080/r/~enchantedwyf/vbvs_app
This commit is contained in:
@@ -12,8 +12,13 @@ import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
||||
|
||||
class SleepDataModuleWidget extends StatefulWidget {
|
||||
final Map<String, dynamic> data;
|
||||
final dynamic sleepReportData; // 可选参数,类型为 var/dynamic
|
||||
|
||||
const SleepDataModuleWidget({super.key, required this.data});
|
||||
const SleepDataModuleWidget({
|
||||
super.key,
|
||||
required this.data,
|
||||
this.sleepReportData, // 标记为可选参数
|
||||
});
|
||||
|
||||
@override
|
||||
State<SleepDataModuleWidget> createState() => _SleepDataModuleWidgetState();
|
||||
@@ -47,17 +52,18 @@ class _SleepDataModuleWidgetState extends State<SleepDataModuleWidget> {
|
||||
if (widget.data['showTip'] != null && widget.data['showTip'] == true) {
|
||||
final String itemLevel = widget.data['code'] ?? '';
|
||||
SleepReportController sleepReportController = Get.find();
|
||||
|
||||
var report = sleepReportController.sleepReport;
|
||||
List<Map<String, dynamic>> levelGroups = [];
|
||||
|
||||
if (widget.sleepReportData != null) {
|
||||
report = widget.sleepReportData;
|
||||
}
|
||||
if (report != null) {
|
||||
var colorMap =
|
||||
Map<String, dynamic>.from(report.value['info']['color']);
|
||||
var levelMap =
|
||||
Map<String, dynamic>.from(report.value['info']['level']);
|
||||
|
||||
for (var prefix in ['G', 'R', 'Y']) {
|
||||
//修改渲染
|
||||
for (var prefix in ['G', 'Y', 'R']) {
|
||||
List<String> keys =
|
||||
colorMap.keys.where((k) => k.startsWith(prefix)).toList();
|
||||
keys.sort(); // G1, G2, G3
|
||||
|
||||
@@ -241,8 +241,8 @@ class _BluetoothPageState extends State<BluetoothPage> {
|
||||
context, '体征传感器', "/vitalSignsSensorPage",
|
||||
arguments: obsData),
|
||||
_buildMenuButton(context, 'WIFI配置', ""),
|
||||
_buildMenuButton(
|
||||
context, '睡眠习惯', "/sleepHabitPage"),
|
||||
// _buildMenuButton(
|
||||
// context, '睡眠习惯', "/sleepHabitPage"),
|
||||
_buildMenuButton(
|
||||
context, '分享设备', "/deviceSharePage",
|
||||
arguments: obsData),
|
||||
@@ -406,6 +406,11 @@ class _BluetoothPageState extends State<BluetoothPage> {
|
||||
if (onTap != null) {
|
||||
onTap(); // 自定义点击逻辑优先执行
|
||||
} else if (path?.isNotEmpty == true) {
|
||||
if (path == "/sleepHabitPage") {
|
||||
WebviewTestController webviewTestController = Get.find();
|
||||
webviewTestController.web.jsbridge?.dart.toSleepHabit();
|
||||
return;
|
||||
}
|
||||
final result = await Get.toNamed(path!, arguments: arguments);
|
||||
if (result != null && onResult != null) {
|
||||
onResult(result); // ✅ 有回调就处理返回值
|
||||
|
||||
@@ -541,7 +541,8 @@ class _DeviceComponentWidgetState extends State<DeviceComponentWidget> {
|
||||
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<DeviceComponentWidget> {
|
||||
|
||||
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 (_) {
|
||||
|
||||
@@ -241,6 +241,7 @@ class MHTBlueToothController extends GetControllerEx<MHTBlueToothModel> {
|
||||
if (currentFullDevice != null) {
|
||||
currentFullDevice!.macAID = res.data['macA'];
|
||||
currentFullDevice!.macBID = res.data['macB'];
|
||||
currentFullDevice!.deviceID = res.data['id'];
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
||||
@@ -195,7 +195,12 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
|
||||
TopSlideNotification.show(context, text: "保存成功");
|
||||
MHTHomeController mhtHomeController = Get.find();
|
||||
mhtHomeController.getPersonList();
|
||||
Get.offNamed("/bindDeviceSuccess");
|
||||
// Get.offNamed("/bindDeviceSuccess");
|
||||
Map data = {};
|
||||
final device = bluetoothController.currentFullDevice;
|
||||
data['_id'] = device!.deviceID;
|
||||
data['isNextStep'] = true;
|
||||
Get.toNamed("/editBedPage", arguments: data);
|
||||
},
|
||||
colors: const [
|
||||
Color(0xFFFCFCFC),
|
||||
|
||||
@@ -10,7 +10,8 @@ class BlueToothDataModel {
|
||||
int type;
|
||||
String? macAID;
|
||||
String? macBID;
|
||||
DateTime lastSeen; // 添加的最后可见时间字段
|
||||
DateTime lastSeen; // 最后可见时间
|
||||
String? deviceID; // 设备ID
|
||||
|
||||
BlueToothDataModel({
|
||||
this.name = '',
|
||||
@@ -20,12 +21,18 @@ class BlueToothDataModel {
|
||||
required this.type,
|
||||
this.macA = '',
|
||||
this.macB = '',
|
||||
required this.lastSeen, // 添加到构造函数参数
|
||||
required this.lastSeen,
|
||||
this.deviceID, // ✅ 加入构造函数参数
|
||||
});
|
||||
|
||||
factory BlueToothDataModel.fromScanResult(ScanResult result, int type,
|
||||
{bool bind = false, String name = '', String mac = ''}) {
|
||||
// 如果外部没有传入 name,则取 localName
|
||||
factory BlueToothDataModel.fromScanResult(
|
||||
ScanResult result,
|
||||
int type, {
|
||||
bool bind = false,
|
||||
String name = '',
|
||||
String mac = '',
|
||||
String? deviceID, // ✅ 工厂方法接收 deviceID
|
||||
}) {
|
||||
String finalName =
|
||||
name.isNotEmpty ? name : (result.advertisementData.localName ?? '');
|
||||
|
||||
@@ -35,9 +42,10 @@ class BlueToothDataModel {
|
||||
mac: mac,
|
||||
scanResult: result,
|
||||
type: type,
|
||||
macA: '', // 保持原有默认值
|
||||
macB: '', // 保持原有默认值
|
||||
lastSeen: DateTime.now(), // 设置为当前时间
|
||||
macA: '',
|
||||
macB: '',
|
||||
lastSeen: DateTime.now(),
|
||||
deviceID: deviceID, // ✅ 赋值
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,11 +9,17 @@ import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/bluetooth.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/device/controller/mht_bluetooth_controller.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/test/WebviewTestModel.dart';
|
||||
|
||||
class EditBedPage extends StatefulWidget {
|
||||
final Map data;
|
||||
EditBedPage({Key? key, required this.data});
|
||||
|
||||
EditBedPage({
|
||||
Key? key,
|
||||
required this.data,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_EditBedPageState createState() => _EditBedPageState();
|
||||
}
|
||||
@@ -79,6 +85,70 @@ class _EditBedPageState extends State<EditBedPage> {
|
||||
left: 0.rpx,
|
||||
child: returnIconButtomNew,
|
||||
),
|
||||
if (widget.data != null &&
|
||||
(widget.data['isNextStep'] != null &&
|
||||
widget.data['isNextStep'] == true))
|
||||
Positioned(
|
||||
right: 30.rpx,
|
||||
child: CustomCard(
|
||||
borderRadius: 16.rpx,
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
onTap: () async {
|
||||
String serviceAddress =
|
||||
ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.device_show;
|
||||
String queryUrl =
|
||||
"$serviceAddress$serviceName$serviceApi";
|
||||
await requestWithLog(
|
||||
logTitle: "更新设备信息",
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: {
|
||||
"id": editedData["_id"],
|
||||
"name": editedData["name"],
|
||||
},
|
||||
onSuccess: (res) {
|
||||
TopSlideNotification.show(context,
|
||||
text: "修改名称成功".tr);
|
||||
deviceListController.getDeviceList();
|
||||
|
||||
Map data = {};
|
||||
final MHTBlueToothController
|
||||
bluetoothController = Get.find();
|
||||
final device =
|
||||
bluetoothController.currentFullDevice;
|
||||
data['_id'] = device!.deviceID;
|
||||
data['isNextStep'] = true;
|
||||
Get.toNamed("/roomPickerPage",
|
||||
arguments: data);
|
||||
},
|
||||
);
|
||||
},
|
||||
colors: const [
|
||||
Color(0xFFFCFCFC),
|
||||
Color(0xFFF8FAF9),
|
||||
Color(0XFFECF6F3),
|
||||
Color(0XFFD9F0E9),
|
||||
Color(0xFFCEECE3)
|
||||
],
|
||||
child: Container(
|
||||
width: 120.rpx,
|
||||
height: 60.rpx,
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"下一步",
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0XFF011D33),
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -186,64 +256,67 @@ class _EditBedPageState extends State<EditBedPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 30.rpx, right: 30.rpx, bottom: 85.rpx),
|
||||
child: CustomCard(
|
||||
borderRadius: 16.rpx,
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
onTap: () async {
|
||||
String serviceAddress =
|
||||
ServiceConstant.service_address;
|
||||
String serviceName =
|
||||
ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.device_show;
|
||||
String queryUrl =
|
||||
"$serviceAddress$serviceName$serviceApi";
|
||||
await requestWithLog(
|
||||
logTitle: "更新设备信息",
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: {
|
||||
"id": editedData["_id"],
|
||||
"name": editedData["name"],
|
||||
},
|
||||
onSuccess: (res) {
|
||||
TopSlideNotification.show(context,
|
||||
text: "修改名称成功".tr);
|
||||
deviceListController.getDeviceList();
|
||||
try {
|
||||
WebviewTestController
|
||||
webviewTestController = Get.find();
|
||||
webviewTestController.web.jsbridge?.dart
|
||||
.alterDevice();
|
||||
} catch (e) {
|
||||
ef.log("[h5]通知列表更新错误:$e");
|
||||
}
|
||||
Get.back(result: editedData);
|
||||
},
|
||||
);
|
||||
},
|
||||
colors: const [
|
||||
Color(0xFFFCFCFC),
|
||||
Color(0xFFF8FAF9),
|
||||
Color(0XFFECF6F3),
|
||||
Color(0XFFD9F0E9),
|
||||
Color(0xFFCEECE3)
|
||||
],
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 90.rpx,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
if (widget.data['isNextStep'] == null ||
|
||||
widget.data['isNextStep'] == false)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 30.rpx, right: 30.rpx, bottom: 85.rpx),
|
||||
child: CustomCard(
|
||||
borderRadius: 16.rpx,
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
onTap: () async {
|
||||
String serviceAddress =
|
||||
ServiceConstant.service_address;
|
||||
String serviceName =
|
||||
ServiceConstant.server_service;
|
||||
String serviceApi =
|
||||
ServiceConstant.device_show;
|
||||
String queryUrl =
|
||||
"$serviceAddress$serviceName$serviceApi";
|
||||
await requestWithLog(
|
||||
logTitle: "更新设备信息",
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: {
|
||||
"id": editedData["_id"],
|
||||
"name": editedData["name"],
|
||||
},
|
||||
onSuccess: (res) {
|
||||
TopSlideNotification.show(context,
|
||||
text: "修改名称成功".tr);
|
||||
deviceListController.getDeviceList();
|
||||
try {
|
||||
WebviewTestController
|
||||
webviewTestController = Get.find();
|
||||
webviewTestController.web.jsbridge?.dart
|
||||
.alterDevice();
|
||||
} catch (e) {
|
||||
ef.log("[h5]通知列表更新错误:$e");
|
||||
}
|
||||
Get.back(result: editedData);
|
||||
},
|
||||
);
|
||||
},
|
||||
colors: const [
|
||||
Color(0xFFFCFCFC),
|
||||
Color(0xFFF8FAF9),
|
||||
Color(0XFFECF6F3),
|
||||
Color(0XFFD9F0E9),
|
||||
Color(0xFFCEECE3)
|
||||
],
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 90.rpx,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text("完成".tr,
|
||||
style: TextStyle(
|
||||
color: const Color(0xFF003058),
|
||||
fontSize: 26.rpx)),
|
||||
),
|
||||
child: Text("完成".tr,
|
||||
style: TextStyle(
|
||||
color: const Color(0xFF003058),
|
||||
fontSize: 26.rpx)),
|
||||
),
|
||||
))
|
||||
))
|
||||
],
|
||||
))),
|
||||
),
|
||||
|
||||
@@ -85,6 +85,75 @@ class _RoomPickerPageState extends State<RoomPickerPage> {
|
||||
left: 0.rpx,
|
||||
child: returnIconButtomNew,
|
||||
),
|
||||
if (widget.data != null &&
|
||||
(widget.data['isNextStep'] != null &&
|
||||
widget.data['isNextStep'] == true))
|
||||
Positioned(
|
||||
right: 30.rpx,
|
||||
child: CustomCard(
|
||||
borderRadius: 16.rpx,
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
onTap: () async {
|
||||
// Get.toNamed("/applyRepairPage");
|
||||
try {
|
||||
String serviceAddress =
|
||||
ServiceConstant.service_address;
|
||||
String serviceName =
|
||||
ServiceConstant.server_service;
|
||||
String serviceApi =
|
||||
ServiceConstant.device_show;
|
||||
String queryUrl =
|
||||
"$serviceAddress$serviceName$serviceApi";
|
||||
await requestWithLog(
|
||||
logTitle: "更新设备信息",
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: {
|
||||
"id": editedData["_id"],
|
||||
"roomId": rooms[selectedIndex]['_id'],
|
||||
},
|
||||
onSuccess: (res) {
|
||||
editedData['roomName'] =
|
||||
rooms[selectedIndex]['name'];
|
||||
TopSlideNotification.show(context,
|
||||
text: "更新成功".tr,
|
||||
textColor: Color(0XFF00C1AA));
|
||||
deviceListController.getDeviceList();
|
||||
Get.offNamed("/bindDeviceSuccess");
|
||||
},
|
||||
onFailure: (res) {
|
||||
TopSlideNotification.show(context,
|
||||
text: "更新失败".tr,
|
||||
textColor: Color(0xFFFF7159));
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
},
|
||||
colors: const [
|
||||
Color(0xFFFCFCFC),
|
||||
Color(0xFFF8FAF9),
|
||||
Color(0XFFECF6F3),
|
||||
Color(0XFFD9F0E9),
|
||||
Color(0xFFCEECE3)
|
||||
],
|
||||
child: Container(
|
||||
width: 120.rpx,
|
||||
height: 60.rpx,
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"下一步",
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: Color(0XFF011D33),
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -157,86 +226,90 @@ class _RoomPickerPageState extends State<RoomPickerPage> {
|
||||
),
|
||||
const Spacer(),
|
||||
// 完成按钮
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 30.rpx,
|
||||
right: 30.rpx,
|
||||
bottom: 83.rpx,
|
||||
),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 50,
|
||||
child: CustomCard(
|
||||
borderRadius: 16.rpx,
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
onTap: () async {
|
||||
// Get.toNamed("/applyRepairPage");
|
||||
try {
|
||||
String serviceAddress =
|
||||
ServiceConstant.service_address;
|
||||
String serviceName =
|
||||
ServiceConstant.server_service;
|
||||
String serviceApi =
|
||||
ServiceConstant.device_show;
|
||||
String queryUrl =
|
||||
"$serviceAddress$serviceName$serviceApi";
|
||||
await requestWithLog(
|
||||
logTitle: "更新设备信息",
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: {
|
||||
"id": editedData["_id"],
|
||||
"roomId": rooms[selectedIndex]['_id'],
|
||||
},
|
||||
onSuccess: (res) {
|
||||
editedData['roomName'] =
|
||||
rooms[selectedIndex]['name'];
|
||||
TopSlideNotification.show(context,
|
||||
text: "更新成功".tr,
|
||||
textColor: Color(0XFF00C1AA));
|
||||
deviceListController.getDeviceList();
|
||||
try {
|
||||
WebviewTestController
|
||||
webviewTestController = Get.find();
|
||||
webviewTestController.web.jsbridge?.dart
|
||||
.alterDevice();
|
||||
} catch (e) {
|
||||
ef.log("[h5]通知列表更新错误:$e");
|
||||
}
|
||||
Get.back(result: editedData);
|
||||
},
|
||||
onFailure: (res) {
|
||||
TopSlideNotification.show(context,
|
||||
text: "更新失败".tr,
|
||||
textColor: Color(0xFFFF7159));
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
},
|
||||
colors: const [
|
||||
Color(0xFFFCFCFC),
|
||||
Color(0xFFF8FAF9),
|
||||
Color(0XFFECF6F3),
|
||||
Color(0XFFD9F0E9),
|
||||
Color(0xFFCEECE3)
|
||||
],
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 90.rpx,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
if (widget.data['isNextStep'] == null ||
|
||||
widget.data['isNextStep'] == false)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 30.rpx,
|
||||
right: 30.rpx,
|
||||
bottom: 83.rpx,
|
||||
),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
height: 50,
|
||||
child: CustomCard(
|
||||
borderRadius: 16.rpx,
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
onTap: () async {
|
||||
// Get.toNamed("/applyRepairPage");
|
||||
try {
|
||||
String serviceAddress =
|
||||
ServiceConstant.service_address;
|
||||
String serviceName =
|
||||
ServiceConstant.server_service;
|
||||
String serviceApi =
|
||||
ServiceConstant.device_show;
|
||||
String queryUrl =
|
||||
"$serviceAddress$serviceName$serviceApi";
|
||||
await requestWithLog(
|
||||
logTitle: "更新设备信息",
|
||||
method: MyHttpMethod.put,
|
||||
queryUrl: queryUrl,
|
||||
data: {
|
||||
"id": editedData["_id"],
|
||||
"roomId": rooms[selectedIndex]['_id'],
|
||||
},
|
||||
onSuccess: (res) {
|
||||
editedData['roomName'] =
|
||||
rooms[selectedIndex]['name'];
|
||||
TopSlideNotification.show(context,
|
||||
text: "更新成功".tr,
|
||||
textColor: Color(0XFF00C1AA));
|
||||
deviceListController.getDeviceList();
|
||||
try {
|
||||
WebviewTestController
|
||||
webviewTestController =
|
||||
Get.find();
|
||||
webviewTestController
|
||||
.web.jsbridge?.dart
|
||||
.alterDevice();
|
||||
} catch (e) {
|
||||
ef.log("[h5]通知列表更新错误:$e");
|
||||
}
|
||||
Get.back(result: editedData);
|
||||
},
|
||||
onFailure: (res) {
|
||||
TopSlideNotification.show(context,
|
||||
text: "更新失败".tr,
|
||||
textColor: Color(0xFFFF7159));
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
},
|
||||
colors: const [
|
||||
Color(0xFFFCFCFC),
|
||||
Color(0xFFF8FAF9),
|
||||
Color(0XFFECF6F3),
|
||||
Color(0XFFD9F0E9),
|
||||
Color(0xFFCEECE3)
|
||||
],
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 90.rpx,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text("完成".tr,
|
||||
style: TextStyle(
|
||||
color: const Color(0xFF003058),
|
||||
fontSize: 30.rpx,
|
||||
)),
|
||||
),
|
||||
child: Text("完成".tr,
|
||||
style: TextStyle(
|
||||
color: const Color(0xFF003058),
|
||||
fontSize: 30.rpx,
|
||||
)),
|
||||
),
|
||||
)),
|
||||
),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -31,6 +31,7 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
||||
var bluetooth = 0;
|
||||
List personList = [];
|
||||
List instantData = [];
|
||||
RxBool initFlag = false.obs;
|
||||
|
||||
WebviewTestController() : super(WebviewTestModel()) {
|
||||
web = WebviewHelper(
|
||||
@@ -44,9 +45,9 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
||||
params: PlatformHeadlessInAppWebViewCreationParams(
|
||||
onLoadStop: (controller, url) {
|
||||
setState(() => ready.value = true);
|
||||
MHTHomeController deviceController = Get.find();
|
||||
web.jsbridge!.dart
|
||||
.updateDeviceList(deviceController.deviceList.values);
|
||||
// MHTHomeController deviceController = Get.find();
|
||||
// web.jsbridge!.dart
|
||||
// .updateDeviceList(deviceController.deviceList.values);
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -129,6 +130,7 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
||||
return true;
|
||||
});
|
||||
bridge.sdk.restoreTimer((args) async {
|
||||
ef.log('更新定时: $args[0]');
|
||||
ef.log('queryInstantData: $args');
|
||||
MHTHomeController homeController = Get.find();
|
||||
var data = await homeController.restoreTimer(args);
|
||||
@@ -160,6 +162,16 @@ class WebviewTestController extends GetControllerEx<WebviewTestModel> {
|
||||
}
|
||||
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');
|
||||
@@ -391,11 +403,11 @@ class WebviewTestView extends GetComponent<WebviewTestController> {
|
||||
child: Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Obx(
|
||||
() => controller.ready.value
|
||||
child: Obx(() {
|
||||
return controller.ready.value
|
||||
? controller.web.build()
|
||||
: Container(),
|
||||
),
|
||||
: Container();
|
||||
}),
|
||||
),
|
||||
));
|
||||
}),
|
||||
|
||||
@@ -1272,6 +1272,8 @@ class MHTLoginPage extends GetView<MHTLoginController> {
|
||||
.model.register_agree = false;
|
||||
Get.offAndToNamed(
|
||||
"/mianPageBottomChange");
|
||||
//登陆成功
|
||||
//
|
||||
}
|
||||
},
|
||||
colors: [
|
||||
|
||||
@@ -124,7 +124,7 @@ class _SleepCardState extends State<SleepCard> with TickerProviderStateMixin {
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
)
|
||||
: null,
|
||||
child: SleepDataModuleWidget(data: item),
|
||||
child: SleepDataModuleWidget(data: item,sleepReportData: widget.sleepReport,),
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -134,7 +134,7 @@ class _SleepCardState extends State<SleepCard> with TickerProviderStateMixin {
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
es.EasyDartModule.logger.error("打鼾监测绘制异常${e}");
|
||||
es.EasyDartModule.logger.error("数据卡片渲染异常${e}");
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user