地址接口的视线

This commit is contained in:
czz
2025-06-21 08:55:52 +08:00
parent d94a0c8a6c
commit 41adcedad7
38 changed files with 2399 additions and 2223 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,45 +1,45 @@
class ServiceConstant { class ServiceConstant {
static const String baseHost = "vsbs-test.he-info.cn";//服务地址 static const String baseHost = "vsbs-test.he-info.cn"; //服务地址
// static const String baseHost = "vsbst-api.he-info.cn";//服务地址 // static const String baseHost = "vsbst-api.he-info.cn";//服务地址
static const String service_address = "http://$baseHost"; static const String service_address = "http://$baseHost";
static String server_service = "/vsbs_app_server";//服务名称 static String server_service = "/vsbs_app_server"; //服务名称
static String send_code = "/api/verifycode/send";//发送验证码 static String send_code = "/api/verifycode/send"; //发送验证码
static String login = "/api/user/login";//登录 static String login = "/api/user/login"; //登录
static String get_bluetooth_device_status = "/api/device/status/info";//设备绑定状态 static String get_bluetooth_device_status =
static String device_bind = "/api/device/bind";//设备绑定 "/api/device/status/info"; //设备绑定状态
static String device_type = "/api/device/type/list";//设备类型 static String device_bind = "/api/device/bind"; //设备绑定
static String upload_file = "/api/file/info";//上传文件 static String device_type = "/api/device/type/list"; //设备类型
static String user_info = "/api/user/info";//更新用户资料,查询用户信息 static String upload_file = "/api/file/info"; //上传文件
static String device_list = "/api/device/list";//绑定设备列表 static String user_info = "/api/user/info"; //更新用户资料,查询用户信息
static String person_info = "/api/personnel/info";//用户资料 static String device_list = "/api/device/list"; //绑定设备列表
static String sleep_report = "/api/device/sleep/data";//睡眠报告 static String person_info = "/api/personnel/info"; //用户资料
static String device_share = "/api/device/share";//分享设备 static String sleep_report = "/api/device/sleep/data"; //睡眠报告
static String message_list = "/api/mesasge/list";//消息列表 static String device_share = "/api/device/share"; //分享设备
static String message_read = "/api/mesasge/read";//消息未读数量 static String message_list = "/api/mesasge/list"; //消息列表
static String device_show = "/api/device/bind";//更新设备绑定 static String message_read = "/api/mesasge/read"; //消息未读数量
static String disease_list = "/api/personnel/disease/list";//获取疾病类型 static String device_show = "/api/device/bind"; //更新设备绑定
static String share_deleted = "";//删除分享 static String disease_list = "/api/personnel/disease/list"; //获取疾病类型
static String start_calibration = "/api/caibration";//开始校准 static String share_deleted = ""; //删除分享
static String calibration_process = "/api/caibration";//校准进度 static String start_calibration = "/api/caibration"; //开始校准
static String submit_repair = "/api/device/repair";//提交报修 static String calibration_process = "/api/caibration"; //校准进度
static String user_setting = "/api/user/config";//查询和更新用户自定义配置 static String submit_repair = "/api/device/repair"; //提交报修
static String user_setting = "/api/user/config"; //查询和更新用户自定义配置
static String room_list = "/api/room/info"; //查询房间列表 static String room_list = "/api/room/info"; //查询房间列表
static String issue_list = "/api/help/list"; //问题与帮助列表 static String issue_list = "/api/help/list"; //问题与帮助列表
static String city_data = "/api/city/data/info"; //城市数据
static String address_list = "/api/addresss/list"; //查询地址列表
static String add_address = "/api/addresss/info"; //添加地址
static String logService = "$service_address/vsbs_log"; static String logService = "$service_address/vsbs_log";
static const String webSocketService = "wss://$baseHost/vsbs_ws_gateway/ws"; static const String webSocketService = "wss://$baseHost/vsbs_ws_gateway/ws";
static const String sleep_token = "HdAMjzqiYQKsmHRyEFKhfRGQ"; static const String sleep_token = "HdAMjzqiYQKsmHRyEFKhfRGQ";
static const String sleep_report_url = "https://alltoone.he-info.cn/h5/#/mattress/sleep/sleep"; static const String sleep_report_url =
"https://alltoone.he-info.cn/h5/#/mattress/sleep/sleep";
static const String user_register = "/api/user/register";//用户注册
static const String user_forgot = "/api/user/forgot";//找回密码
static const String user_changePassword = "/api/user/changePassword";//修改密码
static const String personnel_info = "/api/personnel/info";//人员信息列表
static const String user_register = "/api/user/register"; //用户注册
static const String user_forgot = "/api/user/forgot"; //找回密码
static const String user_changePassword = "/api/user/changePassword"; //修改密码
static const String personnel_info = "/api/personnel/info"; //人员信息列表
} }

View File

