更新绑定时候选择房间和设置房间名称
This commit is contained in:
@@ -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,
|
||||
)),
|
||||
),
|
||||
)),
|
||||
),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user