Selaa lähdekoodia

添加学生端首页公告显示

Pq 3 vuotta sitten
vanhempi
commit
be001726e3

+ 12 - 0
student/src/main/java/com/cooleshow/student/api/APIService.java

@@ -12,6 +12,7 @@ import com.cooleshow.student.bean.AppHomeBean;
 import com.cooleshow.student.bean.CountOfUnreadBean;
 import com.cooleshow.student.bean.CourseTableDataBean;
 import com.cooleshow.student.bean.FriendInfoBean;
+import com.cooleshow.student.bean.HelpCenterContentBean;
 import com.cooleshow.student.bean.HomeLiveAndVideoBean;
 import com.cooleshow.student.bean.HomeStyleBean;
 import com.cooleshow.student.bean.HomeworkListBean;
@@ -202,6 +203,17 @@ public interface APIService {
     @GET(STUDENT_GROUP + "courseSchedule/queryLiveAndVideo")
     Observable<BaseResponse<HomeLiveAndVideoBean>> queryLiveAndVideo(@Query("platform") String platform, @Query("version") String version);
 
+
+
+    /**
+     * 首页统计数据
+     *
+     * @return
+     */
+    @POST(CMS_SERVER + "helpCenterContent/list")
+    Observable<BaseResponse<HelpCenterContentBean>> helpCenterContentList(@Body RequestBody body);
+
+
     /**
      * 首页老师风采-分页
      *

+ 52 - 0
student/src/main/java/com/cooleshow/student/bean/HelpCenterContentBean.java

@@ -0,0 +1,52 @@
+package com.cooleshow.student.bean;
+
+import java.util.List;
+
+/**
+ * 创建日期:2022/5/31 17:14
+ *
+ * @author Ryan
+ * 类说明:
+ */
+public class HelpCenterContentBean {
+    public int limit;
+    public int nextPage;
+    public int offset;
+    public int pageNo;
+    public int prePage;
+    public int total;
+    public int totalPage;
+    public List<RowsBean> rows;
+    public static class RowsBean{
+        /*
+        "status": 0,
+			"order": 0,
+			"title": "测试老师公告",
+			"catalogId": 2,
+			"releaseTime": "2022-05-17 16:20:54",
+			"releaseStatus": 1,
+			"catalogType": "TEACHER",
+			"createOn": "2022-05-17 16:21:04",
+			"modifyOn": "2022-05-17 16:28:31",
+			"createBy": 56,
+			"updateName": "刘俊驰",
+			"updateBy": 56,
+			"id": 24,
+			"content": "\u003Cp\u003E测试老师公告内容\u003C/p\u003E"
+         */
+        public int status;
+        public int order;
+        public String title;
+        public String releaseTime;
+        public int releaseStatus;
+        public String catalogType;
+        public String createOn;
+        public String modifyOn;
+        public long createBy;
+        public String updateName;
+        public long updateBy;
+        public String id;
+        public String content;
+
+    }
+}

+ 2 - 0
student/src/main/java/com/cooleshow/student/contract/HomeContract.java

@@ -3,6 +3,7 @@ package com.cooleshow.student.contract;
 import com.cooleshow.base.presenter.view.BaseView;
 import com.cooleshow.student.bean.AppHomeBean;
 import com.cooleshow.student.bean.CountOfUnreadBean;
+import com.cooleshow.student.bean.HelpCenterContentBean;
 import com.cooleshow.student.bean.HomeLiveAndVideoBean;
 import com.cooleshow.student.bean.HomeStyleBean;
 import com.cooleshow.student.bean.HotAlbumBean;
@@ -29,6 +30,7 @@ public interface HomeContract {
 
         void queryUserInfoSuccess(StudentUserInfo data);
 
+        void helpCenterContentListSuccess(HelpCenterContentBean bean);
 
         void queryCountOfUnreadSuccess(List<CountOfUnreadBean> data);
     }

+ 34 - 0
student/src/main/java/com/cooleshow/student/presenter/main/HomePresenter.java

@@ -7,6 +7,7 @@ import com.cooleshow.base.utils.RequestBodyUtil;
 import com.cooleshow.student.api.APIService;
 import com.cooleshow.student.bean.AppHomeBean;
 import com.cooleshow.student.bean.CountOfUnreadBean;
+import com.cooleshow.student.bean.HelpCenterContentBean;
 import com.cooleshow.student.bean.HomeLiveAndVideoBean;
 import com.cooleshow.student.bean.HomeStyleBean;
 import com.cooleshow.student.bean.HotAlbumBean;
@@ -111,6 +112,39 @@ public class HomePresenter extends BasePresenter<HomeContract.HomeView> implemen
         });
     }
 
