Bläddra i källkod

修改bug 课表刷新,修改个人资料, 学号显示

Ryan8057 3 år sedan
förälder
incheckning
6ea76c1f1c

+ 1 - 0
student/src/main/java/com/cooleshow/student/ui/main/CourseTableFragment.kt

@@ -218,6 +218,7 @@ class CourseTableFragment :
             var maps = CourseHelper.filterDate(datas);
             if (maps != null && maps.isNotEmpty()) {
                 Log.e("asdfasdfasdf", "onGetCourseDateByMonthSuccess: " )
+                mViewBinding.calendarView.clearSchemeDate()
                 mViewBinding.calendarView.addSchemeDate(maps)
             }
         }

+ 1 - 1
student/src/main/java/com/cooleshow/student/ui/main/MineFragment.java

@@ -201,7 +201,7 @@ public class MineFragment extends BaseMVPFragment<FragmentMineLayoutBinding, Min
         }
         GlideUtils.INSTANCE.loadImage(getContext(), data.heardUrl, mViewBinding.ivAvatar, R.drawable.icon_student_default_head);
         mViewBinding.tvNickname.setText(data.username);
-        mViewBinding.tvCardId.setText("学号:" + data.idCardNo);
+        mViewBinding.tvCardId.setText("学号:" + data.userId);
         mViewBinding.tvValidity.setText(data.membershipDays + "");
         mViewBinding.tvFinishedClass.setText(data.finshClassHours + "");
         mViewBinding.tvResidueClass.setText(data.unfinshClassHours + "");

+ 18 - 13
student/src/main/java/com/cooleshow/student/ui/mine/PersonalSettingActivity.java

@@ -96,11 +96,11 @@ public class PersonalSettingActivity extends BaseMVPActivity<ActivityPersonalSet
                 break;
             case R.id.cl_modify_psd:
                 ARouter.getInstance().build(RouterPath.MineCenter.MINE_MODIFY_PASSWORD)
-                        .withString("phoneNum",  UserHelper.getUserPhone())
+                        .withString("phoneNum", UserHelper.getUserPhone())
                         .navigation();
                 break;
             case R.id.cl_certification:
-                if (viewBinding.tvCertificationStatus.getText().equals("未认证")){
+                if (viewBinding.tvCertificationStatus.getText().equals("未认证")) {
                     ARouter.getInstance().build(RouterPath.MineCenter.MINE_PERSONAL_CERTIFICATION)
                             .navigation(this, PERSONAL_CERTIFICATION);
                 }
@@ -349,7 +349,7 @@ public class PersonalSettingActivity extends BaseMVPActivity<ActivityPersonalSet
     @Override
     protected void onResume() {
         super.onResume();
-        Log.e("afkjhkadsfas", "onResume: ===============" );
+        Log.e("afkjhkadsfas", "onResume: ===============");
         presenter.queryUserInfo();
     }
 
@@ -376,14 +376,14 @@ public class PersonalSettingActivity extends BaseMVPActivity<ActivityPersonalSet
             viewBinding.tvSex.setText("男");
         }
         viewBinding.tvPhone.setText(data.phone);