@@ -1,10 +1,15 @@
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_city_picker/model/address.dart'; import 'package:flutter_city_picker/model/address.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/model/user_data.dart'; import 'package:vbvs_app/model/user_data.dart';
import 'package:lpinyin/lpinyin.dart';
part 'address_controller.g.dart'; part 'address_controller.g.dart';
@JsonSerializable() @JsonSerializable()
@@ -14,10 +19,11 @@ class AddressModel {
String? city; //市 String? city; //市
String? county; //区 String? county; //区
String? street; //街道 String? street; //街道
String? detail; //详细信息 String? address; //详细信息
String? name; //名字 String? name; //名字
String? phone; //手机号 String? tel; //手机号
bool? ischecked = false; //是否默认 @JsonKey(name: 'default')
int? default_ = 0; //是否默认
int currentType = 0; int currentType = 0;
String? all_address; String? all_address;
@@ -52,105 +58,161 @@ class AddressController extends GetControllerEx<AddressModel> {
address["street"] = model.addressList![3].name; // 第四个元素为街道 address["street"] = model.addressList![3].name; // 第四个元素为街道
} }
} }
address['detail'] = model.detail; address['address'] = model.address;
address['name'] = model.name; address['name'] = model.name;
address['phone'] = model.phone; address['tel'] = model.tel;
address['isChecked'] = model.ischecked; address['default'] = model.default_;
// try { String serviceAddress = ServiceConstant.service_address;
// final data = await ef.client.rpc("get_now_datetime"); String serviceName = ServiceConstant.server_service;
// final response = await ef.client.from("app_user_address").update({ String serviceApi = ServiceConstant.add_address;
// 'province': address["province"], String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
// 'city': address["city"], await requestWithLog(
// 'county': address["county"], logTitle: "更新地址",
// 'street': address["street"], method: MyHttpMethod.put,
// 'detail': address["detail"], queryUrl: queryUrl,
// 'name': address["name"], data: {
// 'phone': address["phone"], "id": address['_id'],
// 'ischecked': address['isChecked'] ? 1 : 0, "default": address['default'],
// 'update_time': "name": address['name'],
// DateFormat("yyyy-MM-dd HH:mm:ss").parse("$data").toString(), "tel": address['tel'],
// }).eq("id", address['id']); // "area": address['all_address'],
// } catch (e) { "address": address['address'],
// print('Error fetching repairs: $e'); "province": address['province'],
// return e.toString(); "city": address['city'],
// } "county": address['county'],
"street": address['street'],
},
onSuccess: (res) {
if (res.code == 1) {
print("更新地址成功");
}
},
);
return ''; return '';
} }
addAddress(AddressModel model) async { Future<void> addAddress(AddressModel model, BuildContext context) async {
// try { try {
// final UserInfoController userInfoController = final UserInfoController userInfoController =
// Get.find<UserInfoController>(); Get.find<UserInfoController>();
// UserModel user = userInfoController.model.user!; UserModel user = userInfoController.model.user!;
// // 设置省市区街道名称 // 设置省市区街道名称
// if (model.addressList != null && model.addressList!.isNotEmpty) { if (model.addressList != null && model.addressList!.isNotEmpty) {
// if (model.addressList!.length > 0) if (model.addressList!.length > 0)
// model.province = model.addressList![0].name; // 第一个元素为省 model.province = model.addressList![0].name;
// if (model.addressList!.length > 1) if (model.addressList!.length > 1)
// model.city = model.addressList![1].name; // 第二个元素为市 model.city = model.addressList![1].name;
// if (model.addressList!.length > 2) if (model.addressList!.length > 2)
// model.county = model.addressList![2].name; // 第三个元素为区 model.county = model.addressList![2].name;
// if (model.addressList!.length > 3) if (model.addressList!.length > 3)
// model.street = model.addressList![3].name; // 第四个元素为街道 model.street = model.addressList![3].name;
// } }
// // 查询数据库是否已有该用户的地址 // 查询现有地址判断是否设置为默认
// final existingAddresses = await ef.client String listUrl =
// .from('app_user_address') "${ServiceConstant.service_address}${ServiceConstant.server_service}${ServiceConstant.address_list}";
// .select() final listRes = await requestWithLog(
// .eq('user_id', user.uid!); logTitle: "查询地址列表",
method: MyHttpMethod.get,
queryUrl: listUrl,
);
if (listRes.data.length <= 0) {
model.default_ = 1;
}
// 添加地址
String addUrl =
"${ServiceConstant.service_address}${ServiceConstant.server_service}${ServiceConstant.add_address}";
final addRes = await requestWithLog(
logTitle: '添加地址',
method: MyHttpMethod.post,
queryUrl: addUrl,
data: model.toJson(),
);
// // 如果没有地址,将新增地址默认选中 if (addRes.code == 1) {
// if (existingAddresses.isEmpty) { TopSlideNotification.show(context, text: "添加成功".tr);
// model.ischecked = true; }
// } else if (model.ischecked == true) { } catch (e) {
// // 如果新地址被选中,将其他地址的 `ischecked` 字段设为 `0` print(e);
// await ef.client }
// .from('app_user_address')
// .update({'ischecked': 0}).eq('user_id', user.uid!);
// }
// // 添加新地址
// final response = await ef.client.from('app_user_address').insert({
// 'province': model.province,
// 'city': model.city,
// 'county': model.county,
// 'street': model.street,
// 'detail': model.detail,
// 'name': model.name,
// 'phone': model.phone,
// 'ischecked': model.ischecked! ? 1 : 0,
// 'user_id': user.uid,
// });
// } catch (e) {
// print(e);
// }
} }
Future<List<AddressNode>> getData({int? level, int? pid}) async { List<dynamic>? _cityCache;
// 构建查询
return [];
// var query = ef.from("app_area_city").select();
// // 如果 pid 不为 null添加 pid 的条件 Future<void> _loadCityDataOnce() async {
// if (pid != null) { if (_cityCache != null) return;
// query = query.eq("pid", pid);
// }
// if (level != null) {
// query = query.eq("deep", level);
// }
// List arr = await query;
// List<AddressNode> addressNodes = arr.map((item) { String country = "CN";
// return AddressNode.fromJson({ String queryUrl =
// "name": item["ext_name"], // ext_name 对应 name "${ServiceConstant.service_address}${ServiceConstant.server_service}${ServiceConstant.city_data}?country=$country";
// "code": item["id"], // id 对应 code
// "letter": item["pinyin_prefix_upper"], // pinyin_prefix_upper 对应 letter
// });
// }).toList();
// return addressNodes; await requestWithLog(
logTitle: "查询城市数据",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
if (res.data != null && res.data is List) {
// 提取所有 data 并展开成一个统一列表
_cityCache = res.data
.where((e) => e["data"] != null && e["data"] is List)
.expand((e) => e["data"] as List)
.toList();
}
},
);
}
// 构建查询
Future<List<AddressNode>> getData({int? level, String? parentCode}) async {
await _loadCityDataOnce(); // 确保只加载一次
if (_cityCache == null) return [];
// 获取省级数据
if (parentCode == null || parentCode.isEmpty) {
return _cityCache!.map<AddressNode>((item) {
return AddressNode.fromJson({
"name": item["name"],
"code": item["code"],
"letter": _getLetter(item["name"]),
});
}).toList();
}
// 递归查找下级
final parent = _findNodeByCode(_cityCache!, parentCode);
if (parent == null || parent["children"] == null) return [];
List children = parent["children"];
return children.map<AddressNode>((item) {
return AddressNode.fromJson({
"name": item["name"],
"code": item["code"],
"letter": _getLetter(item["name"]),
});
}).toList();
}
Map<String, dynamic>? _findNodeByCode(List<dynamic> list, String code) {
for (var item in list) {
if (item is Map<String, dynamic>) {
if (item["code"] == code) return item;
if (item["children"] != null && item["children"] is List) {
var result = _findNodeByCode(item["children"], code);
if (result != null) return result;
}
}
}
return null;
}
// 工具:中文首字母转大写英文(你也可以用更专业的拼音库)
String _getLetter(String name) {
if (name.isEmpty) return "#";
String pinyin = PinyinHelper.getPinyinE(name,
separator: '', defPinyin: '', format: PinyinFormat.WITHOUT_TONE);
if (pinyin.isEmpty) return "#";
return pinyin[0].toUpperCase();
} }
} }

View File

@@ -11,10 +11,10 @@ AddressModel _$AddressModelFromJson(Map<String, dynamic> json) => AddressModel()
..city = json['city'] as String? ..city = json['city'] as String?
..county = json['county'] as String? ..county = json['county'] as String?
..street = json['street'] as String? ..street = json['street'] as String?
..detail = json['detail'] as String? ..address = json['address'] as String?
..name = json['name'] as String? ..name = json['name'] as String?
..phone = json['phone'] as String? ..tel = json['tel'] as String?
..ischecked = json['ischecked'] as bool? ..default_ = (json['default'] as num?)?.toInt()
..currentType = (json['currentType'] as num).toInt() ..currentType = (json['currentType'] as num).toInt()
..all_address = json['all_address'] as String?; ..all_address = json['all_address'] as String?;
@@ -24,10 +24,10 @@ Map<String, dynamic> _$AddressModelToJson(AddressModel instance) =>
'city': instance.city, 'city': instance.city,
'county': instance.county, 'county': instance.county,
'street': instance.street, 'street': instance.street,
'detail': instance.detail, 'address': instance.address,
'name': instance.name, 'name': instance.name,
'phone': instance.phone, 'tel': instance.tel,
'ischecked': instance.ischecked, 'default': instance.default_,
'currentType': instance.currentType, 'currentType': instance.currentType,
'all_address': instance.all_address, 'all_address': instance.all_address,
}; };

View File

