Sfoglia il codice sorgente

1、mob短信获取失败提示问题

tags/0.0.3+1^0
PH2 3 anni fa
parent
commit
5e5fd67190
7 ha cambiato i file con 40 aggiunte e 11 eliminazioni
  1. +5
    -2
      lib/pages/login_page/account/bloc/login_account_bloc.dart
  2. +8
    -0
      lib/pages/login_page/account/bloc/login_account_state.dart
  3. +2
    -2
      lib/pages/login_page/account/login_account_page.dart
  4. +5
    -2
      lib/pages/login_page/bind/bloc/login_bind_phone_bloc.dart
  5. +9
    -1
      lib/pages/login_page/bind/bloc/login_bind_phone_state.dart
  6. +2
    -2
      lib/pages/login_page/bind/login_bind_phone_page.dart
  7. +9
    -2
      lib/util/mob_util/mob_util.dart

+ 5
- 2
lib/pages/login_page/account/bloc/login_account_bloc.dart Vedi File

@@ -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<LoginAccountEvent, LoginAccountState> {
LoginAccountRepository repository;
@@ -48,10 +49,12 @@ class LoginAccountBloc extends Bloc<LoginAccountEvent, LoginAccountState> {
/// 获取验证码
Stream<LoginAccountState> _mapGetVcodeEventToState(LoginAccountGetVcodeEvent event) async* {
bool result = await repository.fetchGetVcode(event);
if (result)
if (result) {
Fluttertoast.showToast(msg: '验证码下发成功');
yield LoginAccountGetVcodeSuccessState();
else
} else {
yield LoginAccountGetVcodeErrorState();
}
}

/// 验证码登陆


+ 8
- 0
lib/pages/login_page/account/bloc/login_account_state.dart Vedi File

@@ -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;
}

/// 登陆成功


+ 2
- 2
lib/pages/login_page/account/login_account_page.dart Vedi File

@@ -299,12 +299,12 @@ class _LoginAccountPageContianerState extends State<LoginAccountPageContianer> 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;


+ 5
- 2
lib/pages/login_page/bind/bloc/login_bind_phone_bloc.dart Vedi File

@@ -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<LoginBindPhoneEvent, LoginBindPhoneState> {
LoginBindPhoneRepository repository;
@@ -42,10 +43,12 @@ class LoginBindPhoneBloc extends Bloc<LoginBindPhoneEvent, LoginBindPhoneState>
/// 获取验证码
Stream<LoginBindPhoneState> _mapGetVcodeEventToState(LoginBindPhoneGetVCodeEvent event) async* {
bool result = await repository.fetchGetVcode(event);
if (result)
if (result) {
Fluttertoast.showToast(msg: '验证码下发成功');
yield LoginBindPhoneGetVCodeSuccessState();
else
} else {
yield LoginBindPhoneGetVCodeErrorState();
}
}

/// 验证码登陆


+ 9
- 1
lib/pages/login_page/bind/bloc/login_bind_phone_state.dart Vedi File

@@ -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 {


+ 2
- 2
lib/pages/login_page/bind/login_bind_phone_page.dart Vedi File

@@ -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;


+ 9
- 2
lib/util/mob_util/mob_util.dart Vedi File

@@ -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;


Caricamento…
Annulla
Salva