From 092039bc1a55c3ddf853ac39d04f6171e7cb5a4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=BC=80=E5=8F=91=E9=98=9F=E9=95=BF?= Date: Fri, 21 Aug 2026 00:52:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(mobile-next):=20=E6=94=B6=E5=8F=A3=E6=88=91?= =?UTF-8?q?=E7=9A=84=E4=BF=A1=E6=81=AF=E5=8F=AA=E8=AF=BB=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: multica-agent --- .../lib/pages/mine/my_info/my_info_logic.dart | 59 ------------------- .../lib/pages/mine/my_info/my_info_view.dart | 24 +++++--- 2 files changed, 16 insertions(+), 67 deletions(-) diff --git a/mobile-next/lib/pages/mine/my_info/my_info_logic.dart b/mobile-next/lib/pages/mine/my_info/my_info_logic.dart index aea2a2e..f413d2b 100644 --- a/mobile-next/lib/pages/mine/my_info/my_info_logic.dart +++ b/mobile-next/lib/pages/mine/my_info/my_info_logic.dart @@ -1,4 +1,3 @@ -import 'package:flutter_datetime_picker_plus/flutter_datetime_picker_plus.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:get/get.dart'; import 'package:openim/pages/login/login_logic.dart'; @@ -26,8 +25,6 @@ class MyInfoLogic extends GetxController { attr: EditAttr.mobile, ); - void editEmail() => AppNavigator.startEditMyInfo(attr: EditAttr.email, maxLength: 30); - void openPhotoSheet() { IMViews.openPhotoSheet( onData: (path, url) async { @@ -43,62 +40,6 @@ class MyInfoLogic extends GetxController { quality: 15); } - void openDatePicker() { - var appLocale = Get.locale; - var isZh = appLocale!.languageCode.toLowerCase().contains("zh"); - DatePicker.showDatePicker( - Get.context!, - locale: isZh ? LocaleType.zh : LocaleType.en, - maxTime: DateTime.now(), - currentTime: DateTime.fromMillisecondsSinceEpoch(imLogic.userInfo.value.birth ?? 0), - theme: DatePickerTheme( - cancelStyle: Styles.ts_0C1C33_17sp, - doneStyle: Styles.ts_0089FF_17sp, - itemStyle: Styles.ts_0C1C33_17sp, - ), - onConfirm: (dateTime) { - _updateBirthday(dateTime.millisecondsSinceEpoch ~/ 1000); - }, - ); - } - - void selectGender() { - Get.bottomSheet( - BottomSheetView( - items: [ - SheetItem( - label: StrRes.man, - onTap: () => _updateGender(1), - ), - SheetItem( - label: StrRes.woman, - onTap: () => _updateGender(2), - ), - ], - ), - ); - } - - void _updateGender(int gender) { - LoadingView.singleton.wrap( - asyncFunction: () => Apis.updateUserInfo(userID: OpenIM.iMManager.userID, gender: gender) - .then((value) => imLogic.userInfo.update((val) { - val?.gender = gender; - })), - ); - } - - void _updateBirthday(int birthday) { - LoadingView.singleton.wrap( - asyncFunction: () => Apis.updateUserInfo( - userID: OpenIM.iMManager.userID, - birth: birthday * 1000, - ).then((value) => imLogic.userInfo.update((val) { - val?.birth = birthday * 1000; - })), - ); - } - @override void onReady() { _queryMyFullIno(); diff --git a/mobile-next/lib/pages/mine/my_info/my_info_view.dart b/mobile-next/lib/pages/mine/my_info/my_info_view.dart index 315a6a7..b45603e 100644 --- a/mobile-next/lib/pages/mine/my_info/my_info_view.dart +++ b/mobile-next/lib/pages/mine/my_info/my_info_view.dart @@ -42,16 +42,18 @@ class MyInfoPage extends StatelessWidget { ), _buildItemView( label: StrRes.gender, - value: imLogic.userInfo.value.isMale ? StrRes.man : StrRes.woman, - onTap: logic.selectGender, + value: _genderText(imLogic.userInfo.value.gender), + showRightArrow: false, ), _buildItemView( label: StrRes.birthDay, - value: DateUtil.formatDateMs( - imLogic.userInfo.value.birth ?? 0, - format: IMUtils.getTimeFormat1(), - ), - onTap: logic.openDatePicker, + value: imLogic.userInfo.value.birth == null + ? '' + : DateUtil.formatDateMs( + imLogic.userInfo.value.birth!, + format: IMUtils.getTimeFormat1(), + ), + showRightArrow: false, ), ], ), @@ -68,7 +70,7 @@ class MyInfoPage extends StatelessWidget { _buildItemView( label: StrRes.email, value: imLogic.userInfo.value.email, - onTap: logic.editEmail, + showRightArrow: false, ), ], ), @@ -93,6 +95,12 @@ class MyInfoPage extends StatelessWidget { child: Column(children: children), ); + String _genderText(int? gender) { + if (gender == 1) return StrRes.man; + if (gender == 2) return StrRes.woman; + return ''; + } + Widget _buildItemView({ required String label, String? value,