Prechádzať zdrojové kódy

添加老师端->陪练课评价页面

Pq 3 rokov pred
rodič
commit
a6284f15a4

+ 1 - 0
BaseLibrary/src/main/java/com/cooleshow/base/router/RouterPath.kt

@@ -42,6 +42,7 @@ object RouterPath {
     class CommentCenter {
         companion object {
             const val TEACHER_RECEIVED_COMMENT = "/teacher/ui/comment/ReceivedCommentActivity"
+            const val TEACHER_COURSE_COMMENT = "/teacher/ui/comment/CourseCommentActivity"
         }
     }
 

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

@@ -43,6 +43,11 @@
             android:windowSoftInputMode="adjustPan"
             android:configChanges="orientation|screenSize|keyboardHidden"
             android:screenOrientation="portrait" />
+        <activity
+            android:name=".ui.comment.CourseCommentActivity"
+            android:windowSoftInputMode="adjustPan"
+            android:configChanges="orientation|screenSize|keyboardHidden"
+            android:screenOrientation="portrait" />
     </application>
 
 </manifest>

+ 44 - 0
teacher/src/main/java/com/cooleshow/teacher/adapter/CourseCommentNotReplyAdapter.java

@@ -0,0 +1,44 @@
+package com.cooleshow.teacher.adapter;
+
+import android.widget.ImageView;
+import android.widget.RatingBar;
+
+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.CourseCommentListBean;
+import com.cooleshow.teacher.bean.ReceivedCommentListBean;
+
+import androidx.annotation.NonNull;
+
+/**
+ * Author by pq, Date on 2022/5/5.
+ */
+public class CourseCommentNotReplyAdapter extends BaseQuickAdapter<CourseCommentListBean.RowsBean, BaseViewHolder> implements LoadMoreModule {
+
+    public CourseCommentNotReplyAdapter(int layoutResId) {
+        super(layoutResId);
+    }
+
+    @Override
+    protected void convert(@NonNull BaseViewHolder holder, CourseCommentListBean.RowsBean bean) {
+        //头像
+        ImageView iv_avatar = holder.getView(R.id.iv_avatar);
+        GlideUtils.INSTANCE.loadImage(getContext(), bean.avatar, iv_avatar, R.drawable.icon_teacher_default_head);
+        //名称
+        holder.setText(R.id.tv_title, bean.userName);
+        //声部名称
+        holder.setText(R.id.tv_course_name, bean.subjectName);
+        //时间
+        holder.setText(R.id.tv_time, bean.startTime);
+    }
+
+    @NonNull
+    @Override
+    public BaseLoadMoreModule addLoadMoreModule(@NonNull BaseQuickAdapter<?, ?> baseQuickAdapter) {
+        return new BaseLoadMoreModule(baseQuickAdapter);
+    }
+}

+ 11 - 0
teacher/src/main/java/com/cooleshow/teacher/api/APIService.java

@@ -1,6 +1,7 @@
 package com.cooleshow.teacher.api;
 
 import com.cooleshow.base.data.net.BaseResponse;
+import com.cooleshow.teacher.bean.CourseCommentListBean;
 import com.cooleshow.teacher.bean.CourseTableDataBean;
 import com.cooleshow.teacher.bean.LiveCourseListBean;
 import com.cooleshow.teacher.bean.ReceivedCommentListBean;
@@ -146,4 +147,14 @@ public interface APIService {
      */
     @POST(TEACHER_GROUP + "courseReplied/myReplied")
     Observable<BaseResponse<ReceivedCommentListBean>> getReceivedComment(@Body RequestBody body);
+
+
+    /**
+     * 查询课后评价
+     *
+     * @param
+     * @return
+     */
+    @POST(TEACHER_GROUP + "courseSchedule/queryTeacherPracticeCourse")
+    Observable<BaseResponse<CourseCommentListBean>> getCourseCommentList(@Body RequestBody body);
 }

+ 104 - 0
teacher/src/main/java/com/cooleshow/teacher/bean/CourseCommentListBean.java

@@ -0,0 +1,104 @@
+package com.cooleshow.teacher.bean;
+
+import java.util.List;
+
+/**
+ * Author by pq, Date on 2022/5/5.
+ */
+public class CourseCommentListBean {
+
+    /**
+     * footer : [{"avatar":"","classDate":"","courseGoupId":0,"courseId":0,"endTime":"","id":0,"realName":"","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,"realName":"","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 List<RowsBean> rows;
+
+    public static class StatInfoBean {
+    }
+
+    public static class FooterBean {
+        /**
+         * avatar :
+         * classDate :
+         * courseGoupId : 0
+         * courseId : 0
+         * endTime :
+         * id : 0
+         * realName :
+         * 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 realName;
+        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
+         * realName :
+         * 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 realName;
+        public String signInTime;
+        public String startTime;
+        public String status;
+        public int subjectId;
+        public String subjectName;
+        public int userId;
+        public String userName;
+    }
+}

+ 9 - 0
teacher/src/main/java/com/cooleshow/teacher/contract/CourseCommentContract.java

@@ -1,6 +1,7 @@
 package com.cooleshow.teacher.contract;
 
 import com.cooleshow.base.presenter.view.BaseView;
+import com.cooleshow.teacher.bean.CourseCommentListBean;
 import com.cooleshow.teacher.bean.ReceivedCommentListBean;
 
 /**
@@ -8,8 +9,16 @@ import com.cooleshow.teacher.bean.ReceivedCommentListBean;
  */
 public interface CourseCommentContract {
     interface CourseCommentView extends BaseView {
+        void queryCourseCommentSuccess(int page,CourseCommentListBean commentListBean);
+
+        void queryCourseCommentError(int page);
     }
 
     interface Presenter {
+
+        /**
+         * 查询课后评价列表
+         */
+        void queryCourseCommentList(boolean isShowLoading, int repliedStatus, String classMonth, String studentName, int page);
     }
 }

+ 36 - 0
teacher/src/main/java/com/cooleshow/teacher/presenter/comment/CourseCommentPresenter.java

@@ -2,10 +2,12 @@ package com.cooleshow.teacher.presenter.comment;
 
 import android.text.TextUtils;
 
+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.teacher.api.APIService;
+import com.cooleshow.teacher.bean.CourseCommentListBean;
 import com.cooleshow.teacher.bean.ReceivedCommentListBean;
 import com.cooleshow.teacher.contract.CourseCommentContract;
 import com.cooleshow.teacher.contract.ReceivedCommentContract;
@@ -18,4 +20,38 @@ import org.json.JSONObject;
  */
 public class CourseCommentPresenter extends BasePresenter<CourseCommentContract.CourseCommentView> implements CourseCommentContract.Presenter {
 
+    @Override
+    public void queryCourseCommentList(boolean isShowLoading,int repliedStatus, String classMonth, String studentName, int page) {
+        if (isShowLoading && getView() != null) {
+            getView().showLoading();
+        }
+        JSONObject jsonObject = new JSONObject();
+        try {
+            jsonObject.putOpt("classMonth", classMonth);
+            jsonObject.putOpt("replied", repliedStatus);
+            jsonObject.putOpt("page", page);
+            if (!TextUtils.isEmpty(studentName)) {
+                jsonObject.putOpt("studentName", studentName);
+            }
+            jsonObject.putOpt("rows", Constanst.DEFAULT_DATA_SIZE);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+        addSubscribe(create(APIService.class).getCourseCommentList(RequestBodyUtil.convertToRequestBodyJson(jsonObject.toString())), new BaseObserver<CourseCommentListBean>(getView()) {
+            @Override
+            protected void onSuccess(CourseCommentListBean data) {
+                if (getView() != null) {
+                    getView().queryCourseCommentSuccess(page, data);
+                }
+            }
+
+            @Override
+            public void onError(Throwable e) {
+                super.onError(e);
+                if (getView() != null) {
+                    getView().queryCourseCommentError(page);
+                }
+            }
+        });
+    }
 }

+ 67 - 0
teacher/src/main/java/com/cooleshow/teacher/ui/comment/CourseCommentActivity.java

@@ -1,18 +1,85 @@
 package com.cooleshow.teacher.ui.comment;
 
+import android.graphics.Typeface;
+import android.os.Bundle;
+
+import com.alibaba.android.arouter.facade.annotation.Route;
+import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.ui.activity.BaseActivity;
 import com.cooleshow.base.ui.activity.BaseMVPActivity;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
+import com.cooleshow.teacher.R;
+import com.cooleshow.teacher.adapter.CourseCommentNotReplyAdapter;
+import com.cooleshow.teacher.adapter.MineCoursePageAdapter;
 import com.cooleshow.teacher.contract.CourseCommentContract;
 import com.cooleshow.teacher.databinding.ActivityCourseCommentLayoutBinding;
 import com.cooleshow.teacher.presenter.comment.CourseCommentPresenter;
+import com.cooleshow.teacher.ui.course.LiveCourseFragment;
+import com.cooleshow.teacher.ui.course.SparringCourseFragment;
+import com.cooleshow.teacher.ui.course.VideoCourseFragment;
+
+import java.util.ArrayList;
+
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.viewpager2.widget.ViewPager2;
 
 /**
  * Author by pq, Date on 2022/5/5.
  */
+@Route(path = RouterPath.CommentCenter.TEACHER_COURSE_COMMENT)
 public class CourseCommentActivity extends BaseActivity<ActivityCourseCommentLayoutBinding> {
+    private ArrayList<Fragment> mFragments = new ArrayList<>();
+
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
+    }
+
     @Override
     protected void initView() {
+        initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "陪练课评价");
+        viewBinding.radioGroup.setOnCheckedChangeListener((radioGroup, i) -> {
+            if (i == R.id.rb_not_reply) {
+                viewBinding.viewPager.setCurrentItem(0);
+            }
+            if (i == R.id.rb_completed) {
+                viewBinding.viewPager.setCurrentItem(1);
+            }
+        });
+        viewBinding.viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
+            @Override
+            public void onPageSelected(int position) {
+                super.onPageSelected(position);
+                changeTableLayoutBar(position);
+            }
+        });
+    }
+
+    @Override
+    protected void initData() {
+        super.initData();
+        CourseCommentNoReplyFragment noReplyFragment = new CourseCommentNoReplyFragment();
+        CourseCommentHasReplyFragment hasReplyFragment = new CourseCommentHasReplyFragment();
+        mFragments.add(noReplyFragment);
+        mFragments.add(hasReplyFragment);
+        MineCoursePageAdapter mineCoursePageAdapter = new MineCoursePageAdapter(this);
+        mineCoursePageAdapter.setFragments(mFragments);
+        viewBinding.viewPager.setAdapter(mineCoursePageAdapter);
+    }
 
