设备报修

This commit is contained in:
czz
2025-07-14 18:04:42 +08:00
parent a26834f56c
commit d5a5e3282d
13 changed files with 952 additions and 374 deletions

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="42" height="42" viewBox="0 0 42 42"><g><g><path d="M22.48388328125,20.546871015625C22.48388328125,21.267091015625,22.29004328125,21.769041015625,21.72998328125,22.327881015625C21.72998328125,22.327881015625,16.60986328125,28.178951015625,16.60986328125,28.178951015625C16.60986328125,28.178951015625,16.60986328125,31.907941015625,16.60986328125,31.907941015625C16.60986328125,31.907941015625,19.54785328125,31.907941015625,19.54785328125,31.907941015625C19.54785328125,31.907941015625,19.54785328125,29.810041015625,19.54785328125,29.810041015625C19.54785328125,29.810041015625,19.54785328125,29.542941015625,19.54785328125,29.542941015625C19.54785328125,29.542941015625,19.54785328125,28.303951015625,19.54785328125,28.303951015625C19.54785328125,28.303951015625,19.54785328125,27.875981015625,19.54785328125,27.875981015625C19.54785328125,27.875981015625,19.54785328125,26.555911015625,19.54785328125,26.555911015625C19.54785328125,26.555911015625,21.88086328125,23.904051015625,21.88086328125,23.904051015625C22.14502328125,23.634031015625,22.50586328125,23.844971015625,22.48779328125,24.149901015624998C22.48779328125,24.149901015624998,22.48779328125,25.921871015625,22.48779328125,25.921871015625C22.48779328125,25.921871015625,22.48779328125,26.741941015625,22.48779328125,26.741941015625C22.48779328125,26.741941015625,25.41699328125,26.711911015625,25.41699328125,26.711911015625C25.41699328125,26.711911015625,25.41699328125,22.436031015624998,25.41699328125,22.436031015624998C25.41699328125,22.436031015624998,22.48388328125,19.092041015625,22.48388328125,19.092041015625C22.48388328125,19.092041015625,22.48388328125,20.546871015625,22.48388328125,20.546871015625C22.48388328125,20.546871015625,22.48388328125,20.546871015625,22.48388328125,20.546871015625Z" fill="#85F5FF" fill-opacity="1"/></g><g><path d="M21,0C9.40186,0,0,9.4021,0,21C0,21,0,21,0,21C0,32.5979,9.40186,42,21,42C32.5977,42,42,32.5979,42,21C42,21,42,21,42,21C42,9.4021,32.5977,0,21,0C21,0,21,0,21,0ZM28.3569,27.51C28.355,28.592,27.4126,29.5491,26.3496,29.554C26.3496,29.554,22.4878,29.554,22.4878,29.554C22.4878,29.554,22.4878,29.8101,22.4878,29.8101C22.4878,29.8101,22.4878,32.676,22.4878,32.676C22.4209,33.9209,21.4116,34.709,20.4839,34.709C20.4839,34.709,15.687,34.709,15.687,34.709C14.7729,34.709,13.6519,33.9089,13.6519,32.6609C13.6519,32.6609,13.6519,27.552,13.6519,27.552C13.6099,26.8689,13.8989,26.251,14.249,25.894C14.249,25.894,19.54,19.8889,19.54,19.8889C19.54,19.8889,19.54,15.4541,19.54,15.4541C19.54,15.4541,16.604,15.4541,16.604,15.4541C16.604,15.4541,16.604,20.1321,16.604,20.1321C16.604,20.1321,14.2446,22.8081,14.2446,22.8081C13.981,23.0549,13.6431,22.874,13.6431,22.5669C13.6431,22.5669,13.6431,14.6719,13.6431,14.6719C13.6431,13.5569,14.5718,12.6531,15.687,12.6531C15.687,12.6531,19.5347,12.6531,19.5347,12.6531C19.5347,12.6531,19.5347,12.646,19.5347,12.646C19.5347,12.646,19.5347,9.33887,19.5347,9.33887C19.5347,8.31006,20.4116,7.29102,21.5107,7.29102C21.5107,7.29102,26.1099,7.29102,26.1099,7.29102C27.895,7.29102,28.356,8.69507,28.356,9.31006C28.356,9.31006,28.356,16.7361,28.356,16.7361C28.3438,17.2229,27.9351,17.26,27.7188,17.0159C27.7188,17.0159,25.4199,14.396,25.4199,14.396C25.4199,14.396,25.4199,10.092,25.4199,10.092C25.4199,10.092,22.4858,10.092,22.4858,10.092C22.4858,10.092,22.4858,14.116,22.4858,14.116C22.4858,14.116,27.6289,20.001,27.6289,20.001C28.1196,20.5459,28.3569,21.0591,28.3569,21.8081C28.3569,21.8081,28.3569,27.51,28.3569,27.51C28.3569,27.51,28.3569,27.51,28.3569,27.51Z" fill="#85F5FF" fill-opacity="1"/></g></g></svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -31,7 +31,7 @@ class ApplyRepairModel {
int? device_type; //类型 床,床垫 不能为空 int? device_type; //类型 床,床垫 不能为空
String? device_category; //型号 不能为空 String? device_category; //型号 不能为空
String? device_id; //序列号 设备id 不能为空 String? device_id; //序列号 设备id 不能为空
String? device_series;
String? device_name; //名称 可为空 String? device_name; //名称 可为空
List<String>? issue_img = []; //图片 List<String>? issue_img = []; //图片
@@ -123,118 +123,6 @@ class ApplyRepairController extends GetControllerEx<ApplyRepairModel> {
} }
} }
// //提交
// Future<String> submitRepair(BuildContext context) async {
// //tmp
// // return '';
// String message = '';
// final MyDialogController myDialogController =
// Get.find<MyDialogController>();
// if (model.device_type == null || model.device_type!.isEmpty) {
// message = '请选择设备类型!';
// showToast(message);
// return message;
// }
// if (model.device_category == null || model.device_category!.isEmpty) {
// message = '请输入设备型号!';
// showToast(message);
// return message;
// }
// if (model.device_id == null || model.device_id!.isEmpty) {
// message = '请输入设备序列号id';
// showToast(message);
// return message;
// }
// if (model.apply_name == null || model.apply_name!.isEmpty) {
// message = '请输入姓名!';
// showToast(message);
// return message;
// }
// RegExp nameRegExp = RegExp(r'^[\u4e00-\u9fa5]{2,4}$');
// if (!nameRegExp.hasMatch(model.apply_name!)) {
// message = '姓名必须为2到4个汉字';
// showToast(message);
// return message;
// }
// if (model.tel == null || model.tel!.isEmpty) {
// message = '请输入手机号!';
// showToast(message);
// return message;
// }
// if (!MyUtils.isValidPhoneNumber(model.tel!)) {
// message = '无效的手机号!';
// showToast(message);
// return message;
// }
// if (model.desc == null || model.desc!.isEmpty) {
// message = '请输入问题描述!';
// showToast(message);
// return message;
// }
// if (model.issue_img == null || model.issue_img!.isEmpty) {
// message = '请至少上传一张问题图片!';
// showToast(message);
// return message;
// }
// model.status = RepairStatus.pending;
// // await repairRepository.saveRepair(model);
// String type = "repair_submit_${model.device_id}";
// String serviceAddress = ServiceConstant.service_address;
// String serviceName = ServiceConstant.server_service;
// String serviceApi = ServiceConstant.submit_repair;
// String queryUrl = "$serviceAddress$serviceName$serviceApi?type=$type";
// // 组织请求数据
// final UserInfoController userInfoController =
// Get.find<UserInfoController>();
// UserModel user = userInfoController.model.user!;
// Map<String, dynamic> data = {
// 'apply_name': model.apply_name,
// 'desc': model.desc,
// 'device_type': model.device_type,
// 'issue_img': model.issue_img,
// 'tel': model.tel,
// 'uid': user.uid,
// 'device_category': model.device_category,
// 'device_id': model.device_id,
// 'device_name': model.device_name,
// 'status': model.status,
// };
// // 发起插入请求(这里相当于之前的 saveRepair
// requestWithLog(
// logTitle: "提交报修",
// method: MyHttpMethod.post,
// queryUrl: queryUrl,
// data: data,
// onSuccess: (res) {
// if (res.data is List && res.data.isNotEmpty) {
// final inserted = res.data[0];
// model.id = inserted['id'];
// model.create_time = DateTime.tryParse(inserted['create_time']);
// // TextSelectionOverlay
// // // saveRepairHistor
// // saveRepairHistory(
// // RepairProcessModel()
// // ..status = model.status
// // ..record_id = inserted['id'],
// // );
// showToast("提交成功!");
// } else {
// showToast("提交失败:未返回数据!");
// }
// },
// onFailure: (res) {
// showToast("提交失败!");
// },
// );
// return message;
// }
Future<void> getDeviceList() async { Future<void> getDeviceList() async {
// UserModel loginUser = userInfoController.model.user!; // UserModel loginUser = userInfoController.model.user!;
DeviceListController deviceListController = Get.find(); DeviceListController deviceListController = Get.find();
@@ -243,5 +131,4 @@ class ApplyRepairController extends GetControllerEx<ApplyRepairModel> {
ApplyRepairController applyRepairController = Get.find(); ApplyRepairController applyRepairController = Get.find();
applyRepairController.model.device_list = aa; applyRepairController.model.device_list = aa;
} }
} }

