Explorar o código

增加老师端我的课程页面

Pq %!s(int64=3) %!d(string=hai) anos
pai
achega
24199144da
Modificáronse 41 ficheiros con 810 adicións e 118 borrados
  1. 3 3
      BaseLibrary/build.gradle
  2. 8 24
      BaseLibrary/src/main/java/com/cooleshow/base/router/RouterPath.kt
  3. 20 0
      BaseLibrary/src/main/java/com/cooleshow/base/ui/activity/BaseActivity.kt
  4. 0 0
      BaseLibrary/src/main/res/drawable-xhdpi/icon_back_black.png
  5. 0 0
      BaseLibrary/src/main/res/drawable-xxhdpi/icon_back_black.png
  6. 2 1
      BaseLibrary/src/main/res/layout/common_toolbar_layout.xml
  7. 3 0
      teacher/src/main/AndroidManifest.xml
  8. 35 0
      teacher/src/main/java/com/cooleshow/teacher/adapter/MineCoursePageAdapter.java
  9. 45 4
      teacher/src/main/java/com/cooleshow/teacher/adapter/SparringCourseListAdapter.java
  10. 20 1
      teacher/src/main/java/com/cooleshow/teacher/api/APIService.java
  11. 94 0
      teacher/src/main/java/com/cooleshow/teacher/bean/SparringCourseListBean.java
  12. 18 0
      teacher/src/main/java/com/cooleshow/teacher/constants/CourseFilterConstants.java
  13. 3 2
      teacher/src/main/java/com/cooleshow/teacher/contract/HomeContract.java
  14. 4 2
      teacher/src/main/java/com/cooleshow/teacher/contract/SparringCourseContract.java
  15. 1 1
      teacher/src/main/java/com/cooleshow/teacher/presenter/course/MineCoursePresenter.java
  16. 41 2
      teacher/src/main/java/com/cooleshow/teacher/presenter/course/SparringCoursePresenter.java
  17. 27 0
      teacher/src/main/java/com/cooleshow/teacher/presenter/main/HomePresenter.java
  18. 126 0
      teacher/src/main/java/com/cooleshow/teacher/ui/course/LiveCourseFragment.java
  19. 61 0
      teacher/src/main/java/com/cooleshow/teacher/ui/course/MineCourseActivity.java
  20. 106 6
      teacher/src/main/java/com/cooleshow/teacher/ui/course/SparringCourseFragment.java
  21. 1 2
      teacher/src/main/java/com/cooleshow/teacher/ui/main/CourseTableFragment.kt
  22. 17 0
      teacher/src/main/java/com/cooleshow/teacher/ui/main/HomeFragment.kt
  23. 4 2
      teacher/src/main/res/layout/activity_mine_course_layout.xml
  24. 8 0
      teacher/src/main/res/layout/fragment_home_layout.xml
  25. 18 5
      teacher/src/main/res/layout/fragment_sparring_course_layout.xml
  26. 52 22
      usercenter/src/main/java/com/cooleshow/usercenter/bean/UserInfo.java
  27. 31 0
      usercenter/src/main/java/com/cooleshow/usercenter/bean/UserLoginInfo.java
  28. 3 3
      usercenter/src/main/java/com/cooleshow/usercenter/data/api/UserApi.kt
  29. 0 2
      usercenter/src/main/java/com/cooleshow/usercenter/data/respository/UserRepository.kt
  30. 43 2
      usercenter/src/main/java/com/cooleshow/usercenter/helper/UserHelper.java
  31. 0 6
      usercenter/src/main/java/com/cooleshow/usercenter/presenter/BindPasswordPresenter.java
  32. 3 4
      usercenter/src/main/java/com/cooleshow/usercenter/presenter/LoginPresenter.kt
  33. 3 4
      usercenter/src/main/java/com/cooleshow/usercenter/presenter/VerifyLoginPresenter.java
  34. 0 1
      usercenter/src/main/java/com/cooleshow/usercenter/presenter/contract/BindPasswordContract.java
  35. 2 2
      usercenter/src/main/java/com/cooleshow/usercenter/presenter/contract/LoginContract.java
  36. 2 2
      usercenter/src/main/java/com/cooleshow/usercenter/presenter/contract/VerifyLoginContract.java
  37. 2 2
      usercenter/src/main/java/com/cooleshow/usercenter/service/UserService.kt
  38. 0 4
      usercenter/src/main/java/com/cooleshow/usercenter/ui/activity/BindPasswordActivity.java
  39. 2 2
      usercenter/src/main/java/com/cooleshow/usercenter/ui/activity/LoginActivity.kt
  40. 2 3
      usercenter/src/main/java/com/cooleshow/usercenter/ui/activity/VerifyCodeInputActivity.java
  41. 0 4
      usercenter/src/main/java/com/cooleshow/usercenter/ui/activity/VerifyCodeLoginActivity.java

+ 3 - 3
BaseLibrary/build.gradle

@@ -121,7 +121,7 @@ dependencies {
     api 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.7'
     api 'com.contrarywind:Android-PickerView:4.1.9'
 
-    implementation  'io.github.scwang90:refresh-layout-kernel:2.0.5'      //核心必须依赖
-    implementation  'io.github.scwang90:refresh-header-classics:2.0.5'    //经典刷新头
-    implementation  'io.github.scwang90:refresh-footer-classics:2.0.5'    //经典加载
+    api  'io.github.scwang90:refresh-layout-kernel:2.0.5'      //核心必须依赖
+    api  'io.github.scwang90:refresh-header-classics:2.0.5'    //经典刷新头
+    api  'io.github.scwang90:refresh-footer-classics:2.0.5'    //经典加载
 }

+ 8 - 24
BaseLibrary/src/main/java/com/cooleshow/base/router/RouterPath.kt

@@ -3,10 +3,10 @@ package com.cooleshow.base.router
 /*
     模块路由 路径定义
  */
