更新微信登录

This commit is contained in:
wyf
2025-08-19 18:20:47 +08:00
parent 2cca7c7716
commit 1efe130173
4 changed files with 103 additions and 49 deletions

View File

@@ -545,22 +545,50 @@ class THBindTelWidget extends GetView<AuthBindTelController> {
.button_container_radius, // 统一圆角 .button_container_radius, // 统一圆角
// 保留你原有的业务逻辑不变 // 保留你原有的业务逻辑不变
onTap: () async { onTap: () async {
String msg = await controller.bindTel(); // String msg = await controller.bindTel(context);
if (msg == null || msg.isEmpty) { // if (msg == null || msg.isEmpty) {
MHTLoginController loginController = // MHTLoginController loginController =
Get.find(); // Get.find();
//TODO 微信回调监听操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听 // //TODO 微信回调监听操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
loginController.fluwxCancelable?.cancel(); // loginController.fluwxCancelable?.cancel();
// 登录成功移出网络检查监听 // // 登录成功移出网络检查监听
Checknetwork.subscription?.cancel(); // Checknetwork.subscription?.cancel();
final box = GetStorage(); // final box = GetStorage();
box.remove('countdown'); // box.remove('countdown');
CountdownController countdownController = // CountdownController countdownController =
Get.find(); // Get.find();
countdownController.countdown = 0.obs; // countdownController.countdown = 0.obs;
Get.offAndToNamed("/mianPageBottomChange"); // Get.offAndToNamed("/mianPageBottomChange");
} else { // } else {
TopSlideNotification.show(context,text: msg!,textColor: themeController.currentColor.sc9); // 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 = ApiResponse apiResponse =
await controller.updateUserPhone(); await controller.updateUserPhone();

View File

@@ -155,14 +155,14 @@ class MainPageBottomChange extends GetView<MainPageController> {
), ),
child: Scaffold( child: Scaffold(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
body: arr[controller.model.currentIndex], // body: arr[controller.model.currentIndex],
// body: IndexedStack( body: IndexedStack(
// // ✅ 改成 IndexedStack // ✅ 改成 IndexedStack
// index: controller.model.currentIndex, index: controller.model.currentIndex,
// children: arr children: arr
// .map((page) => SizedBox.expand(child: page)) .map((page) => SizedBox.expand(child: page))
// .toList(), .toList(),
// ), ),
floatingActionButtonAnimator: floatingActionButtonAnimator:
FloatingActionButtonAnimator.noAnimation, FloatingActionButtonAnimator.noAnimation,
floatingActionButtonLocation: floatingActionButtonLocation:

View File

@@ -33,21 +33,21 @@ class AuthBindTelController extends GetControllerEx<AuthBindTelModel> {
attr = GetModel(AuthBindTelModel()).obs; attr = GetModel(AuthBindTelModel()).obs;
} }
bindTel() async { bindTel(BuildContext context) async {
String message = ""; String message = "";
if (model.phone == null || model.phone!.isEmpty) { if (model.phone == null || model.phone!.isEmpty) {
message = "请输入手机号".tr; message = "请输入手机号".tr;
TopSlideNotification.show(Get.context!, text: message); TopSlideNotification.show(context, text: message);
return message; return message;
} }
if (!MyUtils.isValidPhoneNumber(model.phone!)) { if (!MyUtils.isValidPhoneNumber(model.phone!)) {
message = '请输入正确的手机号'.tr; message = '请输入正确的手机号'.tr;
TopSlideNotification.show(Get.context!, text: message); TopSlideNotification.show(context, text: message);
return message; return message;
} }
if (model.code == null || model.code!.isEmpty) { if (model.code == null || model.code!.isEmpty) {
message = "请输入验证码".tr; message = "请输入验证码".tr;
TopSlideNotification.show(Get.context!, text: message); TopSlideNotification.show(context, text: message);
return message; return message;
} }
final Map<String, dynamic> requestBody = { final Map<String, dynamic> requestBody = {
@@ -144,7 +144,7 @@ class AuthBindTelController extends GetControllerEx<AuthBindTelModel> {
Future<ApiResponse> updateUserPhone() async { Future<ApiResponse> updateUserPhone() async {
EasyDartModule.logger.info("更新用户资料"); EasyDartModule.logger.info("更新用户资料");
DailyLogUtils.writeLog("更新用户资料"); DailyLogUtils.writeLog("更新用户资料");
try { try {
ApiResponse apiResponse = ApiResponse(code: -1, msg: "保存失败".tr); ApiResponse apiResponse = ApiResponse(code: -1, msg: "保存失败".tr);
String serviceAddress = ServiceConstant.service_address; String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service; String serviceName = ServiceConstant.server_service;

View File

@@ -428,27 +428,53 @@ class BindTelWidget extends GetView<AuthBindTelController> {
gradientDirection: gradientDirection:
GradientDirection.vertical, GradientDirection.vertical,
onTap: () async { onTap: () async {
String msg = await controller.bindTel(); // String msg = await controller.bindTel(context);
if (msg == null || msg.isEmpty) { // if (msg == null || msg.isEmpty) {
MHTLoginController loginController = // MHTLoginController loginController =
Get.find(); // Get.find();
//TODO 微信回调监听操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听 // //TODO 微信回调监听操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
loginController.fluwxCancelable // loginController.fluwxCancelable
?.cancel(); // ?.cancel();
// 登录成功移出网络检查监听 // // 登录成功移出网络检查监听
Checknetwork.subscription?.cancel(); // Checknetwork.subscription?.cancel();
final box = GetStorage(); // final box = GetStorage();
box.remove('countdown'); // box.remove('countdown');
CountdownController // CountdownController
countdownController = Get.find(); // countdownController = Get.find();
countdownController.countdown = 0.obs; // countdownController.countdown = 0.obs;
Get.offAndToNamed( // Get.offAndToNamed(
"/mianPageBottomChange"); // "/mianPageBottomChange");
} else { // } 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, TopSlideNotification.show(context,
text: msg!, text: message);
textColor: themeController return;
.currentColor.sc9); }
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 = ApiResponse apiResponse =
await controller.updateUserPhone(); await controller.updateUserPhone();