+    private void changeTableLayoutBar(int position) {
+        if (position == 0) {
+            viewBinding.rbNotReply.setChecked(true);
+            viewBinding.rbNotReply.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
+            viewBinding.rbCompleted.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
+        }
+        if (position == 1) {
+            viewBinding.rbCompleted.setChecked(true);
+            viewBinding.rbCompleted.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
+            viewBinding.rbNotReply.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
+        }
     }
 
     @Override

+ 245 - 0
teacher/src/main/java/com/cooleshow/teacher/ui/comment/CourseCommentHasReplyFragment.java

@@ -0,0 +1,245 @@
+package com.cooleshow.teacher.ui.comment;
+
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.TextView;
+
+import com.bigkoo.pickerview.builder.TimePickerBuilder;
+import com.bigkoo.pickerview.listener.CustomListener;
+import com.bigkoo.pickerview.view.TimePickerView;
+import com.chad.library.adapter.base.listener.OnLoadMoreListener;
+import com.cooleshow.base.constanst.Constanst;
+import com.cooleshow.base.ui.fragment.BaseMVPFragment;
+import com.cooleshow.base.utils.TimeUtils;
+import com.cooleshow.teacher.R;
+import com.cooleshow.teacher.adapter.CourseCommentNotReplyAdapter;
+import com.cooleshow.teacher.bean.CourseCommentListBean;
+import com.cooleshow.teacher.contract.CourseCommentContract;
+import com.cooleshow.teacher.databinding.FragmentCourseCommentNoReplyLayoutBinding;
+import com.cooleshow.teacher.presenter.comment.CourseCommentPresenter;
+import com.scwang.smart.refresh.layout.api.RefreshLayout;
+import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.LinearLayoutManager;
+
+/**
+ * Author by pq, Date on 2022/5/5.
+ * 陪练课评价-已评价学生
+ */
+public class CourseCommentHasReplyFragment extends BaseMVPFragment<FragmentCourseCommentNoReplyLayoutBinding, CourseCommentPresenter> implements CourseCommentContract.CourseCommentView, View.OnClickListener {
+    public int courseCommentNotReply = 1;//已评价学生
+    private TimePickerView pvTime;
+    private Date currentSelectDate;
+    private String currentFilterDate;
+    private String currentStudentName;
+    private int currentPage = 1;
+    private View mEmptyView;
+    private TextView mTvEmptyTip;
+    private boolean hasNext = true;
+    private CourseCommentNotReplyAdapter mAdapter;
+
+    @Override
+    protected FragmentCourseCommentNoReplyLayoutBinding getLayoutView() {
+        return FragmentCourseCommentNoReplyLayoutBinding.inflate(getLayoutInflater());
+    }
+
+    @Override
+    protected CourseCommentPresenter createPresenter() {
+        return new CourseCommentPresenter();
+    }
+
+    @Override
+    protected void initView(View rootView) {
+
+    }
+
+    @Override
+    protected void initData() {
+        currentSelectDate = TimeUtils.getNowDate();
+        mAdapter = new CourseCommentNotReplyAdapter(R.layout.item_course_comment_list_layout);
+        mViewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+        mViewBinding.recyclerView.setAdapter(mAdapter);
+        initListener();
+        reBuildFilter(currentSelectDate, currentStudentName);
+    }
+
+    private void initListener() {
+        mViewBinding.tvDate.setOnClickListener(this);
+        mViewBinding.tvSearch.setOnClickListener(this);
+        mViewBinding.refreshLayout.setOnRefreshListener(new OnRefreshListener() {
+            @Override
+            public void onRefresh(@NonNull RefreshLayout refreshLayout) {
+                currentPage = 1;
+                queryComment(true);
+            }
+        });
+
+        mAdapter.getLoadMoreModule().setOnLoadMoreListener(new OnLoadMoreListener() {
+            @Override
+            public void onLoadMore() {
+                //上拉加载
+                if (hasNext) {
+                    currentPage++;
+                    queryComment(false);
+                } else {
+                    mAdapter.getLoadMoreModule().loadMoreEnd();
+                }
+            }
+        });
+    }
+
+    /**
+     * 构造筛选条件
+     *
+     * @param date
+     * @param targetStr
+     */
+    private void reBuildFilter(Date date, String targetStr) {
+        currentSelectDate = date != null ? date : TimeUtils.getNowDate();
+        String targetDateTimeStr = TimeUtils.date2String(currentSelectDate, TimeUtils.getSafeDateFormat("yyyy-MM"));
+        if (TextUtils.equals(targetDateTimeStr, currentFilterDate) && TextUtils.equals(targetStr, currentStudentName)) {
+            //防止重复条件触发
+            return;
+        }
+        currentStudentName = targetStr;
+        currentFilterDate = targetDateTimeStr;
+        currentPage = 1;
+        mViewBinding.tvDate.setText(currentFilterDate);
+        queryComment(true);
+    }
+
+    private void queryComment(boolean isShowLoading) {
+        presenter.queryCourseCommentList(isShowLoading, courseCommentNotReply, currentFilterDate, currentStudentName, currentPage);
+    }
+
+
+    /**
+     * 显示时间选择器
+     */
+    private void showTimeSelectPicker() {
+        if (pvTime == null) {
+            pvTime = new TimePickerBuilder(requireContext(), (date, v) -> {//选中事件回调
+                reBuildFilter(date, currentStudentName);
+            }).setLayoutRes(com.cooleshow.base.R.layout.pickerview_default_layout, new CustomListener() {
+                @Override
+                public void customLayout(View v) {
+                    //自定义布局中的控件初始化及事件处理
+                    final TextView tvSubmit = (TextView) v.findViewById(com.cooleshow.base.R.id.tv_finish);
+                    TextView ivCancel = (TextView) v.findViewById(com.cooleshow.base.R.id.tv_cancel);
+                    tvSubmit.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View v) {
+                            pvTime.returnData();
+                            pvTime.dismiss();
+                        }
+                    });
+                    ivCancel.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View v) {
+                            pvTime.dismiss();
+                        }
+                    });
+
+                }
+            })
+                    .setLineSpacingMultiplier(2.5f)
+                    .setType(new boolean[]{true, true, false, false, false, false})// 默认全部显示
+                    .setTextColorCenter(getResources().getColor(com.cooleshow.base.R.color.color_1a1a1a))//设置选中项的颜色
+                    .isDialog(false)//是否显示为对话框样式
+                    .setLabel("年", "月", "", "", "", "")
+                    .build();
+        }
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(currentSelectDate);
+        pvTime.setDate(calendar);
+        if (!pvTime.isShowing()) {
+            pvTime.show();
+        }
+    }
+
+    @Override
+    public void onClick(View v) {
+        if (v.getId() == R.id.tv_date) {
+            //显示时间选择器
+            showTimeSelectPicker();
+            return;
+        }
+
+        if (v.getId() == R.id.tv_search) {
+            //搜索
+            String targetName = mViewBinding.etTargetName.getText().toString();
+            reBuildFilter(currentSelectDate, targetName);
+        }
+    }
+
+    @Override
+    public void queryCourseCommentSuccess(int page, CourseCommentListBean commentListBean) {
+        if (isDetached()) {
+            return;
+        }
+        if (commentListBean != null) {
+            if (page == 1) {
+                //第一页
+                mViewBinding.refreshLayout.finishRefresh();
+                if (mAdapter != null) {
+                    mAdapter.getData().clear();
+                    mAdapter.notifyDataSetChanged();
+                    if (commentListBean.rows != null && commentListBean.rows.size() > 0) {
+                        checkHasNext(commentListBean.rows.size());
+                        mAdapter.setNewInstance(commentListBean.rows);
+                    } else {
+                        showEmptyView();
+                    }
+                }
+            } else {
+                //加载更多
+                if (mAdapter != null) {
+                    if (commentListBean.rows != null && commentListBean.rows.size() > 0) {
+                        mAdapter.getLoadMoreModule().loadMoreComplete();
+                        checkHasNext(commentListBean.rows.size());
+                        mAdapter.addData(commentListBean.rows);
+                    } else {
+                        mAdapter.getLoadMoreModule().loadMoreEnd();
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * 检查是否还有下一页
+     *
+     * @param dataSize
+     */
+    private void checkHasNext(int dataSize) {
+        hasNext = dataSize >= Constanst.DEFAULT_DATA_SIZE;
+    }
+
+    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);
+    }
+
+    @Override
+    public void queryCourseCommentError(int page) {
+        if (isDetached()) {
+            return;
+        }
+        if (page == 1) {
+            mViewBinding.refreshLayout.finishRefresh();
+        } else {
+            if (mAdapter != null) {
+                currentPage--;
+                mAdapter.getLoadMoreModule().loadMoreFail();
+            }
+        }
+    }
+}

+ 213 - 1
teacher/src/main/java/com/cooleshow/teacher/ui/comment/CourseCommentNoReplyFragment.java

@@ -1,16 +1,47 @@
 package com.cooleshow.teacher.ui.comment;
 
+import android.text.TextUtils;
 import android.view.View;
+import android.widget.TextView;
 
+import com.bigkoo.pickerview.builder.TimePickerBuilder;
+import com.bigkoo.pickerview.listener.CustomListener;
+import com.bigkoo.pickerview.view.TimePickerView;
+import com.chad.library.adapter.base.listener.OnLoadMoreListener;
+import com.cooleshow.base.constanst.Constanst;
 import com.cooleshow.base.ui.fragment.BaseMVPFragment;
+import com.cooleshow.base.utils.TimeUtils;
+import com.cooleshow.teacher.R;
+import com.cooleshow.teacher.adapter.CourseCommentNotReplyAdapter;
+import com.cooleshow.teacher.bean.CourseCommentListBean;
 import com.cooleshow.teacher.contract.CourseCommentContract;
 import com.cooleshow.teacher.databinding.FragmentCourseCommentNoReplyLayoutBinding;
 import com.cooleshow.teacher.presenter.comment.CourseCommentPresenter;
+import com.scwang.smart.refresh.layout.api.RefreshLayout;
+import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.LinearLayoutManager;
 
 /**
  * Author by pq, Date on 2022/5/5.
+ * 陪练课评价-未评价学生
  */
-public class CourseCommentNoReplyFragment extends BaseMVPFragment<FragmentCourseCommentNoReplyLayoutBinding, CourseCommentPresenter> implements CourseCommentContract.CourseCommentView {
+public class CourseCommentNoReplyFragment extends BaseMVPFragment<FragmentCourseCommentNoReplyLayoutBinding, CourseCommentPresenter> implements CourseCommentContract.CourseCommentView, View.OnClickListener {
+    public int courseCommentNotReply = 0;//未回复
+    private TimePickerView pvTime;
+    private Date currentSelectDate;
+    private String currentFilterDate;
+    private String currentStudentName;
+    private int currentPage = 1;
+    private View mEmptyView;
+    private TextView mTvEmptyTip;
+    private boolean hasNext = true;
+    private CourseCommentNotReplyAdapter mAdapter;
+
     @Override
     protected FragmentCourseCommentNoReplyLayoutBinding getLayoutView() {
         return FragmentCourseCommentNoReplyLayoutBinding.inflate(getLayoutInflater());
@@ -28,6 +59,187 @@ public class CourseCommentNoReplyFragment extends BaseMVPFragment<FragmentCourse
 
     @Override
     protected void initData() {
+        currentSelectDate = TimeUtils.getNowDate();
+        mAdapter = new CourseCommentNotReplyAdapter(R.layout.item_course_comment_list_layout);
+        mViewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+        mViewBinding.recyclerView.setAdapter(mAdapter);
+        initListener();
+        reBuildFilter(currentSelectDate, currentStudentName);
+    }
+
+    private void initListener() {
+        mViewBinding.tvDate.setOnClickListener(this);
+        mViewBinding.tvSearch.setOnClickListener(this);
+        mViewBinding.refreshLayout.setOnRefreshListener(new OnRefreshListener() {
+            @Override
+            public void onRefresh(@NonNull RefreshLayout refreshLayout) {
+                currentPage = 1;
+                queryComment(true);
+            }
+        });
+
+        mAdapter.getLoadMoreModule().setOnLoadMoreListener(new OnLoadMoreListener() {
+            @Override
+            public void onLoadMore() {
+                //上拉加载
+                if (hasNext) {
+                    currentPage++;
+                    queryComment(false);
+                } else {
+                    mAdapter.getLoadMoreModule().loadMoreEnd();
+                }
+            }
+        });
+    }
 
+    /**
+     * 构造筛选条件
+     *
+     * @param date
+     * @param targetStr
+     */
+    private void reBuildFilter(Date date, String targetStr) {
+        currentSelectDate = date != null ? date : TimeUtils.getNowDate();
+        String targetDateTimeStr = TimeUtils.date2String(currentSelectDate, TimeUtils.getSafeDateFormat("yyyy-MM"));
+        if (TextUtils.equals(targetDateTimeStr, currentFilterDate) && TextUtils.equals(targetStr, currentStudentName)) {
+            //防止重复条件触发
+            return;
+        }
+        currentStudentName = targetStr;
+        currentFilterDate = targetDateTimeStr;
+        currentPage = 1;
+        mViewBinding.tvDate.setText(currentFilterDate);
+        queryComment(true);
+    }
+
+    private void queryComment(boolean isShowLoading) {
+        presenter.queryCourseCommentList(isShowLoading, courseCommentNotReply, currentFilterDate, currentStudentName, currentPage);
+    }
+
+
+    /**
+     * 显示时间选择器
+     */
+    private void showTimeSelectPicker() {
+        if (pvTime == null) {
+            pvTime = new TimePickerBuilder(requireContext(), (date, v) -> {//选中事件回调
+                reBuildFilter(date, currentStudentName);
+            }).setLayoutRes(com.cooleshow.base.R.layout.pickerview_default_layout, new CustomListener() {
+                @Override
+                public void customLayout(View v) {
+                    //自定义布局中的控件初始化及事件处理
+                    final TextView tvSubmit = (TextView) v.findViewById(com.cooleshow.base.R.id.tv_finish);
+                    TextView ivCancel = (TextView) v.findViewById(com.cooleshow.base.R.id.tv_cancel);
+                    tvSubmit.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View v) {
+                            pvTime.returnData();
+                            pvTime.dismiss();
+                        }
+                    });
+                    ivCancel.setOnClickListener(new View.OnClickListener() {
+                        @Override
+                        public void onClick(View v) {
+                            pvTime.dismiss();
+                        }
+                    });
+
+                }
+            })
+                    .setLineSpacingMultiplier(2.5f)
+                    .setType(new boolean[]{true, true, false, false, false, false})// 默认全部显示
+                    .setTextColorCenter(getResources().getColor(com.cooleshow.base.R.color.color_1a1a1a))//设置选中项的颜色
+                    .isDialog(false)//是否显示为对话框样式
+                    .setLabel("年", "月", "", "", "", "")
+                    .build();
+        }
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(currentSelectDate);
+        pvTime.setDate(calendar);
+        if (!pvTime.isShowing()) {
+            pvTime.show();
+        }
+    }
+
+    @Override
+    public void onClick(View v) {
+        if (v.getId() == R.id.tv_date) {
+            //显示时间选择器
+            showTimeSelectPicker();
+            return;
+        }
+
+        if (v.getId() == R.id.tv_search) {
+            //搜索
+            String targetName = mViewBinding.etTargetName.getText().toString();
+            reBuildFilter(currentSelectDate, targetName);
+        }
+    }
+
+    @Override
+    public void queryCourseCommentSuccess(int page, CourseCommentListBean commentListBean) {
+        if (isDetached()) {
+            return;
+        }
+        if (commentListBean != null) {
+            if (page == 1) {
+                //第一页
+                mViewBinding.refreshLayout.finishRefresh();
+                if (mAdapter != null) {
+                    mAdapter.getData().clear();
+                    mAdapter.notifyDataSetChanged();
+                    if (commentListBean.rows != null && commentListBean.rows.size() > 0) {
+                        checkHasNext(commentListBean.rows.size());
+                        mAdapter.setNewInstance(commentListBean.rows);
+                    } else {
+                        showEmptyView();
+                    }
+                }
+            } else {
+                //加载更多
+                if (mAdapter != null) {
+                    if (commentListBean.rows != null && commentListBean.rows.size() > 0) {
+                        mAdapter.getLoadMoreModule().loadMoreComplete();
+                        checkHasNext(commentListBean.rows.size());
+                        mAdapter.addData(commentListBean.rows);
+                    } else {
+                        mAdapter.getLoadMoreModule().loadMoreEnd();
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * 检查是否还有下一页
+     *
+     * @param dataSize
+     */
+    private void checkHasNext(int dataSize) {
+        hasNext = dataSize >= Constanst.DEFAULT_DATA_SIZE;
+    }
+
+    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);
+    }
+
+    @Override
+    public void queryCourseCommentError(int page) {
+        if (isDetached()) {
+            return;
+        }
+        if (page == 1) {
+            mViewBinding.refreshLayout.finishRefresh();
+        } else {
+            if (mAdapter != null) {
+                currentPage--;
+                mAdapter.getLoadMoreModule().loadMoreFail();
+            }
+        }
     }
 }

+ 28 - 7
teacher/src/main/java/com/cooleshow/teacher/ui/comment/ReceivedCommentActivity.java

@@ -58,7 +58,7 @@ public class ReceivedCommentActivity extends BaseMVPActivity<ActivityReceivedCom
 
     @Override
     protected void initView() {
-        viewBinding.tvDate.setOnClickListener(this);
+
     }
 
     @Override
@@ -74,6 +74,7 @@ public class ReceivedCommentActivity extends BaseMVPActivity<ActivityReceivedCom
     }
 
     private void initListener() {
+        viewBinding.tvDate.setOnClickListener(this);
         viewBinding.tvSearch.setOnClickListener(this);
         viewBinding.refreshLayout.setOnRefreshListener(new OnRefreshListener() {
             @Override
@@ -97,6 +98,12 @@ public class ReceivedCommentActivity extends BaseMVPActivity<ActivityReceivedCom
         });
     }
 
+    /**
+     * 构造选择条件
+     *
+     * @param date
+     * @param targetName
+     */
     private void reBuildFilter(Date date, String targetName) {
         currentSelectDate = date != null ? date : TimeUtils.getNowDate();
         String targetDateTimeStr = TimeUtils.date2String(currentSelectDate, TimeUtils.getSafeDateFormat("yyyy-MM"));
@@ -111,9 +118,6 @@ public class ReceivedCommentActivity extends BaseMVPActivity<ActivityReceivedCom
         queryComment(true);
     }
 
-    private void checkHasNext(int dataSize) {
-        hasNext = dataSize >= Constanst.DEFAULT_DATA_SIZE;
-    }
 
     private void queryComment(boolean isShowLoading) {
         presenter.queryReceivedComment(isShowLoading, currentFilterDate, currentStudentName, currentPage);
@@ -130,9 +134,6 @@ public class ReceivedCommentActivity extends BaseMVPActivity<ActivityReceivedCom
         if (v.getId() == R.id.tv_search) {
             //搜索
             String targetName = viewBinding.etTargetName.getText().toString();
-//            if (TextUtils.isEmpty(targetName)) {
-//                return;
-//            }
             reBuildFilter(currentSelectDate, targetName);
         }
     }
@@ -148,6 +149,9 @@ public class ReceivedCommentActivity extends BaseMVPActivity<ActivityReceivedCom
     }
 
 
+    /**
+     * 显示时间选择器
+     */
     private void showTimeSelectPicker() {
         if (pvTime == null) {
             pvTime = new TimePickerBuilder(this, (date, v) -> {//选中事件回调
@@ -223,6 +227,9 @@ public class ReceivedCommentActivity extends BaseMVPActivity<ActivityReceivedCom
         }
     }
 
+    /**
+     * 显示空视图
+     */
     private void showEmptyView() {
         if (mEmptyView == null) {
             mEmptyView = getLayoutInflater().inflate(com.cooleshow.base.R.layout.empty_layout, mListAdapter.getEmptyLayout(), false);
@@ -232,6 +239,11 @@ public class ReceivedCommentActivity extends BaseMVPActivity<ActivityReceivedCom
         mListAdapter.setEmptyView(mEmptyView);
     }
 
+    /**
+     * 查询列表数据失败
+     *
+     * @param page
+     */
     @Override
     public void queryCommentError(int page) {
         if (isFinishing() || isDestroyed()) {
@@ -246,4 +258,13 @@ public class ReceivedCommentActivity extends BaseMVPActivity<ActivityReceivedCom
             }
         }
     }
+
+    /**
+     * 检查是否还有下一页
+     *
+     * @param dataSize
+     */
+    private void checkHasNext(int dataSize) {
+        hasNext = dataSize >= Constanst.DEFAULT_DATA_SIZE;
+    }
 }

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

@@ -36,6 +36,7 @@ class HomeFragment : BaseMVPFragment<FragmentHomeLayoutBinding, HomePresenter>()
         mViewBinding.ivUnCertificationTip.setOnClickListener(this)
         mViewBinding.cardMineIncome.setOnClickListener(this)
         mViewBinding.cardMineAssess.setOnClickListener(this)
+        mViewBinding.cardAfterClassAssess.setOnClickListener(this)
     }
 
     override fun createPresenter(): HomePresenter {
@@ -136,6 +137,10 @@ class HomeFragment : BaseMVPFragment<FragmentHomeLayoutBinding, HomePresenter>()
                 ARouter.getInstance().build(RouterPath.CommentCenter.TEACHER_RECEIVED_COMMENT)
                     .navigation()
             }
+            R.id.card_after_class_assess->{
+                ARouter.getInstance().build(RouterPath.CommentCenter.TEACHER_COURSE_COMMENT)
+                    .navigation()
+            }
         }
     }
 

+ 1 - 1
teacher/src/main/res/layout/activity_course_comment_layout.xml

@@ -18,7 +18,7 @@
         app:layout_constraintTop_toBottomOf="@+id/toolbar_include">
 
         <RadioButton
-            android:id="@+id/rb_not_rated"
+            android:id="@+id/rb_not_reply"
             android:layout_width="@dimen/dp_0"
             android:layout_height="match_parent"
             android:layout_weight="1"

+ 91 - 0
teacher/src/main/res/layout/fragment_course_comment_no_reply_layout.xml

@@ -1,6 +1,97 @@
 <?xml version="1.0" encoding="utf-8"?>
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
+    <TextView
+        android:id="@+id/tv_date"
+        android:layout_width="wrap_content"
+        android:layout_height="36dp"
+        android:drawableRight="@drawable/icon_arrow_down"
+        android:drawablePadding="3dp"
+        android:gravity="center"
+        android:paddingStart="14dp"
+        android:paddingEnd="14dp"
+        android:textColor="@color/color_333333"
+        android:textSize="@dimen/sp_14"
+        app:layout_constraintBottom_toBottomOf="@+id/view_search_bg"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toTopOf="@+id/view_search_bg"
+        tools:text="2021年9月" />
+
+    <View
+        android:id="@+id/view_search_bg"
+        android:layout_width="0dp"
+        android:layout_height="36dp"
+        android:layout_marginTop="16dp"
+        android:layout_marginEnd="14dp"
+        android:background="@drawable/bg_white_18dp"
+        app:layout_constraintLeft_toRightOf="@+id/tv_date"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <ImageView
+        android:id="@+id/iv_search_icon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="11dp"
+        android:src="@drawable/icon_search"
+        app:layout_constraintBottom_toBottomOf="@+id/view_search_bg"
+        app:layout_constraintLeft_toLeftOf="@+id/view_search_bg"
+        app:layout_constraintTop_toTopOf="@+id/view_search_bg" />
+
+    <EditText
+        android:id="@+id/et_target_name"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginEnd="5dp"
+        android:background="@null"
+        android:ellipsize="end"
+        android:hint="请输入学员姓名"
+        android:maxLines="1"
+        android:paddingStart="8dp"
+        android:textColor="@color/color_333333"
+        android:textColorHint="@color/color_999999"
+        android:textSize="@dimen/sp_13"
+        app:layout_constraintBottom_toBottomOf="@+id/view_search_bg"
+        app:layout_constraintLeft_toRightOf="@+id/iv_search_icon"
+        app:layout_constraintRight_toLeftOf="@+id/tv_search"
+        app:layout_constraintTop_toTopOf="@+id/view_search_bg" />
+
+
+    <TextView
+        android:id="@+id/tv_search"
+        android:layout_width="56dp"
+        android:layout_height="28dp"
+        android:layout_marginEnd="4dp"
+        android:background="@drawable/shape_1ecdac_18dp"
+        android:gravity="center"
+        android:text="搜索"
+        android:textColor="@color/white"
+        android:textSize="@dimen/sp_14"
+        app:layout_constraintBottom_toBottomOf="@+id/view_search_bg"
+        app:layout_constraintRight_toRightOf="@+id/view_search_bg"
+        app:layout_constraintTop_toTopOf="@+id/view_search_bg" />
+
+
+    <com.scwang.smart.refresh.layout.SmartRefreshLayout
+        android:id="@+id/refreshLayout"
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/view_search_bg">
+
+        <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>