View File

@@ -18,6 +18,7 @@ ApplyRepairModel _$ApplyRepairModelFromJson(Map<String, dynamic> json) =>
..device_type = (json['device_type'] as num?)?.toInt() ..device_type = (json['device_type'] as num?)?.toInt()
..device_category = json['device_category'] as String? ..device_category = json['device_category'] as String?
..device_id = json['device_id'] as String? ..device_id = json['device_id'] as String?
..device_series = json['device_series'] as String?
..device_name = json['device_name'] as String? ..device_name = json['device_name'] as String?
..issue_img = (json['issue_img'] as List<dynamic>?) ..issue_img = (json['issue_img'] as List<dynamic>?)
?.map((e) => e as String) ?.map((e) => e as String)
@@ -44,6 +45,7 @@ Map<String, dynamic> _$ApplyRepairModelToJson(ApplyRepairModel instance) =>
'device_type': instance.device_type, 'device_type': instance.device_type,
'device_category': instance.device_category, 'device_category': instance.device_category,
'device_id': instance.device_id, 'device_id': instance.device_id,
'device_series': instance.device_series,
'device_name': instance.device_name, 'device_name': instance.device_name,
'issue_img': instance.issue_img, 'issue_img': instance.issue_img,
'imagesLImit': instance.imagesLImit, 'imagesLImit': instance.imagesLImit,

