Commit c329aeb3 authored by david's avatar david Committed by 杨秀秀

完成注销功能

parent 05387797
...@@ -374,5 +374,11 @@ interface ApiService { ...@@ -374,5 +374,11 @@ interface ApiService {
@Headers("Content-type:application/json") @Headers("Content-type:application/json")
@POST("app/activity/queryAppActivityList") @POST("app/activity/queryAppActivityList")
fun getActivityList(@Body requestBody: RequestBody): Observable<BaseResponse<List<ActivityCenterBean>>> fun getActivityList(@Body requestBody: RequestBody): Observable<BaseResponse<List<ActivityCenterBean>>>
/**
* 查询活动列表信息
*/
@Headers("Content-type:application/json")
@POST("app/user/closure-with-reason")
fun logoff(@Body requestBody: RequestBody): Observable<BaseResponse<Boolean>>
} }
\ No newline at end of file
package com.xx.hbhconsumer.data.http.requst
import com.xx.hbhconsumer.data.http.BaseRespons
import io.reactivex.rxjava3.core.Observable
import me.goldze.mvvmhabit.http.ApiParams
import me.goldze.mvvmhabit.http.BaseResponse
class LogoffRequest : BaseRespons() {
/**
* 获取验证码
*/
fun logoff(accountClosureMark: String, accountClosureReason: String): Observable<BaseResponse<Boolean>> {
return apiService.logoff(ApiParams<LogoffRequestBody>().setParams(
LogoffRequestBody(
accountClosureMark,
accountClosureReason
)
));
}
/**
* 忘记密码入参
*
*/
class LogoffRequestBody(
var accountClosureMark: String,
var accountClosureReason: String
)
}
\ No newline at end of file
...@@ -25,12 +25,12 @@ public class LogoffFirstStepActivity extends BaseActivity<ActivityLogoffFirstSte ...@@ -25,12 +25,12 @@ public class LogoffFirstStepActivity extends BaseActivity<ActivityLogoffFirstSte
public void initData() { public void initData() {
super.initData(); super.initData();
viewModel.logoffType.observe(this, logoffType -> { viewModel.logoffType.observe(this, logoffType -> {
if (logoffType == 0) { if (logoffType == 1) {
binding.rgSecurityReason.clearCheck(); binding.rgSecurityReason.clearCheck();
binding.rgOther.clearCheck(); binding.rgOther.clearCheck();
binding.rbUnbindPhone.setChecked(true); binding.rbUnbindPhone.setChecked(true);
binding.etOtherReason.setEnabled(false); binding.etOtherReason.setEnabled(false);
} else if (logoffType == 1) { } else if (logoffType == 2) {
binding.rgUnbindPhone.clearCheck(); binding.rgUnbindPhone.clearCheck();
binding.rgOther.clearCheck(); binding.rgOther.clearCheck();
binding.rbSecurityReason.setChecked(true); binding.rbSecurityReason.setChecked(true);
......
...@@ -15,7 +15,7 @@ import me.goldze.mvvmhabit.binding.command.BindingCommand; ...@@ -15,7 +15,7 @@ import me.goldze.mvvmhabit.binding.command.BindingCommand;
public class LogoffFirstStepViewModel extends BaseViewModel<ForgetPwdRequest> { public class LogoffFirstStepViewModel extends BaseViewModel<ForgetPwdRequest> {
public ObservableField<String> otherReason = new ObservableField<>(""); public ObservableField<String> otherReason = new ObservableField<>("");
public MutableLiveData<Integer> logoffType = new MutableLiveData<>(0); public MutableLiveData<Integer> logoffType = new MutableLiveData<>(1);
public LogoffFirstStepViewModel(@NonNull Application application) { public LogoffFirstStepViewModel(@NonNull Application application) {
super(application); super(application);
} }
...@@ -29,7 +29,8 @@ public class LogoffFirstStepViewModel extends BaseViewModel<ForgetPwdRequest> { ...@@ -29,7 +29,8 @@ public class LogoffFirstStepViewModel extends BaseViewModel<ForgetPwdRequest> {
@Override @Override
public void call() { public void call() {
Bundle bundle=new Bundle(); Bundle bundle=new Bundle();
bundle.putString("pageStep", ""); bundle.putString("accountClosureReason",logoffType.toString());
bundle.putString("accountClosureMark", otherReason.get());
startActivity(LogoffSecondStepActivity.class, bundle); startActivity(LogoffSecondStepActivity.class, bundle);
} }
...@@ -40,7 +41,7 @@ public class LogoffFirstStepViewModel extends BaseViewModel<ForgetPwdRequest> { ...@@ -40,7 +41,7 @@ public class LogoffFirstStepViewModel extends BaseViewModel<ForgetPwdRequest> {
public BindingCommand selectUnbindPhone = new BindingCommand(new BindingAction() { public BindingCommand selectUnbindPhone = new BindingCommand(new BindingAction() {
@Override @Override
public void call() { public void call() {
logoffType.postValue(0); logoffType.postValue(1);
} }
}); });
...@@ -48,7 +49,7 @@ public class LogoffFirstStepViewModel extends BaseViewModel<ForgetPwdRequest> { ...@@ -48,7 +49,7 @@ public class LogoffFirstStepViewModel extends BaseViewModel<ForgetPwdRequest> {
public BindingCommand selectSecurityReason = new BindingCommand(new BindingAction() { public BindingCommand selectSecurityReason = new BindingCommand(new BindingAction() {
@Override @Override
public void call() { public void call() {
logoffType.postValue(1); logoffType.postValue(2);
} }
}); });
...@@ -56,7 +57,7 @@ public class LogoffFirstStepViewModel extends BaseViewModel<ForgetPwdRequest> { ...@@ -56,7 +57,7 @@ public class LogoffFirstStepViewModel extends BaseViewModel<ForgetPwdRequest> {
public BindingCommand selectOther = new BindingCommand(new BindingAction() { public BindingCommand selectOther = new BindingCommand(new BindingAction() {
@Override @Override
public void call() { public void call() {
logoffType.postValue(2); logoffType.postValue(3);
} }
}); });
......
...@@ -4,7 +4,7 @@ import android.os.Bundle; ...@@ -4,7 +4,7 @@ import android.os.Bundle;
import com.xx.hbhconsumer.BR; import com.xx.hbhconsumer.BR;
import com.xx.hbhconsumer.R; import com.xx.hbhconsumer.R;
import com.xx.hbhconsumer.data.http.requst.ForgetPwdRequest; import com.xx.hbhconsumer.data.http.requst.LogoffRequest;
import com.xx.hbhconsumer.databinding.ActivityLogoffSecondStepBinding; import com.xx.hbhconsumer.databinding.ActivityLogoffSecondStepBinding;
import me.goldze.mvvmhabit.base.BaseActivity; import me.goldze.mvvmhabit.base.BaseActivity;
...@@ -32,7 +32,9 @@ public class LogoffSecondStepActivity extends BaseActivity<ActivityLogoffSecondS ...@@ -32,7 +32,9 @@ public class LogoffSecondStepActivity extends BaseActivity<ActivityLogoffSecondS
@Override @Override
public LogoffSecondStepViewModel initViewModel() { public LogoffSecondStepViewModel initViewModel() {
ForgetPwdRequest lm = new ForgetPwdRequest(); LogoffRequest lm = new LogoffRequest();
return new LogoffSecondStepViewModel(getApplication(), lm); String accountClosureMark = getIntent().getStringExtra("accountClosureMark");
String accountClosureReason = getIntent().getStringExtra("accountClosureReason");
return new LogoffSecondStepViewModel(getApplication(), lm, accountClosureReason, accountClosureMark);
} }
} }
package com.xx.hbhconsumer.ui.logoff; package com.xx.hbhconsumer.ui.logoff;
import static me.goldze.mvvmhabit.utils.Utils.Interceptor_TOKEN;
import android.app.Application; import android.app.Application;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.xx.hbhconsumer.data.http.requst.ForgetPwdRequest; import com.xx.hbhconsumer.data.http.requst.LogoffRequest;
import com.xx.hbhconsumer.ui.login.LoginActivity;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.functions.Consumer;
import me.goldze.mvvmhabit.base.BaseViewModel; import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction; import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand; import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.http.ApiDisposableObserver;
import me.goldze.mvvmhabit.utils.RxUtils;
import me.goldze.mvvmhabit.utils.ToastUtils;
public class LogoffSecondStepViewModel extends BaseViewModel<ForgetPwdRequest> { public class LogoffSecondStepViewModel extends BaseViewModel<LogoffRequest> {
String accountClosureMark;
String accountClosureReason;
public LogoffSecondStepViewModel(@NonNull Application application) { public LogoffSecondStepViewModel(@NonNull Application application) {
super(application); super(application);
} }
public LogoffSecondStepViewModel(@NonNull Application application, ForgetPwdRequest model) { public LogoffSecondStepViewModel(@NonNull Application application, LogoffRequest model, String accountClosureReason, String accountClosureMark) {
super(application, model); super(application, model);
this.accountClosureReason = accountClosureReason;
this.accountClosureMark = accountClosureMark;
} }
// 触发确认按钮 // 触发确认按钮
...@@ -25,29 +36,29 @@ public class LogoffSecondStepViewModel extends BaseViewModel<ForgetPwdRequest> { ...@@ -25,29 +36,29 @@ public class LogoffSecondStepViewModel extends BaseViewModel<ForgetPwdRequest> {
@Override @Override
public void call() { public void call() {
// model.ForegetPwd(phone.get().toString(), password.get().toString(),code.get().toString()) model.logoff(accountClosureReason, accountClosureReason)
// .compose(RxUtils.schedulersTransformer()) //线程调度 .compose(RxUtils.schedulersTransformer()) //线程调度
//// .compose(RxUtils.exceptionTransformer()) // 网络错误的异常转换, 这里可以换成自己的ExceptionHandle // .compose(RxUtils.exceptionTransformer()) // 网络错误的异常转换, 这里可以换成自己的ExceptionHandle
// .doOnSubscribe(LogoffSecondStepViewModel.this) .doOnSubscribe(LogoffSecondStepViewModel.this)
// .doOnSubscribe(new Consumer<Disposable>() { .doOnSubscribe(new Consumer<Disposable>() {
// @Override @Override
// public void accept(Disposable disposable) throws Exception { public void accept(Disposable disposable) throws Exception {
// showDialog("正在请求...");
// } }
// }).subscribe(new ApiDisposableObserver<String>() { }).subscribe(new ApiDisposableObserver<Boolean>() {
// @Override @Override
// public void onSuccess(String resultBean) { public void onSuccess(Boolean resultBean) {
// //是指token ToastUtils.showShort("注销成功");
// Interceptor_TOKEN = "Bearer " + resultBean; startActivity(LoginActivity.class);
// startActivity(LoginActivity.class); finish();
// } }
//
// @Override @Override
// public void onError(String Error) { public void onError(String Error) {
// dismissDialog(); dismissDialog();
// } }
//
// }); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment