diff --git a/assets/langs/en_US.json b/assets/langs/en_US.json index 1bb942e..f8b5804 100644 --- a/assets/langs/en_US.json +++ b/assets/langs/en_US.json @@ -571,7 +571,7 @@ "输入关键词": "Enter keywords", "输入国家、省份或城市": "Enter country, province, or city", "手机号码": "Phone number", - "邮箱": "email", + "邮箱": "Email", "微信": "WeChat", "更换": "Change", "换绑": "Rebind", @@ -608,5 +608,9 @@ "离床时长": "Bed Exit Duration", "已关闭": "Disabled", "时": " h", - "允许对方配置wifi": "Allow other to configure WiFi" + "允许对方配置wifi": "Allow other to configure WiFi", + "去绑定": "Go Bind", + "解除分享": "Unshare", + "详情": "Detail", + "更新成功": "Update Success" } \ No newline at end of file diff --git a/assets/langs/zh_CN.json b/assets/langs/zh_CN.json index 2ecd875..d170ae9 100644 --- a/assets/langs/zh_CN.json +++ b/assets/langs/zh_CN.json @@ -608,5 +608,8 @@ "离床时长": "离床时长", "已关闭": "已关闭", "时": "时", - "允许对方配置wifi": "允许对方配置wifi" + "允许对方配置wifi": "允许对方配置wifi", + "去绑定": "去绑定", + "解除分享": "解除分享", + "详情": "详情" } \ No newline at end of file diff --git a/assets/langs/zh_TW.json b/assets/langs/zh_TW.json index c24619e..52eaf3a 100644 --- a/assets/langs/zh_TW.json +++ b/assets/langs/zh_TW.json @@ -604,5 +604,9 @@ "离床时长": "離床時長", "已关闭": "已關閉", "时": "時", - "允许对方配置wifi": "允許對方設定wifi" + "允许对方配置wifi": "允許對方設定wifi", + "去绑定": "去綁定", + "解除分享": "解除分享", + "详情": "詳情", + "更新成功": "更新成功" } \ No newline at end of file diff --git a/lib/component/home_page/DynamicReportDetailWidget.dart b/lib/component/home_page/DynamicReportDetailWidget.dart index 1389d4f..65c089d 100644 --- a/lib/component/home_page/DynamicReportDetailWidget.dart +++ b/lib/component/home_page/DynamicReportDetailWidget.dart @@ -159,7 +159,7 @@ class _DynamicReportDetailWidgetState extends State { fontFamily: 'Inter', fontSize: 26.rpx, letterSpacing: 0.0, - color: themeController.currentColor.sc3, + color: themeController.currentColor.sc2, ), ), Padding( diff --git a/lib/controller/user_info_controller.dart b/lib/controller/user_info_controller.dart index 6babac7..5bca888 100644 --- a/lib/controller/user_info_controller.dart +++ b/lib/controller/user_info_controller.dart @@ -146,7 +146,12 @@ class UserInfoController extends GetControllerEx { LoginController loginController = Get.find(); ApiResponse apiResponse = ApiResponse(code: -1, msg: "保存失败".tr); UserModel user = model.user!; - if (user.tmpNickName == null || user.tmpNickName!.isEmpty) { + final bool hasContactUpdate = (phone != null && phone.isNotEmpty) || + (email != null && email.isNotEmpty); + + /// 只有在【没有更新 phone/email】时,才要求昵称不为空 + if (!hasContactUpdate && + (user.tmpNickName == null || user.tmpNickName!.isEmpty)) { apiResponse.msg = "昵称为空".tr; return apiResponse; } diff --git a/lib/main.dart b/lib/main.dart index 06c004c..f8c5b7b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -143,8 +143,8 @@ void initServiceAddress() { ServiceConstant.baseHost = "zhmht.swes.com.cn:27020"; } else if (AppConstants().ent_type == APPPackageType.TH.code) { // 太和 - // ServiceConstant.baseHost = "vsbst-api.he-info.com"; - ServiceConstant.baseHost = "vsbs-test.he-info.cn"; + ServiceConstant.baseHost = "vsbst-api.he-info.com"; + // ServiceConstant.baseHost = "vsbs-test.he-info.cn"; } else { //默认 ServiceConstant.baseHost = "vsbst-api.he-info.com"; diff --git a/lib/pages/common/selectDialog.dart b/lib/pages/common/selectDialog.dart index d580e8f..9ecc882 100644 --- a/lib/pages/common/selectDialog.dart +++ b/lib/pages/common/selectDialog.dart @@ -56,66 +56,6 @@ getOnePicker(BuildContext context, List arr, int checkIndex, ); } -// Widget getOnePickers( -// BuildContext context, -// List arr, -// RxInt selectedIndex, { -// String unit = '', -// bool looping = false, -// void Function(int)? onChanged, -// bool isMonthName = false, -// Key? pickerKey, -// }) { -// ThemeController themeController = Get.find(); -// final bool isEn = Get.locale?.languageCode.startsWith('en') ?? false; - -// return Obx(() { -// final dynamicKey = ValueKey('picker_${arr.length}_${selectedIndex.value}'); -// return CupertinoPicker.builder( -// key: pickerKey ?? dynamicKey, -// itemExtent: 90.rpx, -// useMagnifier: false, -// magnification: 1, -// diameterRatio: 1.3, -// squeeze: 1, -// scrollController: -// FixedExtentScrollController(initialItem: selectedIndex.value), -// selectionOverlay: Container(), -// onSelectedItemChanged: (int index) { -// selectedIndex.value = index; -// if (onChanged != null) onChanged(index); -// }, -// childCount: arr.length, -// itemBuilder: (context, index) { -// bool isSelected = index == selectedIndex.value; - -// // 处理显示文本 -// String displayText; -// if (isMonthName && isEn && arr[index] is int) { -// displayText = DateFormat.MMMM('en').format(DateTime(0, arr[index])); -// } else { -// // displayText = isEn ? "${arr[index]}" : "${arr[index]}$unit"; // 中文附带单位 -// displayText = "${arr[index]}$unit"; // 中文附带单位 -// } - -// return Center( -// child: Text( -// displayText, -// style: TextStyle( -// fontFamily: 'Readex Pro', -// color: isSelected -// ? themeController.currentColor.sc3 -// : const Color(0xFF9AA0B3), -// fontSize: 30.rpx, -// fontWeight: FontWeight.normal, -// ), -// ), -// ); -// }, -// ); -// }); -// } - Widget getOnePickers( BuildContext context, List arr, @@ -125,6 +65,66 @@ Widget getOnePickers( void Function(int)? onChanged, bool isMonthName = false, Key? pickerKey, +}) { + ThemeController themeController = Get.find(); + final bool isEn = Get.locale?.languageCode.startsWith('en') ?? false; + + return Obx(() { + final dynamicKey = ValueKey('picker_${arr.length}_${selectedIndex.value}'); + return CupertinoPicker.builder( + key: pickerKey ?? dynamicKey, + itemExtent: 90.rpx, + useMagnifier: false, + magnification: 1, + diameterRatio: 1.3, + squeeze: 1, + scrollController: + FixedExtentScrollController(initialItem: selectedIndex.value), + selectionOverlay: Container(), + onSelectedItemChanged: (int index) { + selectedIndex.value = index; + if (onChanged != null) onChanged(index); + }, + childCount: arr.length, + itemBuilder: (context, index) { + bool isSelected = index == selectedIndex.value; + + // 处理显示文本 + String displayText; + if (isMonthName && isEn && arr[index] is int) { + displayText = DateFormat.MMMM('en').format(DateTime(0, arr[index])); + } else { + // displayText = isEn ? "${arr[index]}" : "${arr[index]}$unit"; // 中文附带单位 + displayText = "${arr[index]}$unit"; // 中文附带单位 + } + + return Center( + child: Text( + displayText, + style: TextStyle( + fontFamily: 'Readex Pro', + color: isSelected + ? themeController.currentColor.sc3 + : const Color(0xFF9AA0B3), + fontSize: 30.rpx, + fontWeight: FontWeight.normal, + ), + ), + ); + }, + ); + }); +} + +Widget getOnePickersSpe( + BuildContext context, + List arr, + RxInt selectedIndex, { + String unit = '', + bool looping = false, + void Function(int)? onChanged, + bool isMonthName = false, + Key? pickerKey, /// ⭐ 新增:可选的自定义显示,但不影响旧用法 String Function(dynamic value)? customDisplay, diff --git a/lib/pages/device_bind/THShareDeviceDetailWidget.dart b/lib/pages/device_bind/THShareDeviceDetailWidget.dart index 3ff9c00..b50e6ff 100644 --- a/lib/pages/device_bind/THShareDeviceDetailWidget.dart +++ b/lib/pages/device_bind/THShareDeviceDetailWidget.dart @@ -207,6 +207,7 @@ class THShareDeviceDetailWidget extends GetView { return; } await _updateDeviceInfo(context); + Get.back(); }, child: Container( width: MediaQuery.sizeOf(context).width, @@ -341,10 +342,10 @@ class THShareDeviceDetailWidget extends GetView { ), // 解除分享按钮 Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0, - 0, + padding: EdgeInsetsDirectional.fromSTEB( + 100.rpx, 0, + 100.rpx, AppConstants.page_button_bottom_padding, ), child: Container( @@ -352,12 +353,13 @@ class THShareDeviceDetailWidget extends GetView { height: MediaQuery.sizeOf(context).height * 0.056, constraints: const BoxConstraints(minHeight: 46), decoration: BoxDecoration( - color: - FlutterFlowTheme.of(context).secondaryBackground, + color: Colors.transparent, borderRadius: BorderRadius.circular(16.rpx), ), child: CustomCard( - borderRadius: 16.rpx, + // borderRadius: 16.rpx, + borderRadius: + AppConstants().button_container_radius, // 圆角半径 gradientDirection: GradientDirection.vertical, onTap: () async { if (uid != null) { @@ -402,12 +404,8 @@ class THShareDeviceDetailWidget extends GetView { }, onCancel: () {}); } }, - colors: const [ - Color(0xFFFCFCFC), - Color(0xFFF8FAF9), - Color(0XFFECF6F3), - Color(0XFFD9F0E9), - Color(0xFFCEECE3) + colors: [ + themeController.currentColor.sc9, ], child: Container( width: double.infinity, @@ -419,7 +417,7 @@ class THShareDeviceDetailWidget extends GetView { child: Text( "解除分享".tr, style: TextStyle( - color: const Color(0xFF003058), + color: themeController.currentColor.sc3, fontSize: 30.rpx, ), ), @@ -440,6 +438,7 @@ class THShareDeviceDetailWidget extends GetView { // 构建数据项列表(k:v格式) List _buildDataItems() { List widgets = []; + bool isFirst = true; // 标记第一个有效元素 for (var item in dataList) { // 只显示包含k和v的项 @@ -450,7 +449,7 @@ class THShareDeviceDetailWidget extends GetView { String key = item['k'].toString(); String value = item['v'].toString(); - // 跳过opType相关的显示,因为我们在下面单独处理了 + // 跳过 opType if (key.toLowerCase().contains('optype')) { continue; } @@ -462,13 +461,17 @@ class THShareDeviceDetailWidget extends GetView { '$key: $value', style: TextStyle( fontFamily: 'Readex Pro', - color: key == '名称' ? Color(0xFFFFFFFF) : Color(0xFF9EA4B7), - fontSize: key == '名称' ? 28.rpx : 20.rpx, + color: + isFirst ? const Color(0xFFFFFFFF) : const Color(0xFF9EA4B7), + fontSize: isFirst ? 28.rpx : 20.rpx, letterSpacing: 0.0, ), ), ), ); + + // 第一个有效元素处理完后,标记为 false + isFirst = false; } } diff --git a/lib/pages/device_bind/componnet/bind_dialog.dart b/lib/pages/device_bind/componnet/bind_dialog.dart index ff84e82..4ad5aeb 100644 --- a/lib/pages/device_bind/componnet/bind_dialog.dart +++ b/lib/pages/device_bind/componnet/bind_dialog.dart @@ -1787,7 +1787,8 @@ Future showMessageConfirmDialog({ enableBorder: true, borderColor: themeController.currentColor.sc4, gradientDirection: GradientDirection.vertical, - borderRadius: 16.rpx, + // borderRadius: 16.rpx, + borderRadius: AppConstants().button_container_radius, onTap: () { Get.back(result: 'cancel'); }, @@ -1798,12 +1799,13 @@ Future showMessageConfirmDialog({ alignment: Alignment.center, child: Text( '取消'.tr, - style: TextStyle(fontSize: 26.rpx, color: Colors.black), + style: TextStyle(fontSize: 26.rpx, color: Colors.white), ), ), ), CustomCard( - borderRadius: 16.rpx, + // borderRadius: 16.rpx, + borderRadius: AppConstants().button_container_radius, onTap: () { Get.back(result: 'confirm'); }, diff --git a/lib/pages/device_bind/device_share_page.dart b/lib/pages/device_bind/device_share_page.dart index cafb8fe..0f55a0a 100644 --- a/lib/pages/device_bind/device_share_page.dart +++ b/lib/pages/device_bind/device_share_page.dart @@ -216,8 +216,7 @@ class _DeviceSharePageState extends State { height: 33.rpx * 0.6, - color: const Color( - 0xFF6BFDAC), + color: themeController.currentColor.sc2, ), ), ) diff --git a/lib/pages/main_bottom/mine_page.dart b/lib/pages/main_bottom/mine_page.dart index 1ab8b12..fcfbd87 100644 --- a/lib/pages/main_bottom/mine_page.dart +++ b/lib/pages/main_bottom/mine_page.dart @@ -187,8 +187,21 @@ class _MinePageState extends State { Text( limitText( login == 1 - ? userInfoController - .model.user?.nick_name + ? (userInfoController + .model + .user + ?.nick_name == + null || + userInfoController + .model + .user + ?.nick_name == + "" + ? '未命名'.tr + : userInfoController + .model + .user + ?.nick_name) : '未命名'.tr, AppConstants() .text_length, // 这里设置最大长度,按你需求改,比如 6~10 字符 @@ -259,7 +272,7 @@ class _MinePageState extends State { style: TextStyle( fontFamily: 'Inter', color: themeController - .currentColor.sc3, + .currentColor.sc2, fontSize: AppConstants() .normal_text_fontSize, letterSpacing: 0.0, @@ -690,7 +703,7 @@ class _MinePageState extends State { mainAxisSize: MainAxisSize.max, children: [ Text( - 'V1.0.2512.08', + 'V1.0.2512.09', style: TextStyle( fontFamily: 'Inter', // color: Color(0xFFD9E3EB), diff --git a/lib/pages/person/select_time.dart b/lib/pages/person/select_time.dart index 1382e75..03b42ed 100644 --- a/lib/pages/person/select_time.dart +++ b/lib/pages/person/select_time.dart @@ -564,7 +564,6 @@ Future showHeightPickerDialog( // int tempIndex = selectedIndex; final RxInt tempIndex = RxInt(selectedIndex); // ✅ 改为 RxInt ThemeController themeController = Get.find(); - await showDialog( context: context, barrierDismissible: true, @@ -1134,11 +1133,10 @@ Future showIntervalPickerDialog( ), SizedBox( height: 240.rpx, - child: getOnePickers( + child: getOnePickersSpe( context, values, tempIndex, - /// → 替换显示文本(核心) customDisplay: (val) => formatValue(val), ), diff --git a/lib/pages/user/setting_page.dart b/lib/pages/user/setting_page.dart index af6388f..b5c2760 100644 --- a/lib/pages/user/setting_page.dart +++ b/lib/pages/user/setting_page.dart @@ -225,7 +225,8 @@ class _SettingPageState extends State { .language_name!, style: TextStyle( fontFamily: 'Inter', - color: Color(0xFFD9E3EB), + color: themeController + .currentColor.sc2, fontSize: 26.rpx, letterSpacing: 0.0, ), @@ -609,7 +610,7 @@ class _SettingPageState extends State { ), Padding( padding: EdgeInsetsDirectional.fromSTEB( - 0.rpx, 50.rpx, 0.rpx, 100.rpx), + 0.rpx, 100.rpx, 0.rpx, 100.rpx), child: ClickableContainer( borderRadius: AppConstants().button_container_radius, // 圆角半径 @@ -656,7 +657,7 @@ class _SettingPageState extends State { ), ), ].divide(SizedBox( - height: 17.rpx, + height: 4.rpx, ))), ), ), diff --git a/lib/pages/user/update_user_email.dart b/lib/pages/user/update_user_email.dart index a46f572..6ac66d6 100644 --- a/lib/pages/user/update_user_email.dart +++ b/lib/pages/user/update_user_email.dart @@ -116,8 +116,10 @@ class _UpdateUserEmailPageState extends State { userInfoController.model.user!.tmpNickName = null; loginController.model.updatePhone = null; await userInfoController.getUserInfo(); - userInfoController.model.user!.tmpNickName = userInfoController.model.user!.nick_name; - userInfoController.model.user!.tmpHead = userInfoController.model.user!.avatar; + userInfoController.model.user!.tmpNickName = + userInfoController.model.user!.nick_name; + userInfoController.model.user!.tmpHead = + userInfoController.model.user!.avatar; userInfoController.updateAll(); Get.back(); } @@ -177,7 +179,7 @@ class _UpdateUserEmailPageState extends State { padding: EdgeInsetsDirectional.fromSTEB( 60.rpx, 0, 35.rpx, 0), child: Text( - "原邮箱号" + ":" + "${getHideEmail()}", + "原邮箱号".tr + ":" + "${getHideEmail()}", style: TextStyle( color: themeController.currentColor.sc3, fontSize: AppConstants().normal_text_fontSize, @@ -199,7 +201,7 @@ class _UpdateUserEmailPageState extends State { alignment: AlignmentDirectional(-1, 0), child: Padding( padding: EdgeInsetsDirectional.fromSTEB( - 0, 0.rpx, 0, 20.rpx), + 0, 20.rpx, 0, 20.rpx), child: Container( width: double.infinity, height: bodySize.maxHeight * 0.056, @@ -354,7 +356,7 @@ class _UpdateUserEmailPageState extends State { alignment: AlignmentDirectional(-1, 0), child: Padding( padding: EdgeInsetsDirectional.fromSTEB( - 0, 0.rpx, 0, 0), + 0, 0.rpx, 0, 20.rpx), child: Container( height: bodySize.maxHeight * 0.056, width: double.infinity, diff --git a/lib/pages/user/update_user_page.dart b/lib/pages/user/update_user_page.dart index b693816..beefec7 100644 --- a/lib/pages/user/update_user_page.dart +++ b/lib/pages/user/update_user_page.dart @@ -418,7 +418,9 @@ class _UpdateUserPageState extends State { letterSpacing: 0.0, ), ), - ].divide(SizedBox(width: 22.rpx)), + SizedBox(width: 22.rpx), + getNowInfoByType('phone'), + ], ), Row( mainAxisSize: MainAxisSize.max, @@ -427,9 +429,8 @@ class _UpdateUserPageState extends State { getTextByUserInfo('phone'), style: TextStyle( fontFamily: 'Inter', - // color: Color(0xFFD9E3EB), - color: themeController - .currentColor.sc2, + color: getColorByUserInfo( + 'phone'), fontSize: 26.rpx, letterSpacing: 0.0, ), @@ -485,7 +486,9 @@ class _UpdateUserPageState extends State { letterSpacing: 0.0, ), ), - ].divide(SizedBox(width: 22.rpx)), + SizedBox(width: 22.rpx), + getNowInfoByType('email'), + ], ), Row( mainAxisSize: MainAxisSize.max, @@ -495,8 +498,8 @@ class _UpdateUserPageState extends State { style: TextStyle( fontFamily: 'Inter', // color: Color(0xFFD9E3EB), - color: themeController - .currentColor.sc2, + color: getColorByUserInfo( + 'email'), fontSize: 26.rpx, letterSpacing: 0.0, ), @@ -589,13 +592,8 @@ class _UpdateUserPageState extends State { style: TextStyle( fontFamily: 'Inter', // color: Color(0xFFD9E3EB), - color: getTextByUserInfo( - 'wechat') == - "解绑".tr - ? themeController - .currentColor.sc4 - : themeController - .currentColor.sc2, + color: getColorByUserInfo( + 'wechat'), fontSize: 26.rpx, letterSpacing: 0.0, ), @@ -621,7 +619,6 @@ class _UpdateUserPageState extends State { ), ), ), - ], ), ), @@ -669,25 +666,95 @@ class _UpdateUserPageState extends State { } if (type == "phone") { if (userInfo.phone == null || userInfo.phone!.isEmpty) { - return "更换".tr; + return "去绑定".tr; } else { return "换绑".tr; } } if (type == "email") { if (userInfo.email == null || userInfo.email!.isEmpty) { - return "绑定".tr; + return "去绑定".tr; } else { return "换绑".tr; } } if (type == "wechat") { if (userInfo.bindWx == null || userInfo.bindWx == false) { - return "绑定".tr; + return "去绑定".tr; } else { return "解绑".tr; } } return ""; } + + Color getColorByUserInfo(String type) { + final text = getTextByUserInfo(type); + // 去绑定 = 未绑定 + return text == "去绑定".tr + ? themeController.currentColor.sc4 + : themeController.currentColor.sc2; + } + + getNowInfoByType(String type) { + UserInfoController userInfoController = Get.find(); + UserModel userInfo = userInfoController.model.user!; + if (type == "phone") { + if (userInfo.phone == null || userInfo.phone!.isEmpty) { + return Text( + "(" + "暂未绑定".tr + ")", + style: TextStyle( + color: themeController.currentColor.sc4, + fontSize: AppConstants().normal_text_fontSize, + ), + ); + } else { + return Text( + "(" + "${getHidePhone()}" + ")", + style: TextStyle( + color: themeController.currentColor.sc4, + fontSize: AppConstants().normal_text_fontSize, + ), + ); + } + } + if (type == "email") { + if (userInfo.email == null || userInfo.email!.isEmpty) { + return Text( + "(" + "暂未绑定".tr + ")", + style: TextStyle( + color: themeController.currentColor.sc4, + fontSize: AppConstants().normal_text_fontSize, + ), + ); + } else { + return Text( + "(" + "${getHideEmail()}" + ")", + style: TextStyle( + color: themeController.currentColor.sc4, + fontSize: AppConstants().normal_text_fontSize, + ), + ); + } + } + + return Container(); + } + + getHidePhone() { + UserModel userModel = userInfoController.model.user!; + if (userModel.phone == null || userModel.phone == "") { + return "暂无".tr; + } + return "${userModel.phone!.substring(0, 3)}****${userModel.phone!.substring(7, 11)}"; + } + + getHideEmail() { + UserModel userModel = userInfoController.model.user!; + if (userModel.email == null || userModel.email == "") { + return "暂无".tr; + } + return userModel.email! + .replaceRange(3, userModel.email!.length - 3, "****"); + } }