From 104b39b7c356dcf11b1d5e3c4867797aa486ff86 Mon Sep 17 00:00:00 2001 From: wyf <494641114@qq.com> Date: Sat, 24 May 2025 18:22:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/controller/login/login_controller.dart | 41 ++++++++++++---------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/lib/controller/login/login_controller.dart b/lib/controller/login/login_controller.dart index 9501365..6149967 100644 --- a/lib/controller/login/login_controller.dart +++ b/lib/controller/login/login_controller.dart @@ -184,24 +184,30 @@ class LoginController extends GetControllerEx { 3、对于iOS应用,考虑到iOS应用商店审核指南中的相关规定,建议开发者接入微信登录时,先检测用户手机是否已安装微信客户端 (使用sdk中isWXAppInstalled函数 ),对未安装的用户隐藏微信登录按钮,只提供其他登录方式(比如手机号注册登录、游客登录等) */ - if (isAndroid) { - bool isWeChatInstalled = await fluwx.isWeChatInstalled; - if (!isWeChatInstalled) { - TopSlideNotification.show(context, - text: "微信安装提示".tr, textColor: themeController.currentColor.sc9); - return; + try { + if (isAndroid) { + bool isWeChatInstalled = await fluwx.isWeChatInstalled; + if (!isWeChatInstalled) { + TopSlideNotification.show(context, + text: "微信安装提示".tr, textColor: themeController.currentColor.sc9); + return; + } } + fluwx + .authBy( + which: NormalAuth( + scope: 'snsapi_userinfo', + state: 'wechat_sdk_theh_wxlogin', + )) + .then((data) { + //返回true表示成功或者false表示失败,这边没有意义从login_controller页面构造函数监听中去处理 + debugPrint('msg:$data'); + EasyDartModule.logger.error('msg:$data'); + }); + } catch (e) { + debugPrint('msg:$e'); + EasyDartModule.logger.error('msg:$e'); } - fluwx - .authBy( - which: NormalAuth( - scope: 'snsapi_userinfo', - state: 'wechat_sdk_theh_wxlogin', - )) - .then((data) { - //返回true表示成功或者false表示失败,这边没有意义从login_controller页面构造函数监听中去处理 - debugPrint('msg:$data'); - }); } Future loginByWechatCode(String code) async { @@ -236,8 +242,7 @@ class LoginController extends GetControllerEx { bool isWeChatInstalled = await fluwx.isWeChatInstalled; if (!isWeChatInstalled) { TopSlideNotification.show(context, - text: "微信客服提示".tr, - textColor: themeController.currentColor.sc9); + text: "微信客服提示".tr, textColor: themeController.currentColor.sc9); return; } TopSlideNotification.show(context,