소스 검색

添加云库琴房课程详情页面

Pq 3 년 전
부모
커밋
327dbad8a6
18개의 변경된 파일880개의 추가작업 그리고 9개의 파일을 삭제
  1. 9 0
      BaseLibrary/src/main/java/com/cooleshow/base/common/WebApi.java
  2. 1 0
      BaseLibrary/src/main/java/com/cooleshow/base/router/RouterPath.kt
  3. 9 0
      BaseLibrary/src/main/res/drawable/shape_piano_room_course_icon.xml
  4. 5 0
      teacher/src/main/AndroidManifest.xml
  5. 33 0
      teacher/src/main/java/com/cooleshow/teacher/adapter/PianoRoomCourseStudentListAdapter.java
  6. 22 1
      teacher/src/main/java/com/cooleshow/teacher/api/APIService.java
  7. 47 0
      teacher/src/main/java/com/cooleshow/teacher/bean/PianoRoomCourseCommentBean.java
  8. 87 0
      teacher/src/main/java/com/cooleshow/teacher/bean/PianoRoomCourseHomeworkBean.java
  9. 25 0
      teacher/src/main/java/com/cooleshow/teacher/contract/PianoRoomCourseDetailContract.java
  10. 81 0
      teacher/src/main/java/com/cooleshow/teacher/presenter/course/PianoRoomDetailPresenter.java
  11. 211 0
      teacher/src/main/java/com/cooleshow/teacher/ui/course/PianoRoomCourseDetailActivity.java
  12. 1 0
      teacher/src/main/java/com/cooleshow/teacher/ui/course/SparringCourseDetailActivity.java
  13. 47 8
      teacher/src/main/java/com/cooleshow/teacher/widgets/helper/JsInterfaceUtils.java
  14. BIN
      teacher/src/main/res/drawable-xhdpi/icon_piano_room_course_people_num.png
  15. BIN
      teacher/src/main/res/drawable-xxhdpi/icon_piano_room_course_people_num.png
  16. 248 0
      teacher/src/main/res/layout/activity_piano_room_detail_layout.xml
  17. 53 0
      teacher/src/main/res/layout/item_piano_room_student_layout.xml
  18. 1 0
      teacher/src/main/res/values/styles.xml

+ 9 - 0
BaseLibrary/src/main/java/com/cooleshow/base/common/WebApi.java

@@ -0,0 +1,9 @@
+package com.cooleshow.base.common;
+
+/**
+ * Author by pq, Date on 2022/6/24.
+ */
+public class WebApi {
+    //打开云库琴房详情页
+    public static final String openCourseDetail = "openCourseDetail";
+}

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