+
+    public void helpCenterContentList() {
+        JSONObject jsonObject = new JSONObject();
+        try {
+            jsonObject.putOpt("catalogIds", "2");
+            jsonObject.putOpt("catalogType", "TEACHER");
+            jsonObject.putOpt("page", 1);
+            jsonObject.putOpt("status", 1);
+            jsonObject.putOpt("rows", Constants.DEFAULT_DATA_SIZE);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+        addSubscribe(create(APIService.class).helpCenterContentList(RequestBodyUtil.convertToRequestBodyJson(jsonObject.toString())), new BaseObserver<HelpCenterContentBean>(getView()) {
+            @Override
+            protected void onSuccess(HelpCenterContentBean data) {
+                if (getView() != null) {
+                    getView().helpCenterContentListSuccess(data);
+                }
+            }
+
+            @Override
+            public void onComplete() {
+                super.onComplete();
+            }
+
+            @Override
+            public void onError(Throwable e) {
+                super.onError(e);
+
+            }
+        });
+    }
+
     public void getStylePage() {
 
         JSONObject jsonObject = new JSONObject();

+ 30 - 3
student/src/main/java/com/cooleshow/student/ui/main/HomeFragment.java

@@ -41,6 +41,7 @@ import com.cooleshow.student.adapter.HomeVideoCourseAdapter;
 import com.cooleshow.student.adapter.HomeWonderfulInfoAdapter;
 import com.cooleshow.student.bean.AppHomeBean;
 import com.cooleshow.student.bean.CountOfUnreadBean;
+import com.cooleshow.student.bean.HelpCenterContentBean;
 import com.cooleshow.student.bean.HomeLiveAndVideoBean;
 import com.cooleshow.student.bean.HomeStyleBean;
 import com.cooleshow.student.bean.HotAlbumBean;
@@ -72,7 +73,8 @@ import java.util.TreeMap;
  * 类说明:
  */
 public class HomeFragment extends BaseMVPFragment<FragmentHomeLayoutBinding, HomePresenter> implements HomeContract.HomeView, View.OnClickListener {
-    private boolean isShowFlashPage;
+    private boolean isShowFlashPage =false;
+    private String mCurrentShowNoticeId;
 
     @Override
     public void onClick(View view) {
@@ -126,8 +128,16 @@ public class HomeFragment extends BaseMVPFragment<FragmentHomeLayoutBinding, Hom
                         .withString(WebConstants.WEB_URL, WebConstants.STUDENT_TEACHER_ELEGANT)
                         .navigation();
                 break;
-
-
+            case R.id.bg_announcement:
+                if (TextUtils.isEmpty(mCurrentShowNoticeId)) {
+                    return;
+                }
+                //点击单条公告
+                ARouter.getInstance()
+                        .build(RouterPath.WebCenter.ACTIVITY_HTML)
+                        .withString(WebConstants.WEB_URL, WebConstants.HELP_CENTER_DETAIL + mCurrentShowNoticeId)
+                        .navigation();
+                break;
         }
     }
 
@@ -136,6 +146,7 @@ public class HomeFragment extends BaseMVPFragment<FragmentHomeLayoutBinding, Hom
         super.onResume();
         presenter.queryCountOfUnread();
         presenter.queryUserInfo();
+        presenter.helpCenterContentList();
         presenter.queryLiveAndVideo();
     }
 
@@ -169,6 +180,7 @@ public class HomeFragment extends BaseMVPFragment<FragmentHomeLayoutBinding, Hom
         mViewBinding.imTeacherStyleMore.setOnClickListener(this);
         mViewBinding.tvName.setOnClickListener(this);
         mViewBinding.ivAvatar.setOnClickListener(this);
+        mViewBinding.bgAnnouncement.setOnClickListener(this);
 
         mViewBinding.scrollLayout.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
             boolean localVisibleRect = getLocalVisibleRect(getActivity(), banner, 10);
@@ -333,6 +345,21 @@ public class HomeFragment extends BaseMVPFragment<FragmentHomeLayoutBinding, Hom
         }
     }
 
+    @Override
+    public void helpCenterContentListSuccess(HelpCenterContentBean bean) {
+        if (isDetached()) {
+            return;
+        }
+        if (bean != null && bean.rows != null && bean.rows.size() > 0) {
+            mViewBinding.bgAnnouncement.setVisibility(View.VISIBLE);
+            HelpCenterContentBean.RowsBean rowsBean = bean.rows.get(0);
+            mViewBinding.tvNoticeContent.setText(rowsBean.title);
+            mCurrentShowNoticeId = rowsBean.id;
+        } else {
+            mViewBinding.bgAnnouncement.setVisibility(View.GONE);
+        }
+    }
+
 
     @SuppressLint("SetTextI18n")
     private void initRecentLive(HomeLiveAndVideoBean.RecentCoursesBean recentCourses) {

BIN
student/src/main/res/drawable-xhdpi/icon_calendar_next_month.png


BIN
student/src/main/res/drawable-xhdpi/icon_home_bell.png


BIN
student/src/main/res/drawable-xxhdpi/icon_calendar_next_month.png


BIN
student/src/main/res/drawable-xxhdpi/icon_home_bell.png


+ 51 - 0
student/src/main/res/layout/fragment_home_layout.xml

@@ -194,6 +194,57 @@
                         app:layout_constraintTop_toTopOf="parent" />
                 </androidx.constraintlayout.widget.ConstraintLayout>
 
+
+                <androidx.constraintlayout.widget.ConstraintLayout
+                    android:visibility="gone"
+                    android:id="@+id/bg_announcement"
+                    android:layout_width="match_parent"
+                    android:layout_height="44dp"
+                    android:layout_marginStart="14dp"
+                    android:layout_marginTop="10dp"
+                    android:layout_marginEnd="14dp"
+                    android:background="@drawable/bg_white_10dp"
+                    android:elevation="2dp"
+                    android:orientation="horizontal"
+                    app:layout_constraintLeft_toLeftOf="parent"
+                    app:layout_constraintTop_toBottomOf="@+id/cl_live">
+
+                    <ImageView
+                        android:id="@+id/iv_bell"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginLeft="10dp"
+                        android:src="@drawable/icon_home_bell"
+                        app:layout_constraintBottom_toBottomOf="parent"
+                        app:layout_constraintLeft_toLeftOf="parent"
+                        app:layout_constraintTop_toTopOf="parent" />
+
+                    <TextView
+                        android:id="@+id/tv_notice_content"
+                        android:layout_width="wrap_content"
+                        android:layout_height="match_parent"
+                        android:layout_marginStart="2dp"
+                        android:gravity="center"
+                        android:includeFontPadding="false"
+                        android:textColor="@color/color_1a1a1a"
+                        android:textSize="@dimen/sp_14"
+                        app:layout_constraintBottom_toBottomOf="parent"
+                        app:layout_constraintLeft_toRightOf="@+id/iv_bell"
+                        app:layout_constraintTop_toTopOf="parent"
+                        tools:text="网络教室升级公告" />
+
+                    <ImageView
+                        android:id="@+id/im_notice_list"
+                        android:layout_width="@dimen/dp_38"
+                        android:layout_height="@dimen/dp_38"
+                        android:layout_marginRight="@dimen/dp_1"
+                        android:padding="@dimen/dp_10"
+                        android:src="@drawable/icon_calendar_next_month"
+                        app:layout_constraintBottom_toBottomOf="parent"
+                        app:layout_constraintRight_toRightOf="parent"
+                        app:layout_constraintTop_toTopOf="parent" />
+                </androidx.constraintlayout.widget.ConstraintLayout>
+
                 <androidx.constraintlayout.widget.ConstraintLayout
                     android:id="@+id/cl_hot_album"
                     android:layout_width="match_parent"

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

@@ -79,6 +79,7 @@ public class HomePresenter extends BasePresenter<HomeContract.HomeView> implemen
             jsonObject.putOpt("catalogIds", "2");
             jsonObject.putOpt("catalogType", "TEACHER");
             jsonObject.putOpt("page", 1);
+            jsonObject.putOpt("status", 1);
             jsonObject.putOpt("rows", Constants.DEFAULT_DATA_SIZE);
         } catch (JSONException e) {
             e.printStackTrace();

+ 21 - 12
teacher/src/main/java/com/cooleshow/teacher/ui/main/HomeFragment.kt

@@ -30,6 +30,9 @@ import java.util.*
  */
 class HomeFragment : BaseMVPFragment<FragmentHomeLayoutBinding, HomePresenter>(),
     HomeContract.HomeView, View.OnClickListener {
+
+    private var noticeId: Long = 0
+
     override fun getLayoutView(): FragmentHomeLayoutBinding {
         return FragmentHomeLayoutBinding.inflate(layoutInflater)
     }
@@ -48,7 +51,7 @@ class HomeFragment : BaseMVPFragment<FragmentHomeLayoutBinding, HomePresenter>()
         mViewBinding.cardAfterClassHomework.setOnClickListener(this)
         mViewBinding.cardMineIncome.setOnClickListener(this)
         mViewBinding.ivChat.setOnClickListener(this)
-        mViewBinding.tvNoticeContent.setOnClickListener(this)
+        mViewBinding.bgAnnouncement.setOnClickListener(this)
         mViewBinding.imNoticeList.setOnClickListener(this)
         mViewBinding.cardKotofusa.setOnClickListener(this)
     }
@@ -179,20 +182,20 @@ class HomeFragment : BaseMVPFragment<FragmentHomeLayoutBinding, HomePresenter>()
                 ARouter.getInstance().build(RouterPath.MessageCenter.TEACHER_MESSAGE_MESSAGEBOX)
                     .navigation()
             }
