From f2657e4238ab0e4832447cfb6190bc6c145ae9c9 Mon Sep 17 00:00:00 2001 From: wyf <494641114@qq.com> Date: Wed, 10 Dec 2025 16:59:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=B6=88=E6=81=AF=E5=B0=8F?= =?UTF-8?q?=E7=BA=A2=E7=82=B9=E6=9C=AA=E8=AF=BB=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../message/message_controller.dart | 11 ++-- lib/main.dart | 2 +- lib/pages/main_bottom/home_page.dart | 55 +++++++++++------ .../main_bottom/main_page_bottom_change.dart | 59 ++++++++++--------- lib/pages/main_bottom/mine_page.dart | 2 +- 5 files changed, 75 insertions(+), 54 deletions(-) diff --git a/lib/controller/message/message_controller.dart b/lib/controller/message/message_controller.dart index 9808f85..112a72c 100644 --- a/lib/controller/message/message_controller.dart +++ b/lib/controller/message/message_controller.dart @@ -132,7 +132,7 @@ class MessageController extends GetControllerEx { String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; String? language = ""; - if (AppConstants().ent_type == APPPackageType.MHT.code) { + if (AppConstants().ent_type == APPPackageType.MHT.code) { if (mhLanguageController.selectLanguage != null) { language = mhLanguageController.selectLanguage.value!.language_code; } @@ -203,12 +203,8 @@ class MessageController extends GetControllerEx { // 拼接 URL,添加 type 参数 String queryUrl = "$serviceAddress$serviceName$serviceApi"; - if (type != null && type.isNotEmpty) { - queryUrl += "?type=$type"; - } - String? language = ""; - if (AppConstants().ent_type == APPPackageType.MHT.code) { + if (AppConstants().ent_type == APPPackageType.MHT.code) { if (mhLanguageController.selectLanguage != null) { language = mhLanguageController.selectLanguage.value!.language_code; } @@ -227,7 +223,8 @@ class MessageController extends GetControllerEx { if (type != null) { queryUrl = "$queryUrl&type=$type"; } - queryUrl = "$queryUrl&mid=ALL"; + queryUrl = "$queryUrl&mid=ALL"; + queryUrl = "$queryUrl"; var response = await EasyDartModule.dio.post(queryUrl); if (response != null) { diff --git a/lib/main.dart b/lib/main.dart index f8c5b7b..47f1b0f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -486,7 +486,7 @@ Future startMessagePolling(int ent_type) async { } } - _messageTimer = Timer.periodic(Duration(seconds: 10), (timer) async { + _messageTimer = Timer.periodic(Duration(seconds: 1), (timer) async { try { if (ent_type == APPPackageType.MHT.code) { if (Get.isRegistered()) { diff --git a/lib/pages/main_bottom/home_page.dart b/lib/pages/main_bottom/home_page.dart index a59536e..27a43de 100644 --- a/lib/pages/main_bottom/home_page.dart +++ b/lib/pages/main_bottom/home_page.dart @@ -319,24 +319,45 @@ class _HomePageState extends State { mainAxisAlignment: MainAxisAlignment.end, children: [ - Container( - constraints: BoxConstraints( - maxWidth: - bodySize.maxWidth * - 0.6), - child: Text( - userInfoController.model.user! - .nick_name ?? - '未命名'.tr, - style: TextStyle( - color: themeController - .currentColor.sc3, - fontSize: AppConstants() - .normal_text_fontSize, + ClickableContainer( + backgroundColor: + Colors.transparent, + highlightColor: + Colors.transparent, + padding: EdgeInsets.all(0), + onTap: () async { + int login = userInfoController + .model.login!; + if (login == 1) { + await Get.toNamed( + "/updateUserPage"); + await userInfoController + .getUserInfo(); + userInfoController + .updateAll(); + } else { + Get.toNamed("/loginPage"); + } + }, + child: Container( + constraints: BoxConstraints( + maxWidth: + bodySize.maxWidth * + 0.6), + child: Text( + userInfoController.model + .user!.nick_name ?? + '未命名'.tr, + style: TextStyle( + color: themeController + .currentColor.sc3, + fontSize: AppConstants() + .normal_text_fontSize, + ), + maxLines: 1, + overflow: + TextOverflow.ellipsis, ), - maxLines: 1, - overflow: - TextOverflow.ellipsis, ), ), // Obx(() { diff --git a/lib/pages/main_bottom/main_page_bottom_change.dart b/lib/pages/main_bottom/main_page_bottom_change.dart index 6fc83ec..4b03c8d 100644 --- a/lib/pages/main_bottom/main_page_bottom_change.dart +++ b/lib/pages/main_bottom/main_page_bottom_change.dart @@ -321,8 +321,7 @@ class MainPageBottomChange extends GetView { "assets/img/menu/e.svg", "assets/img/menu/n_e.svg", "菜单.小e".tr), getBottomNavigationBarItem("assets/img/menu/message.svg", "assets/img/menu/n_message.svg", "菜单.消息".tr, - showBadge: (messageController.model.body_message_read == 1 || - messageController.model.system_message_read == 1)), + showBadge: true), getBottomNavigationBarItem("assets/img/menu/mine.svg", "assets/img/menu/n_mine.svg", "菜单.我的".tr), ]; @@ -350,34 +349,38 @@ class MainPageBottomChange extends GetView { if (size == 0) size = 36.rpx; Widget buildIcon(String path) { - return Padding( - padding: EdgeInsets.only(bottom: 6.rpx), - child: isEmpty - ? Container() - : Stack( - clipBehavior: Clip.none, - children: [ - SvgPicture.asset( - path, - width: size, - height: size, - ), - if (showBadge) - Positioned( - right: -20.rpx, - top: -2.rpx, - child: Container( - width: 14.rpx, - height: 14.rpx, - decoration: const BoxDecoration( - color: Colors.red, - shape: BoxShape.circle, + return Obx(() { + int type1 = messageController.model.body_message_read!; + int type2 = messageController.model.system_message_read!; + return Padding( + padding: EdgeInsets.only(bottom: 6.rpx), + child: isEmpty + ? Container() + : Stack( + clipBehavior: Clip.none, + children: [ + SvgPicture.asset( + path, + width: size, + height: size, + ), + if ((type1 == 1 || type2 == 1) && showBadge) + Positioned( + right: -20.rpx, + top: -2.rpx, + child: Container( + width: 14.rpx, + height: 14.rpx, + decoration: const BoxDecoration( + color: Colors.red, + shape: BoxShape.circle, + ), ), ), - ), - ], - ), - ); + ], + ), + ); + }); } return BottomNavigationBarItem( diff --git a/lib/pages/main_bottom/mine_page.dart b/lib/pages/main_bottom/mine_page.dart index fcfbd87..2949197 100644 --- a/lib/pages/main_bottom/mine_page.dart +++ b/lib/pages/main_bottom/mine_page.dart @@ -703,7 +703,7 @@ class _MinePageState extends State { mainAxisSize: MainAxisSize.max, children: [ Text( - 'V1.0.2512.09', + 'V1.0.2512.10', style: TextStyle( fontFamily: 'Inter', // color: Color(0xFFD9E3EB),