@@ -56,6 +56,7 @@ object RouterPath {
         companion object {
             const val TEACHER_MINE_COURSE = "/teacher/ui/course/MineCourseActivity"
             const val SPARRING_COURSE_DETAIL = "/teacher/ui/course/SparringCourseDetailActivity"
+            const val PIANO_ROOM_COURSE_DETAIL = "/ui/course/PianoRoomCourseDetailActivity"
             const val TEACHER_MINE_LIVE_COURSE = "/teacher/ui/course/MineLiveCourseActivity"
             const val TEACHER_MINE_CREATE_LIVE_COURSE_INFO = "/teacher/ui/course/CreateLiveCourseInfoActivity"
             const val TEACHER_MINE_CREATE_LIVE_COURSE_ARRANGEMENT = "/teacher/ui/course/CreateLiveCourseArrangementActivity"

+ 9 - 0
BaseLibrary/src/main/res/drawable/shape_piano_room_course_icon.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <corners android:radius="5dp"/>
+    <gradient
+        android:angle="270"
+        android:endColor="#FF7021"
+        android:startColor="#FFBC90" />
+</shape>

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

@@ -85,6 +85,11 @@
             android:name=".ui.course.SparringCourseDetailActivity"
             android:configChanges="orientation|screenSize|keyboardHidden"
             android:screenOrientation="portrait" />
+
+        <activity
+            android:name=".ui.course.PianoRoomCourseDetailActivity"
+            android:configChanges="orientation|screenSize|keyboardHidden"
+            android:screenOrientation="portrait" />
         <activity
             android:name=".ui.comment.ReceivedCommentActivity"
             android:configChanges="orientation|screenSize|keyboardHidden"

+ 33 - 0
teacher/src/main/java/com/cooleshow/teacher/adapter/PianoRoomCourseStudentListAdapter.java

@@ -0,0 +1,33 @@
+package com.cooleshow.teacher.adapter;
+
+import android.view.View;
+import android.widget.ImageView;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.viewholder.BaseViewHolder;
+import com.cooleshow.base.utils.GlideUtils;
+import com.cooleshow.teacher.R;
+import com.cooleshow.teacher.bean.PianoRoomCourseHomeworkBean;
+
+import androidx.annotation.NonNull;
+
+/**
+ * Author by pq, Date on 2022/6/24.
+ */
+public class PianoRoomCourseStudentListAdapter extends BaseQuickAdapter<PianoRoomCourseHomeworkBean.StudentHomeworkListBean.RecordsBean, BaseViewHolder> {
+
+    public PianoRoomCourseStudentListAdapter(int layoutResId) {
+        super(layoutResId);
+    }
+
+    @Override
+    protected void convert(@NonNull BaseViewHolder holder, PianoRoomCourseHomeworkBean.StudentHomeworkListBean.RecordsBean data) {
+        //头像
+        ImageView iv_avatar = holder.getView(R.id.iv_avatar);
+        GlideUtils.INSTANCE.loadImage(getContext(), data.studentAvatar, iv_avatar, R.drawable.icon_teacher_default_head);
+        //名称
+        holder.setText(R.id.tv_name, data.studentName);
+        //subjectName
+        holder.setText(R.id.tv_course_name, data.subjectName);
+    }
+}

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

@@ -18,6 +18,8 @@ import com.cooleshow.teacher.bean.MineVideoCourseListBean;
 import com.cooleshow.teacher.bean.MusicSheetListBean;
 import com.cooleshow.teacher.bean.MusicSheetShareBean;
 import com.cooleshow.teacher.bean.PayTestBean;
+import com.cooleshow.teacher.bean.PianoRoomCourseCommentBean;
+import com.cooleshow.teacher.bean.PianoRoomCourseHomeworkBean;
 import com.cooleshow.teacher.bean.ReceivedCommentListBean;
 import com.cooleshow.teacher.bean.ResponseBankCardBean;
 import com.cooleshow.teacher.bean.ResponseBindCardBean;
@@ -104,7 +106,7 @@ public interface APIService {
 
 
     /**
-     * 查询个人信息
+     * 查询陪练课作业信息
      *
      * @param
      * @return
@@ -112,6 +114,15 @@ public interface APIService {
     @GET(TEACHER_GROUP + "homework/detail/{courseId}/{studentId}")
     Observable<BaseResponse<SparringCourseHomeworkBean>> getSparringCourseHomework(@Path("courseId") String courseId, @Path("studentId") String studentId);
 
+    /**
+     * 查询琴房课作业信息
+     *
+     * @param
+     * @return
+     */
+    @POST(TEACHER_GROUP + "homework/detail/list")
+    Observable<BaseResponse<PianoRoomCourseHomeworkBean>> getPianoRoomCourseHomework(@Body RequestBody body);
+
 
     /**
      * 查询课程评价信息
@@ -122,6 +133,16 @@ public interface APIService {
     @POST(TEACHER_GROUP + "courseReplied/selectReplied")
     Observable<BaseResponse<SparringCourseCommentBean>> getSparringCourseComment(@Body RequestBody body);
 
+
+    /**
+     * 查询琴房课评价信息
+     *
+     * @param
+     * @return
+     */
+    @POST(TEACHER_GROUP + "courseReplied/selectReplied")
+    Observable<BaseResponse<PianoRoomCourseCommentBean>> getPianoRoomCourseComment(@Body RequestBody body);
+
     /**
      * 提交陪练课老师评价
      *

+ 47 - 0
teacher/src/main/java/com/cooleshow/teacher/bean/PianoRoomCourseCommentBean.java

@@ -0,0 +1,47 @@
+package com.cooleshow.teacher.bean;
+
+/**
+ * Author by pq, Date on 2022/4/27.
+ */
+public class PianoRoomCourseCommentBean {
+
+    /**
+     * status : COMPLETE
+     * userName : cy
+     * startTime : 2022-03-26 11:24:53
+     * endTime : 2022-03-26 12:24:57
+     * avatar : https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png
+     * subjectId : 1
+     * subjectName : 西洋管乐
+     * classDate : 2022-03-26
+     * updateTime : 2022-04-20 16:49:58
+     * studentId : 44
+     * courseGroupId : 1
+     * courseGroupType : PRACTICE
+     * courseScheduleId : 1
+     * score : 4
+     * teacherReplied : Gaggagagagagagagagagagagagagagagagagagagaga
+     * createTime : 2022-04-14 11:40:25
+     * studentReplied : Gagagagagagagag
+     * id : 19
+     */
+
+    public String status;
+    public String userName;
+    public String startTime;
+    public String endTime;
+    public String avatar;
+    public int subjectId;
+    public String subjectName;
+    public String classDate;
+    public String updateTime;
+    public int studentId;
+    public String courseGroupId;
+    public String courseGroupType;
+    public int courseScheduleId;
+    public int score;
+    public String teacherReplied;
+    public String createTime;
+    public String studentReplied;
+    public int id;
+}

+ 87 - 0
teacher/src/main/java/com/cooleshow/teacher/bean/PianoRoomCourseHomeworkBean.java

@@ -0,0 +1,87 @@
+package com.cooleshow.teacher.bean;
+
+import java.util.List;
+
+/**
+ * Author by pq, Date on 2022/4/27.
+ */
+public class PianoRoomCourseHomeworkBean {
+
+    /**
+     * attachments :
+     * backgroundPic :
+     * classDate :
+     * classNum : 0
+     * content :
+     * courseGroupId : 0
+     * courseGroupName :
+     * courseId : 0
+     * courseStatus :
+     * decorateHomework :
+     * decorateTime :
+     * endTime :
+     * imGroupId :
+     * startTime :
+     * studentHomeworkList : {"current":0,"pages":0,"records":[{"homeworkStatus":"","studentAvatar":"","studentId":0,"studentName":"","subjectName":"","submitHomework":""}],"searchCount":true,"size":0,"total":0}
+     * studentNum : 0
+     * subjectName :
+     * title :
+     * type :
+     */
+
+    public String attachments;
+    public String backgroundPic;
+    public String classDate;
+    public int classNum;
+    public String content;
+    public int courseGroupId;
+    public String courseGroupName;
+    public int courseId;
+    public String courseStatus;
+    public int decorateHomework;
+    public String decorateTime;
+    public String endTime;
+    public String imGroupId;
+    public String startTime;
+    public StudentHomeworkListBean studentHomeworkList;
+    public String studentNum;
+    public String subjectName;
+    public String title;
+    public String type;
+
+    public static class StudentHomeworkListBean {
+        /**
+         * current : 0
+         * pages : 0
+         * records : [{"homeworkStatus":"","studentAvatar":"","studentId":0,"studentName":"","subjectName":"","submitHomework":""}]
+         * searchCount : true
+         * size : 0
+         * total : 0
+         */
+
+        public int current;
+        public int pages;
+        public boolean searchCount;
+        public int size;
+        public int total;
+        public List<RecordsBean> records;
+
+        public static class RecordsBean {
+            /**
+             * homeworkStatus :
+             * studentAvatar :
+             * studentId : 0
+             * studentName :
+             * subjectName :
+             * submitHomework :
+             */
+
+            public String homeworkStatus;
+            public String studentAvatar;
+            public int studentId;
+            public String studentName;
+            public String subjectName;
+            public String submitHomework;
+        }
+    }
+}

+ 25 - 0
teacher/src/main/java/com/cooleshow/teacher/contract/PianoRoomCourseDetailContract.java

@@ -0,0 +1,25 @@
+package com.cooleshow.teacher.contract;
+
+import com.cooleshow.base.presenter.view.BaseView;
+import com.cooleshow.teacher.bean.PianoRoomCourseCommentBean;
+import com.cooleshow.teacher.bean.PianoRoomCourseHomeworkBean;
+import com.cooleshow.teacher.bean.SparringCourseCommentBean;
+import com.cooleshow.teacher.bean.SparringCourseHomeworkBean;
+
+/**
+ * Author by pq, Date on 2022/4/20.
+ */
+public interface PianoRoomCourseDetailContract {
+
+    interface PianoRoomCourseDetailView extends BaseView {
+        void getCourseInfoSuccess(PianoRoomCourseHomeworkBean bean);
+
+        void submitSparringCourseHomeworkSuccess();
+    }
+
+    interface Presenter {
+        void getCourseInfo(String courseId);
+
+        void submitSparringCourseHomework(String commentContent, String courseScheduleId);
+    }
+}

+ 81 - 0
teacher/src/main/java/com/cooleshow/teacher/presenter/course/PianoRoomDetailPresenter.java

@@ -0,0 +1,81 @@
+package com.cooleshow.teacher.presenter.course;
+
+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.PianoRoomCourseCommentBean;
+import com.cooleshow.teacher.bean.PianoRoomCourseHomeworkBean;
+import com.cooleshow.teacher.bean.SparringCourseCommentBean;
+import com.cooleshow.teacher.bean.SparringCourseHomeworkBean;
+import com.cooleshow.teacher.contract.PianoRoomCourseDetailContract;
+import com.cooleshow.teacher.contract.SparringCourseDetailContract;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * Author by pq, Date on 2022/4/27.
+ */
+public class PianoRoomDetailPresenter extends BasePresenter<PianoRoomCourseDetailContract.PianoRoomCourseDetailView> implements PianoRoomCourseDetailContract.Presenter {
+
+    @Override
+    public void getCourseInfo(String courseId) {
+        if (getView() != null) {
+            getView().showLoading();
+        }
+        JSONObject jsonObject = new JSONObject();
+        try {
+            jsonObject.putOpt("courseId", courseId);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+        addSubscribe(create(APIService.class).getPianoRoomCourseHomework(RequestBodyUtil.convertToRequestBodyJson(jsonObject.toString())), new BaseObserver<PianoRoomCourseHomeworkBean>(getView()) {
+            @Override
+            protected void onSuccess(PianoRoomCourseHomeworkBean data) {
+                if (getView() != null) {
+                    getView().getCourseInfoSuccess(data);
+                }
+            }
+
+            @Override
+            public void onError(Throwable e) {
+                super.onError(e);
+            }
+        });
+    }
+
+    /**
+     * 提交布置作业
+     * @param commentContent
+     * @param courseScheduleId
+     */
+    @Override
+    public void submitSparringCourseHomework(String commentContent, String courseScheduleId) {
+        if (getView() != null) {
+            getView().showLoading();
+        }
+        JSONObject jsonObject = new JSONObject();
+        try {
+            jsonObject.putOpt("courseScheduleId", courseScheduleId);
+            jsonObject.putOpt("content", commentContent);
+            jsonObject.putOpt("attachments", commentContent);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        addSubscribe(create(APIService.class).submitSparringCourseHomework(RequestBodyUtil.convertToRequestBodyJson(jsonObject.toString())), new BaseObserver<Object>(getView()) {
+            @Override
+            protected void onSuccess(Object o) {
+                if (getView() != null) {
+                    getView().submitSparringCourseHomeworkSuccess();
+                }
+            }
+
+            @Override
+            public void onError(Throwable e) {
+                super.onError(e);
+            }
+        });
+    }
+}

+ 211 - 0
teacher/src/main/java/com/cooleshow/teacher/ui/course/PianoRoomCourseDetailActivity.java

@@ -0,0 +1,211 @@
+package com.cooleshow.teacher.ui.course;
+
+import android.graphics.Color;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.View;
+
+import com.alibaba.android.arouter.facade.annotation.Route;
+import com.cooleshow.base.router.RouterPath;
+import com.cooleshow.base.ui.activity.BaseMVPActivity;
+import com.cooleshow.base.utils.GlideUtils;
+import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
+import com.cooleshow.base.widgets.EmptyViewLayout;
+import com.cooleshow.teacher.R;
+import com.cooleshow.teacher.adapter.PianoRoomCourseStudentListAdapter;
+import com.cooleshow.teacher.bean.PianoRoomCourseCommentBean;
+import com.cooleshow.teacher.bean.PianoRoomCourseHomeworkBean;
+import com.cooleshow.teacher.bean.SparringCourseHomeworkBean;
+import com.cooleshow.teacher.constants.CourseConstants;
+import com.cooleshow.teacher.contract.PianoRoomCourseDetailContract;
+import com.cooleshow.teacher.databinding.ActivityPianoRoomDetailLayoutBinding;
+import com.cooleshow.teacher.presenter.course.PianoRoomDetailPresenter;
+import com.cooleshow.teacher.widgets.CourseSetCommentDialog;
+import com.cooleshow.usercenter.helper.UserHelper;
+
+import java.util.List;
+
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.LinearLayoutManager;
+
+/**
+ * Author by pq, Date on 2022/6/24.
+ * 琴房课详情页面
+ */
+@Route(path = RouterPath.CourseCenter.PIANO_ROOM_COURSE_DETAIL)
+public class PianoRoomCourseDetailActivity extends BaseMVPActivity<ActivityPianoRoomDetailLayoutBinding, PianoRoomDetailPresenter> implements PianoRoomCourseDetailContract.PianoRoomCourseDetailView, View.OnClickListener {
+    public static final String COURSE_ID = "course_id";
+
+    private String mCourseId;
+    private PianoRoomCourseStudentListAdapter mAdapter;
+    private CourseSetCommentDialog mSetCommentDialog;
+
+    @Override
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        QMUIStatusBarHelper.setStatusBarLightMode(this);
+    }
+
+    @Override
+    protected void initView() {
+        mCourseId = getIntent().getStringExtra(COURSE_ID);
+        if (TextUtils.isEmpty(mCourseId)) {
+            finish();
+            return;
+        }
+
+        viewBinding.tvSetHomework.setOnClickListener(this);
+    }
+
+    @Override
+    public void initData() {
+        super.initData();
+        initMidTitleToolBar(viewBinding.toolbarInclude.toolbar, "课程详情");
+        viewBinding.toolbarInclude.toolbar.setBackgroundColor(Color.WHITE);
+        EmptyViewLayout emptyViewLayout = new EmptyViewLayout(this);
+        emptyViewLayout.setContent(com.cooleshow.base.R.drawable.icon_empty_course, "暂无学员");
+        mAdapter = new PianoRoomCourseStudentListAdapter(R.layout.item_piano_room_student_layout);
+        mAdapter.setEmptyView(emptyViewLayout);
+        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
+        viewBinding.recyclerView.setLayoutManager(linearLayoutManager);
+        viewBinding.recyclerView.setAdapter(mAdapter);
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        refresh();
+    }
+
+    private void refresh() {
+        if (presenter != null) {
+            presenter.getCourseInfo(mCourseId);
+        }
+    }
+
+    @Override
+    protected ActivityPianoRoomDetailLayoutBinding getLayoutView() {
+        return ActivityPianoRoomDetailLayoutBinding.inflate(getLayoutInflater());
+    }
+
+    @Override
+    protected PianoRoomDetailPresenter createPresenter() {
+        return new PianoRoomDetailPresenter();
+    }
+
+    @Override
+    public void getCourseInfoSuccess(PianoRoomCourseHomeworkBean infoBean) {
+        if (!checkActivityExist()) {
+            return;
+        }
+        if (infoBean == null) {
+            return;
+        }
+        //时间
+        viewBinding.tvCourseTime.setText(infoBean.classDate);
+        //title
+        viewBinding.tvTitle.setText(infoBean.courseGroupName);
+        //subjectName
+        viewBinding.tvCourseName.setText(infoBean.subjectName);
+        //学生人数
+        viewBinding.tvCoursePeopleNum.setText(String.format("%s人", infoBean.studentNum));
+        String status = infoBean.courseStatus;
+        if (TextUtils.equals(CourseConstants.COURSE_STATUS_NOT_START, status)) {
+            //课程未开始
+            viewBinding.tvCourseStatus.setText(getString(R.string.course_not_start_str));
+            viewBinding.tvCourseStatus.setTextColor(getResources().getColor(com.cooleshow.base.R.color.color_ff802c));
+        }
+        if (TextUtils.equals(CourseConstants.COURSE_STATUS_ING, status)) {
+            //课程进行中
+            viewBinding.tvCourseStatus.setText(R.string.course_ing_str);
+            viewBinding.tvCourseStatus.setTextColor(getResources().getColor(com.cooleshow.base.R.color.color_2dc7aa));
+        }
+        if (TextUtils.equals(CourseConstants.COURSE_STATUS_COMPLETE, status)) {
+            //课程已结束
+            viewBinding.tvCourseStatus.setText(R.string.course_is_completed);
+            viewBinding.tvCourseStatus.setTextColor(getResources().getColor(com.cooleshow.base.R.color.color_999999));
+        }
+        //课后作业信息
+        handleHomeworkData(infoBean);
+        //学生列表数据
+        handleStudentList(infoBean);
+    }
+
+    /**
+     * 提交布置作业成功
+     */
+    @Override
+    public void submitSparringCourseHomeworkSuccess() {
+        if (!checkActivityExist()) {
+            return;
+        }
+        refresh();
+    }
+
+    /**
+     * 绑定学生列表数据
+     *
+     * @param infoBean
+     */
+    private void handleStudentList(PianoRoomCourseHomeworkBean infoBean) {
+        if (mAdapter != null && infoBean != null && infoBean.studentHomeworkList != null) {
+            List<PianoRoomCourseHomeworkBean.StudentHomeworkListBean.RecordsBean> records = infoBean.studentHomeworkList.records;
+            if (records != null && records.size() > 0) {
+                mAdapter.setNewInstance(records);
+            } else {
+                mAdapter.notifyDataSetChanged();
+            }
+        }
+    }
+
+
+    /**
+     * 课后作业
+     */
+    private void handleHomeworkData(PianoRoomCourseHomeworkBean bean) {
+        if (bean == null) {
+            return;
+        }
+        if (bean.decorateHomework == CourseConstants.COURSE_HOMEWORK_SET) {
+            //已布置课后作业
+            viewBinding.tvHomeworkEmptyText.setVisibility(View.GONE);
+            viewBinding.tvHomeworkContent.setVisibility(View.VISIBLE);
+            viewBinding.tvHomeworkContent.setText(bean.content);
+            viewBinding.tvSetHomework.setVisibility(View.GONE);
+        } else {
+            //未布置课后作业
+            viewBinding.tvHomeworkEmptyText.setVisibility(View.VISIBLE);
+            viewBinding.tvHomeworkContent.setVisibility(View.GONE);
+            viewBinding.tvSetHomework.setVisibility(View.VISIBLE);
+        }
+    }
+
+    @Override
+    public void onClick(View v) {
+        int id = v.getId();
+        if (id == R.id.tv_set_homework) {
+            //布置作业
+            showSetCommentDialog();
+            return;
+        }
+    }
+
+    private void showSetCommentDialog() {
+        if (mSetCommentDialog == null) {
+            mSetCommentDialog = new CourseSetCommentDialog(this);
+            mSetCommentDialog.setOnSubmitClickListener(new CourseSetCommentDialog.OnSubmitClickListener() {
+                @Override
+                public void onSubmit(String content, int type) {
+                    if (type == CourseSetCommentDialog.TYPE_SET_HOMEWORK) {
+                        //提交布置作业
+                        presenter.submitSparringCourseHomework(content, mCourseId);
+                    }
+                }
+            });
+        }
+        if (!mSetCommentDialog.isShowing()) {
+            mSetCommentDialog.show();
+        }
+        mSetCommentDialog.showMethod(CourseSetCommentDialog.TYPE_SET_HOMEWORK);
+    }
+}

+ 1 - 0
teacher/src/main/java/com/cooleshow/teacher/ui/course/SparringCourseDetailActivity.java

@@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
 
 /**
  * Author by pq, Date on 2022/4/27.
+ * 陪练课详情页
  */
 @Route(path = RouterPath.CourseCenter.SPARRING_COURSE_DETAIL)
 public class SparringCourseDetailActivity extends BaseMVPActivity<ActivitySparringCourseDetailLayoutBinding, SparringCourseDetailPresenter> implements SparringCourseDetailContract.SparringCourseDetailView, View.OnClickListener {

+ 47 - 8
teacher/src/main/java/com/cooleshow/teacher/widgets/helper/JsInterfaceUtils.java

@@ -11,6 +11,7 @@ import android.view.WindowManager;
 import android.webkit.JavascriptInterface;
 
 import com.alibaba.android.arouter.launcher.ARouter;
+import com.cooleshow.base.common.WebApi;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.usercenter.UserConstants;
 import com.cooleshow.usercenter.helper.UserHelper;
@@ -25,7 +26,6 @@ import io.rong.imlib.model.UserInfo;
  * Description:
  * Copyright  : Copyright (c) 2016
  * Company    : 大雅
- * Author     : 刘瑞
  * Date       : 2018/11/12 15:23
  */
 public class JsInterfaceUtils extends Object {
@@ -51,6 +51,7 @@ public class JsInterfaceUtils extends Object {
                 String api = jsonObject.getString("api");
                 if ("back".equals(api)) {
                     activity.finish();
+                    return;
                 }
                 if ("login".equals(api)) {
                     UserHelper.saveUserToken("");
@@ -59,6 +60,7 @@ public class JsInterfaceUtils extends Object {
                             .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK)
                             .navigation();
                     activity.finish();
+                    return;
                 }
                 if ("openConversationActivity".equals(api)) {
                     JSONObject contentBean = jsonObject.getJSONObject("content");
@@ -70,6 +72,7 @@ public class JsInterfaceUtils extends Object {
                                     Uri.parse(contentBean.getString("img"))));
                         }
                     }
+                    return;
                 }
                 if (TextUtils.equals("chooseFile", api)) {
                     //选择文件
@@ -82,30 +85,38 @@ public class JsInterfaceUtils extends Object {
                     JSONObject content = jsonObject.getJSONObject("content");
                     int orientation = content.getInt("orientation");
                     activity.setRequestedOrientation(orientation);
-                    if (onListener != null)
+                    if (onListener != null) {
                         onListener.onSendMessage(content.toString());
+                    }
+                    return;
                 }
 
                 if ("keepScreenLongLight".equals(api)) {
                     JSONObject content = jsonObject.getJSONObject("content");
                     boolean isOpenLight = content.getBoolean("isOpenLight");
                     keepScreenLongLight(isOpenLight);
-                    if (onListener != null)
+                    if (onListener != null) {
                         onListener.onSendMessage(content.toString());
+                    }
+                    return;
                 }
 
                 if ("setStatusBarTextColor".equals(api)) {
                     JSONObject content = jsonObject.getJSONObject("content");
                     boolean statusBarTextColor = content.getBoolean("statusBarTextColor");
-                    if (onListener != null)
+                    if (onListener != null) {
                         onListener.setStatusBarTextColor(statusBarTextColor);
+                    }
+                    return;
                 }
                 if ("isSpecialShapedScreen".equals(api)) {
                     JSONObject content = jsonObject.getJSONObject("content");
                     content.put("isSpecialShapedScreen", ImmersionBar.hasNotchScreen(activity));
                     content.put("notchHeight", ImmersionBar.getNotchHeight(activity));
-                    if (onListener != null)
+                    if (onListener != null) {
                         onListener.onSendMessage(jsonObject.toString());
+                    }
+                    return;
                 }
                 if ("getToken".equals(api)) {
                     JSONObject content = jsonObject.getJSONObject("content");
@@ -114,8 +125,10 @@ public class JsInterfaceUtils extends Object {
                     content.put("tokenType", s[0]);
                     content.put("accessToken", s[1]);
 
-                    if (onListener != null)
+                    if (onListener != null) {
                         onListener.onSendMessage(jsonObject.toString());
+                    }
+                    return;
                 }
 
                 if ("openWebView".equals(api)) {
@@ -142,6 +155,7 @@ public class JsInterfaceUtils extends Object {
                             .withBoolean("isOpenLight", isOpenLight)
                             .withInt("orientation", orientation)
                             .navigation();
+                    return;
                 }
                 if ("openAccompanyWebView".equals(api)) {
                     JSONObject content = jsonObject.getJSONObject("content");
@@ -163,6 +177,7 @@ public class JsInterfaceUtils extends Object {
                             .withBoolean("isOpenLight", isOpenLight)
                             .withInt("orientation", orientation)
                             .navigation();
+                    return;
 
                 }
 
@@ -171,6 +186,7 @@ public class JsInterfaceUtils extends Object {
                     if (onListener != null) {
                         onListener.onAccompanySelecResult(String.valueOf(content.getInt("id")), content.getString("name"));
                     }
+                    return;
 
                 }
                 if ("downloadFile".equals(api)) {
@@ -178,6 +194,7 @@ public class JsInterfaceUtils extends Object {
                     if (onListener != null) {
                         onListener.downloadFile(content.getString("downloadUrl"));
                     }
+                    return;
 
                 }
 
@@ -186,17 +203,20 @@ public class JsInterfaceUtils extends Object {
                     if (onListener != null) {
                         onListener.shareAchievements(jsonObject);
                     }
+                    return;
                 }
 
                 if ("backIconChange".equals(api)) {
                     if (onListener != null) {
                         onListener.backIconChange(jsonObject);
                     }
+                    return;
                 }
                 if ("getNavHeight".equals(api)) {
                     if (onListener != null) {
                         onListener.getNavHeight(jsonObject);
                     }
+                    return;
                 }
                 /**
                  * { status: 0 隐藏 1 显示 }
@@ -205,11 +225,13 @@ public class JsInterfaceUtils extends Object {
                     if (onListener != null) {
                         onListener.setBarStatus(jsonObject);
                     }
+                    return;
                 }
                 if ("authToBack".equalsIgnoreCase(api)) {
                     if (onListener != null) {
                         onListener.authToBack(jsonObject);
                     }
+                    return;
                 }
                 //进入直播间
                 if ("joinLiveRoom".equals(api)) {
@@ -217,6 +239,7 @@ public class JsInterfaceUtils extends Object {
                     if (onListener != null) {
                         onListener.joinLiveRoom(content.getString("roomId"), content.getString("teacherId"));
                     }
+                    return;
                 }
                 //进入聊天
                 if ("joinChatGroup".equals(api)) {
@@ -224,11 +247,13 @@ public class JsInterfaceUtils extends Object {
                     if (onListener != null) {
                         onListener.joinChatGroup(content.getString("type"), content.getString("id"));
                     }
+                    return;
                 }
                 //跳转地址页面
                 if ("setAddress".equals(api)) {
                     ARouter.getInstance().build(RouterPath.MineCenter.MINE_SELECT_ADDRESS_LIST)
                             .navigation(activity, 1011);
+                    return;
                 }
                 //支付
                 if ("paymentOrder".equals(api)) {
@@ -236,12 +261,25 @@ public class JsInterfaceUtils extends Object {
                     if (onListener != null) {
                         onListener.paymentOrder(content.getString("orderNo"), content.getString("payChannel"), content.getString("payInfo"));
                     }
+                    return;
                 }
                 if ("savePicture".equalsIgnoreCase(api)) {
                     JSONObject content = jsonObject.getJSONObject("content");
                     if (onListener != null) {
-                        onListener.savePicture(content.getString("base64"),content.getString("uuid"));
+                        onListener.savePicture(content.getString("base64"), content.getString("uuid"));
                     }
+                    return;
+                }
+
+                if (TextUtils.equals(WebApi.openCourseDetail, api)) {
+                    JSONObject content = jsonObject.getJSONObject("content");
+                    String courseId = content.optString("courseId");
+                    if (!TextUtils.isEmpty(courseId)) {
+                        ARouter.getInstance().build(RouterPath.CourseCenter.PIANO_ROOM_COURSE_DETAIL)
+                                .withString("course_id", courseId)
+                                .navigation();
+                    }
+                    return;
                 }
             } catch (Exception e) {
             }
@@ -340,9 +378,10 @@ public class JsInterfaceUtils extends Object {
 
         /**
          * 保存图片
+         *
          * @param base64
          */
-        void savePicture(String base64,String uuid);
+        void savePicture(String base64, String uuid);
     }
 
 }

BIN
teacher/src/main/res/drawable-xhdpi/icon_piano_room_course_people_num.png


BIN
teacher/src/main/res/drawable-xxhdpi/icon_piano_room_course_people_num.png


+ 248 - 0
teacher/src/main/res/layout/activity_piano_room_detail_layout.xml

@@ -0,0 +1,248 @@
+<?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">
+
+    <include
+        android:id="@+id/toolbar_include"
+        layout="@layout/common_toolbar_layout" />
+
+    <androidx.core.widget.NestedScrollView
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:layout_marginTop="12dp"
+        android:overScrollMode="never"
+        android:scrollbars="none"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/toolbar_include">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical"
+            android:paddingStart="14dp"
+            android:paddingTop="12dp"
+            android:paddingEnd="14dp"
+            android:paddingBottom="12dp">
+
+            <androidx.constraintlayout.widget.ConstraintLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:background="@drawable/bg_white_10dp"
+                android:paddingBottom="20dp">
+
+                <ImageView
+                    android:id="@+id/iv_time_icon"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="11dp"
+                    android:layout_marginTop="12dp"
+                    android:src="@drawable/icon_clock"
+                    app:layout_constraintLeft_toLeftOf="parent"
+                    app:layout_constraintTop_toTopOf="parent" />
+
+                <TextView
+                    android:id="@+id/tv_course_time"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:includeFontPadding="false"
+                    android:paddingStart="7dp"
+                    android:textColor="@color/color_666666"
+                    android:textSize="@dimen/sp_13"
+                    app:layout_constraintBottom_toBottomOf="@+id/iv_time_icon"
+                    app:layout_constraintLeft_toRightOf="@+id/iv_time_icon"
+                    app:layout_constraintTop_toTopOf="@+id/iv_time_icon"
+                    tools:text="2021/09/17 14:00~14:25" />
+
+                <TextView
+                    android:id="@+id/tv_course_status"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginEnd="11dp"
+                    android:text="已结束"
+                    android:textColor="@color/color_999999"
+                    android:textSize="@dimen/sp_14"
+                    app:layout_constraintBottom_toBottomOf="@+id/iv_time_icon"
+                    app:layout_constraintRight_toRightOf="parent"
+                    app:layout_constraintTop_toTopOf="@+id/iv_time_icon" />
+
+                <View
+                    android:id="@+id/view_line"
+                    android:layout_width="match_parent"
+                    android:layout_height="1px"
+                    android:layout_marginTop="10dp"
+                    android:background="@color/color_f2f2f2"
+                    app:layout_constraintTop_toBottomOf="@+id/iv_time_icon" />
+
+                <TextView
+                    android:id="@+id/iv_avatar"
+                    android:layout_width="42dp"
+                    android:layout_height="42dp"
+                    android:layout_marginStart="11dp"
+                    android:layout_marginTop="20dp"
+                    android:background="@drawable/shape_piano_room_course_icon"
+                    android:gravity="center"
+                    android:text="小课"
+                    android:textColor="@color/white"
+                    android:textSize="@dimen/sp_14"
+                    app:layout_constraintBottom_toBottomOf="parent"
+                    app:layout_constraintLeft_toLeftOf="parent"
+                    app:layout_constraintTop_toBottomOf="@+id/view_line" />
+
+                <TextView
+                    android:id="@+id/tv_title"
+                    android:layout_width="0dp"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="10dp"
+                    android:layout_marginEnd="10dp"
+                    android:ellipsize="end"
+                    android:includeFontPadding="false"
+                    android:maxLines="2"
+                    android:textColor="@color/color_1a1a1a"
+                    android:textSize="@dimen/sp_16"
+                    android:textStyle="bold"
+                    app:layout_constraintBottom_toTopOf="@+id/tv_course_name"
+                    app:layout_constraintLeft_toRightOf="@+id/iv_avatar"
+                    app:layout_constraintRight_toRightOf="parent"
+                    app:layout_constraintTop_toTopOf="@+id/iv_avatar"
+                    app:layout_constraintVertical_chainStyle="packed"
+                    tools:text="张豆豆张豆豆张豆豆张豆" />
+
+                <TextView
+                    android:id="@+id/tv_course_name"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="8dp"
+                    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/iv_avatar"
+                    app:layout_constraintLeft_toLeftOf="@+id/tv_title"
+                    app:layout_constraintTop_toBottomOf="@+id/tv_title"
+                    tools:text="单簧管" />
+
+                <View
+                    android:id="@+id/view_line2"
+                    android:layout_width="1dp"
+                    android:layout_height="12dp"
+                    android:layout_marginStart="8dp"
+                    android:background="@color/color_dedede"
+                    app:layout_constraintBottom_toBottomOf="@+id/tv_course_name"
+                    app:layout_constraintLeft_toRightOf="@+id/tv_course_name"
+                    app:layout_constraintTop_toTopOf="@+id/tv_course_name" />
+
+                <TextView
+                    android:id="@+id/tv_course_people_num"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="8dp"
+                    android:text="0人"
+                    android:textColor="@color/color_999999"
+                    android:textSize="@dimen/sp_14"
+                    app:layout_constraintBottom_toBottomOf="@+id/tv_course_name"
+                    app:layout_constraintLeft_toRightOf="@+id/view_line2"
+                    app:layout_constraintTop_toTopOf="@+id/tv_course_name" />
+
+            </androidx.constraintlayout.widget.ConstraintLayout>
+
+            <androidx.constraintlayout.widget.ConstraintLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="12dp"
+                android:background="@drawable/bg_white_10dp"
+                android:paddingBottom="10dp">
+
+                <View
+                    android:id="@+id/view_title_line_homework"
+                    android:layout_width="4dp"
+                    android:layout_height="14dp"
+                    android:layout_marginStart="12dp"
+                    android:layout_marginTop="13dp"
+                    android:background="@drawable/shape_course_title_tag_bg"
+                    app:layout_constraintLeft_toLeftOf="parent"
+                    app:layout_constraintTop_toTopOf="parent" />
+
+                <TextView
+                    android:id="@+id/tv_homework_title"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:includeFontPadding="false"
+                    android:paddingStart="5dp"
+                    android:text="课后作业"
+                    android:textColor="@color/color_1a1a1a"
+                    android:textSize="@dimen/sp_13"
+                    app:layout_constraintBottom_toBottomOf="@+id/view_title_line_homework"
+                    app:layout_constraintLeft_toRightOf="@+id/view_title_line_homework"
+                    app:layout_constraintTop_toTopOf="@+id/view_title_line_homework" />
+
+                <TextView
+                    android:id="@+id/tv_set_homework"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:drawableLeft="@drawable/icon_set_homework"
+                    android:drawablePadding="3dp"
+                    android:includeFontPadding="false"
+                    android:paddingEnd="11dp"
+                    android:text="@string/set_homework_str"
+                    android:textColor="@color/color_2dc7aa"
+                    android:textSize="@dimen/sp_14"
+                    android:visibility="invisible"
+                    app:layout_constraintBottom_toBottomOf="@+id/view_title_line_homework"
+                    app:layout_constraintRight_toRightOf="parent"
+                    app:layout_constraintTop_toTopOf="@+id/view_title_line_homework" />
+
+                <FrameLayout
+                    android:id="@+id/view_homework_content_bg"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginStart="11dp"
+                    android:layout_marginTop="11dp"
+                    android:layout_marginEnd="11dp"
+                    android:background="@drawable/shape_bg_f7f8f9_4dp"
+                    android:minHeight="88dp"
+                    android:padding="11dp"
+                    app:layout_constraintTop_toBottomOf="@+id/view_title_line_homework">
+
+                    <TextView
+                        android:id="@+id/tv_homework_empty_text"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="center"
+                        android:drawableLeft="@drawable/icon_homework_empty"
+                        android:drawablePadding="8dp"
+                        android:gravity="center_vertical"
+                        android:text="课程结束之后记得布置作业哦!"
+                        android:textColor="@color/color_999999"
+                        android:textSize="@dimen/sp_13" />
+
+                    <TextView
+                        android:id="@+id/tv_homework_content"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:includeFontPadding="false"
+                        android:textColor="@color/color_333333"
+                        android:textSize="@dimen/sp_13"
+                        android:visibility="gone"
+                        tools:text="每个音的指法比较熟练,但是遇到指法变换比较频繁的小节熟练度不足,建议平时可以选择指法变换较大的曲目多加练习!" />
+                </FrameLayout>
+            </androidx.constraintlayout.widget.ConstraintLayout>
+
+            <androidx.recyclerview.widget.RecyclerView
+                android:layout_marginTop="10dp"
+                android:id="@+id/recyclerView"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:overScrollMode="never"
+                android:scrollbars="horizontal" />
+        </LinearLayout>
+    </androidx.core.widget.NestedScrollView>
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 53 - 0
teacher/src/main/res/layout/item_piano_room_student_layout.xml

@@ -0,0 +1,53 @@
+<?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:background="@drawable/bg_white_10dp"
+    android:paddingStart="12dp"
+    android:paddingTop="14dp"
+    android:paddingBottom="14dp">
+
+    <com.cooleshow.base.widgets.QMUIRadiusImageView
+        android:id="@+id/iv_avatar"
+        android:layout_width="48dp"
+        android:layout_height="48dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:qmui_corner_radius="5dp" />
+
+    <TextView
+        android:id="@+id/tv_name"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="9dp"
+        android:includeFontPadding="false"
+        android:textColor="@color/color_1a1a1a"
+        android:textSize="@dimen/sp_15"
+        app:layout_constraintBottom_toTopOf="@+id/tv_course_name"
+        app:layout_constraintLeft_toRightOf="@+id/iv_avatar"
+        app:layout_constraintTop_toTopOf="parent"
+        tools:text="张静怡" />
+
+    <TextView
+        android:id="@+id/tv_course_name"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="2dp"
+        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/iv_avatar"
+        app:layout_constraintLeft_toLeftOf="@+id/tv_name"
+        app:layout_constraintTop_toBottomOf="@+id/tv_name"
+        tools:text="单簧管" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 1 - 0
teacher/src/main/res/values/styles.xml

@@ -5,6 +5,7 @@
         <item name="colorPrimary">@color/colorPrimary</item>
         <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
         <item name="colorAccent">@color/colorAccent</item>
+        <item name="android:windowBackground">@color/color_f6f8f9</item>
     </style>
 
     <style name="SplashTheme" parent="AppTheme">