@@ -1,6 +1,7 @@
import 'package:ef/ef.dart'; import 'package:ef/ef.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
part 'address_list_controller.g.dart'; part 'address_list_controller.g.dart';
@@ -23,42 +24,48 @@ class AddressListController extends GetControllerEx<AddressListModel> {
attr = GetModel(AddressListModel()).obs; attr = GetModel(AddressListModel()).obs;
} }
// getAddressList() async { getAddressList() async {
// await ApiService.request.get("/api/address/info/list").then((d) { String serviceAddress = ServiceConstant.service_address;
// model.addressList = d.data["data"] ?? []; String serviceName = ServiceConstant.server_service;
// updateAll(); String serviceApi = ServiceConstant.address_list;
// }).catchError((e) { String queryUrl = "$serviceAddress$serviceName$serviceApi";
// print("$e");
// });
// }
// //更新默认 requestWithLog(
// Future<void> updateDefault(address) async { logTitle: '查询地址列表',
// var id = address['id']; method: MyHttpMethod.get,
// var uid = address['userId']; queryUrl: queryUrl,
// try { onSuccess: (res) {
// await ef.client // 安全检查 res.data 是否为 List
// .from("app_user_address") if (res.data != null && res.data is List && res.data.isNotEmpty) {
// .update({ model.addressList = res.data;
// 'ischecked': 0, } else {
// }) model.addressList = []; // 设为空数组,防止空指针问题
// .eq("user_id", address['userId']) }
// .eq("ischecked", 1); updateAll();
// await ef.client.from("app_user_address").update({ },
// 'ischecked': 1, onFailure: (err) {
// }).eq("id", address['id']); model.addressList = []; // 请求失败时也清空列表以防旧数据残留
// } catch (e) { updateAll();
// print('Error fetching repairs: $e'); },
// } );
// } }
// // 删除地址 // // 删除地址
// Future<void> deleteAddress(String id) async { Future<void> deleteAddress(String id) async {
// try { String serviceAddress = ServiceConstant.service_address;
// await ef.client.from("app_user_address").delete().eq("id", id); String serviceName = ServiceConstant.server_service;
// print("Address with ID $id has been successfully deleted."); String serviceApi = ServiceConstant.add_address;
// } catch (e) { String queryUrl = "$serviceAddress$serviceName$serviceApi?id=$id";
// print("Error deleting address with ID $id: $e"); requestWithLog(
// } logTitle: '删除地址',
// } method: MyHttpMethod.delete,
queryUrl: queryUrl,
onSuccess: (res) {
getAddressList();
},
onFailure: (err) {
getAddressList();
},
);
}
} }

View File

@@ -6,6 +6,7 @@ import 'package:vbvs_app/common/color/repair_status.dart';
import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/common/util/myDialog/my_dialog_controller.dart'; import 'package:vbvs_app/common/util/myDialog/my_dialog_controller.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart'; import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart';
import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/model/user_data.dart'; import 'package:vbvs_app/model/user_data.dart';
@@ -216,16 +217,14 @@ class ApplyRepairController extends GetControllerEx<ApplyRepairModel> {
return message; return message;
} }
// Future<void> getDeviceList() async { Future<void> getDeviceList() async {
// final UserInfoController userInfoController = // UserModel loginUser = userInfoController.model.user!;
// Get.find<UserInfoController>(); DeviceListController deviceListController = Get.find();
// // UserModel loginUser = userInfoController.model.user!; await deviceListController.getDeviceList();
// DeviceListController deviceListController = Get.find(); var aa = deviceListController.model.deviceList;
// await deviceListController.getDeviceList(); ApplyRepairController applyRepairController = Get.find();
// var aa = deviceListController.model.deviceListWyf; applyRepairController.model.device_list = aa;
// ApplyRepairController applyRepairController = Get.find(); }
// applyRepairController.model.device_list = aa;
// }
// String getPublicUrl(String path) { // String getPublicUrl(String path) {
// try { // try {

View File