-object RouterPath{
+object RouterPath {
 
     //主页面
-    class APPCenter{
+    class APPCenter {
         companion object {
             const val PATH_HOME = "/appCenter/home"
 
@@ -14,7 +14,7 @@ object RouterPath{
     }
 
     //用户模块
-    class UserCenter{
+    class UserCenter {
         companion object {
             const val PATH_LOGIN = "/userCenter/login"
             const val PATH_VERIFY_LOGIN = "/userCenter/verifyLogin"
@@ -24,33 +24,17 @@ object RouterPath{
     }
 
     //用户模块
-    class WebCenter{
+    class WebCenter {
         companion object {
-            const val ACTIVITY_HTML = "ui/activity/web/HtmlActivity"
+            const val ACTIVITY_HTML = "/ui/activity/web/HtmlActivity"
         }
     }
 
-
-
-    //订单模块
-    class OrderCenter{
-        companion object {
-            const val PATH_ORDER_CONFIRM = "/orderCenter/confirm"
-        }
-    }
-
-    //支付模块
-    class PaySDK{
+    //用户模块
+    class CourseCenter {
         companion object {
-            const val PATH_PAY = "/paySDK/pay"
+            const val TEACHER_MINE_COURSE = "/teacher/ui/course/MineCourseActivity"
         }
     }
 
-    //消息模块
-    class MessageCenter{
-        companion object {
-            const val PATH_MESSAGE_PUSH = "/messageCenter/push"
-            const val PATH_MESSAGE_ORDER = "/messageCenter/order"
-        }
-    }
 }

+ 20 - 0
BaseLibrary/src/main/java/com/cooleshow/base/ui/activity/BaseActivity.kt

@@ -1,7 +1,13 @@
 package com.cooleshow.base.ui.activity
 
+import android.graphics.Color
 import android.os.Bundle
+import android.view.View
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.appcompat.widget.Toolbar
 import androidx.viewbinding.ViewBinding
+import com.cooleshow.base.R
 import com.cooleshow.base.common.AppManager
 import com.cooleshow.base.presenter.view.BaseView
 import com.cooleshow.base.utils.ToastUtils
@@ -42,6 +48,20 @@ abstract class BaseActivity<V : ViewBinding> : RxAppCompatActivity(), BaseView {
         mLoading?.hideLoading()
     }
 
+    fun initMidTitleToolBar(toolbar: Toolbar?, title: String?) {
+        if (toolbar == null) return
+        val tv_title: TextView = toolbar.findViewById<TextView>(R.id.title)
+        toolbar.findViewById<View>(R.id.iv_back)
+            .setOnClickListener(View.OnClickListener { onBackPressed() })
+        toolbar.title = ""
+        (toolbar.findViewById(R.id.iv_back) as ImageView).setImageResource(R.drawable.icon_back_black)
+        tv_title.setTextColor(resources.getColor(R.color.common_black))
+        tv_title.text = title
+        setSupportActionBar(toolbar)
+        supportActionBar!!.setDisplayHomeAsUpEnabled(false)
+        supportActionBar!!.setDisplayShowHomeEnabled(false)
+    }
+
     override fun onError(throwable: Throwable) {
         ToastUtils.showShort("onError:${throwable.message}")
     }

+ 0 - 0
usercenter/src/main/res/drawable-xhdpi/icon_back_black.png → BaseLibrary/src/main/res/drawable-xhdpi/icon_back_black.png


+ 0 - 0
usercenter/src/main/res/drawable-xxhdpi/icon_back_black.png → BaseLibrary/src/main/res/drawable-xxhdpi/icon_back_black.png


+ 2 - 1
BaseLibrary/src/main/res/layout/common_toolbar_layout.xml

@@ -24,12 +24,13 @@
         android:src="@drawable/icon_back_black" />
 
     <TextView
+        tools:text="我的课程"
         android:id="@+id/title"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_centerInParent="true"
         android:layout_gravity="center"
-        android:textColor="@color/white"
+        android:textColor="@color/common_black"
         android:textSize="@dimen/sp_18"
         android:textStyle="bold" />
 

+ 3 - 0
teacher/src/main/AndroidManifest.xml

@@ -25,6 +25,9 @@
             android:name="com.cooleshow.teacher.ui.main.MainActivity"
             android:exported="false">
         </activity>
+        <activity android:name=".ui.course.MineCourseActivity"
+            android:configChanges="orientation|screenSize|keyboardHidden"
+            android:screenOrientation="portrait"/>
     </application>
 
 </manifest>

+ 35 - 0
teacher/src/main/java/com/cooleshow/teacher/adapter/MineCoursePageAdapter.java

@@ -0,0 +1,35 @@
+package com.cooleshow.teacher.adapter;
+
+import java.util.ArrayList;
+
+import androidx.annotation.NonNull;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentActivity;
+import androidx.viewpager2.adapter.FragmentStateAdapter;
+
+/**
+ * Author by pq, Date on 2022/4/20.
+ */
+public class MineCoursePageAdapter extends FragmentStateAdapter {
+    private ArrayList<Fragment> mFragments;
+
+    public void setFragments(ArrayList<Fragment> fragments) {
+        this.mFragments = fragments;
+    }
+
+    public MineCoursePageAdapter(@NonNull FragmentActivity fragmentActivity) {
+        super(fragmentActivity);
+    }
+
+    @NonNull
+    @Override
+    public Fragment createFragment(int position) {
+        Fragment fragment = mFragments.get(position);
+        return fragment;
+    }
+
+    @Override
+    public int getItemCount() {
+        return mFragments != null ? mFragments.size() : 0;
+    }
+}

+ 45 - 4
teacher/src/main/java/com/cooleshow/teacher/adapter/SparringCourseListAdapter.java

@@ -1,30 +1,71 @@
 package com.cooleshow.teacher.adapter;
 
+import android.text.TextUtils;
+import android.widget.ImageView;
+import android.widget.TextView;
+
 import com.chad.library.adapter.base.BaseQuickAdapter;
 import com.chad.library.adapter.base.module.BaseLoadMoreModule;
 import com.chad.library.adapter.base.module.LoadMoreModule;
 import com.chad.library.adapter.base.viewholder.BaseViewHolder;
+import com.cooleshow.base.utils.GlideUtils;
+import com.cooleshow.teacher.R;
 import com.cooleshow.teacher.bean.SparringCourseListBean;
+import com.cooleshow.teacher.constants.CourseFilterConstants;
 
 import androidx.annotation.NonNull;
 
 /**
  * Author by pq, Date on 2022/4/25.
  */
-public class SparringCourseListAdapter extends BaseQuickAdapter<SparringCourseListBean, BaseViewHolder> implements LoadMoreModule {
+public class SparringCourseListAdapter extends BaseQuickAdapter<SparringCourseListBean.RowsBean, BaseViewHolder> implements LoadMoreModule {
 
     public SparringCourseListAdapter(int layoutResId) {
         super(layoutResId);
     }
 
     @Override
-    protected void convert(@NonNull BaseViewHolder baseViewHolder, SparringCourseListBean sparringCourseListBean) {
-//        baseViewHolder.getLayoutPosition();
+    protected void convert(@NonNull BaseViewHolder holder, SparringCourseListBean.RowsBean data) {
+        //时间
+        holder.setText(R.id.tv_time, data.startTime);
+        //title
+        holder.setText(R.id.tv_title, data.userName);
+        //subjectName
+        holder.setText(R.id.tv_course_name, data.subjectName);
+        ImageView iv_avatar = holder.getView(R.id.iv_avatar);
+        //头像
+        GlideUtils.INSTANCE.loadImage(getContext(), data.avatar, iv_avatar, R.drawable.icon_teacher_default_head);
+
+        TextView tvCourseStatusBt = holder.getView(R.id.tv_course_status_bt);
+
+        if (TextUtils.equals(CourseFilterConstants.COURSE_STATUS_NOT_START, data.status)) {
+            //未开始
+            holder.setText(R.id.tv_course_status, "未开始");
+            tvCourseStatusBt.setText("调课");
+            tvCourseStatusBt.setBackgroundResource(R.drawable.shape_course_status_normal);
+            tvCourseStatusBt.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_2dc7aa));
+        }
+
+        if (TextUtils.equals(CourseFilterConstants.COURSE_STATUS_ING, data.status)) {
+            //进行中
+            holder.setText(R.id.tv_course_status, "进行中");
+            tvCourseStatusBt.setText("进入教室");
+            tvCourseStatusBt.setBackgroundResource(R.drawable.shape_course_status_ing);
+            tvCourseStatusBt.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.white));
+        }
+
+        if (TextUtils.equals(CourseFilterConstants.COURSE_STATUS_COMPLETE, data.status)) {
+            //已结束
+            holder.setText(R.id.tv_course_status, "已结束");
+            tvCourseStatusBt.setText("评价");
+            tvCourseStatusBt.setBackgroundResource(R.drawable.shape_course_status_normal);
+            tvCourseStatusBt.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_2dc7aa));
+        }
     }
 
     @NonNull
     @Override
     public BaseLoadMoreModule addLoadMoreModule(@NonNull BaseQuickAdapter<?, ?> baseQuickAdapter) {
-        return null;
+        return new BaseLoadMoreModule(baseQuickAdapter);
     }
 }

+ 20 - 1
teacher/src/main/java/com/cooleshow/teacher/api/APIService.java

@@ -2,6 +2,7 @@ package com.cooleshow.teacher.api;
 
 import com.cooleshow.base.data.net.BaseResponse;
 import com.cooleshow.teacher.bean.CourseTableDataBean;
+import com.cooleshow.teacher.bean.SparringCourseListBean;
 
 import java.util.List;
 
@@ -10,8 +11,8 @@ import okhttp3.RequestBody;
 import retrofit2.http.Body;
 import retrofit2.http.GET;
 import retrofit2.http.POST;
-import retrofit2.http.Query;
 
+import static com.cooleshow.base.common.BaseConstant.AUTH_GROUP;
 import static com.cooleshow.base.common.BaseConstant.TEACHER_GROUP;
 
 /**
@@ -35,4 +36,22 @@ public interface APIService {
      */
     @POST(TEACHER_GROUP + "courseSchedule/queryCourseUser")
     Observable<BaseResponse<CourseTableDataBean>> getCourseSchedulesWithDate(@Body RequestBody body);
+
+    /**
+     * 根据日期获取老师当日排课
+     *
+     * @param
+     * @return
+     */
+    @POST(TEACHER_GROUP + "courseSchedule/queryTeacherPracticeCourse")
+    Observable<BaseResponse<SparringCourseListBean>> getSparringCourses(@Body RequestBody body);
+
+    /**
+     * 查询个人信息
+     *
+     * @param
+     * @return
+     */
+    @GET(AUTH_GROUP + "api/queryUserInfo")
+    Observable<BaseResponse<Object>> getUserInfo();
 }

+ 94 - 0
teacher/src/main/java/com/cooleshow/teacher/bean/SparringCourseListBean.java

@@ -1,7 +1,101 @@
 package com.cooleshow.teacher.bean;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * Author by pq, Date on 2022/4/25.
  */
 public class SparringCourseListBean {
+
+    /**
+     * footer : [{"avatar":"","classDate":"","courseGoupId":0,"courseId":0,"endTime":"","id":0,"signInTime":"","startTime":"","status":"","subjectId":0,"subjectName":"","userId":0,"userName":""}]
+     * limit : 0
+     * nextPage : 0
+     * offset : 0
+     * pageNo : 0
+     * prePage : 0
+     * rows : [{"avatar":"","classDate":"","courseGoupId":0,"courseId":0,"endTime":"","id":0,"signInTime":"","startTime":"","status":"","subjectId":0,"subjectName":"","userId":0,"userName":""}]
+     * statInfo : {}
+     * total : 0
+     * totalPage : 0
+     */
+
+    public int limit;
+    public int nextPage;
+    public int offset;
+    public int pageNo;
+    public int prePage;
+    public StatInfoBean statInfo;
+    public int total;
+    public int totalPage;
+    public List<FooterBean> footer;
+    public ArrayList<RowsBean> rows;
+
+    public static class StatInfoBean {
+    }
+
+    public static class FooterBean {
+        /**
+         * avatar :
+         * classDate :
+         * courseGoupId : 0
+         * courseId : 0
+         * endTime :
+         * id : 0
+         * signInTime :
+         * startTime :
+         * status :
+         * subjectId : 0
+         * subjectName :
+         * userId : 0
+         * userName :
+         */
+
+        public String avatar;
+        public String classDate;
+        public int courseGoupId;
+        public int courseId;
+        public String endTime;
+        public int id;
+        public String signInTime;
+        public String startTime;
+        public String status;
+        public int subjectId;
+        public String subjectName;
+        public int userId;
+        public String userName;
+    }
+
+    public static class RowsBean {
+        /**
+         * avatar :
+         * classDate :
+         * courseGoupId : 0
+         * courseId : 0
+         * endTime :
+         * id : 0
+         * signInTime :
+         * startTime :
+         * status :
+         * subjectId : 0
+         * subjectName :
+         * userId : 0
+         * userName :
+         */
+
+        public String avatar;
+        public String classDate;
+        public int courseGoupId;
+        public int courseId;
+        public String endTime;
+        public int id;
+        public String signInTime;
+        public String startTime;
+        public String status;
+        public int subjectId;
+        public String subjectName;
+        public int userId;
+        public String userName;
+    }
 }

+ 18 - 0
teacher/src/main/java/com/cooleshow/teacher/constants/CourseFilterConstants.java

@@ -0,0 +1,18 @@
+package com.cooleshow.teacher.constants;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import androidx.annotation.IntDef;
+import androidx.annotation.StringDef;
+
+public class CourseFilterConstants {
+    public static final String COURSE_FILTER_ALL = "";//全部
+    public static final String COURSE_FILTER_HAS_NOT_STARTED = "NOT_START";//未开始
+    public static final String COURSE_FILTER_IN_PROGRESS = "ING";//进行中
+    public static final String COURSE_FILTER_COMPLETED = "COMPLETE";//已完成
+
+    public static final String COURSE_STATUS_NOT_START = "NOT_START";//课程未开始
+    public static final String COURSE_STATUS_ING = "ING";//课程进行中
+    public static final String COURSE_STATUS_COMPLETE = "COMPLETE";//课程已结束
+}

+ 3 - 2
teacher/src/main/java/com/cooleshow/teacher/contract/HomeContract.java

@@ -1,6 +1,7 @@
 package com.cooleshow.teacher.contract;
 
 import com.cooleshow.base.presenter.view.BaseView;
+import com.cooleshow.usercenter.bean.UserInfo;
 
 /**
  * Author by pq, Date on 2022/4/20.
@@ -8,10 +9,10 @@ import com.cooleshow.base.presenter.view.BaseView;
 public interface HomeContract {
 
     interface HomeView extends BaseView {
-//        void onLoginResult(UserInfo userInfo);
+        void getUserInfoSuccess(UserInfo userInfo);
     }
 
     interface Presenter {
-//        void onLoginByPwd(String mobile , String pwd);
+        void getUserInfo();
     }
 }

+ 4 - 2
teacher/src/main/java/com/cooleshow/teacher/contract/SparringCourseContract.java

@@ -1,6 +1,7 @@
 package com.cooleshow.teacher.contract;
 
 import com.cooleshow.base.presenter.view.BaseView;
+import com.cooleshow.teacher.bean.SparringCourseListBean;
 
 /**
  * Author by pq, Date on 2022/4/20.
@@ -8,10 +9,11 @@ import com.cooleshow.base.presenter.view.BaseView;
 public interface SparringCourseContract {
 
     interface SparringCourseView extends BaseView {
-//        void onLoginResult(UserInfo userInfo);
+        void onGetSparringCourseSuccess(int page, SparringCourseListBean sparringCourseBean);
+        void onGetCourseError(int page);
     }
 
     interface Presenter {
-//        void onLoginByPwd(String mobile , String pwd);
+        void querySparringCourse(String month, String status, int subjectId,int page);
     }
 }

+ 1 - 1
teacher/src/main/java/com/cooleshow/teacher/presenter/course/MineCoursePresenter.java

@@ -7,6 +7,6 @@ import com.cooleshow.teacher.contract.MineCourseContract;
 /**
  * Author by pq, Date on 2022/4/20.
  */
-public class MineCoursePresenter extends BasePresenter<MineCourseContract.MineCourseView> implements HomeContract.Presenter {
+public class MineCoursePresenter extends BasePresenter<MineCourseContract.MineCourseView> implements MineCourseContract.Presenter {
 
 }

+ 41 - 2
teacher/src/main/java/com/cooleshow/teacher/presenter/course/SparringCoursePresenter.java

@@ -1,14 +1,53 @@
 package com.cooleshow.teacher.presenter.course;
 
 import com.cooleshow.base.presenter.BasePresenter;
-import com.cooleshow.teacher.contract.HomeContract;
-import com.cooleshow.teacher.contract.MineCourseContract;
+import com.cooleshow.base.rx.BaseObserver;
+import com.cooleshow.base.utils.RequestBodyUtil;
+import com.cooleshow.teacher.api.APIService;
+import com.cooleshow.teacher.bean.SparringCourseListBean;
 import com.cooleshow.teacher.contract.SparringCourseContract;
 
+import org.json.JSONException;
+import org.json.JSONObject;
+
 /**
  * 陪练课presenter
  * Author by pq, Date on 2022/4/20.
  */
 public class SparringCoursePresenter extends BasePresenter<SparringCourseContract.SparringCourseView> implements SparringCourseContract.Presenter {
 
+    @Override
+    public void querySparringCourse(String month, String status, int subjectId, int page) {
+        if (getView() != null) {
+            getView().showLoading();
+        }
+        JSONObject jsonObject = new JSONObject();
+        try {
+            jsonObject.putOpt("classMonth", month);
+            jsonObject.putOpt("status", status);
+            if (subjectId != 0) {
+                jsonObject.putOpt("subjectId", subjectId);
+            }
+            jsonObject.putOpt("page", page);
+            jsonObject.putOpt("rows", 10);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+        addSubscribe(create(APIService.class).getSparringCourses(RequestBodyUtil.convertToRequestBodyJson(jsonObject.toString())), new BaseObserver<SparringCourseListBean>(getView()) {
+            @Override
+            protected void onSuccess(SparringCourseListBean data) {
+                if (getView() != null) {
+                    getView().onGetSparringCourseSuccess(page, data);
+                }
+            }
+
+            @Override
+            public void onError(Throwable e) {
+                super.onError(e);
+                if (getView() != null) {
+                    getView().onGetCourseError(page);
+                }
+            }
+        });
+    }
 }

+ 27 - 0
teacher/src/main/java/com/cooleshow/teacher/presenter/main/HomePresenter.java

@@ -1,11 +1,38 @@
 package com.cooleshow.teacher.presenter.main;
 
 import com.cooleshow.base.presenter.BasePresenter;
+import com.cooleshow.base.rx.BaseObserver;
+import com.cooleshow.base.utils.RequestBodyUtil;
+import com.cooleshow.teacher.api.APIService;
 import com.cooleshow.teacher.contract.HomeContract;
 
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.List;
+
 /**
  * Author by pq, Date on 2022/4/20.
  */
 public class HomePresenter extends BasePresenter<HomeContract.HomeView> implements HomeContract.Presenter {
 
+    /**
+     * 查询UserInfo
+     *
+     * @param
+     */
+    @Override
+    public void getUserInfo() {
+        if (getView() != null) {
+            getView().showLoading();
+        }
+        addSubscribe(create(APIService.class).getUserInfo(), new BaseObserver<Object>(getView()) {
+            @Override
+            protected void onSuccess(Object data) {
+                if (getView() != null) {
+//                    getView().getUserInfoSuccess();
+                }
+            }
+        });
+    }
 }

+ 126 - 0
teacher/src/main/java/com/cooleshow/teacher/ui/course/LiveCourseFragment.java

@@ -0,0 +1,126 @@
+package com.cooleshow.teacher.ui.course;
+
+import android.view.View;
+
+import com.chad.library.adapter.base.listener.OnLoadMoreListener;
+import com.cooleshow.base.ui.fragment.BaseMVPFragment;
+import com.cooleshow.base.utils.LogUtils;
+import com.cooleshow.base.utils.TimeUtils;
+import com.cooleshow.teacher.R;
+import com.cooleshow.teacher.adapter.SparringCourseListAdapter;
+import com.cooleshow.teacher.bean.SparringCourseListBean;
+import com.cooleshow.teacher.constants.CourseFilterConstants;
+import com.cooleshow.teacher.contract.SparringCourseContract;
+import com.cooleshow.teacher.databinding.FragmentSparringCourseLayoutBinding;
+import com.cooleshow.teacher.presenter.course.SparringCoursePresenter;
+import com.scwang.smart.refresh.layout.api.RefreshLayout;
+import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.LinearLayoutManager;
+
+/**
+ * Author by pq, Date on 2022/4/25.
+ */
+public class LiveCourseFragment extends BaseMVPFragment<FragmentSparringCourseLayoutBinding, SparringCoursePresenter> implements SparringCourseContract.SparringCourseView {
+    private String currentCourseFilterStatus = CourseFilterConstants.COURSE_FILTER_ALL;
+    private String currentFilterDate;
+    private int currentSubjectId;
+    private int currentPage;
+    private SparringCourseListAdapter mAdapter;
+
+    @Override
+    protected FragmentSparringCourseLayoutBinding getLayoutView() {
+        return FragmentSparringCourseLayoutBinding.inflate(getLayoutInflater());
+    }
+
+    @Override
+    protected SparringCoursePresenter createPresenter() {
+        return new SparringCoursePresenter();
+    }
+
+    @Override
+    protected void initView(View rootView) {
+        buildDefaultFilter();
+    }
+
+    private void buildDefaultFilter() {
+        currentFilterDate = TimeUtils.getNowString(TimeUtils.getSafeDateFormat("yyyy-MM"));
+        currentCourseFilterStatus = CourseFilterConstants.COURSE_FILTER_ALL;
+        currentPage = 1;
+    }
+
+
+    @Override
+    protected void initData() {
+        mViewBinding.refreshLayout.setOnRefreshListener(new OnRefreshListener() {
+            @Override
+            public void onRefresh(@NonNull RefreshLayout refreshLayout) {
+                currentPage = 1;
+                queryCourse();
+            }
+        });
+
+        mAdapter = new SparringCourseListAdapter(R.layout.item_sparring_course_list_layout);
+        mAdapter.getLoadMoreModule().setOnLoadMoreListener(new OnLoadMoreListener() {
+            @Override
+            public void onLoadMore() {
+                //上拉加载
+                currentPage++;
+                queryCourse();
+            }
+        });
+        mViewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
+        mViewBinding.recyclerView.setAdapter(mAdapter);
+    }
+
+    private void queryCourse() {
+        //根据默认筛选条件查询
+        LogUtils.i("pq","currentFilterDate:"+currentFilterDate);
+        LogUtils.i("pq","currentCourseFilterStatus:"+currentCourseFilterStatus);
+        LogUtils.i("pq","currentSubjectId:"+currentSubjectId);
+        LogUtils.i("pq","currentPage:"+currentPage);
+        presenter.querySparringCourse(currentFilterDate, currentCourseFilterStatus, currentSubjectId, currentPage);
+    }
+
+    @Override
+    public void onGetSparringCourseSuccess(int page, SparringCourseListBean sparringCourseBean) {
+        if (isDetached()) {
+            return;
+        }
+        if (sparringCourseBean != null) {
+            if (page != 1) {
+                //第一页
+                mViewBinding.refreshLayout.finishRefresh();
+                if (mAdapter != null) {
+                    if (sparringCourseBean.rows != null && sparringCourseBean.rows.size() > 0) {
+                        mAdapter.getData().clear();
+                        mAdapter.notifyDataSetChanged();
+                        mAdapter.setNewInstance(sparringCourseBean.rows);
+                    } else {
+                        showEmptyView();
+                    }
+                }
+            } else {
+                //加载更多
+                if (mAdapter != null) {
+                    mAdapter.getLoadMoreModule().loadMoreComplete();
+                    if (sparringCourseBean.rows != null && sparringCourseBean.rows.size() > 0) {
+                        mAdapter.addData(sparringCourseBean.rows);
+                    } else {
+                        mAdapter.getLoadMoreModule().loadMoreEnd();
+                    }
+                }
+            }
+        }
+    }
+
+    @Override
+    public void onGetCourseError(int page) {
+
+    }
+
+    private void showEmptyView() {
+
+    }
+}

+ 61 - 0
teacher/src/main/java/com/cooleshow/teacher/ui/course/MineCourseActivity.java

@@ -1,18 +1,38 @@
 package com.cooleshow.teacher.ui.course;
 
+import android.graphics.Typeface;
+import android.os.Bundle;
+
+import com.alibaba.android.arouter.facade.annotation.Route;
 import com.cooleshow.base.presenter.BasePresenter;
+import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.teacher.R;
+import com.cooleshow.teacher.adapter.MineCoursePageAdapter;
 import com.cooleshow.teacher.databinding.ActivityMineCourseLayoutBinding;
 import com.cooleshow.teacher.presenter.course.MineCoursePresenter;
 
+import java.util.ArrayList;
+
 import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
 import androidx.viewbinding.ViewBinding;
+import androidx.viewpager2.widget.ViewPager2;
 
 /**
  * Author by pq, Date on 2022/4/25.
  */
+@Route(path = RouterPath.CourseCenter.TEACHER_MINE_COURSE)
 public class MineCourseActivity extends BaseMVPActivity<ActivityMineCourseLayoutBinding, MineCoursePresenter> {
+    private ArrayList<Fragment> mFragments = new ArrayList<>();
+
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
+    }
 
     @NonNull
     @Override
@@ -22,6 +42,7 @@ public class MineCourseActivity extends BaseMVPActivity<ActivityMineCourseLayout
 
     @Override
     protected void initView() {
+        initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "我的课程");
         viewBinding.radioGroup.setOnCheckedChangeListener((radioGroup, i) -> {
             if (i == R.id.rb_sparring) {
                 viewBinding.viewPager.setCurrentItem(0);
@@ -33,8 +54,48 @@ public class MineCourseActivity extends BaseMVPActivity<ActivityMineCourseLayout
                 viewBinding.viewPager.setCurrentItem(2);
             }
         });
+        viewBinding.viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
+            @Override
+            public void onPageSelected(int position) {
+                super.onPageSelected(position);
+                changeTableLayoutBar(position);
+            }
+        });
+    }
 
+    private void changeTableLayoutBar(int position) {
+        if (position == 0) {
+            viewBinding.rbSparring.setChecked(true);
+            viewBinding.rbSparring.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
+            viewBinding.rbLiveCourse.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
+            viewBinding.rbVideoCourse.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
+        }
+        if (position == 1) {
+            viewBinding.rbLiveCourse.setChecked(true);
+            viewBinding.rbSparring.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
+            viewBinding.rbLiveCourse.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
+            viewBinding.rbVideoCourse.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
+        }
+        if (position == 2) {
+            viewBinding.rbVideoCourse.setChecked(true);
+            viewBinding.rbSparring.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
+            viewBinding.rbLiveCourse.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
+            viewBinding.rbVideoCourse.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
+        }
+    }
 
+    @Override
+    public void initData() {
+        super.initData();
+        SparringCourseFragment sparringCourseFragment = new SparringCourseFragment();
+        SparringCourseFragment sparringCourseFragment2 = new SparringCourseFragment();
+        LiveCourseFragment liveCourseFragment = new LiveCourseFragment();
+        mFragments.add(sparringCourseFragment);
+        mFragments.add(liveCourseFragment);
+        mFragments.add(sparringCourseFragment2);
+        MineCoursePageAdapter mineCoursePageAdapter = new MineCoursePageAdapter(this);
+        mineCoursePageAdapter.setFragments(mFragments);
+        viewBinding.viewPager.setAdapter(mineCoursePageAdapter);
     }
 
     @Override

+ 106 - 6
teacher/src/main/java/com/cooleshow/teacher/ui/course/SparringCourseFragment.java

@@ -1,21 +1,36 @@
 package com.cooleshow.teacher.ui.course;
 
 import android.view.View;
+import android.widget.TextView;
 
 import com.chad.library.adapter.base.listener.OnLoadMoreListener;
-import com.cooleshow.base.presenter.BasePresenter;
 import com.cooleshow.base.ui.fragment.BaseMVPFragment;
+import com.cooleshow.base.utils.LogUtils;
+import com.cooleshow.base.utils.TimeUtils;
 import com.cooleshow.teacher.R;
 import com.cooleshow.teacher.adapter.SparringCourseListAdapter;
+import com.cooleshow.teacher.bean.SparringCourseListBean;
+import com.cooleshow.teacher.constants.CourseFilterConstants;
+import com.cooleshow.teacher.contract.SparringCourseContract;
 import com.cooleshow.teacher.databinding.FragmentSparringCourseLayoutBinding;
 import com.cooleshow.teacher.presenter.course.SparringCoursePresenter;
+import com.scwang.smart.refresh.layout.api.RefreshLayout;
+import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
 
-import androidx.viewbinding.ViewBinding;
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.LinearLayoutManager;
 
 /**
  * Author by pq, Date on 2022/4/25.
  */
-public class SparringCourseFragment extends BaseMVPFragment<FragmentSparringCourseLayoutBinding, SparringCoursePresenter> {
+public class SparringCourseFragment extends BaseMVPFragment<FragmentSparringCourseLayoutBinding, SparringCoursePresenter> implements SparringCourseContract.SparringCourseView {
+    private String currentCourseFilterStatus = CourseFilterConstants.COURSE_FILTER_ALL;
+    private String currentFilterDate;
+    private int currentSubjectId;
+    private int currentPage;
+    private SparringCourseListAdapter mAdapter;
+    private View mEmptyView;
+    private TextView mTvEmptyTip;
 
     @Override
     protected FragmentSparringCourseLayoutBinding getLayoutView() {
@@ -27,20 +42,105 @@ public class SparringCourseFragment extends BaseMVPFragment<FragmentSparringCour
         return new SparringCoursePresenter();
     }
 
-
     @Override
     protected void initView(View rootView) {
+        buildDefaultFilter();
+        mViewBinding.tvTime.setText(currentFilterDate);
+    }
 
+    private void buildDefaultFilter() {
+        currentFilterDate = TimeUtils.getNowString(TimeUtils.getSafeDateFormat("yyyy-MM"));
+        currentCourseFilterStatus = CourseFilterConstants.COURSE_FILTER_ALL;
+        currentPage = 1;
     }
 
+
     @Override
     protected void initData() {
-        SparringCourseListAdapter sparringCourseListAdapter = new SparringCourseListAdapter(R.layout.item_sparring_course_list_layout);
-        sparringCourseListAdapter.getLoadMoreModule().setOnLoadMoreListener(new OnLoadMoreListener() {
+        mViewBinding.refreshLayout.setOnRefreshListener(new OnRefreshListener() {
+            @Override
+            public void onRefresh(@NonNull RefreshLayout refreshLayout) {
+                currentPage = 1;
+                queryCourse();
+            }
+        });
+
+        mAdapter = new SparringCourseListAdapter(R.layout.item_sparring_course_list_layout);
+        mAdapter.getLoadMoreModule().setOnLoadMoreListener(new OnLoadMoreListener() {
             @Override
             public void onLoadMore() {
                 //上拉加载
+                currentPage++;
+                queryCourse();
             }
         });
+        mViewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
+        mViewBinding.recyclerView.setAdapter(mAdapter);
+        queryCourse();
+    }
+
+    private void queryCourse() {
+        //根据默认筛选条件查询
+        LogUtils.i("pq", "currentFilterDate:" + currentFilterDate);
+        LogUtils.i("pq", "currentCourseFilterStatus:" + currentCourseFilterStatus);
+        LogUtils.i("pq", "currentSubjectId:" + currentSubjectId);
+        LogUtils.i("pq", "currentPage:" + currentPage);
+        presenter.querySparringCourse(currentFilterDate, currentCourseFilterStatus, currentSubjectId, currentPage);
+    }
+
+    @Override
+    public void onGetSparringCourseSuccess(int page, SparringCourseListBean sparringCourseBean) {
+        if (isDetached()) {
+            return;
+        }
+        if (sparringCourseBean != null) {
+            if (page == 1) {
+                //第一页
+                mViewBinding.refreshLayout.finishRefresh();
+                if (mAdapter != null) {
+                    if (sparringCourseBean.rows != null && sparringCourseBean.rows.size() > 0) {
+                        mAdapter.getData().clear();
+                        mAdapter.notifyDataSetChanged();
+                        mAdapter.setNewInstance(sparringCourseBean.rows);
+                    } else {
+                        showEmptyView();
+                    }
+                }
+            } else {
+                //加载更多
+                if (mAdapter != null) {
+                    if (sparringCourseBean.rows != null && sparringCourseBean.rows.size() > 0) {
+                        mViewBinding.refreshLayout.finishLoadMore();
+                        mAdapter.getLoadMoreModule().loadMoreComplete();
+                        mAdapter.addData(sparringCourseBean.rows);
+                    } else {
+                        mAdapter.getLoadMoreModule().loadMoreEnd(false);
+                    }
+                }
+            }
+        }
+    }
+
+    @Override
+    public void onGetCourseError(int page) {
+        if (isDetached()) {
+            return;
+        }
+        if (page == 1) {
+            mViewBinding.refreshLayout.finishRefresh();
+        } else {
+            if (mAdapter != null) {
+                mAdapter.getLoadMoreModule().loadMoreFail();
+            }
+        }
+    }
+
+    private void showEmptyView() {
+        if (mEmptyView == null) {
+            mEmptyView = getLayoutInflater().inflate(com.cooleshow.base.R.layout.empty_layout, mAdapter.getEmptyLayout(), false);
+            mTvEmptyTip = mEmptyView.findViewById(com.cooleshow.base.R.id.tv_empty_tip);
+        }
+        mTvEmptyTip.setText("暂无数据");
+        mAdapter.setEmptyView(mEmptyView);
     }
 }

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

@@ -35,8 +35,7 @@ import java.util.*
  * Author by pq, Date on 2022/4/20.
  */
 class CourseTableFragment :
-    BaseMVPFragment<FragmentCourseTableLayoutBinding, CourseTablePresenter>(),
-    HomeContract.HomeView, CalendarView.OnCalendarSelectListener,
+    BaseMVPFragment<FragmentCourseTableLayoutBinding, CourseTablePresenter>(), CalendarView.OnCalendarSelectListener,
     CalendarView.OnCalendarInterceptListener, CalendarView.OnMonthChangeListener,
     CalendarView.OnViewChangeListener, CourseTableContract.CourseTableView, View.OnClickListener {
     private lateinit var currentSelectDate: Date

+ 17 - 0
teacher/src/main/java/com/cooleshow/teacher/ui/main/HomeFragment.kt

@@ -1,11 +1,15 @@
 package com.cooleshow.teacher.ui.main
 
 import android.view.View
+import com.alibaba.android.arouter.launcher.ARouter
+import com.cooleshow.base.router.RouterPath
 import com.cooleshow.base.ui.fragment.BaseMVPFragment
 import com.cooleshow.teacher.R
 import com.cooleshow.teacher.contract.HomeContract
 import com.cooleshow.teacher.databinding.FragmentHomeLayoutBinding
 import com.cooleshow.teacher.presenter.main.HomePresenter
+import com.cooleshow.usercenter.bean.UserInfo
+import com.cooleshow.usercenter.helper.UserHelper
 
 
 /**
@@ -21,10 +25,23 @@ class HomeFragment : BaseMVPFragment<FragmentHomeLayoutBinding, HomePresenter>()
     }
 
     override fun initData() {
+        mViewBinding.btMineCourse.setOnClickListener {
+            ARouter.getInstance().build(RouterPath.CourseCenter.TEACHER_MINE_COURSE).navigation()
+        }
     }
 
     override fun createPresenter(): HomePresenter {
         return HomePresenter()
     }
 
+    override fun onResume() {
+        super.onResume()
+        presenter.getUserInfo()
+    }
+
+    override fun getUserInfoSuccess(userInfo: UserInfo?) {
+        //存储userInfo信息
+        UserHelper.saveUserInfo(userInfo)
+    }
+
 }

+ 4 - 2
teacher/src/main/res/layout/activity_mine_course_layout.xml

@@ -4,7 +4,9 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
-    <include layout="@layout/common_toolbar_layout" />
+    <include
+        android:id="@+id/toolbarInclude"
+        layout="@layout/common_toolbar_layout" />
 
     <RadioGroup
         android:id="@+id/radio_group"
@@ -12,7 +14,7 @@
         android:layout_height="@dimen/dp_40"
         android:gravity="center_vertical"
         android:orientation="horizontal"
-        app:layout_constraintTop_toBottomOf="@+id/toolbar">
+        app:layout_constraintTop_toBottomOf="@+id/toolbarInclude">
 
         <RadioButton
             android:id="@+id/rb_sparring"

+ 8 - 0
teacher/src/main/res/layout/fragment_home_layout.xml

@@ -13,4 +13,12 @@
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
+
+    <Button
+        android:id="@+id/bt_mine_course"
+        android:layout_width="100dp"
+        android:layout_height="50dp"
+        android:text="我的课堂"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 18 - 5
teacher/src/main/res/layout/fragment_sparring_course_layout.xml

@@ -34,6 +34,7 @@
         android:includeFontPadding="false"
         android:textColor="@color/color_666666"
         android:textSize="@dimen/sp_13"
+        android:text="课程状态"
         app:layout_constraintBottom_toBottomOf="@+id/tv_time"
         app:layout_constraintLeft_toRightOf="@+id/tv_time"
         app:layout_constraintRight_toLeftOf="@+id/tv_agency"
@@ -51,19 +52,31 @@
         android:includeFontPadding="false"
         android:textColor="@color/color_666666"
         android:textSize="@dimen/sp_13"
+        android:text="声部"
         app:layout_constraintBottom_toBottomOf="@+id/tv_time"
         app:layout_constraintLeft_toRightOf="@+id/tv_course_status"
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toTopOf="@+id/tv_time"
         tools:text="课程状态" />
 
-    <androidx.recyclerview.widget.RecyclerView
-        android:id="@+id/recyclerView"
+    <com.scwang.smart.refresh.layout.SmartRefreshLayout
+        android:id="@+id/refreshLayout"
         android:layout_width="match_parent"
         android:layout_height="0dp"
-        android:overScrollMode="never"
-        android:scrollbars="none"
+        app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/tv_time" />
+        app:layout_constraintTop_toBottomOf="@+id/tv_time">
+
+        <com.scwang.smart.refresh.header.ClassicsHeader
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content" />
+
+        <androidx.recyclerview.widget.RecyclerView
+            android:id="@+id/recyclerView"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:overScrollMode="never"
+            android:scrollbars="none" />
+    </com.scwang.smart.refresh.layout.SmartRefreshLayout>
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 52 - 22
usercenter/src/main/java/com/cooleshow/usercenter/bean/UserInfo.java

@@ -1,31 +1,61 @@
 package com.cooleshow.usercenter.bean;
 
-import java.io.Serializable;
-
 /**
- * Author by pq, Date on 2022/4/22.
+ * Author by pq, Date on 2022/4/25.
  */
-public class UserInfo implements Serializable {
+public class UserInfo {
 
     /**
-     * password : true
-     * authentication : {"access_token":"7767ca75-bb03-4971-98d6-d74396174be5","token_type":"bearer","refresh_token":"dda2ed9f-e0f3-4d8e-96b9-900104ff3e10","scope":"server"}
+     * roles : null
+     * username : 张三
+     * delFlag : false
+     * lockFlag : 0
+     * userType : TEACHER
+     * password : $2a$10$LnHL1QT5e/QZi5HLkDIkkOQjT9AawXOMvvAcszzxbkyJDQD3bM9AO
+     * imToken : baJrtdp87wrzcvo84ydpAb2r9blynxp9@q4s7.cn.rongnav.com;q4s7.cn.rongcfg.com
+     * birthdate : null
+     * idCardNo :
+     * gender : 0
+     * wechatId :
+     * wxOpenid :
+     * qqOpenid :
+     * isSuperAdmin : false
+     * salt :
+     * phone : 13627281518
+     * avatar : https://daya.ks3-cn-beijing.ksyun.com/202204/T3R3yxq.jpeg
+     * email :
+     * createTime : 2022-03-30 09:57:17
+     * nation :
+     * certificateType :
+     * updateTime : 2022-04-24 11:51:32
+     * superAdmin : false
+     * id : 15
+     * realName :
      */
 
-    public boolean password;
-    public AuthenticationBean authentication;
-
-    public static class AuthenticationBean  {
-        /**
-         * access_token : 7767ca75-bb03-4971-98d6-d74396174be5
-         * token_type : bearer
-         * refresh_token : dda2ed9f-e0f3-4d8e-96b9-900104ff3e10
-         * scope : server
-         */
-
-        public String access_token;
-        public String token_type;
-        public String refresh_token;
-        public String scope;
-    }
+    public Object roles;
+    public String username;
+    public boolean delFlag;
+    public int lockFlag;
+    public String userType;
+    public String password;
+    public String imToken;
+    public Object birthdate;
+    public String idCardNo;
+    public int gender;
+    public String wechatId;
+    public String wxOpenid;
+    public String qqOpenid;
+    public boolean isSuperAdmin;
+    public String salt;
+    public String phone;
+    public String avatar;
+    public String email;
+    public String createTime;
+    public String nation;
+    public String certificateType;
+    public String updateTime;
+    public boolean superAdmin;
+    public int id;
+    public String realName;
 }

+ 31 - 0
usercenter/src/main/java/com/cooleshow/usercenter/bean/UserLoginInfo.java

@@ -0,0 +1,31 @@
+package com.cooleshow.usercenter.bean;
+
+import java.io.Serializable;
+
+/**
+ * Author by pq, Date on 2022/4/22.
+ */
+public class UserLoginInfo implements Serializable {
+
+    /**
+     * password : true
+     * authentication : {"access_token":"7767ca75-bb03-4971-98d6-d74396174be5","token_type":"bearer","refresh_token":"dda2ed9f-e0f3-4d8e-96b9-900104ff3e10","scope":"server"}
+     */
+
+    public boolean password;
+    public AuthenticationBean authentication;
+
+    public static class AuthenticationBean  {
+        /**
+         * access_token : 7767ca75-bb03-4971-98d6-d74396174be5
+         * token_type : bearer
+         * refresh_token : dda2ed9f-e0f3-4d8e-96b9-900104ff3e10
+         * scope : server
+         */
+
+        public String access_token;
+        public String token_type;
+        public String refresh_token;
+        public String scope;
+    }
+}

+ 3 - 3
usercenter/src/main/java/com/cooleshow/usercenter/data/api/UserApi.kt

@@ -3,7 +3,7 @@ package com.cooleshow.usercenter.data.api
 
 import com.cooleshow.base.common.BaseConstant
 import com.cooleshow.base.data.net.BaseResponse
-import com.cooleshow.usercenter.bean.UserInfo
+import com.cooleshow.usercenter.bean.UserLoginInfo
 import com.cooleshow.usercenter.data.protocol.RegisterReq
 import io.reactivex.rxjava3.core.Observable
 import retrofit2.http.*
@@ -25,7 +25,7 @@ interface UserApi {
      */
     @FormUrlEncoded
     @POST("api-auth/usernameLogin")
-    fun login(@FieldMap req: MutableMap<String?, String?>): Observable<BaseResponse<UserInfo>>
+    fun login(@FieldMap req: MutableMap<String?, String?>): Observable<BaseResponse<UserLoginInfo>>
 
 
     /*
@@ -51,7 +51,7 @@ interface UserApi {
       */
     @FormUrlEncoded
     @POST(BaseConstant.AUTH_GROUP + "smsLogin")
-    fun loginByCode(@FieldMap req: MutableMap<String?, String?>): Observable<BaseResponse<UserInfo>>
+    fun loginByCode(@FieldMap req: MutableMap<String?, String?>): Observable<BaseResponse<UserLoginInfo>>
 
     /*
       发送验证码

+ 0 - 2
usercenter/src/main/java/com/cooleshow/usercenter/data/respository/UserRepository.kt

@@ -2,9 +2,7 @@ package com.kotlin.user.data.respository
 
 import com.cooleshow.base.data.net.BaseResponse
 import com.cooleshow.base.data.net.RetrofitFactory
-import com.cooleshow.usercenter.bean.UserInfo
 import com.cooleshow.usercenter.data.api.UserApi
-import com.cooleshow.usercenter.data.protocol.LoginReq
 import com.cooleshow.usercenter.data.protocol.RegisterReq
 
 import io.reactivex.rxjava3.core.Observable

+ 43 - 2
usercenter/src/main/java/com/cooleshow/usercenter/helper/UserHelper.java

@@ -5,12 +5,18 @@ import android.text.TextUtils;
 import com.cooleshow.base.data.net.CommonParamsHelper;
 import com.cooleshow.base.utils.SPUtils;
 import com.cooleshow.usercenter.bean.UserInfo;
+import com.cooleshow.usercenter.bean.UserLoginInfo;
 
 /**
  * Author by pq, Date on 2022/4/22.
  */
 public class UserHelper {
     public static final String USER_TOKEN_KEY = "user_token";
+    public static final String USER_ID = "user_id";
+    public static final String USERNAME = "username";
+    public static final String USER_IM_TOKEN = "imToken";
+    public static final String USER_PHONE = "phone";
+    public static final String USER_AVATAR = "avatar";
 
     public static boolean isLogin() {
         return !TextUtils.isEmpty(getUserToken());
@@ -21,13 +27,13 @@ public class UserHelper {
         return tokenType + " " + token;
     }
 
-    public static void handleLoginSuccessAction(UserInfo data) {
+    public static void handleLoginSuccessAction(UserLoginInfo data) {
         String resultToken = buildToken(data.authentication.token_type, data.authentication.access_token);
         saveUserToken(resultToken);
         CommonParamsHelper.getInstance().addCommonHeaderParams(CommonParamsHelper.USER_TOKEN, resultToken);
     }
 
-    public static String handleLoginSuccessActionNotSave(UserInfo data) {
+    public static String handleLoginSuccessActionNotSave(UserLoginInfo data) {
         String resultToken = buildToken(data.authentication.token_type, data.authentication.access_token);
         CommonParamsHelper.getInstance().addCommonHeaderParams(CommonParamsHelper.USER_TOKEN, resultToken);
         return resultToken;
@@ -41,4 +47,39 @@ public class UserHelper {
         return SPUtils.getInstance().getString(USER_TOKEN_KEY);
     }
 
+    public static void saveUserInfo(UserInfo userInfo) {
+        if (userInfo == null) {
+            return;
+        }
+        //userId
+        SPUtils.getInstance().put(USER_ID, userInfo.id);
+        //昵称
+        SPUtils.getInstance().put(USERNAME, userInfo.username);
+        //imtoken
+        SPUtils.getInstance().put(USER_IM_TOKEN, userInfo.imToken);
+        //电话
+        SPUtils.getInstance().put(USER_PHONE, userInfo.phone);
+        //头像
+        SPUtils.getInstance().put(USER_AVATAR, userInfo.avatar);
+    }
+
+    public static String getUserId() {
+        return SPUtils.getInstance().getString(USER_ID);
+    }
+
+    public static String getUserName() {
+        return SPUtils.getInstance().getString(USERNAME);
+    }
+
+    public static String getUserIMToken() {
+        return SPUtils.getInstance().getString(USER_IM_TOKEN);
+    }
+
+    public static String getUserPhone() {
+        return SPUtils.getInstance().getString(USER_PHONE);
+    }
+
+    public static String getUserAvatar() {
+        return SPUtils.getInstance().getString(USER_AVATAR);
+    }
 }

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

@@ -1,15 +1,9 @@
 package com.cooleshow.usercenter.presenter;
 
-import com.cooleshow.base.constanst.Constanst;
 import com.cooleshow.base.presenter.BasePresenter;
 import com.cooleshow.base.rx.BaseObserver;
-import com.cooleshow.usercenter.bean.UserInfo;
 import com.cooleshow.usercenter.data.api.UserApi;
 import com.cooleshow.usercenter.presenter.contract.BindPasswordContract;
-import com.cooleshow.usercenter.presenter.contract.VerifyLoginContract;
-
-import java.util.HashMap;
-import java.util.Map;
 
 
 /**

+ 3 - 4
usercenter/src/main/java/com/cooleshow/usercenter/presenter/LoginPresenter.kt

@@ -1,10 +1,9 @@
 package com.cooleshow.usercenter.presenter
 
 import com.cooleshow.base.constanst.Constanst
-import com.cooleshow.base.data.net.BaseResponse
 import com.cooleshow.base.presenter.BasePresenter
 import com.cooleshow.base.rx.BaseObserver
-import com.cooleshow.usercenter.bean.UserInfo
+import com.cooleshow.usercenter.bean.UserLoginInfo
 import com.cooleshow.usercenter.data.api.UserApi
 import com.cooleshow.usercenter.presenter.contract.LoginContract
 
@@ -23,8 +22,8 @@ class LoginPresenter constructor() : BasePresenter<LoginContract.LoginView>(),
         params["username"] = mobile
         params["password"] = pwd
         addSubscribe(create(UserApi::class.java).login(params),
-            object : BaseObserver<UserInfo>(view) {
-                override fun onSuccess(data: UserInfo) {
+            object : BaseObserver<UserLoginInfo>(view) {
+                override fun onSuccess(data: UserLoginInfo) {
                     if (view != null) {
                         view.onLoginResult(data)
                     }

+ 3 - 4
usercenter/src/main/java/com/cooleshow/usercenter/presenter/VerifyLoginPresenter.java

@@ -3,8 +3,7 @@ package com.cooleshow.usercenter.presenter;
 import com.cooleshow.base.constanst.Constanst;
 import com.cooleshow.base.presenter.BasePresenter;
 import com.cooleshow.base.rx.BaseObserver;
-import com.cooleshow.base.utils.RequestBodyUtil;
-import com.cooleshow.usercenter.bean.UserInfo;
+import com.cooleshow.usercenter.bean.UserLoginInfo;
 import com.cooleshow.usercenter.data.api.UserApi;
 import com.cooleshow.usercenter.presenter.contract.VerifyLoginContract;
 
@@ -61,9 +60,9 @@ public class VerifyLoginPresenter extends BasePresenter<VerifyLoginContract.Veri
         maps.put("phone", mobile);
         maps.put("smsCode", code);
         maps.put("isSurportRegister", "true");
-        addSubscribe(create(UserApi.class).loginByCode(maps), new BaseObserver<UserInfo>(getView()) {
+        addSubscribe(create(UserApi.class).loginByCode(maps), new BaseObserver<UserLoginInfo>(getView()) {
             @Override
-            protected void onSuccess(UserInfo data) {
+            protected void onSuccess(UserLoginInfo data) {
                 if (getView() != null) {
                     getView().loginByCodeSuccess(data);
                 }

+ 0 - 1
usercenter/src/main/java/com/cooleshow/usercenter/presenter/contract/BindPasswordContract.java

@@ -1,7 +1,6 @@
 package com.cooleshow.usercenter.presenter.contract;
 
 import com.cooleshow.base.presenter.view.BaseView;
-import com.cooleshow.usercenter.bean.UserInfo;
 
 /**
  * Author by pq, Date on 2022/4/20.

+ 2 - 2
usercenter/src/main/java/com/cooleshow/usercenter/presenter/contract/LoginContract.java

@@ -1,7 +1,7 @@
 package com.cooleshow.usercenter.presenter.contract;
 
 import com.cooleshow.base.presenter.view.BaseView;
-import com.cooleshow.usercenter.bean.UserInfo;
+import com.cooleshow.usercenter.bean.UserLoginInfo;
 
 /**
  * Author by pq, Date on 2022/4/20.
@@ -9,7 +9,7 @@ import com.cooleshow.usercenter.bean.UserInfo;
 public interface LoginContract {
 
     interface LoginView extends BaseView {
-        void onLoginResult(UserInfo userInfo);
+        void onLoginResult(UserLoginInfo userInfo);
     }
 
     interface Presenter {

+ 2 - 2
usercenter/src/main/java/com/cooleshow/usercenter/presenter/contract/VerifyLoginContract.java

@@ -1,7 +1,7 @@
 package com.cooleshow.usercenter.presenter.contract;
 
 import com.cooleshow.base.presenter.view.BaseView;
-import com.cooleshow.usercenter.bean.UserInfo;
+import com.cooleshow.usercenter.bean.UserLoginInfo;
 
 /**
  * Author by pq, Date on 2022/4/19.
@@ -10,7 +10,7 @@ public interface VerifyLoginContract {
     interface VerifyLoginView extends BaseView {
         void sendVerifyCodeSuccess();
         void sendVerifyCodeFail();
-        void loginByCodeSuccess(UserInfo data);
+        void loginByCodeSuccess(UserLoginInfo data);
     }
 
     interface Presenter {

+ 2 - 2
usercenter/src/main/java/com/cooleshow/usercenter/service/UserService.kt

@@ -1,6 +1,6 @@
 package com.cooleshow.usercenter.service
 
-import com.cooleshow.usercenter.bean.UserInfo
+import com.cooleshow.usercenter.bean.UserLoginInfo
 import io.reactivex.rxjava3.core.Observable
 
 
@@ -13,7 +13,7 @@ interface UserService {
     fun register(mobile:String,pwd:String,verifyCode:String): Observable<Boolean>
 
     //用户登录
-    fun login(mobile:String,pwd:String,pushId:String):Observable<UserInfo>
+    fun login(mobile:String,pwd:String,pushId:String):Observable<UserLoginInfo>
 
     //忘记密码
 //    fun forgetPwd(mobile:String,verifyCode:String):Observable<Boolean>

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

@@ -5,19 +5,15 @@ import android.os.Bundle;
 import android.view.View;
 
 import com.alibaba.android.arouter.facade.annotation.Route;
-import com.alibaba.android.arouter.launcher.ARouter;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.ToastUtils;
 import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.usercenter.R;
 import com.cooleshow.usercenter.UserConstants;
-import com.cooleshow.usercenter.bean.UserInfo;
 import com.cooleshow.usercenter.databinding.ActivityBindPwdLayoutBinding;
-import com.cooleshow.usercenter.databinding.ActivityVerifyCodeLoginBinding;
 import com.cooleshow.usercenter.helper.PhoneCheckHelper;
 import com.cooleshow.usercenter.presenter.BindPasswordPresenter;
-import com.cooleshow.usercenter.presenter.VerifyLoginPresenter;
 import com.cooleshow.usercenter.presenter.contract.BindPasswordContract;
 
 import androidx.annotation.NonNull;

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

@@ -17,7 +17,7 @@ import com.cooleshow.base.utils.ToastUtils
 import com.cooleshow.base.utils.helper.QMUIStatusBarHelper
 import com.cooleshow.usercenter.R
 import com.cooleshow.usercenter.UserConstants
-import com.cooleshow.usercenter.bean.UserInfo
+import com.cooleshow.usercenter.bean.UserLoginInfo
 import com.cooleshow.usercenter.databinding.ActivityLoginBinding
 import com.cooleshow.usercenter.helper.UserHelper
 import com.cooleshow.usercenter.presenter.LoginPresenter
@@ -67,7 +67,7 @@ class LoginActivity : BaseMVPActivity<ActivityLoginBinding, LoginPresenter>(),
     /**
      * 登录成功
      */
-    override fun onLoginResult(result: UserInfo) {
+    override fun onLoginResult(result: UserLoginInfo) {
         if (isFinishing || isDestroyed) {
             return;
         }

+ 2 - 3
usercenter/src/main/java/com/cooleshow/usercenter/ui/activity/VerifyCodeInputActivity.java

@@ -9,7 +9,6 @@ import android.view.View;
 
 import com.alibaba.android.arouter.facade.annotation.Route;
 import com.alibaba.android.arouter.launcher.ARouter;
-import com.cooleshow.base.common.AppManager;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.KeyboardUtils;
@@ -19,7 +18,7 @@ import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.base.widgets.VerifyEditText;
 import com.cooleshow.usercenter.R;
 import com.cooleshow.usercenter.UserConstants;
-import com.cooleshow.usercenter.bean.UserInfo;
+import com.cooleshow.usercenter.bean.UserLoginInfo;
 import com.cooleshow.usercenter.databinding.ActivityInputCodeLayoutBinding;
 import com.cooleshow.usercenter.helper.UserHelper;
 import com.cooleshow.usercenter.presenter.VerifyLoginPresenter;
@@ -169,7 +168,7 @@ public class VerifyCodeInputActivity extends BaseMVPActivity<ActivityInputCodeLa
     }
 
     @Override
-    public void loginByCodeSuccess(UserInfo data) {
+    public void loginByCodeSuccess(UserLoginInfo data) {
         //添加公共参数
         if (isFinishing() || isDestroyed()) {
             return;

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

@@ -11,19 +11,15 @@ import android.view.View;
 
 import com.alibaba.android.arouter.facade.annotation.Route;
 import com.alibaba.android.arouter.launcher.ARouter;
-import com.cooleshow.base.common.AppManager;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
 import com.cooleshow.base.utils.SpannableStringUtils;
-import com.cooleshow.base.utils.ToastUtils;
 import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
 import com.cooleshow.usercenter.R;
 import com.cooleshow.usercenter.UserConstants;
-import com.cooleshow.usercenter.bean.UserInfo;
 import com.cooleshow.usercenter.databinding.ActivityVerifyCodeLoginBinding;
 import com.cooleshow.usercenter.helper.PhoneCheckHelper;
 import com.cooleshow.usercenter.presenter.VerifyLoginPresenter;
-import com.cooleshow.usercenter.presenter.contract.VerifyLoginContract;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;