-            R.id.tv_notice_content -> {
+            R.id.bg_announcement -> {
                 //点击单条公告
                 ARouter.getInstance()
                     .build(RouterPath.WebCenter.ACTIVITY_HTML)
                     .withString(WebConstants.WEB_URL, WebConstants.HELP_CENTER_DETAIL + noticeId)
                     .navigation()
             }
-            R.id.im_notice_list -> {
-                //公告列表
-                ARouter.getInstance()
-                    .build(RouterPath.WebCenter.ACTIVITY_HTML)
-                    .withString(WebConstants.WEB_URL, WebConstants.HELP_CENTER_CATALOGTYPE_2)
-                    .navigation()
-            }
+//            R.id.im_notice_list -> {
+//                //公告列表
+//                ARouter.getInstance()
+//                    .build(RouterPath.WebCenter.ACTIVITY_HTML)
+//                    .withString(WebConstants.WEB_URL, WebConstants.HELP_CENTER_CATALOGTYPE_2)
+//                    .navigation()
+//            }
             R.id.card_Kotofusa -> {
                 //云库琴房
                 ARouter.getInstance()
@@ -302,12 +305,15 @@ class HomeFragment : BaseMVPFragment<FragmentHomeLayoutBinding, HomePresenter>()
         )
     }
 
-    private var noticeId: Long = 0
+
     override fun helpCenterContentListSuccess(data: HelpCenterContentBean?) {
 
         if (data?.rows != null && data.rows.size > 0) {
+            mViewBinding.bgAnnouncement.setVisible(true)
             mViewBinding.tvNoticeContent.text = data.rows[0].title
             noticeId = data.rows[0].id
+        } else {
+            mViewBinding.bgAnnouncement.setVisible(false)
         }
 
     }
@@ -364,13 +370,16 @@ class HomeFragment : BaseMVPFragment<FragmentHomeLayoutBinding, HomePresenter>()
         when (bean?.courseType) {
             CourseConstants.LIVE_COURSE -> ARouter.getInstance()
                 .build(RouterPath.WebCenter.ACTIVITY_HTML)
-                .withString(WebConstants.WEB_URL, WebConstants.TEACHER_LIVE_DETAIL + "?groupId=" + bean.courseGroupId)
+                .withString(
+                    WebConstants.WEB_URL,
+                    WebConstants.TEACHER_LIVE_DETAIL + "?groupId=" + bean.courseGroupId
+                )
                 .navigation()
             CourseConstants.OTHER_COURSE ->                 //陪练课
                 ARouter.getInstance().build(RouterPath.CourseCenter.SPARRING_COURSE_DETAIL)
                     .withString(CourseConstants.COURSE_ID, bean.courseId.toString())
                     .withString(CourseConstants.COURSE_GROUP_ID, bean.courseGroupId.toString())
-                    .withString(CourseConstants.STUDENT_ID,bean.studentId.toString())
+                    .withString(CourseConstants.STUDENT_ID, bean.studentId.toString())
                     .navigation()
             CourseConstants.PIANO_ROOM_COURSE ->
                 //琴房课 跳转详情页