@@ -18,7 +18,7 @@ part 'device_list_controller.g.dart';
class DeviceListModel { class DeviceListModel {
//设备列表 //设备列表
List<dynamic> deviceList = []; List<dynamic> deviceList = [];
List<dynamic> deviceListWyf = [];
@JsonKey(ignore: true) @JsonKey(ignore: true)
String? keyword; String? keyword;

View File

@@ -7,12 +7,9 @@ part of 'device_list_controller.dart';
// ************************************************************************** // **************************************************************************
DeviceListModel _$DeviceListModelFromJson(Map<String, dynamic> json) => DeviceListModel _$DeviceListModelFromJson(Map<String, dynamic> json) =>
DeviceListModel() DeviceListModel()..deviceList = json['deviceList'] as List<dynamic>;
..deviceList = json['deviceList'] as List<dynamic>
..deviceListWyf = json['deviceListWyf'] as List<dynamic>;
Map<String, dynamic> _$DeviceListModelToJson(DeviceListModel instance) => Map<String, dynamic> _$DeviceListModelToJson(DeviceListModel instance) =>
<String, dynamic>{ <String, dynamic>{
'deviceList': instance.deviceList, 'deviceList': instance.deviceList,
'deviceListWyf': instance.deviceListWyf,
}; };

View File

@@ -19,8 +19,8 @@ class RepairModel {
// String? issue; //问题描述 // String? issue; //问题描述
String? fileUrl; //文件地址 String? fileUrl; //文件地址
String? mac; //状态 String? mac; //状态
String? desc;//问题描述 String? desc; //问题描述
List? img;//上传图片 List? img; //上传图片
RepairModel(); RepairModel();
factory RepairModel.fromJson(Map<String, dynamic> json) { factory RepairModel.fromJson(Map<String, dynamic> json) {
try { try {

View File

@@ -18,7 +18,6 @@ UserInfoModel _$UserInfoModelFromJson(Map<String, dynamic> json) =>
..deviceId = json['deviceId'] as String? ..deviceId = json['deviceId'] as String?
..deviceModel = json['deviceModel'] as String? ..deviceModel = json['deviceModel'] as String?
..appVersion = json['appVersion'] as String? ..appVersion = json['appVersion'] as String?
..img_bucket = json['img_bucket'] as String?
..login = (json['login'] as num?)?.toInt() ..login = (json['login'] as num?)?.toInt()
..deviceBindNum = (json['deviceBindNum'] as num?)?.toInt() ..deviceBindNum = (json['deviceBindNum'] as num?)?.toInt()
..loginPhone = (json['loginPhone'] as num?)?.toInt(); ..loginPhone = (json['loginPhone'] as num?)?.toInt();
@@ -33,7 +32,6 @@ Map<String, dynamic> _$UserInfoModelToJson(UserInfoModel instance) =>
'deviceId': instance.deviceId, 'deviceId': instance.deviceId,
'deviceModel': instance.deviceModel, 'deviceModel': instance.deviceModel,
'appVersion': instance.appVersion, 'appVersion': instance.appVersion,
'img_bucket': instance.img_bucket,
'login': instance.login, 'login': instance.login,
'deviceBindNum': instance.deviceBindNum, 'deviceBindNum': instance.deviceBindNum,
'loginPhone': instance.loginPhone, 'loginPhone': instance.loginPhone,

View File

@@ -73,7 +73,7 @@ class BezierBottomNavigationBar extends StatelessWidget {
fontSize: 22.rpx, fontSize: 22.rpx,
color: selectedIndex == i color: selectedIndex == i
? Colors.white ? Colors.white
: Colors.grey.shade400, : const Color(0XFF929699),
), ),
), ),
], ],

View File

@@ -381,7 +381,7 @@ Future<void> showWeightPickerDialog(
context, context,
weights, weights,
tempIndex, // ✅ 传入 RxInt tempIndex, // ✅ 传入 RxInt
unit: "cm", unit: "kg",
), ),
), ),
], ],
@@ -408,7 +408,6 @@ Future<void> showHeightPickerDialog(
int selectedIndex = heights.indexOf(initialHeight); int selectedIndex = heights.indexOf(initialHeight);
// int tempIndex = selectedIndex; // int tempIndex = selectedIndex;
final RxInt tempIndex = RxInt(selectedIndex); // ✅ 改为 RxInt final RxInt tempIndex = RxInt(selectedIndex); // ✅ 改为 RxInt
ThemeController themeController = Get.find(); ThemeController themeController = Get.find();
await showDialog( await showDialog(

View File

@@ -17,20 +17,22 @@ class _MattressControlPageState extends State<MattressControlPage> {
final controller = Get.put(ControlCardController()); final controller = Get.put(ControlCardController());
final data = { final data = {
"_id": "684bf0845a81f423c0000000", "_id": "333330000000000000000000",
"uid": "68465947a0cff49592000000", "uid": "684b90df767e00004e0072e2",
"bind_type": 1, "bind_type": 1,
"device_type": 3, "device_type": 3,
"mac": "545024122617", "mac": "545024122666",
"bind_mac": null, "bind_mac": null,
"bind_mac_a": "48CA43B2E8C8", "bind_mac_a": "B43A45C3D411",
"bind_mac_b": "48CA43B2E8B0", "bind_mac_b": "B43A45C3D388",
"position": 0, "position": 0,
"share_uid": null, "share_uid": null,
"person": null, "person": null,
"op_type": null, "op_type": null,
"show": true, "show": true,
"create_time": 1749807236514, "create_time": 1750121686274,
"room_id": "684395bf9ef8601da20f6475",
"roomName": "主卧",
"shareNum": 0, "shareNum": 0,
"status": { "status": {
"signal": -1, "signal": -1,
@@ -40,7 +42,7 @@ class _MattressControlPageState extends State<MattressControlPage> {
"failure": 0, "failure": 0,
"updateTime": -1 "updateTime": -1
}, },
"code": "545024122617" "code": "545024122666"
}; };
int selectedIndex = 1; // 当前选中的tab索引 int selectedIndex = 1; // 当前选中的tab索引
@override @override
@@ -75,7 +77,7 @@ class _MattressControlPageState extends State<MattressControlPage> {
SizedBox(width: 26.rpx), SizedBox(width: 26.rpx),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFF003058), color: const Color(0xFF003058),
borderRadius: BorderRadius.circular(30.rpx), borderRadius: BorderRadius.circular(30.rpx),
), ),
constraints: BoxConstraints( constraints: BoxConstraints(
@@ -90,6 +92,11 @@ class _MattressControlPageState extends State<MattressControlPage> {
underline: const SizedBox(), underline: const SizedBox(),
dropdownColor: Colors.blueGrey, dropdownColor: Colors.blueGrey,
iconEnabledColor: Colors.white, iconEnabledColor: Colors.white,
icon: Icon(
Icons.keyboard_arrow_down, // 最常用的向下箭头
color: Colors.white,
size: 30.rpx,
),
style: const TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
isExpanded: true, isExpanded: true,
items: const [ items: const [
@@ -113,11 +120,16 @@ class _MattressControlPageState extends State<MattressControlPage> {
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
padding: EdgeInsets.only(right: 69.rpx), padding: EdgeInsets.only(right: 69.rpx),
onTap: () {}, onTap: () {},
child: Icon( child: Image.asset(
Icons.bluetooth, 'assets/images/active_bluetooth.png',
color: Colors.white, width: 42.rpx,
size: 42.rpx, height: 42.rpx,
), ),
// Icon(
// Icons.bluetooth,
// color: Colors.white,
// size: 42.rpx,
// ),
), ),
ClickableContainer( ClickableContainer(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
@@ -131,7 +143,7 @@ class _MattressControlPageState extends State<MattressControlPage> {
], ],
centerTitle: false, centerTitle: false,
), ),
body: SafeArea( body: const SafeArea(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [

View File

@@ -51,14 +51,10 @@ class ShareUserWidget extends GetView {
height: 42.rpx, height: 42.rpx,
child: SvgPicture.asset('assets/img/icon/default_head.svg'), child: SvgPicture.asset('assets/img/icon/default_head.svg'),
), ),
Expanded( Expanded(
child: Container( child: Container(
margin: margin:
EdgeInsetsDirectional.only(start: 30.rpx, end: 30.rpx), EdgeInsetsDirectional.only(start: 30.rpx, end: 30.rpx),
// width: MediaQuery.sizeOf(context).width * 0.5,
// height: MediaQuery.sizeOf(context).height * 0.075,
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
@@ -72,6 +68,7 @@ class ShareUserWidget extends GetView {
color: Colors.white, color: Colors.white,
fontSize: 30.rpx, fontSize: 30.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
height: 1,
), ),
), ),
), ),
@@ -90,6 +87,7 @@ class ShareUserWidget extends GetView {
color: const Color(0xFFC8CBD2), color: const Color(0xFFC8CBD2),
fontSize: 20.rpx, fontSize: 20.rpx,
letterSpacing: 0.0, letterSpacing: 0.0,
height: 1,
), ),
), ),
), ),
@@ -98,44 +96,6 @@ class ShareUserWidget extends GetView {
), ),
), ),
), ),
// Container(
// width: MediaQuery.sizeOf(context).width * 0.2,
// height: MediaQuery.sizeOf(context).height * 0.075,
// constraints: const BoxConstraints(
// maxWidth: 130,
// ),
// decoration: BoxDecoration(
//
// ),
// child: Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Align(
// alignment: const AlignmentDirectional(0, 0),
// child: Text(
// ' ',
// style: TextStyle(
// fontFamily: 'Readex Pro',
// color: const Color(0xFF333333),
// fontSize: 13,
// letterSpacing: 0.0,
// ),
// ),
// ),
// Flexible(
// child: Align(
// alignment: const AlignmentDirectional(0, 0.05),
// child: Icon(
// Icons.arrow_forward_ios,
// color: FlutterFlowTheme.of(context).secondaryText,
// size: 10,
// ),
// ),
// ),
// ].divide(const SizedBox(width: 27)),
// ),
// ),
ClickableContainer( ClickableContainer(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
highlightColor: Colors.transparent, highlightColor: Colors.transparent,
@@ -147,25 +107,9 @@ class ShareUserWidget extends GetView {
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/img/icon/expand.svg', 'assets/img/icon/expand.svg',
color: Colors.white, color: Colors.white,
) ))),
// Icon(
// Icons.arrow_forward_ios,
// color: Colors.white,
// // size: 14.rpx,
// ),
)),
], ],
), ),
// Container(
// width: MediaQuery.sizeOf(context).width,
// height: MediaQuery.sizeOf(context).height * 0.09,
// child: Container(
// width: MediaQuery.sizeOf(context).width,
// height: MediaQuery.sizeOf(context).height * 0.09,
// decoration: BoxDecoration(),
// ),
// ),
), ),
), ),
); );

View File

