更新同步遥控器

This commit is contained in:
wyf
2025-06-30 21:56:15 +08:00
parent 0e0f475536
commit adaaf561ee
8 changed files with 148 additions and 29 deletions

View File

@@ -560,4 +560,79 @@ class MHTHomeController extends GetControllerEx<MHTHomeModel> {
},
);
}
//开启定时器
void startTimer(args) {
var tmp = args[0];
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "control_${tmp['mac']}";
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
var data = {
"type": type,
"duration": tmp['duration'],
"mac": tmp['mac'],
"time": tmp['startTime'],
};
requestWithLog(
logTitle: "更新控制倒计时",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {});
}
//关闭定时器
void cancelTimer(args) {
var tmp = args[0];
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "control_${tmp['mac']}";
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
var data = {
"type": type,
"duration": 0,
"mac": tmp['mac'],
"time": tmp['startTime'],
};
requestWithLog(
logTitle: "查询控制倒计时",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {});
}
//恢复
restoreTimer(args) async {
var data = {};
try {
var tmp = args[0];
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "control_${tmp}";
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=$type";
await requestWithLog(
logTitle: "查询控制倒计时",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
if (res.data != null) {
data = res.data;
}
},
onFailure: (res) {
data = {};
},
);
} catch (e) {
ef.log("$e");
}
return data;
}
}

View File

@@ -271,6 +271,7 @@ class _MhtSleepReportPageState extends State<MhtSleepReportPage> {
'backgroundImg':
'assets/images/new_background.png',
'arrow': false,
'noBackImg':true,
},
),
);

View File

@@ -372,7 +372,7 @@ class _NewHomePageState extends State<NewHomePage> {
MediaQuery.sizeOf(context).height *
0.184,
constraints: BoxConstraints(
minHeight: 350.rpx,
minHeight: 354.rpx,
),
decoration: BoxDecoration(
color: stringToColor("#003058"),
@@ -385,8 +385,8 @@ class _NewHomePageState extends State<NewHomePage> {
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(
30.rpx,
16.rpx,
20.rpx,
20.rpx,
16.rpx,
25.rpx),
child: Container(
@@ -522,7 +522,6 @@ class _NewHomePageState extends State<NewHomePage> {
isMultiSelect: false,
),
),
),
InkWell(
onTap: () {
@@ -827,10 +826,15 @@ class _NewHomePageState extends State<NewHomePage> {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.add,
size: 60.rpx,
color: stringToColor("#85F5FF"),
// Icon(
// Icons.add,
// size: 60.rpx,
// color: stringToColor("#85F5FF"),
// ),
SvgPicture.asset(
'assets/images/icon/add.svg',
width: 42.rpx,
height: 42.rpx,
),
SizedBox(width: 20.rpx),
Text(