View File

@@ -54,9 +54,10 @@ class ExperienceStoreListController
if (lock) { if (lock) {
return; return;
} }
if (page == 0) { // if (page == 0) {
position = await weatherModelController.determinePosition(); // position = await weatherModelController.determinePosition();
} // }
lock = true; lock = true;
int page_ = page; int page_ = page;
ApiService.reservation ApiService.reservation

View File

@@ -28,10 +28,10 @@ class RepairListController extends GetControllerEx<RepairListModel> {
} }
//初始化列表数据 //初始化列表数据
@override
Future<void> onInit() async { Future<void> initData() async {
super.onInit();
await getRepairList(); await getRepairList();
updateAll();
} }
getRepairList() async { getRepairList() async {

View File

@@ -41,8 +41,8 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
var tmpcontroller = var tmpcontroller =
FormFieldController<String>(controller.model.select_device); FormFieldController<String>(controller.model.select_device);
List<String> deviceTypeNames = ['', '床垫']; // List<String> deviceTypeNames = ['床', '床垫'];
List<String> deviceTypeIds = ['', '床垫']; // List<String> deviceTypeIds = ['床', '床垫'];
return LayoutBuilder(builder: (context, cc) { return LayoutBuilder(builder: (context, cc) {
bodysize = cc; bodysize = cc;
return GestureDetector( return GestureDetector(
@@ -232,18 +232,33 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
.model .model
.device_list! .device_list!
.map((device) => { .map((device) => {
'id': device['_id'].toString(), // 提取设备 ID 'mac': device['mac'].toString(), // 提取设备 Mac
'name': device['name'].toString(), // 提取设备名称 'name': device['name'].toString(), // 提取设备名称
'type': device['device_type'].toString()
}) })
.toList(); .toList();
// 提取 optionsLabel 和 optionsValue // 提取 optionsLabel 和 optionsValue
List<String> deviceNames = deviceOptions // List<String> deviceNames = deviceOptions
.map((device) => device['name']!) // 用于显示的名称列表 // .map((device) => device['name']!) // 用于显示的名称列表
.toList(); // .toList();
List<String>
deviceNames =
controller.model.device_list!.map((device) {
final mac =
device['mac']?.toString() ?? '';
final name =
device['name']?.toString() ?? '';
final type =
getDeviceTypeName(int.tryParse('${device['device_type']}'));
List<String> deviceIds = deviceOptions return name.isNotEmpty
.map((device) => device['id']!) // 用于匹配的 ID 列表 ? '$name-MAC$mac'
: '$type-MAC$mac';
}).toList();
List<String> deviceMacs = deviceOptions
.map((device) => device['mac']!) // 用于匹配的 ID 列表
.toList(); .toList();
return FlutterFlowDropDown< return FlutterFlowDropDown<
@@ -253,18 +268,36 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
fillColor: fillColor:
Colors.white, // 控件区域背景色 Colors.white, // 控件区域背景色
options: options:
deviceIds, // 下拉菜单选项为设备的 ID deviceMacs, // 下拉菜单选项为设备的 ID
optionLabels: optionLabels:
deviceNames, // 下拉菜单显示的内容为设备名称 deviceNames, // 下拉菜单显示的内容为设备名称
onChanged: onChanged:
(val) { (val) {
var selectedDevice = controller.model.device_list!.firstWhere((device) => device['_id'].toString() == val); // var selectedDevice = controller.model.device_list!.firstWhere((device) => device['mac'].toString() == val);
controller.model.select_device = val; // controller.model.select_device = val;
// controller.model.device_type = selectedDevice['device_type'];
// // controller.model.device_category = selectedDevice['deviceSeries']['name'] ?? '未知型号'; // 获取设备型号
// controller.model.device_category = '未知型号';
// controller.model.device_id = selectedDevice['mac'] ?? '未知设备mac'; // 获取设备ID
// controller.model.device_name = selectedDevice['name'] ?? '未知设备'; // 获取设备名称
// controller.updateAll();
var selectedDevice = controller.model.device_list!.firstWhere((device) => device['mac'].toString() == val);
final mac = selectedDevice['mac']?.toString() ?? '未知MAC';
final name = selectedDevice['name']?.toString();
final type = int.tryParse('${selectedDevice['device_type']}');
final typeName = getDeviceTypeName(type);
controller.model.select_device = mac;
controller.model.device_type = selectedDevice['device_type']; controller.model.device_type = selectedDevice['device_type'];
// controller.model.device_category = selectedDevice['deviceSeries']['name'] ?? '未知型号'; // 获取设备型号 controller.model.device_category = '未知型号'; // 后续可替换成设备系列
controller.model.device_category = '未知型号';
controller.model.device_id = selectedDevice['_id'] ?? '未知设备ID'; // 获取设备ID // 如果 name 不为空则用 name否则用 typeName-mac
controller.model.device_name = selectedDevice['name'] ?? '未知设备'; // 获取设备名称 controller.model.device_name = (name != null && name.isNotEmpty) ? name : '$typeName-MAC$mac';
controller.model.device_id = mac;
controller.updateAll(); controller.updateAll();
}, },
width: width:
@@ -375,30 +408,499 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
), ),
Expanded( Expanded(
child: Container( child: Container(
width: 100, decoration:
height: 100, BoxDecoration(
decoration: color: Colors
BoxDecoration( .white,
color: Colors borderRadius:
.white, BorderRadius
borderRadius: .circular(
BorderRadius 8),
.circular(8), ),
width: double
.infinity,
child: Padding(
padding: EdgeInsetsDirectional
.fromSTEB(
35.rpx,
0,
35.rpx,
0),
child: Row(
mainAxisSize:
MainAxisSize
.max,
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Expanded(
child:
Container(
child:
Align(
alignment:
AlignmentDirectional(-1, 0),
child:
TextFormField(
onChanged: (value) {
controller.model.device_series = value;
},
autofocus: false,
obscureText: false,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(0),
isDense: true,
labelStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
),
hintStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
filled: false,
fillColor: Colors.white,
),
style: TextStyle(
fontFamily: 'Readex Pro',
letterSpacing: 0,
color: Colors.black,
fontSize: 26.rpx,
),
// cursorColor:
// Colors.black,
// validator: _model
// .textControllerValidator
// .asValidator(context),
),
),
),
),
],
), ),
child: Padding( ),
padding: EdgeInsets.only(left: 26.rpx), ),
child: Align(
alignment: Alignment.centerLeft,
child: Obx(() => Text(
getDeviceTypeName(controller.model.device_type),
style: TextStyle(fontSize: 26.rpx, color: Colors.black),
))))),
), ),
].divide(SizedBox( ].divide(SizedBox(
width: 26.rpx)), width: 26.rpx)),
), ),
), ),
), ),
// Flexible(
// child: Container(
// width:
// MediaQuery.sizeOf(
// context)
// .width,
// height: 10,
// constraints:
// BoxConstraints(
// minHeight: 60.rpx,
// ),
// child: Row(
// mainAxisSize:
// MainAxisSize.max,
// children: [
// Container(
// width: 105.rpx,
// height: MediaQuery
// .sizeOf(
// context)
// .height *
// 0.038,
// constraints:
// const BoxConstraints(
// minWidth: 60,
// ),
// child: Align(
// alignment:
// const AlignmentDirectional(
// -1, 0),
// child: Text(
// '产品型号',
// style: TextStyle(
// fontFamily:
// 'Readex Pro',
// fontSize: 26
// .rpx,
// letterSpacing:
// 0,
// color: Colors
// .white),
// ),
// ),
// ),
// // Expanded(
// // child: Container(
// // width: 100,
// // height: 100,
// // decoration:
// // BoxDecoration(
// // color: Colors
// // .white,
// // borderRadius:
// // BorderRadius
// // .circular(8),
// // ),
// // child: Padding(
// // padding: EdgeInsets.only(left: 26.rpx),
// // child: Align(
// // alignment: Alignment.centerLeft,
// // child: Obx(() => Text(
// // controller.model.device_category ?? '',
// // style: TextStyle(fontSize: 26.rpx, color: Colors.black),
// // ))))),
// // ),
// Expanded(
// child: Container(
// child: Align(
// alignment:
// AlignmentDirectional(
// -1,
// 0),
// child:
// TextFormField(
// onChanged:
// (value) {
// controller
// .model
// .device_category = value;
// },
// autofocus:
// false,
// obscureText:
// false,
// decoration:
// InputDecoration(
// contentPadding:
// EdgeInsets.all(
// 0),
// isDense:
// true,
// labelStyle:
// TextStyle(
// fontFamily:
// 'Inter',
// fontSize:
// 26.rpx,
// letterSpacing:
// 0.0,
// ),
// hintStyle:
// TextStyle(
// fontFamily:
// 'Inter',
// fontSize:
// 26.rpx,
// letterSpacing:
// 0.0,
// color: themeController
// .currentColor
// .sc4,
// ),
// enabledBorder:
// OutlineInputBorder(
// borderSide:
// BorderSide(
// color:
// Color(0x00000000),
// width:
// 1.rpx,
// ),
// borderRadius:
// BorderRadius.circular(8.rpx),
// ),
// focusedBorder:
// OutlineInputBorder(
// borderSide:
// BorderSide(
// color:
// Color(0x00000000),
// width:
// 1.rpx,
// ),
// borderRadius:
// BorderRadius.circular(8.rpx),
// ),
// errorBorder:
// OutlineInputBorder(
// borderSide:
// BorderSide(
// color:
// Colors.red,
// width:
// 1.rpx,
// ),
// borderRadius:
// BorderRadius.circular(8.rpx),
// ),
// focusedErrorBorder:
// OutlineInputBorder(
// borderSide:
// BorderSide(
// color:
// Colors.red,
// width:
// 1.rpx,
// ),
// borderRadius:
// BorderRadius.circular(8.rpx),
// ),
// filled:
// false,
// fillColor:
// Colors
// .white,
// ),
// style:
// TextStyle(
// fontFamily:
// 'Readex Pro',
// letterSpacing:
// 0,
// color: Colors
// .black,
// fontSize:
// 26.rpx,
// ),
// // cursorColor:
// // Colors.black,
// // validator: _model
// // .textControllerValidator
// // .asValidator(context),
// ),
// ),
// ),
// ),
// ].divide(SizedBox(
// width: 26.rpx)),
// ),
// ),
// ),
// Flexible(
// child: Container(
// width:
// MediaQuery.sizeOf(
// context)
// .width,
// height: 10,
// constraints:
// BoxConstraints(
// minHeight: 60.rpx,
// ),
// child: Row(
// mainAxisSize:
// MainAxisSize.max,
// children: [
// Container(
// width: 105.rpx,
// height: MediaQuery
// .sizeOf(
// context)
// .height *
// 0.038,
// constraints:
// const BoxConstraints(
// minWidth: 60,
// ),
// child: Align(
// alignment:
// const AlignmentDirectional(
// -1, 0),
// child: Text(
// '序列号',
// style: TextStyle(
// fontFamily:
// 'Readex Pro',
// fontSize: 26
// .rpx,
// letterSpacing:
// 0,
// color: Colors
// .white),
// ),
// ),
// ),
// // Expanded(
// // child: Container(
// // width: 100,
// // height: 100,
// // decoration:
// // BoxDecoration(
// // color: Colors
// // .white,
// // borderRadius:
// // BorderRadius
// // .circular(8),
// // ),
// // child: Padding(
// // padding: EdgeInsets.only(left: 26.rpx),
// // child: Align(
// // alignment: Alignment.centerLeft,
// // child: Obx(() => Text(
// // controller.model.device_id ?? '',
// // style: TextStyle(fontSize: 26.rpx, color: Colors.black),
// // ))))),
// // ),
// Expanded(
// child: Container(
// child: Align(
// alignment:
// AlignmentDirectional(
// -1,
// 0),
// child:
// TextFormField(
// onChanged:
// (value) {
// controller
// .model
// .device_id = value;
// },
// autofocus:
// false,
// obscureText:
// false,
// decoration:
// InputDecoration(
// contentPadding:
// EdgeInsets.all(
// 0),
// isDense:
// true,
// labelStyle:
// TextStyle(
// fontFamily:
// 'Inter',
// fontSize:
// 26.rpx,
// letterSpacing:
// 0.0,
// ),
// hintStyle:
// TextStyle(
// fontFamily:
// 'Inter',
// fontSize:
// 26.rpx,
// letterSpacing:
// 0.0,
// color: themeController
// .currentColor
// .sc4,
// ),
// enabledBorder:
// OutlineInputBorder(
// borderSide:
// BorderSide(
// color:
// Color(0x00000000),
// width:
// 1.rpx,
// ),
// borderRadius:
// BorderRadius.circular(8.rpx),
// ),
// focusedBorder:
// OutlineInputBorder(
// borderSide:
// BorderSide(
// color:
// Color(0x00000000),
// width:
// 1.rpx,
// ),
// borderRadius:
// BorderRadius.circular(8.rpx),
// ),
// errorBorder:
// OutlineInputBorder(
// borderSide:
// BorderSide(
// color:
// Colors.red,
// width:
// 1.rpx,
// ),
// borderRadius:
// BorderRadius.circular(8.rpx),
// ),
// focusedErrorBorder:
// OutlineInputBorder(
// borderSide:
// BorderSide(
// color:
// Colors.red,
// width:
// 1.rpx,
// ),
// borderRadius:
// BorderRadius.circular(8.rpx),
// ),
// filled:
// false,
// fillColor:
// Colors
// .white,
// ),
// style:
// TextStyle(
// fontFamily:
// 'Readex Pro',
// letterSpacing:
// 0,
// color: Colors
// .black,
// fontSize:
// 26.rpx,
// ),
// // cursorColor:
// // Colors.black,
// // validator: _model
// // .textControllerValidator
// // .asValidator(context),
// ),
// ),
// ),
// ),
// ].divide(SizedBox(
// width: 26.rpx)),
// ),
// ),
// ),
Flexible( Flexible(
child: Container( child: Container(
width: width:
@@ -445,24 +947,110 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
), ),
Expanded( Expanded(
child: Container( child: Container(
width: 100, decoration:
height: 100, BoxDecoration(
decoration: color: Colors
BoxDecoration( .white,
color: Colors borderRadius:
.white, BorderRadius
borderRadius: .circular(
BorderRadius 8),
.circular(8), ),
width: double
.infinity,
child: Padding(
padding: EdgeInsetsDirectional
.fromSTEB(
35.rpx,
0,
35.rpx,
0),
child: Row(
mainAxisSize:
MainAxisSize
.max,
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Expanded(
child:
Container(
child:
Align(
alignment:
AlignmentDirectional(-1, 0),
child:
TextFormField(
onChanged: (value) {
controller.model.device_category = value;
},
autofocus: false,
obscureText: false,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(0),
isDense: true,
labelStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
),
hintStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
filled: false,
fillColor: Colors.white,
),
style: TextStyle(
fontFamily: 'Readex Pro',
letterSpacing: 0,
color: Colors.black,
fontSize: 26.rpx,
),
// cursorColor:
// Colors.black,
// validator: _model
// .textControllerValidator
// .asValidator(context),
),
),
),
),
],
), ),
child: Padding( ),
padding: EdgeInsets.only(left: 26.rpx), ),
child: Align(
alignment: Alignment.centerLeft,
child: Obx(() => Text(
controller.model.device_category ?? '',
style: TextStyle(fontSize: 26.rpx, color: Colors.black),
))))),
), ),
].divide(SizedBox( ].divide(SizedBox(
width: 26.rpx)), width: 26.rpx)),
@@ -515,24 +1103,110 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
), ),
Expanded( Expanded(
child: Container( child: Container(
width: 100, decoration:
height: 100, BoxDecoration(
decoration: color: Colors
BoxDecoration( .white,
color: Colors borderRadius:
.white, BorderRadius
borderRadius: .circular(
BorderRadius 8),
.circular(8), ),
width: double
.infinity,
child: Padding(
padding: EdgeInsetsDirectional
.fromSTEB(
35.rpx,
0,
35.rpx,
0),
child: Row(
mainAxisSize:
MainAxisSize
.max,
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Expanded(
child:
Container(
child:
Align(
alignment:
AlignmentDirectional(-1, 0),
child:
TextFormField(
onChanged: (value) {
controller.model.device_id = value;
},
autofocus: false,
obscureText: false,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(0),
isDense: true,
labelStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
),
hintStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
filled: false,
fillColor: Colors.white,
),
style: TextStyle(
fontFamily: 'Readex Pro',
letterSpacing: 0,
color: Colors.black,
fontSize: 26.rpx,
),
// cursorColor:
// Colors.black,
// validator: _model
// .textControllerValidator
// .asValidator(context),
),
),
),
),
],
), ),
child: Padding( ),
padding: EdgeInsets.only(left: 26.rpx), ),
child: Align(
alignment: Alignment.centerLeft,
child: Obx(() => Text(
controller.model.device_id ?? '',
style: TextStyle(fontSize: 26.rpx, color: Colors.black),
))))),
), ),
].divide(SizedBox( ].divide(SizedBox(
width: 26.rpx)), width: 26.rpx)),
@@ -1491,6 +2165,10 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
"mac": controller.model.device_id, "mac": controller.model.device_id,
"desc": controller.model.desc, "desc": controller.model.desc,
"img": controller.model.issue_img, "img": controller.model.issue_img,
"category":
controller.model.device_category,
"series": controller.model.device_series,
"name": controller.model.device_name
} }
], ],
}; };
@@ -1502,9 +2180,8 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
onSuccess: (res) { onSuccess: (res) {
TopSlideNotification.show(context, TopSlideNotification.show(context,
text: res.msg!); text: res.msg!);
repairListController.getRepairList();
Get.toNamed("/applyRepairSuccess"); Get.toNamed("/applyRepairSuccess");
// repairListController.getRepairList();
}, },
onFailure: (res) { onFailure: (res) {
TopSlideNotification.show(context, TopSlideNotification.show(context,
@@ -1590,8 +2267,8 @@ class ApplyRepairPage extends GetView<ApplyRepairController> {
String message = ""; String message = "";
if (controller.model.device_type == null || if (controller.model.device_type == null ||
controller.model.device_type == 0) { controller.model.device_series!.isEmpty) {
message = '选择设备类型'; message = '输入设备系列';
return message; return message;
} }
if (controller.model.device_category == null || if (controller.model.device_category == null ||

View File

@@ -495,6 +495,7 @@ class EditAddressPage extends GetView<AddressController>
), ),
), ),
), ),
].divide(const SizedBox( ].divide(const SizedBox(
width: 15)), width: 15)),
), ),

