diff --git a/lib/pages/login_page/account/bloc/login_account_bloc.dart b/lib/pages/login_page/account/bloc/login_account_bloc.dart index 70d3907..3ad8231 100644 --- a/lib/pages/login_page/account/bloc/login_account_bloc.dart +++ b/lib/pages/login_page/account/bloc/login_account_bloc.dart @@ -4,6 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:zhiying_comm/util/empty_util.dart'; import './bloc.dart'; import 'login_account_repository.dart'; +import 'package:fluttertoast/fluttertoast.dart'; class LoginAccountBloc extends Bloc { LoginAccountRepository repository; @@ -48,10 +49,12 @@ class LoginAccountBloc extends Bloc { /// 获取验证码 Stream _mapGetVcodeEventToState(LoginAccountGetVcodeEvent event) async* { bool result = await repository.fetchGetVcode(event); - if (result) + if (result) { + Fluttertoast.showToast(msg: '验证码下发成功'); yield LoginAccountGetVcodeSuccessState(); - else + } else { yield LoginAccountGetVcodeErrorState(); + } } /// 验证码登陆 diff --git a/lib/pages/login_page/account/bloc/login_account_state.dart b/lib/pages/login_page/account/bloc/login_account_state.dart index 0d1ccaf..539e600 100644 --- a/lib/pages/login_page/account/bloc/login_account_state.dart +++ b/lib/pages/login_page/account/bloc/login_account_state.dart @@ -41,6 +41,14 @@ class LoginAccountGetVcodeErrorState extends LoginAccountState { final String msg; const LoginAccountGetVcodeErrorState({this.msg}); + + @override + bool operator ==(Object other) { + return false; + } + + @override + int get hashCode => super.hashCode; } /// 登陆成功 diff --git a/lib/pages/login_page/account/login_account_page.dart b/lib/pages/login_page/account/login_account_page.dart index bd22eef..c2174d9 100644 --- a/lib/pages/login_page/account/login_account_page.dart +++ b/lib/pages/login_page/account/login_account_page.dart @@ -299,12 +299,12 @@ class _LoginAccountPageContianerState extends State i } // 获取验证码成功 if (current is LoginAccountGetVcodeSuccessState) { - Fluttertoast.showToast(msg: '验证码下发成功'); + // Fluttertoast.showToast(msg: '验证码下发成功'); return false; } // 获取验证码失败 if (current is LoginAccountGetVcodeErrorState) { - Fluttertoast.showToast(msg: '验证码获取失败~'); + // Fluttertoast.showToast(msg: '验证码获取失败~'); return false; } return true; diff --git a/lib/pages/login_page/bind/bloc/login_bind_phone_bloc.dart b/lib/pages/login_page/bind/bloc/login_bind_phone_bloc.dart index 6ca0e57..0341e6f 100644 --- a/lib/pages/login_page/bind/bloc/login_bind_phone_bloc.dart +++ b/lib/pages/login_page/bind/bloc/login_bind_phone_bloc.dart @@ -3,6 +3,7 @@ import 'package:bloc/bloc.dart'; import 'package:flutter/cupertino.dart'; import './bloc.dart'; import 'package:zhiying_comm/util/empty_util.dart'; +import 'package:fluttertoast/fluttertoast.dart'; class LoginBindPhoneBloc extends Bloc { LoginBindPhoneRepository repository; @@ -42,10 +43,12 @@ class LoginBindPhoneBloc extends Bloc /// 获取验证码 Stream _mapGetVcodeEventToState(LoginBindPhoneGetVCodeEvent event) async* { bool result = await repository.fetchGetVcode(event); - if (result) + if (result) { + Fluttertoast.showToast(msg: '验证码下发成功'); yield LoginBindPhoneGetVCodeSuccessState(); - else + } else { yield LoginBindPhoneGetVCodeErrorState(); + } } /// 验证码登陆 diff --git a/lib/pages/login_page/bind/bloc/login_bind_phone_state.dart b/lib/pages/login_page/bind/bloc/login_bind_phone_state.dart index 7fb8b91..3ab3d1f 100644 --- a/lib/pages/login_page/bind/bloc/login_bind_phone_state.dart +++ b/lib/pages/login_page/bind/bloc/login_bind_phone_state.dart @@ -30,7 +30,15 @@ class LoginBindPhoneErrorState extends LoginBindPhoneState {} class LoginBindPhoneGetVCodeSuccessState extends LoginBindPhoneState {} /// 验证码下发失败的状态 -class LoginBindPhoneGetVCodeErrorState extends LoginBindPhoneState {} +class LoginBindPhoneGetVCodeErrorState extends LoginBindPhoneState { + @override + bool operator ==(Object other) { + return false; + } + + @override + int get hashCode => super.hashCode; +} /// 登陆成功 class LoginBindPhoneLoginSuccessState extends LoginBindPhoneState { diff --git a/lib/pages/login_page/bind/login_bind_phone_page.dart b/lib/pages/login_page/bind/login_bind_phone_page.dart index 7cd7b38..e47a3d7 100644 --- a/lib/pages/login_page/bind/login_bind_phone_page.dart +++ b/lib/pages/login_page/bind/login_bind_phone_page.dart @@ -242,12 +242,12 @@ class _LoginBindPhonePageContainerState extends State<_LoginBindPhonePageContain } // 获取验证码成功 if (current is LoginBindPhoneGetVCodeSuccessState) { - Fluttertoast.showToast(msg: '验证码下发成功'); + // Fluttertoast.showToast(msg: '验证码下发成功'); return false; } // 获取验证码失败 if (current is LoginBindPhoneGetVCodeErrorState) { - Fluttertoast.showToast(msg: '验证码获取失败~'); + // Fluttertoast.showToast(msg: '验证码获取失败~'); return false; } return true; diff --git a/lib/util/mob_util/mob_util.dart b/lib/util/mob_util/mob_util.dart index d5b15b1..5410e1e 100644 --- a/lib/util/mob_util/mob_util.dart +++ b/lib/util/mob_util/mob_util.dart @@ -10,6 +10,7 @@ import 'package:zhiying_comm/util/log/let_log.dart'; import 'package:zhiying_comm/util/mob_util/secverify/quick_login_util.dart'; import 'package:zhiying_comm/util/net_util.dart'; import 'package:zhiying_comm/util/shared_prefe_util.dart'; +import 'package:fluttertoast/fluttertoast.dart'; /// /// MOB SDK 工具类 @@ -82,11 +83,17 @@ class MobUtil { await Smssdk.getTextCode(phone, zoneCode, vCodeType, (ret, err) { if (err != null) { result = false; - Logger.debug('get vcode fail err = ${err?.toString()}'); + Logger.debug('get vcode fail err = ${err?.toString()}, ret = ${ret?.toString()}' ); + if(!EmptyUtil.isEmpty(err)){ + Fluttertoast.showToast(msg: '获取验证码失败:${err['msg']}'); + }else { + Fluttertoast.showToast(msg: '获取验证码失败~'); + } + } else { String rst = ret.toString(); if (rst == null || rst == "") { - rst = '获取验证码成功! ret = ${ret?.toString()}'; + rst = '获取验证码成功! ret = ${ret?.toString()}, err = ${err?.toString()} '; } Logger.debug(rst); result = true;