添加 github Oauth ,个人中心

This commit is contained in:
yifeng.yl
2019-05-30 20:04:01 +08:00
parent dbcdbab7d2
commit 617e2953b3
13 changed files with 294 additions and 91 deletions

View File

@ -8,29 +8,38 @@ class DataUtils {
// 登陆获取用户信息
static Future doLogin(Map<String, String> params) async {
var response = await NetUtils.post(Api.DO_LOGIN, params);
print(response);
try {
UserInfo userInfo = UserInfo.fromJson(response['data']);
UserInformation userInfo = UserInformation.fromJson(response['data']);
return userInfo;
} catch (err) {
return response['data'];
return response['message'];
}
}
// 获取用户信息
static Future<UserInfo> getUserInfo(Map<String, String> params) async {
static Future<UserInformation> getUserInfo(Map<String, String> params) async {
var response = await NetUtils.get(Api.GET_USER_INFO, params);
print(response);
UserInfo userInfo = UserInfo.fromJson(response['data']);
return userInfo;
try {
UserInformation userInfo = UserInformation.fromJson(response['data']);
return userInfo;
} catch (err) {
return response['message'];
}
}
// 验证登陆
static Future<bool> checkLogin() async {
static Future checkLogin() async {
var response = await NetUtils.get(Api.CHECK_LOGIN);
print('验证登陆:$response');
return response['success'];
try {
if (response['success']) {
UserInformation userInfo = UserInformation.fromJson(response['data']);
return userInfo;
} else {
return response['success'];
}
} catch (err) {
return response['message'];
}
}
// 退出登陆