other_login_provider.dart
1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/models/phone_code_model.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/utils/utils.dart';
/**
* 第三方登陆
*/
class OtherLoginProvider extends ChangeNotifier {
String phone; //手机号码
String code; //验证码
PhoneCodeSunModel phoneCodeSunModel;
/// 给手机发送短信验证码
Future<bool> getPhoneCode(BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
.request<Map<String, dynamic>>(
context, Method.get, HttpUrl.send_vc_code,
data: params, showLoading: false)
.catchError((error) {});
if (baseResp.code == Constant.status_success) {
if (baseResp.data.isEmpty) {
return false;
} else {
//解析解析
phoneCodeSunModel = PhoneCodeModel.fromJson(baseResp.responseData).data;
return true;
}
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
}
}