-        if (!TextUtils.isEmpty(data.birthdate)){
+        if (!TextUtils.isEmpty(data.birthdate)) {
             if (data.birthdate.contains(" ")) {
                 String[] s = data.birthdate.split(" ");
                 viewBinding.tvBirthday.setText(s[0]);
             } else {
                 viewBinding.tvBirthday.setText(data.birthdate);
             }
-        }else {
+        } else {
             viewBinding.tvBirthday.setText("");
         }
 
@@ -405,7 +405,7 @@ public class PersonalSettingActivity extends BaseMVPActivity<ActivityPersonalSet
 
     @Override
     public void submitSetDetailSuccess(SetDetailBean setDetailBean) {
-       /* mySetDetailBean.gender = setDetailBean.gender + "";
+        mySetDetailBean.gender = setDetailBean.gender + "";
         mySetDetailBean.heardUrl = setDetailBean.avatar;
         if (setDetailBean.gender == 0) {
             //女
@@ -415,14 +415,19 @@ public class PersonalSettingActivity extends BaseMVPActivity<ActivityPersonalSet
             viewBinding.tvSex.setText("男");
         }
         //15510601008
-        if (setDetailBean.birthdate.contains(" ")) {
-            String[] s = setDetailBean.birthdate.split(" ");
-            viewBinding.tvBirthday.setText(s[0]);
-        } else {
-            viewBinding.tvBirthday.setText(setDetailBean.birthdate);
-        }*/
+        if (!TextUtils.isEmpty(setDetailBean.birthdate)) {
+            if (setDetailBean.birthdate.contains(" ")) {
+                String[] s = setDetailBean.birthdate.split(" ");
+                viewBinding.tvBirthday.setText(s[0]);
+            } else {
+                viewBinding.tvBirthday.setText(setDetailBean.birthdate);
+            }
+            mySetDetailBean.birthdate=setDetailBean.birthdate;
+        }else{
+            viewBinding.tvBirthday.setText("");
+        }
         ToastUtils.showShort("修改成功");
-//        GlideUtils.INSTANCE.loadImage(this, setDetailBean.avatar, viewBinding.imHeader, R.drawable.icon_student_default_head);
+        GlideUtils.INSTANCE.loadImage(this, setDetailBean.avatar, viewBinding.imHeader, R.drawable.icon_student_default_head);
 
 
     }

+ 1 - 0
student/src/main/res/layout/fragment_course_table_layout.xml

@@ -11,6 +11,7 @@
         android:layout_width="match_parent"
         android:layout_height="20dp"
         app:layout_constrainedHeight="true"
+        android:background="@color/white"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
 

+ 1 - 0
teacher/src/main/java/com/cooleshow/teacher/ui/main/CourseTableFragment.kt

@@ -205,6 +205,7 @@ class CourseTableFragment :
             //更新日历表,显示有课字样
             var maps = CourseHelper.filterDate(datas);
             if (maps != null && maps.isNotEmpty()) {
+                mViewBinding.calendarView.clearSchemeDate()
                 mViewBinding.calendarView.addSchemeDate(maps)
             }
         }

+ 1 - 0
teacher/src/main/res/layout/fragment_course_table_layout.xml

@@ -10,6 +10,7 @@
         android:id="@+id/view_status_bar"
         android:layout_width="match_parent"
         android:layout_height="20dp"
+        android:background="@color/white"
         app:layout_constrainedHeight="true"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintTop_toTopOf="parent" />

+ 8 - 0
usercenter/src/main/java/com/cooleshow/usercenter/presenter/BindPasswordPresenter.java

@@ -1,7 +1,10 @@
 package com.cooleshow.usercenter.presenter;
 
+import com.cooleshow.base.data.net.ApiException;
 import com.cooleshow.base.presenter.BasePresenter;
 import com.cooleshow.base.rx.BaseObserver;
+import com.cooleshow.base.utils.ErrorParse;
+import com.cooleshow.base.utils.ToastUtils;
 import com.cooleshow.usercenter.data.api.UserApi;
 import com.cooleshow.usercenter.presenter.contract.BindPasswordContract;
 
@@ -27,6 +30,11 @@ public class BindPasswordPresenter extends BasePresenter<BindPasswordContract.Bi
             @Override
             public void onError(Throwable e) {
                 super.onError(e);
+                if (e instanceof ApiException) {
+                    ErrorParse.getInstance().parseError(e);
+                    ApiException apiException = (ApiException) e;
+                    ToastUtils.showShort(apiException.getErrmsg());
+                }
             }
         });
     }

+ 11 - 0
usercenter/src/main/java/com/cooleshow/usercenter/presenter/LoginPresenter.kt

@@ -1,8 +1,11 @@
 package com.cooleshow.usercenter.presenter
 
 import com.cooleshow.base.constanst.Constants
