|
|
@ -14,6 +14,7 @@ import androidx.fragment.app.Fragment; |
|
|
|
|
|
|
|
|
|
|
|
import com.blankj.utilcode.util.EncryptUtils; |
|
|
|
import com.blankj.utilcode.util.EncryptUtils; |
|
|
|
import com.blankj.utilcode.util.ToastUtils; |
|
|
|
import com.blankj.utilcode.util.ToastUtils; |
|
|
|
|
|
|
|
import com.example.yideng.loaddialoglibrary.LmiotDialog; |
|
|
|
import com.hjq.http.EasyConfig; |
|
|
|
import com.hjq.http.EasyConfig; |
|
|
|
import com.hjq.http.EasyHttp; |
|
|
|
import com.hjq.http.EasyHttp; |
|
|
|
import com.hjq.http.listener.OnHttpListener; |
|
|
|
import com.hjq.http.listener.OnHttpListener; |
|
|
@ -126,6 +127,7 @@ public class LoginAccountFragment extends Fragment implements View.OnClickListen |
|
|
|
|
|
|
|
|
|
|
|
//手机号登录
|
|
|
|
//手机号登录
|
|
|
|
public void AccountLogin(String mobile, String password) { |
|
|
|
public void AccountLogin(String mobile, String password) { |
|
|
|
|
|
|
|
LmiotDialog.show(getActivity(), "登录中.."); |
|
|
|
EasyHttp.post(getActivity()) |
|
|
|
EasyHttp.post(getActivity()) |
|
|
|
.api(new AccountLoginApi(mobile, password)) |
|
|
|
.api(new AccountLoginApi(mobile, password)) |
|
|
|
.request(new OnHttpListener<HttpData<ApiResponse<TokenBean>>>() { |
|
|
|
.request(new OnHttpListener<HttpData<ApiResponse<TokenBean>>>() { |
|
|
@ -152,6 +154,7 @@ public class LoginAccountFragment extends Fragment implements View.OnClickListen |
|
|
|
tokenBean.getPreRegion().getPkey() |
|
|
|
tokenBean.getPreRegion().getPkey() |
|
|
|
); |
|
|
|
); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
LmiotDialog.hidden(); |
|
|
|
// CacheUtil.setToken(null);
|
|
|
|
// CacheUtil.setToken(null);
|
|
|
|
new XPopup.Builder(getActivity()).isRequestFocus(true) |
|
|
|
new XPopup.Builder(getActivity()).isRequestFocus(true) |
|
|
|
.asCustom(new TipDialog(getActivity(), "请先前往手机app进行实名认证,认证成功后才可登录", new TipDialog.DialogClick() { |
|
|
|
.asCustom(new TipDialog(getActivity(), "请先前往手机app进行实名认证,认证成功后才可登录", new TipDialog.DialogClick() { |
|
|
@ -167,9 +170,11 @@ public class LoginAccountFragment extends Fragment implements View.OnClickListen |
|
|
|
})).show(); |
|
|
|
})).show(); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
LmiotDialog.hidden(); |
|
|
|
ToastUtils.showLong(apiResponseHttpData.getData().getMessage()); |
|
|
|
ToastUtils.showLong(apiResponseHttpData.getData().getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
LmiotDialog.hidden(); |
|
|
|
ToastUtils.showLong(apiResponseHttpData.getMessage()); |
|
|
|
ToastUtils.showLong(apiResponseHttpData.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -177,6 +182,7 @@ public class LoginAccountFragment extends Fragment implements View.OnClickListen |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onFail(Exception e) { |
|
|
|
public void onFail(Exception e) { |
|
|
|
|
|
|
|
LmiotDialog.hidden(); |
|
|
|
ToastUtils.showLong("登录失败"); |
|
|
|
ToastUtils.showLong("登录失败"); |
|
|
|
LogUtils.e("失败:" + e); |
|
|
|
LogUtils.e("失败:" + e); |
|
|
|
} |
|
|
|
} |
|
|
@ -189,6 +195,7 @@ public class LoginAccountFragment extends Fragment implements View.OnClickListen |
|
|
|
.request(new OnHttpListener<HttpData<ApiResponse<AreaLoginApi>>>() { |
|
|
|
.request(new OnHttpListener<HttpData<ApiResponse<AreaLoginApi>>>() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onSucceed(HttpData<ApiResponse<AreaLoginApi>> personInfoBeanHttpData) { |
|
|
|
public void onSucceed(HttpData<ApiResponse<AreaLoginApi>> personInfoBeanHttpData) { |
|
|
|
|
|
|
|
LmiotDialog.hidden(); |
|
|
|
if (personInfoBeanHttpData.isRequestSucceed()) { |
|
|
|
if (personInfoBeanHttpData.isRequestSucceed()) { |
|
|
|
if (personInfoBeanHttpData.getData().getCode() == 200) { |
|
|
|
if (personInfoBeanHttpData.getData().getCode() == 200) { |
|
|
|
CacheUtil.saveUserToken(personInfoBeanHttpData.getData().getData().getUserToken()); |
|
|
|
CacheUtil.saveUserToken(personInfoBeanHttpData.getData().getData().getUserToken()); |
|
|
@ -206,6 +213,7 @@ public class LoginAccountFragment extends Fragment implements View.OnClickListen |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onFail(Exception e) { |
|
|
|
public void onFail(Exception e) { |
|
|
|
|
|
|
|
LmiotDialog.hidden(); |
|
|
|
ToastUtils.showLong("登录失败"); |
|
|
|
ToastUtils.showLong("登录失败"); |
|
|
|
LogUtils.e("失败:" + e); |
|
|
|
LogUtils.e("失败:" + e); |
|
|
|
} |
|
|
|
} |
|
|
|