From 63608b5dca9eebb6fa2cb1a8652b395f1d910c3e Mon Sep 17 00:00:00 2001
From: 张钢 <floatgang@163.com>
Date: 星期一, 02 九月 2024 13:52:17 +0800
Subject: [PATCH] 对新接口进行了适配

---
 app/src/main/java/com/application/zhangshi_app_android/ui/login/LoginActivityViewModel.java |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/app/src/main/java/com/application/zhangshi_app_android/ui/login/LoginActivityViewModel.java b/app/src/main/java/com/application/zhangshi_app_android/ui/login/LoginActivityViewModel.java
index 74b66c9..d3f5e2e 100644
--- a/app/src/main/java/com/application/zhangshi_app_android/ui/login/LoginActivityViewModel.java
+++ b/app/src/main/java/com/application/zhangshi_app_android/ui/login/LoginActivityViewModel.java
@@ -4,6 +4,7 @@
 
 import android.app.Application;
 import android.text.TextUtils;
+import android.util.Log;
 
 import androidx.annotation.NonNull;
 import androidx.lifecycle.MutableLiveData;
@@ -38,6 +39,7 @@
     private MutableLiveData<String> againPassword = new MutableLiveData<>();
     private MutableLiveData<Boolean> passwordVisibility = new MutableLiveData<>();
     private MutableLiveData<Boolean> againPasswordVisibility = new MutableLiveData<>();
+    private MutableLiveData<String> selectLoginBackgroundLiveData = new MutableLiveData<>();//鑳屾櫙鍥�
 
     private MutableLiveData<String> value = new MutableLiveData<>();
     public LoginActivityViewModel(@NonNull Application application) {
@@ -92,7 +94,7 @@
             return;
         }
         if (captchaImageLiveData.getValue() != null){
-            model.login(new LoginRequestBean(username.getValue(),password.getValue(),captchaImageLiveData.getValue().getValue(),captchaImageLiveData.getValue().getUuid()))
+            model.login(new LoginRequestBean(username.getValue(),password.getValue(),value.getValue(),captchaImageLiveData.getValue().getUuid()))
                     .compose(RxUtils.schedulersTransformer())
                     .subscribe(new Observer<ResultData<LoginResponseBean>>() {
                         @Override
@@ -105,8 +107,9 @@
                             if (loginResponseBeanResultData.getCode() == CODE_SUCCESS){
                                 String token = loginResponseBeanResultData.getData().getToken();
                                 UserManager.getInstance().setToken(token);
-                                ToastUtils.showShort("鐧婚檰鎴愬姛");
                                 AppManager.getAppManager().startActivity(MainActivity.class);
+                                AppManager.getAppManager().finishCurrentActivity();
+                                ToastUtils.showShort("鐧婚檰鎴愬姛");
                             }else {
                                 changeStateView(StateViewEnum.DATA_ERROR);
                                 messageLiveData.postValue(loginResponseBeanResultData.getMsg());
@@ -226,4 +229,12 @@
     public void setValue(MutableLiveData<String> value) {
         this.value = value;
     }
+
+    public MutableLiveData<String> getSelectLoginBackgroundLiveData() {
+        return selectLoginBackgroundLiveData;
+    }
+
+    public void setSelectLoginBackgroundLiveData(MutableLiveData<String> selectLoginBackgroundLiveData) {
+        this.selectLoginBackgroundLiveData = selectLoginBackgroundLiveData;
+    }
 }

--
Gitblit v1.9.1