Commit ea2c8205a2744ab6c563b2421cbe60268ecaf14e
1 parent
23384a42
feat:更新代码
Showing
7 changed files
with
9 additions
and
7 deletions
lib/login/loginpage/bloc/login_bloc.dart
... | ... | @@ -42,19 +42,19 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> { |
42 | 42 | |
43 | 43 | ///请求登陆 |
44 | 44 | void _requestLoginApi(RequestLoginEvent event, Emitter<LoginState> emitter) async { |
45 | - DioUtil().requestData( | |
45 | + await DioUtil().requestData( | |
46 | 46 | Api.login, |
47 | + method: HttpMethod.post, | |
47 | 48 | data: { |
48 | 49 | 'phoneNum':'17730280759', |
49 | 50 | 'type':_loginType.toString(), |
50 | 51 | 'password':'asd123456'}, |
51 | 52 | successCallBack: (data){ |
52 | - | |
53 | + emitter(LoginResultChangeState(true)); | |
53 | 54 | }, |
54 | 55 | errorCallBack: (error){ |
55 | - | |
56 | + emitter(LoginResultChangeState(false)); | |
56 | 57 | }); |
57 | - // emitter(LoginResultChangeState()); | |
58 | 58 | } |
59 | 59 | |
60 | 60 | ///切换登陆方式 | ... | ... |
lib/login/loginpage/bloc/login_state.dart
lib/modes/response_model.dart renamed to lib/models/response_model.dart
lib/modes/response_model.g.dart renamed to lib/models/response_model.g.dart
lib/modes/test_model.dart renamed to lib/models/test_model.dart
lib/modes/test_model.g.dart renamed to lib/models/test_model.g.dart
lib/network/network_manager.dart
... | ... | @@ -3,9 +3,9 @@ import 'dart:io'; |
3 | 3 | import 'package:dio/dio.dart'; |
4 | 4 | import 'package:flutter/foundation.dart'; |
5 | 5 | import 'package:flutter_easyloading/flutter_easyloading.dart'; |
6 | +import 'package:wow_english/models/response_model.dart'; | |
6 | 7 | import 'package:wow_english/network/basic_configuration.dart'; |
7 | 8 | |
8 | -import '../modes/response_model.dart'; | |
9 | 9 | |
10 | 10 | enum HttpMethod { |
11 | 11 | get, |
... | ... | @@ -37,12 +37,13 @@ class DioUtil { |
37 | 37 | Future<void> requestData<T>( |
38 | 38 | String path, { |
39 | 39 | data, |
40 | - HttpMethod method = HttpMethod.post, | |
40 | + // HttpMethod method = HttpMethod.post, | |
41 | 41 | Map<String, dynamic>? queryParameters, |
42 | 42 | ProgressCallback? onSendProgress, |
43 | 43 | ProgressCallback? onReceiveProgress, |
44 | 44 | required Function successCallBack, |
45 | 45 | required Function errorCallBack, |
46 | + required HttpMethod method, | |
46 | 47 | }) async{ |
47 | 48 | try { |
48 | 49 | Map<String, dynamic> headers = <String, dynamic>{}; | ... | ... |