+ 80 - 0
teacher/src/main/res/layout/item_course_comment_list_layout.xml

@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_marginStart="14dp"
+    android:layout_marginTop="12dp"
+    android:layout_marginEnd="14dp"
+    android:background="@drawable/bg_white_10dp"
+    android:paddingStart="11dp"
+    android:paddingEnd="11dp"
+    android:paddingBottom="15dp">
+
+    <com.cooleshow.base.widgets.QMUIRadiusImageView
+        android:id="@+id/iv_avatar"
+        android:layout_width="47dp"
+        android:layout_height="51dp"
+        android:layout_marginTop="15dp"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:qmui_corner_radius="5dp" />
+
+
+    <TextView
+        android:id="@+id/tv_title"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="10dp"
+        android:layout_marginTop="3dp"
+        android:includeFontPadding="false"
+        android:textColor="@color/color_1a1a1a"
+        android:textSize="@dimen/sp_16"
+        android:textStyle="bold"
+        app:layout_constraintLeft_toRightOf="@+id/iv_avatar"
+        app:layout_constraintTop_toTopOf="@+id/iv_avatar"
+        tools:text="张豆豆" />
+
+    <TextView
+        android:id="@+id/tv_course_name"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="5dp"
+        android:background="@drawable/shape_couse_type_text_bg"
+        android:gravity="center"
+        android:includeFontPadding="false"
+        android:paddingStart="4dp"
+        android:paddingTop="2dp"
+        android:paddingEnd="4dp"
+        android:paddingBottom="2dp"
+        android:textColor="@color/color_ff8c00"
+        android:textSize="@dimen/sp_11"
+        app:layout_constraintBottom_toBottomOf="@+id/tv_title"
+        app:layout_constraintLeft_toRightOf="@+id/tv_title"
+        app:layout_constraintTop_toTopOf="@+id/tv_title"
+        tools:text="单簧管" />
+
+
+    <ImageView
+        android:id="@+id/iv_clock_icon"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="11dp"
+        android:src="@drawable/icon_clock"
+        app:layout_constraintBottom_toBottomOf="@+id/iv_avatar"
+        app:layout_constraintLeft_toLeftOf="@+id/tv_title" />
+
+    <TextView
+        android:id="@+id/tv_time"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="6dp"
+        android:includeFontPadding="false"
+        android:textColor="@color/color_666666"
+        android:textSize="@dimen/sp_13"
+        app:layout_constraintBottom_toBottomOf="@+id/iv_clock_icon"
+        app:layout_constraintLeft_toRightOf="@+id/iv_clock_icon"
+        app:layout_constraintTop_toTopOf="@+id/iv_clock_icon"
+        tools:text="2021/09/17 14:00~14:25" />
+</androidx.constraintlayout.widget.ConstraintLayout>