diff --git a/lib/pages/login_page/account/login_account_page.dart b/lib/pages/login_page/account/login_account_page.dart index 4ff4c8e..7765b14 100644 --- a/lib/pages/login_page/account/login_account_page.dart +++ b/lib/pages/login_page/account/login_account_page.dart @@ -106,6 +106,7 @@ class _LoginAccountPageContianerState extends State i setState(() { _useVcode = !_useVcode; + _canSubmit = false; }); // 清除缓存 if (_useVcode) { diff --git a/lib/util/net_util.dart b/lib/util/net_util.dart index a0bf7f2..cfd40ca 100644 --- a/lib/util/net_util.dart +++ b/lib/util/net_util.dart @@ -94,7 +94,7 @@ class NetUtil { } /// 同步请求 - static Future post(String path, {Map params, Map queryParameters, NetMethod method = NetMethod.POST, bool cache = false}) async { + static Future post(String path, {Map params, Map queryParameters, NetMethod method = NetMethod.POST, bool cache = false, bool showToast = true}) async { if (params == null) { params = {}; } @@ -131,12 +131,18 @@ class NetUtil { // 缓存返回的数据 } else { Logger.error('error: ' + result[GlobalConfig.HTTP_RESPONSE_KEY_MSG]); - if (result[GlobalConfig.HTTP_RESPONSE_KEY_CODE] != 401000) { - Fluttertoast.showToast( - msg: result[GlobalConfig.HTTP_RESPONSE_KEY_MSG], - toastLength: Toast.LENGTH_SHORT, - gravity: ToastGravity.BOTTOM, - ); + /// + /// 401000 验证用户失败(不提示Toast) + /// 404004 没有找到对应模块(跳空页面,不提示toast) + /// + if (result[GlobalConfig.HTTP_RESPONSE_KEY_CODE] != 401000 && result[GlobalConfig.HTTP_RESPONSE_KEY_CODE] != 404004) { + if(showToast) { + Fluttertoast.showToast( + msg: result[GlobalConfig.HTTP_RESPONSE_KEY_MSG], + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.BOTTOM, + ); + } } // 退出登陆 @@ -159,7 +165,7 @@ class NetUtil { } /// 异步请求 - static void request(String path, {NetMethod method = NetMethod.GET, Map params,Map queryParameters, OnSuccess onSuccess, OnError onError, OnCache onCache}) async { + static void request(String path, {NetMethod method = NetMethod.GET, Map params,Map queryParameters, OnSuccess onSuccess, OnError onError, OnCache onCache, bool showToast = true}) async { if (params == null) { params = {}; } @@ -172,7 +178,7 @@ class NetUtil { } try { - Map result = await NetUtil.post(path, method: method, params: params, queryParameters: queryParameters); + Map result = await NetUtil.post(path, method: method, params: params, queryParameters: queryParameters, showToast: showToast); // TODO 解密? if (isSuccess(result)) { if (onSuccess != null) {