更新
This commit is contained in:
@@ -63,7 +63,7 @@ class _ApplyRepairPageState extends State<ApplyRepairPage> {
|
||||
await deviceTypeController.getDeviceType(); // 等待数据加载
|
||||
if (deviceTypeController.deviceTypeList.isNotEmpty) {
|
||||
repairController.device_type.value =
|
||||
deviceTypeController.deviceTypeList.first['_id'];
|
||||
deviceTypeController.deviceTypeList.first['type'];
|
||||
}
|
||||
await bodyDeviceController.getDeviceList();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
@@ -80,7 +80,7 @@ class _ApplyRepairPageState extends State<ApplyRepairPage> {
|
||||
Widget build(BuildContext context) {
|
||||
if (deviceTypeController.deviceTypeList.isNotEmpty) {
|
||||
repairController.device_type.value =
|
||||
deviceTypeController.deviceTypeList.first['_id'];
|
||||
deviceTypeController.deviceTypeList.first['type'];
|
||||
}
|
||||
if (bodyDeviceController.deviceList.isNotEmpty) {
|
||||
repairController.deviceListId = bodyDeviceController.deviceList
|
||||
@@ -169,7 +169,7 @@ class _ApplyRepairPageState extends State<ApplyRepairPage> {
|
||||
AppConstants().button_container_radius,
|
||||
onTap: () async {
|
||||
repairController.device_type.value =
|
||||
deviceType['_id'];
|
||||
deviceType['type'];
|
||||
repairController.repairList
|
||||
.clear(); // 清空旧数据
|
||||
repairController.repairList
|
||||
@@ -180,7 +180,7 @@ class _ApplyRepairPageState extends State<ApplyRepairPage> {
|
||||
repairController
|
||||
.updateAll(); // 手动触发更新(如果未自动更新)
|
||||
},
|
||||
colors: deviceType['_id'] ==
|
||||
colors: deviceType['type'] ==
|
||||
repairController.device_type.value
|
||||
? [
|
||||
themeController.currentColor.sc1,
|
||||
@@ -328,7 +328,7 @@ class _ApplyRepairPageState extends State<ApplyRepairPage> {
|
||||
String queryUrl =
|
||||
"$serviceAddress$serviceName$serviceApi";
|
||||
var data = {
|
||||
"device": repairController.repairList,
|
||||
"device": repairController.repairList.value,
|
||||
"type": repairController.device_type.value,
|
||||
"contacts": {
|
||||
"name": repairController.name.value,
|
||||
@@ -340,8 +340,19 @@ class _ApplyRepairPageState extends State<ApplyRepairPage> {
|
||||
method: MyHttpMethod.post,
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
onSuccess: (res) {
|
||||
TopSlideNotification.show(context,
|
||||
text: res.msg!);
|
||||
// Get.back();
|
||||
Get.toNamed("/applyRepairSuccess");
|
||||
},
|
||||
onFailure: (res) {
|
||||
TopSlideNotification.show(context,
|
||||
text: res.msg!,
|
||||
textColor:
|
||||
themeController.currentColor.sc9);
|
||||
},
|
||||
);
|
||||
Get.back();
|
||||
}
|
||||
},
|
||||
colors: [
|
||||
@@ -515,16 +526,32 @@ class _ApplyRepairPageState extends State<ApplyRepairPage> {
|
||||
// return "第 ${i + 1} 项问题描述未填写";
|
||||
return "问题描述未填写".tr;
|
||||
}
|
||||
if (item["issue"] != null && item["issue"].toString().trim().isNotEmpty) {
|
||||
final issueText = item["issue"].toString().trim();
|
||||
final charCount = issueText.runes.length;
|
||||
|
||||
if (charCount > 60) {
|
||||
_scrollToKey(repairItemKeys[i]);
|
||||
return "问题描述最多输入60个字".tr;
|
||||
}
|
||||
} else {
|
||||
_scrollToKey(repairItemKeys[i]);
|
||||
return "问题描述不能为空".tr;
|
||||
}
|
||||
}
|
||||
|
||||
// 检查联系人
|
||||
if (repairController.name.trim().isEmpty) {
|
||||
_scrollToKey(contactKey);
|
||||
return "联系人不能为空";
|
||||
return "联系人不能为空".tr;
|
||||
}
|
||||
if (repairController.phone.trim().isEmpty) {
|
||||
_scrollToKey(phoneKey);
|
||||
return "联系电话不能为空";
|
||||
return "联系电话不能为空".tr;
|
||||
}
|
||||
if (!MyUtils.isValidPhoneNumber(repairController.phone.trim())) {
|
||||
_scrollToKey(phoneKey);
|
||||
return "无效的手机号码".tr;
|
||||
}
|
||||
|
||||
return errormsg;
|
||||
|
||||
Reference in New Issue
Block a user