更新设备名称时候的为空的bug
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:ef/ef.dart';
|
import 'package:ef/ef.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||||
@@ -94,6 +96,18 @@ class _EditBedPageState extends State<EditBedPage> {
|
|||||||
borderRadius: 16.rpx,
|
borderRadius: 16.rpx,
|
||||||
gradientDirection: GradientDirection.vertical,
|
gradientDirection: GradientDirection.vertical,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
final MHTBlueToothController bluetoothController =
|
||||||
|
Get.find();
|
||||||
|
final device =
|
||||||
|
bluetoothController.currentFullDevice;
|
||||||
|
if (editedData['name'] == null ||
|
||||||
|
editedData['name'] == '') {
|
||||||
|
if (device!.type == 2) {
|
||||||
|
editedData['name'] = '智能电动床';
|
||||||
|
} else {
|
||||||
|
editedData['name'] = '律动智能床垫';
|
||||||
|
}
|
||||||
|
}
|
||||||
String serviceAddress =
|
String serviceAddress =
|
||||||
ServiceConstant.service_address;
|
ServiceConstant.service_address;
|
||||||
String serviceName = ServiceConstant.server_service;
|
String serviceName = ServiceConstant.server_service;
|
||||||
@@ -112,12 +126,7 @@ class _EditBedPageState extends State<EditBedPage> {
|
|||||||
TopSlideNotification.show(context,
|
TopSlideNotification.show(context,
|
||||||
text: "修改名称成功".tr);
|
text: "修改名称成功".tr);
|
||||||
deviceListController.getDeviceList();
|
deviceListController.getDeviceList();
|
||||||
|
|
||||||
Map data = {};
|
Map data = {};
|
||||||
final MHTBlueToothController
|
|
||||||
bluetoothController = Get.find();
|
|
||||||
final device =
|
|
||||||
bluetoothController.currentFullDevice;
|
|
||||||
data['_id'] = device!.deviceID;
|
data['_id'] = device!.deviceID;
|
||||||
data['isNextStep'] = true;
|
data['isNextStep'] = true;
|
||||||
Get.toNamed("/roomPickerPage", arguments: data);
|
Get.toNamed("/roomPickerPage", arguments: data);
|
||||||
@@ -193,7 +202,6 @@ class _EditBedPageState extends State<EditBedPage> {
|
|||||||
maxLength: AppConstants().text_length,
|
maxLength: AppConstants().text_length,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "请输入设备的名称",
|
hintText: "请输入设备的名称",
|
||||||
// counterText: "",
|
|
||||||
contentPadding:
|
contentPadding:
|
||||||
const EdgeInsetsDirectional
|
const EdgeInsetsDirectional
|
||||||
.fromSTEB(10, 0, 10, 0),
|
.fromSTEB(10, 0, 10, 0),
|
||||||
@@ -271,6 +279,14 @@ class _EditBedPageState extends State<EditBedPage> {
|
|||||||
ServiceConstant.device_show;
|
ServiceConstant.device_show;
|
||||||
String queryUrl =
|
String queryUrl =
|
||||||
"$serviceAddress$serviceName$serviceApi";
|
"$serviceAddress$serviceName$serviceApi";
|
||||||
|
if (editedData['name'] == null ||
|
||||||
|
editedData['name'] == '') {
|
||||||
|
if (editedData['device_type'] == 2) {
|
||||||
|
editedData['name'] = '智能电动床';
|
||||||
|
} else {
|
||||||
|
editedData['name'] = '律动智能床垫';
|
||||||
|
}
|
||||||
|
}
|
||||||
await requestWithLog(
|
await requestWithLog(
|
||||||
logTitle: "更新设备信息",
|
logTitle: "更新设备信息",
|
||||||
method: MyHttpMethod.put,
|
method: MyHttpMethod.put,
|
||||||
|
|||||||
@@ -199,7 +199,11 @@ class MHTLoginController extends GetControllerEx<LoginModel> {
|
|||||||
String serviceName = ServiceConstant.server_service;
|
String serviceName = ServiceConstant.server_service;
|
||||||
String serviceApi = ServiceConstant.send_code;
|
String serviceApi = ServiceConstant.send_code;
|
||||||
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
|
||||||
var data = {"userName": model.phone, "type": 1};
|
var data = {
|
||||||
|
"userName": model.phone,
|
||||||
|
"type": 1,
|
||||||
|
};
|
||||||
|
data['code'] = "mht";
|
||||||
await requestWithLog(
|
await requestWithLog(
|
||||||
data: data,
|
data: data,
|
||||||
logTitle: "发送验证码",
|
logTitle: "发送验证码",
|
||||||
|
|||||||
Reference in New Issue
Block a user