@@ -15,9 +15,9 @@ class AddressListPage extends GetView<AddressListController> {
final scaffoldKey = GlobalKey<ScaffoldState>(); final scaffoldKey = GlobalKey<ScaffoldState>();
BoxConstraints? bodysize; BoxConstraints? bodysize;
// AddressListPage() { AddressListPage() {
// controller.getAddressList(); controller.getAddressList();
// } }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -65,6 +65,7 @@ class AddressListPage extends GetView<AddressListController> {
centerTitle: false, centerTitle: false,
), ),
body: Container( body: Container(
margin: EdgeInsets.only(top: 30.rpx),
width: bodysize!.maxWidth, width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 1, height: bodysize!.maxHeight * 1,
child: Column( child: Column(
@@ -80,49 +81,24 @@ class AddressListPage extends GetView<AddressListController> {
child: Container( child: Container(
width: bodysize!.maxWidth, width: bodysize!.maxWidth,
height: bodysize!.maxHeight * 1, height: bodysize!.maxHeight * 1,
decoration: BoxDecoration( decoration: BoxDecoration(),
color: Color(0xFFF6F6F6), child: Obx(() => ListView(
), shrinkWrap: true,
child: Column( scrollDirection: Axis.vertical,
mainAxisSize: MainAxisSize.max, children: (controller.model.addressList!
children: [ .asMap()
Align( .entries
alignment: AlignmentDirectional(-1, 0), .map((e) => AddressModuleWidget(
child: Padding( index: e.key,
padding: EdgeInsetsDirectional.fromSTEB( addressListController:
31, 27, 0, 26), controller,
child: Text( ))
'我的地址', .toList() as List<Widget>)
style: TextStyle( .divide(const SizedBox(height: 10))
fontFamily: 'Readex Pro', .addToEnd(const SizedBox(
fontSize: AppFontsize.title_size, height:
letterSpacing: 0, AppConstants.list_end_height)),
fontWeight: FontWeight.w600, )),
),
),
),
),
Expanded(
child: Obx(() => ListView(
shrinkWrap: true,
scrollDirection: Axis.vertical,
children: (controller.model.addressList!
.asMap()
.entries
.map((e) => AddressModuleWidget(
index: e.key,
addressListController:
controller,
))
.toList() as List<Widget>)
.divide(const SizedBox(height: 10))
.addToEnd(const SizedBox(
height: AppConstants
.list_end_height)),
)),
),
],
),
), ),
); );
} }
@@ -143,7 +119,7 @@ class AddressListPage extends GetView<AddressListController> {
), ),
child: TextButton( child: TextButton(
onPressed: () { onPressed: () {
controller.model.address = {'isChecked': false}; controller.model.address = {'default': 0};
controller.model.type = 1; controller.model.type = 1;
Get.toNamed("/editAddressPage"); Get.toNamed("/editAddressPage");
}, },
@@ -167,20 +143,7 @@ class AddressListPage extends GetView<AddressListController> {
width: 42.rpx, width: 42.rpx,
height: 42.rpx, height: 42.rpx,
), ),
// Text(
// '+',
// style: FlutterFlowTheme.of(context)
// .titleSmall
// .override(
// fontFamily: 'Readex Pro',
// color: Color(0xFF85F5FF),
// fontSize:
// AppFontsize.normal_text_size +
// 12, // 让加号比文字稍大
// letterSpacing: 0,
// ),
// ),
//),
SizedBox(width: 10), // 加号和文字间距 SizedBox(width: 10), // 加号和文字间距
Text( Text(
'添加新地址', '添加新地址',

View File

@@ -2,8 +2,8 @@ import 'package:ef/ef.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/controller/mh_controller/address_list_controller.dart'; import 'package:vbvs_app/controller/mh_controller/address_list_controller.dart';
import '../../common/color/appFontsize.dart'; import '../../common/color/appFontsize.dart';
class AddressModuleWidget extends GetView { class AddressModuleWidget extends GetView {
@@ -20,14 +20,14 @@ class AddressModuleWidget extends GetView {
return SingleChildScrollView( return SingleChildScrollView(
child: SlidableAutoCloseBehavior( child: SlidableAutoCloseBehavior(
child: Padding( child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(15, 0, 15, 0), padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
child: Container( child: Container(
width: MediaQuery.sizeOf(context).width, width: MediaQuery.sizeOf(context).width,
constraints: BoxConstraints( constraints: BoxConstraints(
minHeight: 100, minHeight: 220.rpx,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Color(0xFF003058),
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
), ),
child: Slidable( child: Slidable(
@@ -38,12 +38,12 @@ class AddressModuleWidget extends GetView {
Expanded( Expanded(
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
// await addressListController.deleteAddress( await addressListController.deleteAddress(
// addressListController.model.addressList[index] addressListController.model.addressList[index]
// ['id']); ['_id']);
// addressListController.model.addressList.removeAt(index); addressListController.model.addressList.removeAt(index);
// addressListController.updateAll(); addressListController.updateAll();
}, },
child: Container( child: Container(
margin: EdgeInsets.only(left: 30), margin: EdgeInsets.only(left: 30),
@@ -62,184 +62,128 @@ class AddressModuleWidget extends GetView {
], ],
), ),
child: Padding( child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(15, 13, 15, 10), padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 20.rpx, 30.rpx, 20.rpx),
child: Container( child: Container(
width: MediaQuery.sizeOf(context).width, width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.123, height: MediaQuery.sizeOf(context).height * 0.123,
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Expanded( Container(
child: Container( height: 60.rpx,
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.08,
constraints: BoxConstraints(
minHeight: 112,
),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Expanded(
width: MediaQuery.sizeOf(context).width * 0.7, child: Text(
height: [
MediaQuery.sizeOf(context).height * 0.08, addressListController
constraints: BoxConstraints( .model.addressList[index]['province'],
minHeight: 112, addressListController
), .model.addressList[index]['city'],
child: Column( addressListController
mainAxisSize: MainAxisSize.max, .model.addressList[index]['county'],
children: [ addressListController
Flexible( .model.addressList[index]['street']
child: Align( ]
alignment: AlignmentDirectional(-1, 0), .where((element) =>
child: Text( element != null && element.isNotEmpty)
[ .join(' '),
addressListController.model style: TextStyle(
.addressList[index]['province'], fontFamily: 'Readex Pro',
addressListController.model color: Colors.white,
.addressList[index]['city'], fontSize: AppFontsize.normal_text_size,
addressListController.model letterSpacing: 0,
.addressList[index]['county'], ),
addressListController.model
.addressList[index]['street']
]
.where((element) =>
element != null &&
element.isNotEmpty)
.join(' '),
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFF333333),
fontSize:
AppFontsize.normal_text_size,
letterSpacing: 0,
),
),
),
),
Flexible(
child: Align(
alignment: AlignmentDirectional(-1, 0),
child: Text(
addressListController
.model
.addressList[index]
['detail']
?.isEmpty ??
true
? '无详细地址'
: addressListController.model
.addressList[index]['detail'],
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFF333333),
fontSize:
AppFontsize.normal_text_size,
letterSpacing: 0,
),
),
),
),
Flexible(
child: Align(
alignment: AlignmentDirectional(-1, 0),
child: Text(
'${addressListController.model.addressList[index]['name']} ' +
'${addressListController.model.addressList[index]['phone']} ',
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFF333333),
fontSize:
AppFontsize.normal_text_size,
letterSpacing: 0,
),
),
),
),
].divide(SizedBox(height: 5)),
), ),
), ),
Align( Obx(() => Visibility(
alignment: AlignmentDirectional(1, -1), visible: addressListController.model
child: Theme( .addressList[index]["default"] ==
data: ThemeData( 1,
checkboxTheme: CheckboxThemeData( child: Container(
visualDensity: VisualDensity.compact, width: 71.rpx,
materialTapTargetSize: height: 36.rpx,
MaterialTapTargetSize.shrinkWrap, child: ElevatedButton(
shape: RoundedRectangleBorder( onPressed: () {},
borderRadius: BorderRadius.circular(64), child: Text(
'默认',
style: TextStyle(
color: Color(0XFF6BFDAC),
fontSize: 20.rpx,
),
),
style: ElevatedButton.styleFrom(
backgroundColor:
const Color(0x4D6BFDAC),
padding: EdgeInsets.zero,
),
), ),
), ),
unselectedWidgetColor: Color(0xFFD3D3D3), ))
),
child: Obx(() {
return Checkbox(
value: addressListController
.model.addressList[index]
['isChecked'] ??
false,
onChanged: (newValue) async {
// if (newValue == true) {
// for (var i = 0;
// i <
// addressListController
// .model.addressList.length;
// i++) {
// addressListController
// .model.addressList[i]
// ['isChecked'] = false;
// }
// addressListController
// .model.addressList[index]
// ['isChecked'] = newValue;
// addressListController.updateDefault(
// addressListController
// .model.addressList[index]);
// }
// addressListController.updateAll();
},
side: BorderSide(
width: 1.5,
color: Colors.white,
),
activeColor: const Color(0xFFd3b684),
// checkColor:
// FlutterFlowTheme.of(context).info,
);
}),
),
)
], ],
)),
Container(
height: 60.rpx,
alignment: Alignment.centerLeft,
child: Text(
addressListController.model
.addressList[index]['address']?.isEmpty ??
true
? '无详细地址'
: addressListController.model.addressList[index]
['address'],
style: TextStyle(
fontFamily: 'Readex Pro',
color: Colors.white,
fontSize: AppFontsize.normal_text_size,
letterSpacing: 0,
), ),
), ),
), ),
Align( Container(
alignment: AlignmentDirectional(1, 0), height: 60.rpx,
child: InkWell( child: Row(
onTap: () { mainAxisAlignment: MainAxisAlignment.spaceBetween,
addressListController.model.address = children: [
addressListController.model.addressList[index]; Text(
addressListController.model.type = 2; '${addressListController.model.addressList[index]['name']} ' +
Get.toNamed("/editAddressPage"); '${addressListController.model.addressList[index]['tel']} ',
}, style: TextStyle(
child: Container( fontFamily: 'Readex Pro',
width: 100, color: Colors.white,
height: MediaQuery.sizeOf(context).height * 0.03, fontSize: AppFontsize.normal_text_size,
child: Align( letterSpacing: 0,
alignment: AlignmentDirectional(1, 0), ),
child: Text( ),
'编辑', InkWell(
style: TextStyle( onTap: () {
fontFamily: 'Readex Pro', addressListController.model.address =
color: Color(0xFF9EA4B7), addressListController
fontSize: AppFontsize.small_text_size, .model.addressList[index];
letterSpacing: 0, addressListController.model.type = 2;
Get.toNamed("/editAddressPage");
},
child: Container(
width: 100,
height:
MediaQuery.sizeOf(context).height * 0.03,
child: Align(
alignment: AlignmentDirectional(1, 0),
child: Text(
'编辑',
style: TextStyle(
fontFamily: 'Readex Pro',
color: Color(0xFF84F5FF),
fontSize: AppFontsize.small_text_size,
letterSpacing: 0,
),
),
), ),
), ),
), ),
), ],
), ),
), ),
], ],

File diff suppressed because it is too large Load Diff

View File

@@ -84,7 +84,8 @@ class BluetoothPage extends GetView {
highlightColor: const Color(0xFF055466), highlightColor: const Color(0xFF055466),
padding: EdgeInsets.only(left: 0), padding: EdgeInsets.only(left: 0),
onTap: () { onTap: () {
Get.toNamed("/editBedPage"); Get.toNamed("/editBedPage",
arguments: data);
}, },
child: Container( child: Container(
width: 42.rpx, width: 42.rpx,
@@ -135,7 +136,7 @@ class BluetoothPage extends GetView {
context, '人员资料', "/peopleInfoPage", context, '人员资料', "/peopleInfoPage",
arguments: data), arguments: data),
_buildMenuButton( _buildMenuButton(
context, '房间选择', "/roomPickerPage"), context, '房间选择', "/roomPickerPage",arguments: data),
_buildMenuButton(context, '设备校准', ""), _buildMenuButton(context, '设备校准', ""),
_buildMenuButton(context, '体征传感器', ""), _buildMenuButton(context, '体征传感器', ""),
_buildMenuButton(context, 'WIFI配置', ""), _buildMenuButton(context, 'WIFI配置', ""),

View File

@@ -6,6 +6,7 @@ import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appFontsize.dart'; import 'package:vbvs_app/common/color/appFontsize.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart'; import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart';
@@ -115,25 +116,25 @@ class DeviceInfoWidget extends GetView {
letterSpacing: 0, letterSpacing: 0,
height: 1), height: 1),
), ),
TextSpan( // TextSpan(
text: // text:
' (${deviceListController.model.deviceList[index]['status'] ?? ''})', // ' (${deviceListController.model.deviceList[index]['status'] ?? ''})',
style: TextStyle( // style: TextStyle(
fontFamily: 'Readex Pro', // fontFamily: 'Readex Pro',
color: deviceListController // color: deviceListController
.model // .model
.deviceList[ // .deviceList[
index] // index]
['status'] == // ['status'] ==
'在线' // '在线'
? Color( // ? Color(
0xFF07C160) // 在线的颜色 // 0xFF07C160) // 在线的颜色
: Color( // : Color(
0xFFEA7CA7), // 离线的颜色 // 0xFFEA7CA7), // 离线的颜色
fontSize: 26.rpx, // fontSize: 26.rpx,
letterSpacing: 0, // letterSpacing: 0,
), // ),
), // ),
], ],
), ),
maxLines: 1, // 限制显示一行 maxLines: 1, // 限制显示一行
@@ -196,7 +197,7 @@ class DeviceInfoWidget extends GetView {
color: Color(0XFF85F5FF), color: Color(0XFF85F5FF),
textStyle: TextStyle( textStyle: TextStyle(
fontFamily: 'Readex Pro', fontFamily: 'Readex Pro',
color: Colors.white, color: Color(0xFF011D33),
fontSize: 28.rpx, fontSize: 28.rpx,
letterSpacing: 0, letterSpacing: 0,
), ),
@@ -238,11 +239,12 @@ class DeviceInfoWidget extends GetView {
children: [ children: [
InkWell( InkWell(
onTap: () async { onTap: () async {
if (device['type'] == 1) { await Get.toNamed("/deviceSharePage");
globalController.model.deviceMain = device; // if (device['type'] == 1) {
await Get.toNamed("/deviceShare"); // globalController.model.deviceMain = device;
globalController.getDeviceList(); // await Get.toNamed("/deviceSharePage");
} // globalController.getDeviceList();
// }
}, },
child: Container( child: Container(
height: MediaQuery.sizeOf(context).height * 0.1, height: MediaQuery.sizeOf(context).height * 0.1,
@@ -351,11 +353,15 @@ class DeviceInfoWidget extends GetView {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
var a = [device["bindMacA"]]; TopSlideNotification.show(
if ("${device["bindMacB"]}".length > 6) { context,
a.add(device["bindMacB"]); text: "功能开发中...",
} );
Get.toNamed("/sleepWebview", arguments: a); // var a = [device["bindMacA"]];
// if ("${device["bindMacB"]}".length > 6) {
// a.add(device["bindMacB"]);
// }
// Get.toNamed("/sleepWebview", arguments: a);
}, },
child: Container( child: Container(
height: MediaQuery.sizeOf(context).height * 0.1, height: MediaQuery.sizeOf(context).height * 0.1,

View File

@@ -33,108 +33,107 @@ class _DeviceListPageState extends State<DeviceListPage> {
return LayoutBuilder(builder: (context, cc) { return LayoutBuilder(builder: (context, cc) {
bodysize = cc; bodysize = cc;
return GestureDetector( return GestureDetector(
onTap: () => FocusScope.of(context).unfocus(), onTap: () => FocusScope.of(context).unfocus(),
child: Scaffold( child: Container(
resizeToAvoidBottomInset: false, decoration: const BoxDecoration(
appBar: AppBar( image: DecorationImage(
backgroundColor: Colors.transparent, image: AssetImage('assets/images/new_background.png'), // 本地图片
automaticallyImplyLeading: false, fit: BoxFit.fill, // 填满整个 Container
iconTheme: IconThemeData(color: Colors.white),
titleSpacing: 0,
// leading: returnIconButtomAddCallback(() {
// controller.saveDataApi();
// updateParm(isShowToast: false);
// }),
// leading: returnIconButtomNew,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
// 中间居中的标题
Text(
'设备列表',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 30.rpx,
),
),
// 左侧图标
Positioned(
left: 20.rpx,
child: returnIconButtomNew,
),
],
),
), ),
actions: [],
centerTitle: false,
), ),
backgroundColor: Colors.transparent, child: Scaffold(
body: Stack( resizeToAvoidBottomInset: false,
children: [ appBar: AppBar(
Positioned.fill( backgroundColor: Colors.transparent,
child: Image.asset( automaticallyImplyLeading: false,
'assets/images/new_background.png', iconTheme: IconThemeData(color: Colors.white),
fit: BoxFit.fill, titleSpacing: 0,
), // leading: returnIconButtomAddCallback(() {
), // controller.saveDataApi();
Column( // updateParm(isShowToast: false);
mainAxisSize: MainAxisSize.max, // }),
children: [ // leading: returnIconButtomNew,
Padding( title: Container(
padding: EdgeInsetsDirectional.fromSTEB(0, 10, 0, 23), width: double.infinity,
child: SearchWidget( height: 180.rpx,
keyword: controller.model.keyword, child: Stack(
color: controller.model.color, alignment: Alignment.center,
hint: "检索设备", children: [
onChange: (d) { // 中间居中的标题
controller.model.keyword = d; Text(
}, '设备列表',
findCallback: () { textAlign: TextAlign.center,
controller.getDeviceList(); style: TextStyle(
}, color: Colors.white,
), fontSize: 30.rpx,
), ),
Obx(() {
if (controller.model.deviceList == null ||
controller.model.deviceList.isEmpty) {
return Expanded(child: NullDataWidget());
}
// 如果 deviceList 不为空,渲染列表
return Expanded(
child: ListView(
shrinkWrap: true,
scrollDirection: Axis.vertical,
children: controller.model.deviceList
.asMap()
.entries
.map((e) => DeviceInfoWidget(
index: e.key,
deviceListController: controller,
))
.toList()
.divide(const SizedBox(height: 10))
.addToEnd(const SizedBox(height: 100)),
), ),
); // 左侧图标
}), Positioned(
], left: 20.rpx,
child: returnIconButtomNew,
),
],
),
),
actions: [],
centerTitle: false,
), ),
], backgroundColor: Colors.transparent,
) body: Container(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 10, 0, 23),
child: SearchWidget(
keyword: controller.model.keyword,
color: controller.model.color,
hint: "检索设备",
onChange: (d) {
controller.model.keyword = d;
},
findCallback: () {
controller.getDeviceList();
},
),
),
Obx(() {
if (controller.model.deviceList == null ||
controller.model.deviceList.isEmpty) {
return Expanded(child: NullDataWidget());
}
// Container( // 如果 deviceList 不为空,渲染列表
// width: bodysize!.maxWidth, return Expanded(
// height: bodysize!.maxHeight, child: ListView(
shrinkWrap: true,
scrollDirection: Axis.vertical,
children: controller.model.deviceList
.asMap()
.entries
.map((e) => DeviceInfoWidget(
index: e.key,
deviceListController: controller,
))
.toList()
.divide(const SizedBox(height: 10))
.addToEnd(const SizedBox(height: 100)),
),
);
}),
],
),
)
// ), // Container(
), // width: bodysize!.maxWidth,
); // height: bodysize!.maxHeight,
// ),
),
));
}); });
} }
} }