+import com.cooleshow.base.data.net.ApiException
 import com.cooleshow.base.presenter.BasePresenter
 import com.cooleshow.base.rx.BaseObserver
+import com.cooleshow.base.utils.ErrorParse
+import com.cooleshow.base.utils.ToastUtils
 import com.cooleshow.usercenter.bean.UserLoginInfo
 import com.cooleshow.usercenter.data.api.UserApi
 import com.cooleshow.usercenter.presenter.contract.LoginContract
@@ -28,6 +31,14 @@ class LoginPresenter constructor() : BasePresenter<LoginContract.LoginView>(),
                         view.onLoginResult(data)
                     }
                 }
+
+                override fun onError(e: Throwable) {
+                    super.onError(e)
+                    if (e is ApiException) {
+                        ErrorParse.getInstance().parseError(e)
+                        ToastUtils.showShort(e.errmsg)
+                    }
+                }
             })
     }
 

+ 23 - 0
usercenter/src/main/java/com/cooleshow/usercenter/presenter/VerifyLoginPresenter.java

@@ -2,8 +2,11 @@ package com.cooleshow.usercenter.presenter;
 
 import com.cooleshow.base.common.BaseApplication;
 import com.cooleshow.base.constanst.Constants;
+import com.cooleshow.base.data.net.ApiException;
 import com.cooleshow.base.presenter.BasePresenter;
 import com.cooleshow.base.rx.BaseObserver;
+import com.cooleshow.base.utils.ErrorParse;
+import com.cooleshow.base.utils.ToastUtils;
 import com.cooleshow.usercenter.bean.UserLoginInfo;
 import com.cooleshow.usercenter.constants.UserConstants;
 import com.cooleshow.usercenter.data.api.UserApi;
@@ -48,6 +51,11 @@ public class VerifyLoginPresenter extends BasePresenter<VerifyLoginContract.Veri
             @Override
             public void onError(Throwable e) {
                 super.onError(e);
+                if (e instanceof ApiException) {
+                    ErrorParse.getInstance().parseError(e);
+                    ApiException apiException = (ApiException) e;
+                    ToastUtils.showShort(apiException.getErrmsg());
+                }
                 if (getView() != null) {
                     getView().sendVerifyCodeFail();
                 }
@@ -72,6 +80,11 @@ public class VerifyLoginPresenter extends BasePresenter<VerifyLoginContract.Veri
             @Override
             public void onError(Throwable e) {
                 super.onError(e);
+                if (e instanceof ApiException) {
+                    ErrorParse.getInstance().parseError(e);
+                    ApiException apiException = (ApiException) e;
+                    ToastUtils.showShort(apiException.getErrmsg());
+                }
                 if (getView() != null) {
                     getView().sendVerifyCodeFail();
                 }
@@ -107,6 +120,16 @@ public class VerifyLoginPresenter extends BasePresenter<VerifyLoginContract.Veri
                     getView().loginByCodeSuccess(data);
                 }
             }
+
+            @Override
+            public void onError(Throwable e) {
+                super.onError(e);
+                if (e instanceof ApiException) {
+                    ErrorParse.getInstance().parseError(e);
+                    ApiException apiException = (ApiException) e;
+                    ToastUtils.showShort(apiException.getErrmsg());
+                }
+            }
         });
     }
 }

+ 4 - 0
usercenter/src/main/java/com/cooleshow/usercenter/ui/activity/LoginActivity.kt

@@ -62,6 +62,10 @@ class LoginActivity : BaseMVPActivity<ActivityLoginBinding, LoginPresenter>(),
                 ToastUtils.showShort("密码不可为空")
                 return@setOnClickListener;
             }
+            if (!viewBinding.cbPrivacy.isChecked) {
+                ToastUtils.showShort("请勾选用户协议")
+                return@setOnClickListener
+            }
             presenter?.onLoginByPwd(et_phone_num?.text.toString(), et_password?.text.toString());
         }
     }