View File

@@ -39,7 +39,7 @@ class _ExperienceStorePageState extends State<ExperienceStorePage> {
super.initState(); super.initState();
Timer(Duration(milliseconds: 100), () async { Timer(Duration(milliseconds: 100), () async {
controller.resetParm(); controller.resetParm();
await weatherModelController.determinePosition(); // await weatherModelController.determinePosition();
controller.page = 0; controller.page = 0;
controller.getData(); controller.getData();
scrollController.addListener(() { scrollController.addListener(() {

View File

@@ -1,3 +1,5 @@
import 'dart:ffi';
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@@ -24,43 +26,43 @@ class _MinePageState extends State<NewMinePage> {
GlobalController globalController = Get.find(); GlobalController globalController = Get.find();
UserInfoController userInfoController = Get.find(); UserInfoController userInfoController = Get.find();
ThemeController themeController = Get.find(); ThemeController themeController = Get.find();
final GlobalKey _textKey = GlobalKey(); // final GlobalKey _textKey = GlobalKey();
double _textHalfWidth = 0; // double _textHalfWidth = 0;
@override // @override
void initState() { // void initState() {
super.initState(); // super.initState();
final login = userInfoController.model.login; // final login = userInfoController.model.login;
String text; // String text;
if (login == 0) { // if (login == 0) {
text = '未命名'.tr; // text = '未命名'.tr;
} else { // } else {
final nickname = userInfoController.model.user?.nick_name; // final nickname = userInfoController.model.user?.nick_name;
text = (nickname != null && nickname.isNotEmpty) ? nickname : '未命名'.tr; // text = (nickname != null && nickname.isNotEmpty) ? nickname : '未命名'.tr;
} // }
_calculateTextHalfWidth(text); // _calculateTextHalfWidth(text);
} // }
void _calculateTextHalfWidth(String text) { // void _calculateTextHalfWidth(String text) {
final textSpan = TextSpan( // final textSpan = TextSpan(
text: text, // text: text,
style: TextStyle( // style: TextStyle(
fontSize: 30.rpx, // fontSize: 30.rpx,
height: 1, // height: 1,
), // ),
); // );
final textPainter = TextPainter( // final textPainter = TextPainter(
text: textSpan, // text: textSpan,
textDirection: ui.TextDirection.ltr, // textDirection: ui.TextDirection.ltr,
); // );
textPainter.layout(); // 计算文本宽度 // textPainter.layout(); // 计算文本宽度
setState(() { // setState(() {
_textHalfWidth = textPainter.width / 2; // _textHalfWidth = textPainter.width / 2;
}); // });
} // }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -128,139 +130,144 @@ class _MinePageState extends State<NewMinePage> {
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Padding( Padding(
padding: EdgeInsetsDirectional.only(top: 30.rpx), padding: EdgeInsets.only(
child: Container( top: 30.rpx, left: 60.rpx, bottom: 70.rpx),
width: 120.rpx, child: Row(
height: 120.rpx,
clipBehavior: Clip.antiAlias,
decoration: const BoxDecoration(
shape: BoxShape.circle,
),
child: login == 1
? (userInfoController.model.user!.avatar == null ||
userInfoController
.model.user!.avatar!.isEmpty
? Image.asset(
"assets/images/mine_avatar.png",
fit: BoxFit.cover,
)
: Image.network(
userInfoController.model.user!.avatar!,
fit: BoxFit.cover,
))
: Image.asset(
"assets/images/mine_avatar.png",
fit: BoxFit.cover,
),
),
),
Padding(
padding: EdgeInsetsDirectional.only(top: 19.rpx),
child: Container(
width: double.infinity,
decoration: const BoxDecoration(),
child: Stack(
alignment: Alignment.center, // 使子组件在Stack中居中
children: [ children: [
Obx(() { Container(
return getUserInfo(userInfoController); width: 120.rpx,
}), height: 120.rpx,
Positioned( clipBehavior: Clip.antiAlias,
left: MediaQuery.of(context).size.width / 2 + decoration: const BoxDecoration(
_textHalfWidth + shape: BoxShape.circle,
30.rpx, ),
top: -10.rpx, child: login == 1
child: ClickableContainer( ? (userInfoController.model.user!.avatar ==
backgroundColor: Colors.transparent, null ||
highlightColor: const Color(0xFF055466), userInfoController
padding: EdgeInsets.zero, .model.user!.avatar!.isEmpty
onTap: () async { ? Image.asset(
if (userInfoController.model.login == "assets/images/default_avatar.png",
null || fit: BoxFit.cover,
userInfoController.model.login == 0) { )
TopSlideNotification.show( : Image.network(
context, userInfoController
text: "必须登录提示".tr, .model.user!.avatar!,
textColor: fit: BoxFit.cover,
themeController.currentColor.sc9, ))
); : Image.asset(
Get.toNamed("/loginPage"); "assets/images/default_avatar.png",
return; fit: BoxFit.cover,
}
await Get.toNamed("/editUserInfoPage");
await userInfoController.getUserInfo();
userInfoController.updateAll();
final login =
userInfoController.model.login;
String text;
if (login == 0) {
text = '未命名'.tr;
} else {
final nickname = userInfoController
.model.user?.nick_name;
text = (nickname != null &&
nickname.isNotEmpty)
? nickname
: '未命名'.tr;
}
_calculateTextHalfWidth(text);
},
child: Container(
width: 42.rpx,
height: 42.rpx,
alignment: Alignment.center,
child: SvgPicture.asset(
'assets/images/edit.svg',
color: Colors.white,
width: 18.rpx,
height: 18.rpx,
), ),
)),
), ),
], Flexible(
), child: Column(
), crossAxisAlignment: CrossAxisAlignment.start,
), children: [
Row(
children: [
Text(
login == 1
? (userInfoController
.model.user!.nick_name ??
'未命名'.tr)
: "未命名".tr,
style: TextStyle(
fontFamily: 'Inter',
color: themeController.currentColor.sc3,
fontSize:
AppConstants().title_text_fontSize,
letterSpacing: 0.0,
),
),
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: const Color(0xFF055466),
padding: EdgeInsets.zero,
onTap: () async {
if (userInfoController.model.login ==
null ||
userInfoController.model.login ==
0) {
TopSlideNotification.show(
context,
text: "必须登录提示".tr,
textColor: themeController
.currentColor.sc9,
);
Get.toNamed("/loginPage");
return;
}
await Get.toNamed(
"/editUserInfoPage");
await userInfoController
.getUserInfo();
userInfoController.updateAll();
final login =
userInfoController.model.login;
String text;
Container( if (login == 0) {
margin: EdgeInsets.only( text = '未命名'.tr;
left: 30.rpx, right: 30.rpx, top: 94.rpx), } else {
child: Text( final nickname = userInfoController
'对已绑定的智能设备进行个性化配置,以获得更好的体验', .model.user?.nick_name;
style: TextStyle( text = (nickname != null &&
fontSize: 26.rpx, nickname.isNotEmpty)
color: const Color(0XFF929699), ? nickname
height: 1), : '未命名'.tr;
}
},
child: Container(
width: 42.rpx,
height: 42.rpx,
alignment: Alignment.center,
child: SvgPicture.asset(
'assets/images/edit.svg',
color: Colors.white,
width: 18.rpx,
height: 18.rpx,
),
)),
].divide(SizedBox(
width: 20.rpx,
)),
),
Text(
login == 1
? (() {
final user =
userInfoController.model.user!;
if (user.email != null &&
user.email!.isNotEmpty) {
return user.email!;
} else if (user.phone != null &&
user.phone!.isNotEmpty) {
return MyUtils.hidePhoneNumber(
user.phone!);
} else {
return "微信用户".tr;
}
})()
: "未知数据".tr,
style: TextStyle(
fontFamily: 'Inter',
color: themeController.currentColor.sc4,
fontSize:
AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
),
],
))
].divide(SizedBox(
width: 30.rpx,
)),
)), )),
Padding(
padding: EdgeInsets.only(top: 46.rpx, bottom: 109.rpx),
child: ElevatedButton(
onPressed: () {
Get.toNamed("/deviceListPage");
},
style: ElevatedButton.styleFrom(
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
backgroundColor: const Color(0XFF85F5FF),
side: const BorderSide(color: Color(0XFF74DAE5)),
// foregroundColor: Colors.cyanAccent,
minimumSize: Size(260.rpx, 60.rpx),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(6),
),
),
child: Text(
'我的智能设备'.tr,
style: TextStyle(
fontSize: 26.rpx, color: const Color(0xFF003058)),
),
),
),
// 使用 Expanded 让滚动区域占据可用空间
// SizedBox(height: 109.rpx),
Expanded( Expanded(
child: Container( child: Container(
margin: const EdgeInsets.symmetric(horizontal: 16), margin: EdgeInsets.symmetric(horizontal: 30.rpx),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
color: Colors.transparent, color: Colors.transparent,
@@ -269,9 +276,12 @@ class _MinePageState extends State<NewMinePage> {
// 直接使用 SingleChildScrollView // 直接使用 SingleChildScrollView
child: Column( child: Column(
children: [ children: [
_buildListTile('assets/img/icon/mydevice.svg',
"我的智能设备", "我绑定或关联的智能床,智能床垫等智能设备",
showTopLine: true, path: "/deviceListPage"),
_buildListTile('assets/img/icon/order.svg', _buildListTile('assets/img/icon/order.svg',
'我的订单', '快捷查看我在网上的订单记录', '我的订单', '快捷查看我在网上的订单记录',
showTopLine: true, path: ""), path: ""),
_buildListTile('assets/img/icon/store.svg', _buildListTile('assets/img/icon/store.svg',
'门店体验', '如果想免费体验智能设备,可在此进行提前预约', '门店体验', '如果想免费体验智能设备,可在此进行提前预约',
path: "/experienceStorePage"), path: "/experienceStorePage"),

View File

@@ -63,8 +63,8 @@ class RepairHistoryWidget extends GetView<RepairInfoController> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
repairListController.model.repairList[index]['device'][0] repairListController.model.repairList[index]['device'][0]['name']
['mac'] ?? ??
'', '',
style: TextStyle( style: TextStyle(
color: Colors.white, fontSize: 30.rpx, height: 1), color: Colors.white, fontSize: 30.rpx, height: 1),

View File

@@ -17,29 +17,29 @@ class DeviceRepairPage extends GetView<RepairListController> {
// final ScrollController scrollController = ScrollController(); // final ScrollController scrollController = ScrollController();
final RepairListController controller = Get.find(); final RepairListController controller = Get.find();
// DeviceRepairPage() { DeviceRepairPage() {
// controller.model.limit = AppConstants.limit; // controller.model.offset = 0;
// controller.model.offset = 0; // controller.model.isLoading = false;
// controller.model.isLoading = false; // controller.model.hasMore = true;
// controller.model.hasMore = true; controller.model.repairList.clear();
// controller.model.repairList.clear(); controller.initData();
// controller.initData(); Get.put(RepairListController());
// Get.put(RepairListController());
// scrollController.addListener(() { scrollController.addListener(() {
// if (scrollController.position.pixels == if (scrollController.position.pixels ==
// scrollController.position.maxScrollExtent && scrollController.position.maxScrollExtent &&
// controller.model.hasMore) { controller.model.hasMore) {
// controller.initData(); controller.initData();
// controller.updateAll(); controller.updateAll();
// } }
// }); });
// } }
// final List<ApplyRepairModel> mockData // final List<ApplyRepairModel> mockData
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, cc) { return LayoutBuilder(builder: (context, cc) {
bodysize = cc; bodysize = cc;
return GestureDetector( return GestureDetector(
@@ -202,9 +202,7 @@ class DeviceRepairPage extends GetView<RepairListController> {
), ),
), ),
)), )),
SizedBox(height: 235.rpx), SizedBox(height: 235.rpx),
// 报修历史标题 // 报修历史标题
Container( Container(
width: double.infinity, width: double.infinity,
@@ -214,7 +212,6 @@ class DeviceRepairPage extends GetView<RepairListController> {
fontSize: 30.rpx, fontSize: 30.rpx,
height: 1)), height: 1)),
), ),
SizedBox(height: 32.rpx), SizedBox(height: 32.rpx),
// Obx(() { // Obx(() {
// return Visibility( // return Visibility(
@@ -267,4 +264,6 @@ class DeviceRepairPage extends GetView<RepairListController> {
)); ));
}); });
} }
} }

View File

@@ -88,7 +88,7 @@ Widget MonthDataWidget(
showLabel: sleepReport['scoreList']['type'], showLabel: sleepReport['scoreList']['type'],
), ),
SleepCard( SleepCard(
sleepReport: sleepReport, sleepReport: sleepReport['cwl'],
highlightItem: data['itemName'], highlightItem: data['itemName'],
), ),
IndicatorCompareCard( IndicatorCompareCard(

View File

@@ -1065,7 +1065,7 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
child: Container( child: Container(
width: 30.rpx, width: 30.rpx,
height: 30.rpx, height: 30.rpx,
child: SvgPicture.asset('assets/img/icon/arrow_right.svg', child: SvgPicture.asset('assets/img/icon/arrow_right1.svg',
color: isRightLimit.value color: isRightLimit.value
? Color(0xFF929699) ? Color(0xFF929699)
: Color(0xFFFFFFFF)), : Color(0xFFFFFFFF)),