View File

@@ -35,9 +35,6 @@ class DevicePeopleInfo extends GetView<PeopleInfoController> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
WidgetsBinding.instance.addPostFrameCallback((_) {
controller.initData(data['mac']);
});
return LayoutBuilder( return LayoutBuilder(
builder: (context, boxConstraints) => GestureDetector( builder: (context, boxConstraints) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(), onTap: () => FocusScope.of(context).unfocus(),

View File

@@ -434,22 +434,30 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
letterSpacing: 0.0, letterSpacing: 0.0,
), ),
), ),
Radio<int>( Theme(
value: 1, data:
groupValue: controller.model.type, Theme.of(context).copyWith(
onChanged: (value) { unselectedWidgetColor: Color(
controller.model.type = value!; 0xFFC8CBD2), // 改变未选中状态边框颜色
controller.updateAll(); ),
}, child: Radio<int>(
activeColor: value: 1,
const Color(0xFF6BFDAC), groupValue:
materialTapTargetSize: controller.model.type,
MaterialTapTargetSize onChanged: (value) {
.shrinkWrap, // 减少内边距 controller.model.type =
visualDensity: VisualDensity( value!;
horizontal: -4, controller.updateAll();
vertical: -4), // 缩小视觉密度 },
) activeColor:
const Color(0xFF6BFDAC),
materialTapTargetSize:
MaterialTapTargetSize
.shrinkWrap, // 减少内边距
visualDensity: VisualDensity(
horizontal: -4,
vertical: -4), // 缩小视觉密度
))
], ],
), ),
), ),
@@ -485,22 +493,30 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
letterSpacing: 0.0, letterSpacing: 0.0,
), ),
), ),
Radio<int>( Theme(
value: 2, data:
groupValue: controller.model.type, Theme.of(context).copyWith(
onChanged: (value) { unselectedWidgetColor: Color(
controller.model.type = value!; 0xFFC8CBD2), // 改变未选中状态边框颜色
controller.updateAll(); ),
}, child: Radio<int>(
activeColor: value: 2,
const Color(0xFF6BFDAC), groupValue:
materialTapTargetSize: controller.model.type,
MaterialTapTargetSize onChanged: (value) {
.shrinkWrap, // 减少内边距 controller.model.type =
visualDensity: VisualDensity( value!;
horizontal: -4, controller.updateAll();
vertical: -4), // 缩小视觉密度 },
) activeColor:
const Color(0xFF6BFDAC),
materialTapTargetSize:
MaterialTapTargetSize
.shrinkWrap, // 减少内边距
visualDensity: VisualDensity(
horizontal: -4,
vertical: -4), // 缩小视觉密度
))
], ],
), ),
), ),

