更新快检功能必传mac参数
This commit is contained in:
@@ -20,6 +20,7 @@ import 'package:vbvs_app/component/tool/ToggleColorContainer.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
|
||||
import 'package:vbvs_app/controller/device/body_device_controller.dart';
|
||||
import 'package:vbvs_app/controller/device/device_type_controller.dart';
|
||||
import 'package:vbvs_app/controller/person/person_controller.dart';
|
||||
import 'package:vbvs_app/enum/BindType.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
@@ -118,7 +119,7 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
// widget.device['bind_type'] == BindType.active.code ? 9 : 5;
|
||||
final itemCount = widget.device['bind_type'] == BindType.active.code
|
||||
? 9
|
||||
: (getWifiPermissionByOpType(widget.device) ? 6 : 5);
|
||||
: (getWifiPermissionByOpType(widget.device) ? 7 : 6);
|
||||
|
||||
final estimatedPopupHeight =
|
||||
(itemCount * estimatedItemHeight) + 40.rpx; // 加上padding
|
||||
@@ -1222,6 +1223,25 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
child: CustomCard(
|
||||
borderRadius: AppConstants().button_container_radius,
|
||||
onTap: () async {
|
||||
// bool online = widget.device['status']['status'] == 1;
|
||||
// if (!online) {
|
||||
// NewTopSlideNotification.show(
|
||||
// text: "当前设备已离线,无法快检!".tr,
|
||||
// textColor: themeController.currentColor.sc9);
|
||||
// return;
|
||||
// }
|
||||
DeviceTypeController deviceTypeController =
|
||||
Get.find();
|
||||
await deviceTypeController
|
||||
.checkReportStatus(widget.device['mac']);
|
||||
// if (deviceTypeController.experience_status.value ==
|
||||
// 200 &&
|
||||
// !deviceTypeController.own.value) {
|
||||
// NewTopSlideNotification.show(
|
||||
// text: "设备正在快检中,请稍后再试!".tr,
|
||||
// textColor: themeController.currentColor.sc9);
|
||||
// return;
|
||||
// }
|
||||
await Get.toNamed("/healthCheckPage",
|
||||
arguments: widget.device);
|
||||
},
|
||||
|
||||
@@ -96,7 +96,7 @@ class _HealthReportCardWidgetState extends State<HealthReportCardWidget> {
|
||||
String ID = reportData['id'];
|
||||
DeviceTypeController deviceTypeController =
|
||||
Get.find();
|
||||
await deviceTypeController.getCheckHistory(id: ID);
|
||||
await deviceTypeController.getCheckHistory(id: ID,mac: reportData['mac']);
|
||||
if (deviceTypeController.currentCq.value == null ||
|
||||
deviceTypeController.currentCq.value.isEmpty) {
|
||||
NewTopSlideNotification.show(
|
||||
|
||||
@@ -20,6 +20,7 @@ import 'package:vbvs_app/controller/device/device_type_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/enum/APPQuickCheckStatus.dart';
|
||||
import 'package:vbvs_app/model/WebSocketMessage.dart';
|
||||
import 'package:vbvs_app/pages/device/component/DeviceStatusInfoWidget.dart';
|
||||
import 'package:vbvs_app/pages/device_bind/componnet/CalibrationProgressWidget.dart';
|
||||
@@ -68,13 +69,22 @@ class _HealthCheckPageState extends State<HealthCheckPage>
|
||||
_isInitialized = true;
|
||||
});
|
||||
// 如果当前状态是体验中,启动定时器
|
||||
if (deviceTypeController.experience_status.value == 200) {
|
||||
if (deviceTypeController.experience_status.value == 200 &&
|
||||
deviceTypeController.own.value) {
|
||||
_startCheckStatusTimer();
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
ef.log("快检初始化数据失败");
|
||||
}
|
||||
|
||||
_initWebSocket();
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future<void> _initWebSocket() async {
|
||||
// 发送WebSocket请求
|
||||
try {
|
||||
Future.delayed(Duration(seconds: 0), () {
|
||||
CommonVariables.callMap["/vsbs/web/rt/marttress"] = (data) {
|
||||
@@ -128,13 +138,6 @@ class _HealthCheckPageState extends State<HealthCheckPage>
|
||||
edm.EasyDartModule.logger
|
||||
.error("[webscoekt]格式化数据错误-->${{"mac": widget.personInfo['mac']}}");
|
||||
}
|
||||
_initWebSocket();
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void _initWebSocket() {
|
||||
// 发送WebSocket请求
|
||||
if (widget.personInfo['status'] != null) {
|
||||
try {
|
||||
onlineState =
|
||||
@@ -151,6 +154,11 @@ class _HealthCheckPageState extends State<HealthCheckPage>
|
||||
.info("[webscoekt]发送请求:数据-->${{"mac": widget.personInfo['mac']}}");
|
||||
DailyLogUtils.writeLog(
|
||||
"[webscoekt]发送请求:数据-->${{"mac": widget.personInfo['mac']}}");
|
||||
edm.EasyDartModule.websocket.sendData(jsonEncode(WebSocketMessage(
|
||||
path: "/vsbs/web/rt/marttress",
|
||||
type: 1,
|
||||
data: {"mac": widget.personInfo['mac']})));
|
||||
await Future.delayed(Duration(seconds: 3));
|
||||
edm.EasyDartModule.websocket.sendData(jsonEncode(WebSocketMessage(
|
||||
path: "/vsbs/web/rt/marttress",
|
||||
type: 1,
|
||||
@@ -177,12 +185,14 @@ class _HealthCheckPageState extends State<HealthCheckPage>
|
||||
edm.EasyDartModule.logger.info("app切回页面,重连websocket");
|
||||
_initWebSocket();
|
||||
|
||||
_initWebSocket();
|
||||
// 重新查询状态,然后根据状态决定是否启动定时器
|
||||
deviceTypeController
|
||||
.checkReportStatus(widget.personInfo['mac'])
|
||||
.then((_) {
|
||||
// 如果当前状态是体验中,重新启动定时器
|
||||
if (deviceTypeController.experience_status.value != 404) {
|
||||
if (deviceTypeController.experience_status.value != 404 &&
|
||||
deviceTypeController.own.value) {
|
||||
_startCheckStatusTimer();
|
||||
}
|
||||
});
|
||||
@@ -258,7 +268,9 @@ class _HealthCheckPageState extends State<HealthCheckPage>
|
||||
child: returnIconButtom,
|
||||
),
|
||||
Obx(() {
|
||||
return deviceTypeController.experience_status.value != 200
|
||||
return deviceTypeController.experience_status.value !=
|
||||
200 ||
|
||||
!deviceTypeController.own.value
|
||||
? Positioned(
|
||||
right: 0.rpx,
|
||||
child: ClickableContainer(
|
||||
@@ -323,8 +335,9 @@ class _HealthCheckPageState extends State<HealthCheckPage>
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
if (deviceTypeController
|
||||
.experience_status.value !=
|
||||
200)
|
||||
.experience_status.value !=
|
||||
200 ||
|
||||
!deviceTypeController.own.value)
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 0.rpx, 30.rpx, 100.rpx),
|
||||
@@ -1221,8 +1234,9 @@ class _HealthCheckPageState extends State<HealthCheckPage>
|
||||
),
|
||||
),
|
||||
if (deviceTypeController
|
||||
.experience_status.value ==
|
||||
200)
|
||||
.experience_status.value ==
|
||||
200 &&
|
||||
deviceTypeController.own.value)
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.fromLTRB(46.rpx, 0, 46.rpx, 0),
|
||||
@@ -1274,8 +1288,9 @@ class _HealthCheckPageState extends State<HealthCheckPage>
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: deviceTypeController
|
||||
.experience_status.value !=
|
||||
200
|
||||
.experience_status.value !=
|
||||
200 ||
|
||||
!deviceTypeController.own.value
|
||||
? Container()
|
||||
: Column(
|
||||
children: [
|
||||
@@ -1403,8 +1418,9 @@ class _HealthCheckPageState extends State<HealthCheckPage>
|
||||
),
|
||||
)),
|
||||
if (deviceTypeController
|
||||
.experience_status.value !=
|
||||
200)
|
||||
.experience_status.value !=
|
||||
200 ||
|
||||
!deviceTypeController.own.value)
|
||||
ClickableContainer(
|
||||
backgroundColor:
|
||||
Colors.transparent, // 可自定义背景色
|
||||
@@ -1469,8 +1485,9 @@ class _HealthCheckPageState extends State<HealthCheckPage>
|
||||
height: 40.rpx,
|
||||
),
|
||||
if (deviceTypeController
|
||||
.experience_status.value !=
|
||||
200)
|
||||
.experience_status.value !=
|
||||
200 ||
|
||||
!deviceTypeController.own.value)
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
100.rpx, 0, 100.rpx, 0),
|
||||
@@ -1484,7 +1501,24 @@ class _HealthCheckPageState extends State<HealthCheckPage>
|
||||
await deviceTypeController
|
||||
.checkReportStatus(
|
||||
widget.personInfo['mac']);
|
||||
if (!canStart) {
|
||||
// if (!canStart) {
|
||||
// NewTopSlideNotification.show(
|
||||
// text: "设备正在快检中,请稍后再试!".tr,
|
||||
// textColor: themeController
|
||||
// .currentColor.sc9);
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (!deviceTypeController.own.value &&
|
||||
deviceTypeController
|
||||
.experience_status
|
||||
.value ==
|
||||
APPQuickCheckStatus
|
||||
.inProgress.value) {
|
||||
NewTopSlideNotification.show(
|
||||
text: "设备正在快检中,请稍后再试!".tr,
|
||||
textColor: themeController
|
||||
.currentColor.sc9);
|
||||
return;
|
||||
}
|
||||
bool opRes =
|
||||
@@ -1542,8 +1576,9 @@ class _HealthCheckPageState extends State<HealthCheckPage>
|
||||
),
|
||||
),
|
||||
if (deviceTypeController
|
||||
.experience_status.value ==
|
||||
200)
|
||||
.experience_status.value ==
|
||||
200 &&
|
||||
deviceTypeController.own.value)
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
100.rpx, 0.rpx, 100.rpx, 60.rpx),
|
||||
@@ -1553,8 +1588,9 @@ class _HealthCheckPageState extends State<HealthCheckPage>
|
||||
),
|
||||
),
|
||||
if (deviceTypeController
|
||||
.experience_status.value ==
|
||||
200)
|
||||
.experience_status.value ==
|
||||
200 &&
|
||||
deviceTypeController.own.value)
|
||||
Padding(
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
100.rpx, 0, 100.rpx, 0),
|
||||
@@ -1702,7 +1738,8 @@ class _HealthCheckPageState extends State<HealthCheckPage>
|
||||
progressNotifier.value =
|
||||
deviceTypeController.experience_percent.value.toDouble();
|
||||
deviceTypeController.updateAll();
|
||||
if (deviceTypeController.experience_status.value == 201) {
|
||||
if (deviceTypeController.experience_status.value ==
|
||||
APPQuickCheckStatus.completed.value) {
|
||||
//体验正常结束
|
||||
deviceTypeController.experience_status.value = 404;
|
||||
deviceTypeController.experience_status.value = 0;
|
||||
@@ -1710,24 +1747,60 @@ class _HealthCheckPageState extends State<HealthCheckPage>
|
||||
edm.EasyDartModule.logger.info("快检结束,停止定时查询");
|
||||
_checkStatusTimer?.cancel();
|
||||
await deviceTypeController.getCheckHistory(
|
||||
id: deviceTypeController.experience_id.value);
|
||||
id: deviceTypeController.experience_id.value,mac: widget.personInfo['mac']);
|
||||
Get.toNamed('/healthQuickCheckReportPage',
|
||||
arguments: deviceTypeController.currentCq.value);
|
||||
}
|
||||
if (deviceTypeController.experience_status.value != 200 &&
|
||||
deviceTypeController.experience_status.value != 201 &&
|
||||
deviceTypeController.experience_status.value != 404 &&
|
||||
deviceTypeController.experience_status.value != 203) {
|
||||
// if (deviceTypeController.experience_status.value != APPQuickCheckStatus.inProgress.value &&
|
||||
// deviceTypeController.experience_status.value != 201 &&
|
||||
// deviceTypeController.experience_status.value != 404 &&
|
||||
// deviceTypeController.experience_status.value != 203) {
|
||||
// //体验异常结束
|
||||
// deviceTypeController.experience_status.value = 404;
|
||||
// deviceTypeController.experience_percent.value = 0;
|
||||
// progressNotifier.value = 0;
|
||||
// edm.EasyDartModule.logger.info("快检结束,停止定时查询");
|
||||
// _checkStatusTimer?.cancel();
|
||||
// // NewTopSlideNotification.show(
|
||||
// // text:
|
||||
// // "体验异常结束".tr,
|
||||
// // textColor: themeController.currentColor.sc9);
|
||||
// }
|
||||
if (deviceTypeController.experience_status.value ==
|
||||
APPQuickCheckStatus.timeout.value ||
|
||||
deviceTypeController.experience_status.value ==
|
||||
APPQuickCheckStatus.calculateError.value ||
|
||||
deviceTypeController.experience_status.value ==
|
||||
APPQuickCheckStatus.insufficientData.value) {
|
||||
// 根据状态码获取对应的枚举
|
||||
APPQuickCheckStatus? status = APPQuickCheckStatusExtension.fromInt(
|
||||
deviceTypeController.experience_status.value);
|
||||
|
||||
// 获取对应的状态描述文字
|
||||
String statusMessage = status?.description ?? "体验异常结束".tr;
|
||||
|
||||
//体验异常结束
|
||||
deviceTypeController.experience_status.value = 404;
|
||||
deviceTypeController.experience_percent.value = 0;
|
||||
progressNotifier.value = 0;
|
||||
edm.EasyDartModule.logger.info("快检结束,停止定时查询");
|
||||
edm.EasyDartModule.logger
|
||||
.info("快检结束,停止定时查询 - 状态: ${status?.description}");
|
||||
_checkStatusTimer?.cancel();
|
||||
// NewTopSlideNotification.show(
|
||||
// text:
|
||||
// "体验异常结束".tr,
|
||||
// text: statusMessage,
|
||||
// textColor: themeController.currentColor.sc9);
|
||||
await showTipDialog(
|
||||
context,
|
||||
Text(
|
||||
statusMessage,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (!deviceTypeController.own.value) {
|
||||
_checkStatusTimer?.cancel();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -25,7 +25,12 @@ class _HealthExperienceHistoryState extends State<HealthExperienceHistory> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
loadData(widget.data);
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
loadData(widget.data).then((aa) {
|
||||
deviceTypeController.updateAll();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -35,89 +40,97 @@ class _HealthExperienceHistoryState extends State<HealthExperienceHistory> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, bodysize) => GestureDetector(
|
||||
// onTap: () => FocusScope.of(context).unfocus(),,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(getBackgroundImageNoImage()), // 本地图片
|
||||
fit: BoxFit.fill, // 填满整个 Container
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: AppBar(
|
||||
backgroundColor: themeController.currentColor.sc17,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: IconThemeData(
|
||||
color: themeController.currentColor.sc3,
|
||||
try {
|
||||
return LayoutBuilder(
|
||||
builder: (context, bodysize) => GestureDetector(
|
||||
// onTap: () => FocusScope.of(context).unfocus(),,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(getBackgroundImageNoImage()), // 本地图片
|
||||
fit: BoxFit.fill, // 填满整个 Container
|
||||
),
|
||||
titleSpacing: 0,
|
||||
title: Container(
|
||||
width: double.infinity,
|
||||
height: 180.rpx,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
/// 居中标题
|
||||
Text(
|
||||
'快检历史'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController.currentColor.sc3,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
// child: returnIconButtom,
|
||||
child: returnIconButtomAddCallback(() {}),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: AppBar(
|
||||
backgroundColor: themeController.currentColor.sc17,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: IconThemeData(
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
titleSpacing: 0,
|
||||
title: Container(
|
||||
width: double.infinity,
|
||||
height: 180.rpx,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
/// 居中标题
|
||||
Text(
|
||||
'快检历史'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController.currentColor.sc3,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
// child: returnIconButtom,
|
||||
child: returnIconButtomAddCallback(() {}),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [],
|
||||
centerTitle: false,
|
||||
),
|
||||
actions: [],
|
||||
centerTitle: false,
|
||||
),
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(30.rpx, 0.rpx, 30.rpx, 0),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Obx(() {
|
||||
final list = deviceTypeController.cqHistoryList.value;
|
||||
return list.isEmpty
|
||||
? const NullDataWidget()
|
||||
: _buildMessageListView(list);
|
||||
}),
|
||||
),
|
||||
],
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(30.rpx, 0.rpx, 30.rpx, 0),
|
||||
child: Obx(() {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (deviceTypeController.qcListLoading.value)
|
||||
Center(
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
themeController.currentColor.sc1,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!deviceTypeController.qcListLoading.value)
|
||||
Expanded(
|
||||
child: Obx(() {
|
||||
final list =
|
||||
deviceTypeController.cqHistoryList.value;
|
||||
return list.isEmpty
|
||||
? const NullDataWidget()
|
||||
: _buildMessageListView(list);
|
||||
}),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
} catch (e) {
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> loadData(data) async {
|
||||
//todo 请求历史体征数据
|
||||
// String serviceAddress = ServiceConstant.service_address;
|
||||
// String serviceName = ServiceConstant.server_service;
|
||||
// String serviceApi = ServiceConstant.message_list;
|
||||
// String queryUrl =
|
||||
// "${serviceAddress}${serviceName}${serviceApi}?type=app_vsm&mac=${data['mac']}";
|
||||
// ApiResponse apiResponse = await requestWithLog(
|
||||
// logTitle: "查询消息回看数据", method: MyHttpMethod.get, queryUrl: queryUrl);
|
||||
// messageReviewController.messageList.value = apiResponse.data;
|
||||
// messageReviewController.updateAll();
|
||||
deviceTypeController.getCheckHistory();
|
||||
deviceTypeController.getCheckHistory(mac: data['mac']);
|
||||
}
|
||||
|
||||
Widget _buildMessageListView(List dataList) {
|
||||
|
||||
@@ -17,6 +17,7 @@ import 'package:vbvs_app/controller/device/device_type_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/main.dart';
|
||||
import 'package:vbvs_app/model/WebSocketMessage.dart';
|
||||
import 'package:vbvs_app/pages/device/component/DeviceStatusInfoWidget.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
@@ -52,12 +53,12 @@ class _InstantBodyPageState extends State<InstantBodyPage>
|
||||
@override
|
||||
void initState() {
|
||||
WidgetsBinding.instance.addObserver(this); // 添加生命周期观察者
|
||||
// edm.EasyDartModule.websocket.sendData(jsonEncode(WebSocketMessage(
|
||||
// path: "/vsbs/web/rt/marttress",
|
||||
// type: 1,
|
||||
// data: {"mac": widget.personInfo['mac']})));
|
||||
// _startOnlineTimer(); // 初始化时启动定时器
|
||||
_initWebSocket();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future<void> _initWebSocket() async {
|
||||
// 发送WebSocket请求
|
||||
try {
|
||||
Future.delayed(Duration(seconds: 0), () {
|
||||
CommonVariables.callMap["/vsbs/web/rt/marttress"] = (data) {
|
||||
@@ -111,12 +112,6 @@ class _InstantBodyPageState extends State<InstantBodyPage>
|
||||
edm.EasyDartModule.logger
|
||||
.error("[webscoekt]格式化数据错误-->${{"mac": widget.personInfo['mac']}}");
|
||||
}
|
||||
_initWebSocket();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void _initWebSocket() {
|
||||
// 发送WebSocket请求
|
||||
if (widget.personInfo['status'] != null) {
|
||||
try {
|
||||
onlineState =
|
||||
@@ -133,11 +128,21 @@ class _InstantBodyPageState extends State<InstantBodyPage>
|
||||
.info("[webscoekt]发送请求:数据-->${{"mac": widget.personInfo['mac']}}");
|
||||
DailyLogUtils.writeLog(
|
||||
"[webscoekt]发送请求:数据-->${{"mac": widget.personInfo['mac']}}");
|
||||
edm.EasyDartModule.websocket.sendData(jsonEncode(WebSocketMessage(
|
||||
path: "/vsbs/web/rt/marttress",
|
||||
type: 1,
|
||||
data: {"mac": widget.personInfo['mac']})));
|
||||
try {
|
||||
edm.EasyDartModule.websocket.sendData(jsonEncode(WebSocketMessage(
|
||||
path: "/vsbs/web/rt/marttress",
|
||||
type: 1,
|
||||
data: {"mac": widget.personInfo['mac']})));
|
||||
await Future.delayed(Duration(seconds: 3));
|
||||
edm.EasyDartModule.websocket.sendData(jsonEncode(WebSocketMessage(
|
||||
path: "/vsbs/web/rt/marttress",
|
||||
type: 1,
|
||||
data: {"mac": widget.personInfo['mac']})));
|
||||
} catch (e) {
|
||||
ef.log("msg");
|
||||
}
|
||||
_startOnlineTimer();
|
||||
ef.log("websocket初始化成功");
|
||||
}
|
||||
//y
|
||||
|
||||
@@ -159,7 +164,7 @@ class _InstantBodyPageState extends State<InstantBodyPage>
|
||||
_initWebSocket();
|
||||
} else if (state == AppLifecycleState.paused) {
|
||||
// 应用进入后台时关闭WebSocket
|
||||
_closeWebSocket();
|
||||
// _closeWebSocket();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -659,7 +664,6 @@ class _InstantBodyPageState extends State<InstantBodyPage>
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: 40.rpx,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user