From 1efe13017374a60b6ce93e27dee11aa067f9be8a Mon Sep 17 00:00:00 2001 From: wyf <494641114@qq.com> Date: Tue, 19 Aug 2025 18:20:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BE=AE=E4=BF=A1=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/login/th_bind_tel_page.dart | 60 ++++++++++++----- .../main_bottom/main_page_bottom_change.dart | 16 ++--- .../user/controller/bind_tel_controller.dart | 10 +-- .../mh_page/user/page/bind_tel_page.dart | 66 +++++++++++++------ 4 files changed, 103 insertions(+), 49 deletions(-) diff --git a/lib/pages/login/th_bind_tel_page.dart b/lib/pages/login/th_bind_tel_page.dart index 3742ec9..df45bdd 100644 --- a/lib/pages/login/th_bind_tel_page.dart +++ b/lib/pages/login/th_bind_tel_page.dart @@ -545,22 +545,50 @@ class THBindTelWidget extends GetView { .button_container_radius, // 统一圆角 // 保留你原有的业务逻辑不变 onTap: () async { - String msg = await controller.bindTel(); - if (msg == null || msg.isEmpty) { - MHTLoginController loginController = - Get.find(); - //TODO 微信回调监听操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听 - loginController.fluwxCancelable?.cancel(); - // 登录成功移出网络检查监听 - Checknetwork.subscription?.cancel(); - final box = GetStorage(); - box.remove('countdown'); - CountdownController countdownController = - Get.find(); - countdownController.countdown = 0.obs; - Get.offAndToNamed("/mianPageBottomChange"); - } else { - TopSlideNotification.show(context,text: msg!,textColor: themeController.currentColor.sc9); + // String msg = await controller.bindTel(context); + // if (msg == null || msg.isEmpty) { + // MHTLoginController loginController = + // Get.find(); + // //TODO 微信回调监听操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听 + // loginController.fluwxCancelable?.cancel(); + // // 登录成功移出网络检查监听 + // Checknetwork.subscription?.cancel(); + // final box = GetStorage(); + // box.remove('countdown'); + // CountdownController countdownController = + // Get.find(); + // countdownController.countdown = 0.obs; + // Get.offAndToNamed("/mianPageBottomChange"); + // } else { + // TopSlideNotification.show(context,text: msg!,textColor: themeController.currentColor.sc9); + // } + AuthBindTelController authBindTelController = + Get.find(); + String message = ""; + if (authBindTelController.model.phone == + null || + authBindTelController + .model.phone!.isEmpty) { + message = "请输入手机号".tr; + TopSlideNotification.show(context, + text: message); + return; + } + if (!MyUtils.isValidPhoneNumber( + authBindTelController.model.phone!)) { + message = '请输入正确的手机号'.tr; + TopSlideNotification.show(context, + text: message); + return; + } + if (authBindTelController.model.code == + null || + authBindTelController + .model.code!.isEmpty) { + message = "请输入验证码".tr; + TopSlideNotification.show(context, + text: message); + return; } ApiResponse apiResponse = await controller.updateUserPhone(); diff --git a/lib/pages/main_bottom/main_page_bottom_change.dart b/lib/pages/main_bottom/main_page_bottom_change.dart index 84d7184..2e64a74 100644 --- a/lib/pages/main_bottom/main_page_bottom_change.dart +++ b/lib/pages/main_bottom/main_page_bottom_change.dart @@ -155,14 +155,14 @@ class MainPageBottomChange extends GetView { ), child: Scaffold( backgroundColor: Colors.transparent, - body: arr[controller.model.currentIndex], - // body: IndexedStack( - // // ✅ 改成 IndexedStack - // index: controller.model.currentIndex, - // children: arr - // .map((page) => SizedBox.expand(child: page)) - // .toList(), - // ), + // body: arr[controller.model.currentIndex], + body: IndexedStack( + // ✅ 改成 IndexedStack + index: controller.model.currentIndex, + children: arr + .map((page) => SizedBox.expand(child: page)) + .toList(), + ), floatingActionButtonAnimator: FloatingActionButtonAnimator.noAnimation, floatingActionButtonLocation: diff --git a/lib/pages/mh_page/user/controller/bind_tel_controller.dart b/lib/pages/mh_page/user/controller/bind_tel_controller.dart index 2742c43..46dc3f1 100644 --- a/lib/pages/mh_page/user/controller/bind_tel_controller.dart +++ b/lib/pages/mh_page/user/controller/bind_tel_controller.dart @@ -33,21 +33,21 @@ class AuthBindTelController extends GetControllerEx { attr = GetModel(AuthBindTelModel()).obs; } - bindTel() async { + bindTel(BuildContext context) async { String message = ""; if (model.phone == null || model.phone!.isEmpty) { message = "请输入手机号".tr; - TopSlideNotification.show(Get.context!, text: message); + TopSlideNotification.show(context, text: message); return message; } if (!MyUtils.isValidPhoneNumber(model.phone!)) { message = '请输入正确的手机号'.tr; - TopSlideNotification.show(Get.context!, text: message); + TopSlideNotification.show(context, text: message); return message; } if (model.code == null || model.code!.isEmpty) { message = "请输入验证码".tr; - TopSlideNotification.show(Get.context!, text: message); + TopSlideNotification.show(context, text: message); return message; } final Map requestBody = { @@ -144,7 +144,7 @@ class AuthBindTelController extends GetControllerEx { Future updateUserPhone() async { EasyDartModule.logger.info("更新用户资料"); DailyLogUtils.writeLog("更新用户资料"); - try { + try { ApiResponse apiResponse = ApiResponse(code: -1, msg: "保存失败".tr); String serviceAddress = ServiceConstant.service_address; String serviceName = ServiceConstant.server_service; diff --git a/lib/pages/mh_page/user/page/bind_tel_page.dart b/lib/pages/mh_page/user/page/bind_tel_page.dart index a550f52..f4acd0b 100644 --- a/lib/pages/mh_page/user/page/bind_tel_page.dart +++ b/lib/pages/mh_page/user/page/bind_tel_page.dart @@ -428,27 +428,53 @@ class BindTelWidget extends GetView { gradientDirection: GradientDirection.vertical, onTap: () async { - String msg = await controller.bindTel(); - if (msg == null || msg.isEmpty) { - MHTLoginController loginController = - Get.find(); - //TODO 微信回调监听操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听 - loginController.fluwxCancelable - ?.cancel(); - // 登录成功移出网络检查监听 - Checknetwork.subscription?.cancel(); - final box = GetStorage(); - box.remove('countdown'); - CountdownController - countdownController = Get.find(); - countdownController.countdown = 0.obs; - Get.offAndToNamed( - "/mianPageBottomChange"); - } else { + // String msg = await controller.bindTel(context); + // if (msg == null || msg.isEmpty) { + // MHTLoginController loginController = + // Get.find(); + // //TODO 微信回调监听操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听 + // loginController.fluwxCancelable + // ?.cancel(); + // // 登录成功移出网络检查监听 + // Checknetwork.subscription?.cancel(); + // final box = GetStorage(); + // box.remove('countdown'); + // CountdownController + // countdownController = Get.find(); + // countdownController.countdown = 0.obs; + // Get.offAndToNamed( + // "/mianPageBottomChange"); + // } else { + // TopSlideNotification.show(context, + // text: msg!, + // textColor: themeController + // .currentColor.sc9); + // } + AuthBindTelController + authBindTelController = Get.find(); + String message = ""; + if (authBindTelController.model.phone == + null || + authBindTelController + .model.phone!.isEmpty) { + message = "请输入手机号".tr; TopSlideNotification.show(context, - text: msg!, - textColor: themeController - .currentColor.sc9); + text: message); + return; + } + if (!MyUtils.isValidPhoneNumber( + authBindTelController.model.phone!)) { + message = '请输入正确的手机号'.tr; + TopSlideNotification.show(context, + text: message); + return; + } + if (authBindTelController.model.code == null || + authBindTelController.model.code!.isEmpty) { + message = "请输入验证码".tr; + TopSlideNotification.show(context, + text: message); + return; } ApiResponse apiResponse = await controller.updateUserPhone();