File diff suppressed because it is too large Load Diff

View File

@@ -188,7 +188,7 @@ class _EditBedPageState extends State<EditBedPage> {
ServiceConstant.service_address; ServiceConstant.service_address;
String serviceName = String serviceName =
ServiceConstant.server_service; ServiceConstant.server_service;
String serviceApi = ServiceConstant.person_info; String serviceApi = ServiceConstant.device_show;
String queryUrl = String queryUrl =
"$serviceAddress$serviceName$serviceApi"; "$serviceAddress$serviceName$serviceApi";
await requestWithLog( await requestWithLog(
@@ -196,10 +196,12 @@ class _EditBedPageState extends State<EditBedPage> {
method: MyHttpMethod.put, method: MyHttpMethod.put,
queryUrl: queryUrl, queryUrl: queryUrl,
data: { data: {
"id": editedData["id"], "id": editedData["_id"],
"name": editedData["name"], "name": editedData["name"],
}, },
onSuccess: (res) {}, onSuccess: (res) {
'更新人员信息成功: $res';
},
); );
}, },
colors: const [ colors: const [

View File

@@ -0,0 +1,105 @@
import 'package:flutter/material.dart';
import 'package:flutter_city_picker/listener/picker_listener.dart';
import 'package:flutter_city_picker/model/address.dart';
import 'package:flutter_city_picker/view/city_picker.dart';
class CityPicker {
/// 展示
static void show({
required BuildContext context,
AnimationController? animController,
double opacity = 0.5,
bool dismissible = true,
double height = 500.0,
double titleHeight = 50.0,
double corner = 20.0,
Color? backgroundColor,
double paddingLeft = 15.0,
Widget? titleWidget,
String? selectText,
Widget? closeWidget,
double tabHeight = 40.0,
bool showTabIndicator = true,
double tabPadding = 10.0,
Color? tabIndicatorColor,
double tabIndicatorHeight = 3.0,
double labelTextSize = 15.0,
Color? selectedLabelColor,
Color? unselectedLabelColor,
double itemHeadHeight = 30.0,
Color? itemHeadBackgroundColor,
Color? itemHeadLineColor,
double itemHeadLineHeight = 0.1,
TextStyle? itemHeadTextStyle,
double itemHeight = 40.0,
double indexBarWidth = 28,
double indexBarItemHeight = 20,
Color indexBarBackgroundColor = Colors.black12,
TextStyle? indexBarTextStyle,
Widget? itemSelectedIconWidget,
TextStyle? itemSelectedTextStyle,
TextStyle? itemUnSelectedTextStyle,
List<AddressNode>? initialAddress,
required CityPickerListener cityPickerListener,
}) {
showGeneralDialog(
context: context,
barrierColor: Colors.black.withOpacity(opacity),
barrierDismissible: dismissible,
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
transitionDuration: const Duration(milliseconds: 300),
pageBuilder: (context, animation, secondaryAnimation) {
return Align(
alignment: Alignment.bottomCenter,
child: Material(
color: Colors.transparent,
child: Container(
width: MediaQuery.of(context).size.width,
height: height,
decoration: BoxDecoration(
color: backgroundColor ?? Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(corner),
topRight: Radius.circular(corner),
),
),
child: CityPickerWidget(
height: height,
titleHeight: titleHeight,
corner: corner,
backgroundColor: backgroundColor,
paddingLeft: paddingLeft,
titleWidget: titleWidget,
selectText: selectText,
closeWidget: closeWidget,
tabHeight: tabHeight,
showTabIndicator: showTabIndicator,
tabPadding: tabPadding,
tabIndicatorColor: tabIndicatorColor,
tabIndicatorHeight: tabIndicatorHeight,
labelTextSize: labelTextSize,
selectedLabelColor: selectedLabelColor,
unselectedLabelColor: unselectedLabelColor,
itemHeadHeight: itemHeadHeight,
itemHeadBackgroundColor: itemHeadBackgroundColor,
itemHeadLineColor: itemHeadLineColor,
itemHeadLineHeight: itemHeadLineHeight,
itemHeadTextStyle: itemHeadTextStyle,
itemHeight: itemHeight,
indexBarWidth: indexBarWidth,
indexBarItemHeight: indexBarItemHeight,
indexBarBackgroundColor: indexBarBackgroundColor,
indexBarTextStyle: indexBarTextStyle,
itemSelectedIconWidget: itemSelectedIconWidget,
itemSelectedTextStyle: itemSelectedTextStyle,
itemUnSelectedTextStyle: itemUnSelectedTextStyle,
initialAddress: initialAddress,
cityPickerListener: cityPickerListener,
),
),
),
);
},
);
}
}

View File

@@ -142,7 +142,7 @@ class _NewHomePageState extends State<NewHomePage> {
}), }),
const Spacer(), // 左右分隔 const Spacer(), // 左右分隔
FloatingSvgIcon( FloatingSvgIcon(
assetPath: 'assets/img/icon/xiaoe.svg', assetPath: 'assets/img/icon/xiaoyi.svg',
width: 60.rpx, width: 60.rpx,
height: 60.rpx, height: 60.rpx,
onTap: () { onTap: () {
@@ -463,7 +463,7 @@ class _NewHomePageState extends State<NewHomePage> {
), ),
fillColor: fillColor:
stringToColor( stringToColor(
"#184468"), "##011D33"),
elevation: 2, elevation: 2,
borderColor: borderColor:
Colors.transparent, Colors.transparent,
@@ -482,6 +482,7 @@ class _NewHomePageState extends State<NewHomePage> {
isMultiSelect: false, isMultiSelect: false,
), ),
), ),
), ),
InkWell( InkWell(
onTap: () { onTap: () {
@@ -559,7 +560,8 @@ class _NewHomePageState extends State<NewHomePage> {
.value .value
.length, (index) { .length, (index) {
var day = homeController var day = homeController
.homeSleepDays[index]; .homeSleepDays[
index];
bool isSelected = bool isSelected =
homeController homeController
.selectedDayIndex .selectedDayIndex
@@ -607,7 +609,7 @@ class _NewHomePageState extends State<NewHomePage> {
BoxDecoration( BoxDecoration(
color: isSelected color: isSelected
? stringToColor( ? stringToColor(
"#184468") "#011D33")
: Colors : Colors
.transparent, .transparent,
borderRadius: borderRadius:

File diff suppressed because it is too large Load Diff

View File

@@ -173,9 +173,7 @@ class DeviceRepairPage extends GetView<RepairListController> {
), ),
], ],
))), ))),
SizedBox(height: 24.rpx), SizedBox(height: 24.rpx),
InkWell( InkWell(
onTap: () { onTap: () {
// bool isOk = true; // bool isOk = true;

View File

@@ -7,16 +7,20 @@ import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart';
class RoomPickerPage extends StatefulWidget { class RoomPickerPage extends StatefulWidget {
final Map data;
RoomPickerPage({Key? key, required this.data});
@override @override
_RoomPickerPageState createState() => _RoomPickerPageState(); _RoomPickerPageState createState() => _RoomPickerPageState();
} }
class _RoomPickerPageState extends State<RoomPickerPage> { class _RoomPickerPageState extends State<RoomPickerPage> {
late Map<String, dynamic> editedData;
RxList rooms = [].obs; RxList rooms = [].obs;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
editedData = Map.from(widget.data); // 创建副本
getRoomList(); getRoomList();
} }
@@ -31,6 +35,7 @@ class _RoomPickerPageState extends State<RoomPickerPage> {
queryUrl: queryUrl, queryUrl: queryUrl,
onSuccess: (res) { onSuccess: (res) {
rooms.assignAll(res.data); rooms.assignAll(res.data);
setState(() => selectedIndex = 0);
}, },
); );
} }
@@ -161,8 +166,32 @@ class _RoomPickerPageState extends State<RoomPickerPage> {
child: CustomCard( child: CustomCard(
borderRadius: 16.rpx, borderRadius: 16.rpx,
gradientDirection: GradientDirection.vertical, gradientDirection: GradientDirection.vertical,
onTap: () { onTap: () async {
// Get.toNamed("/applyRepairPage"); // 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) {
'更新人员信息成功: $res';
},
);
} catch (e) {
print(e);
}
}, },
colors: const [ colors: const [
Color(0xFFFCFCFC), Color(0xFFFCFCFC),

View File

@@ -130,7 +130,7 @@ class SearchWidget extends GetView {
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
SizedBox( SizedBox(
height: 50.rpx, height: 30.rpx,
child: VerticalDivider( child: VerticalDivider(
thickness: 2.rpx, thickness: 2.rpx,
color: stringToColor("#333333"), //固定 color: stringToColor("#333333"), //固定

View File

@@ -83,7 +83,7 @@ class _UpdateUserPageState extends State<EditUserPage> {
), ),
Positioned( Positioned(
left: 0, left: 0,
child: returnIconButtom, child: returnIconButtomNew,
), ),
Positioned( Positioned(
right: 20.rpx, right: 20.rpx,

View File

@@ -591,8 +591,13 @@ class _RxhxMhtState extends State<RxhxMht> {
child: Center( child: Center(
child: Text( child: Text(
weeks[index], weeks[index],
style: const TextStyle( style: TextStyle(
color: Colors.white), color: controller.model
.rxhxWeeks[
index] ==
1
? Color(0XFF003058)
: Colors.white),
), ),
), ),
), ),

View File

@@ -491,6 +491,7 @@ class _ApplyRepairPageState extends State<ApplyRepairPage> {
cursorColor: themeController.currentColor.sc3, cursorColor: themeController.currentColor.sc3,
onChanged: onChanged, onChanged: onChanged,
), ),
), ),
), ),
].divide(SizedBox(width: 24.rpx)), ].divide(SizedBox(width: 24.rpx)),

View File

@@ -68,7 +68,7 @@ var mhroutes = {
"/sleepHabitPage": (context) => SleepHabitPage(), "/sleepHabitPage": (context) => SleepHabitPage(),
'/syms': (context) => Smys(), '/syms': (context) => Smys(),
"/applyRepairPage": (context) => ApplyRepairPage(), "/applyRepairPage": (context) => ApplyRepairPage(),
"/roomPickerPage": (context) => RoomPickerPage(), "/roomPickerPage": (context, {arguments}) => RoomPickerPage(data: arguments),
"/editBedPage": (context, {arguments}) => EditBedPage(data: arguments), "/editBedPage": (context, {arguments}) => EditBedPage(data: arguments),
"/experienceStorePage": (context) => ExperienceStorePage(), "/experienceStorePage": (context) => ExperienceStorePage(),
"/bookInfoPage": (context, {arguments}) => "/bookInfoPage": (context, {arguments}) =>