浏览代码

处理客服入口

Pq 8 月之前
父节点
当前提交
e09535ecbf
共有 18 个文件被更改,包括 346 次插入41 次删除
  1. 18 2
      chatModule/src/main/java/com/cooleshow/chatmodule/utils/helper/ChatHelper.java
  2. 8 0
      institution/src/main/java/com/cooleshow/institution/stu/api/APIService.java
  3. 3 1
      institution/src/main/java/com/cooleshow/institution/stu/contract/MineContract.java
  4. 12 0
      institution/src/main/java/com/cooleshow/institution/stu/presenter/MinePresenter.java
  5. 28 0
      institution/src/main/java/com/cooleshow/institution/stu/ui/main/MineFragment.java
  6. 39 0
      institution/src/main/res/layout/fg_mine_layout.xml
  7. 8 0
      student/src/main/java/com/cooleshow/student/api/APIService.java
  8. 2 0
      student/src/main/java/com/cooleshow/student/contract/MineContract.java
  9. 12 0
      student/src/main/java/com/cooleshow/student/presenter/main/MinePresenter.java
  10. 34 1
      student/src/main/java/com/cooleshow/student/ui/main/MineFragment.java
  11. 84 37
      student/src/main/res/layout/fragment_mine_layout.xml
  12. 8 0
      teacher/src/main/java/com/cooleshow/teacher/api/APIService.java
  13. 1 0
      teacher/src/main/java/com/cooleshow/teacher/contract/MineContract.java
  14. 13 0
      teacher/src/main/java/com/cooleshow/teacher/presenter/main/MinePresenter.java
  15. 30 0
      teacher/src/main/java/com/cooleshow/teacher/ui/main/MineFragment.java
  16. 10 0
      teacher/src/main/res/layout/fragment_mine_layout.xml
  17. 18 0
      usercenter/src/main/java/com/cooleshow/usercenter/bean/StudentUserInfo.java
  18. 18 0
      usercenter/src/main/java/com/cooleshow/usercenter/bean/TeacherUserInfo.java

+ 18 - 2
chatModule/src/main/java/com/cooleshow/chatmodule/utils/helper/ChatHelper.java

@@ -25,6 +25,11 @@ import com.tencent.qcloud.tuikit.tuichat.util.ChatMessageBuilder;
  */
 public class ChatHelper {
     public static final String SINGLE_CHAT = "single";//单聊
+    // 两次点击按钮之间的点击间隔不能少于1000毫秒
+    private static final int MIN_CLICK_DELAY_TIME = 1000;
+    private static long lastClickTime;
+
+
     private ChatHelper() {
 
     }
@@ -34,6 +39,17 @@ public class ChatHelper {
     }
 
 
+    public static boolean isFastClick() {
+        boolean flag = false;
+        long curClickTime = System.currentTimeMillis();
+        if ((curClickTime - lastClickTime) < MIN_CLICK_DELAY_TIME) {
+            flag = true;
+        }
+        lastClickTime = curClickTime;
+        return flag;
+    }
+
+
 //    Bundle param = new Bundle();
 //        param.putInt(TUIConstants.TUIChat.CHAT_TYPE, conversationInfo.isGroup() ? V2TIMConversation.V2TIM_GROUP : V2TIMConversation.V2TIM_C2C);
 //        param.putString(TUIConstants.TUIChat.CHAT_ID, conversationInfo.getId());
@@ -59,7 +75,7 @@ public class ChatHelper {
         if (TextUtils.isEmpty(targetId)) {
             return;
         }
-        if (UiUtils.isFastClick()) {
+        if (isFastClick()) {
             return;
         }
         Bundle param = new Bundle();
@@ -138,7 +154,7 @@ public class ChatHelper {
     }
 
 
-    private TUIMessageBean getMsgBean( String liveRoomId, String teacherAvatar, String teacherName, String liveDes) {
+    private TUIMessageBean getMsgBean(String liveRoomId, String teacherAvatar, String teacherName, String liveDes) {
         TUIChatShareLiveMessageBean messageBean = new TUIChatShareLiveMessageBean();
         messageBean.setLiveDescMessage(liveDes);
         messageBean.setRoomUID(liveRoomId);

+ 8 - 0
institution/src/main/java/com/cooleshow/institution/stu/api/APIService.java

@@ -122,4 +122,12 @@ public interface APIService {
      */
     @GET(STUDENT_GROUP + "sysMessage/queryCountOfUnread")
     Observable<BaseResponse<List<CountOfUnreadBean>>> queryCountOfUnread();
+
+    /**
+     *
+     *
+     * @return
+     */
+    @GET(STUDENT_GROUP + "student/updateUserCustomerService")
+    Observable<BaseResponse<String>> updateUserCustomerService();
 }

+ 3 - 1
institution/src/main/java/com/cooleshow/institution/stu/contract/MineContract.java

@@ -10,11 +10,13 @@ import java.util.List;
  * Author by pq, Date on 2023/9/11.
  */
 public interface MineContract {
-    public interface MineContractView extends BaseView{
+    public interface MineContractView extends BaseView {
 
         void queryUserInfoSuccess(StudentUserInfo data);
 
         void queryCountOfUnreadSuccess(List<CountOfUnreadBean> data);
 
+        void updateUserCustomerServiceSuccess(String data);
+
     }
 }

+ 12 - 0
institution/src/main/java/com/cooleshow/institution/stu/presenter/MinePresenter.java

@@ -37,4 +37,16 @@ public class MinePresenter extends BasePresenter<MineContract.MineContractView>
             }
         });
     }
+
+    public void updateUserCustomerService() {
+
+        addSubscribe(create(APIService.class).updateUserCustomerService(), new BaseObserver<String>(getView()) {
+            @Override
+            protected void onSuccess(String data) {
+                if (getView() != null) {
+                    getView().updateUserCustomerServiceSuccess(data);
+                }
+            }
+        });
+    }
 }

+ 28 - 0
institution/src/main/java/com/cooleshow/institution/stu/ui/main/MineFragment.java

@@ -18,6 +18,7 @@ import com.cooleshow.base.utils.TimeUtils;
 import com.cooleshow.base.utils.UiUtils;
 import com.cooleshow.base.utils.Utils;
 import com.cooleshow.base.utils.helper.QMUIDeviceHelper;
+import com.cooleshow.chatmodule.utils.helper.ChatHelper;
 import com.cooleshow.institution.stu.R;
 import com.cooleshow.institution.stu.adapter.JGMineCommonFunctionAdapter;
 import com.cooleshow.institution.stu.adapter.JGMineCommonFunctionAdapter2;
@@ -44,6 +45,7 @@ import androidx.viewpager2.widget.ViewPager2;
  */
 public class MineFragment extends BaseMVPFragment<FgMineLayoutBinding, MinePresenter> implements View.OnClickListener, MineContract.MineContractView {
     public static final int MAX_ITEM_FOR_PAGE = 4;
+    private String customerId = "";
     private ViewPager2.OnPageChangeCallback mPageChangeCallback = new ViewPager2.OnPageChangeCallback() {
         @Override
         public void onPageSelected(int position) {
@@ -117,6 +119,7 @@ public class MineFragment extends BaseMVPFragment<FgMineLayoutBinding, MinePrese
         mViewBinding.tvAboutUs.setOnClickListener(this);
         mViewBinding.imMessage.setOnClickListener(this);
         mViewBinding.ivTrainToolsBg.setOnClickListener(this);
+        mViewBinding.tvCustomer.setOnClickListener(this);
 
         mViewBinding.viewpagerMenu.registerOnPageChangeCallback(mPageChangeCallback);
     }
@@ -184,6 +187,11 @@ public class MineFragment extends BaseMVPFragment<FgMineLayoutBinding, MinePrese
             }
         }
         mViewBinding.tvToolsLimitTime.setText(tip);
+
+        //客服
+        this.customerId = data.getImCustomerId();
+        boolean hasCustomer = data.getCustomerServiceNum() > 0;
+        mViewBinding.groupCustomer.setVisibility(hasCustomer ? View.VISIBLE : View.GONE);
     }
 
     @Override
@@ -240,6 +248,14 @@ public class MineFragment extends BaseMVPFragment<FgMineLayoutBinding, MinePrese
                     .navigation();
             return;
         }
+        if (id == R.id.tv_customer) {
+            if (!TextUtils.isEmpty(customerId)) {
+                openCustomerService();
+            } else {
+                presenter.updateUserCustomerService();
+            }
+            return;
+        }
     }
 
     @Override
@@ -248,6 +264,18 @@ public class MineFragment extends BaseMVPFragment<FgMineLayoutBinding, MinePrese
     }
 
     @Override
+    public void updateUserCustomerServiceSuccess(String data) {
+        if (!TextUtils.isEmpty(data)) {
+            this.customerId = data;
+            openCustomerService();
+        }
+    }
+
+    private void openCustomerService() {
+        ChatHelper.getInstance().goChat(customerId, "");
+    }
+
+    @Override
     public void queryCountOfUnreadSuccess(List<CountOfUnreadBean> data) {
         if (isDetached()) {
             return;

+ 39 - 0
institution/src/main/res/layout/fg_mine_layout.xml

@@ -651,6 +651,45 @@
                 app:layout_constraintBottom_toBottomOf="@+id/tv_about_us"
                 app:layout_constraintRight_toRightOf="@+id/tv_about_us"
                 app:layout_constraintTop_toTopOf="@+id/tv_about_us" />
+
+            <View
+                android:id="@+id/view_line12"
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:background="@color/color_f2f2f2"
+                app:layout_constraintLeft_toLeftOf="parent"
+                app:layout_constraintTop_toBottomOf="@+id/tv_about_us" />
+
+
+            <TextView
+                android:id="@+id/tv_customer"
+                android:layout_width="match_parent"
+                android:layout_height="58dp"
+                android:drawableStart="@drawable/jg_mine_about"
+                android:drawablePadding="8dp"
+                android:gravity="center_vertical"
+                android:text="在线客服"
+                android:textColor="@color/color_1a1a1a"
+                android:textSize="@dimen/sp_16"
+                app:layout_constraintLeft_toLeftOf="parent"
+                app:layout_constraintTop_toBottomOf="@+id/view_line12" />
+
+            <ImageView
+                android:id="@+id/iv_customer_arrow"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:src="@drawable/jg_icon_go_right"
+                app:layout_constraintBottom_toBottomOf="@+id/tv_customer"
+                app:layout_constraintRight_toRightOf="@+id/tv_customer"
+                app:layout_constraintTop_toTopOf="@+id/tv_customer" />
+
+
+            <androidx.constraintlayout.widget.Group
+                android:visibility="gone"
+                android:id="@+id/group_customer"
+                app:constraint_referenced_ids="iv_customer_arrow,tv_customer,view_line12"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"/>
         </androidx.constraintlayout.widget.ConstraintLayout>
     </androidx.constraintlayout.widget.ConstraintLayout>
 </ScrollView>

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

@@ -529,4 +529,12 @@ public interface APIService {
 
     @GET(STUDENT_GROUP+"courseSchedule/selectRoomConfig")
     Observable<BaseResponse<CommonCourseConfigBean>> getCourseConfig();
+
+    /**
+     *
+     *
+     * @return
+     */
+    @GET(STUDENT_GROUP + "student/updateUserCustomerService")
+    Observable<BaseResponse<String>> updateUserCustomerService();
 }

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

@@ -12,6 +12,8 @@ import com.cooleshow.usercenter.bean.StudentUserInfo;
 public interface MineContract {
     interface MineView extends BaseView {
         void queryUserInfoSuccess(StudentUserInfo data);
+
+        void updateUserCustomerServiceSuccess(String data);
     }
 
     interface Presenter {

+ 12 - 0
student/src/main/java/com/cooleshow/student/presenter/main/MinePresenter.java

@@ -25,4 +25,16 @@ public class MinePresenter extends BasePresenter<MineContract.MineView> implemen
         });
     }
 
+    public void updateUserCustomerService() {
+
+        addSubscribe(create(APIService.class).updateUserCustomerService(), new BaseObserver<String>(getView()) {
+            @Override
+            protected void onSuccess(String data) {
+                if (getView() != null) {
+                    getView().updateUserCustomerServiceSuccess(data);
+                }
+            }
+        });
+    }
+
 }

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

@@ -24,6 +24,7 @@ import com.cooleshow.base.utils.Utils;
 import com.cooleshow.base.utils.helper.PermissionTipHelper;
 import com.cooleshow.base.utils.helper.WebStartHelper;
 import com.cooleshow.base.widgets.DialogUtil;
+import com.cooleshow.chatmodule.utils.helper.ChatHelper;
 import com.cooleshow.student.R;
 import com.cooleshow.student.adapter.ItemMarkAdapter;
 import com.cooleshow.student.adapter.MineItemMarkAdapter;
@@ -44,6 +45,9 @@ import java.util.List;
  * 类说明:
  */
 public class MineFragment extends BaseMVPFragment<FragmentMineLayoutBinding, MinePresenter> implements MineContract.MineView, View.OnClickListener {
+    private String customerId = "";
+
+
     @Override
     public void onClick(View view) {
         switch (view.getId()) {
@@ -196,9 +200,17 @@ public class MineFragment extends BaseMVPFragment<FragmentMineLayoutBinding, Min
                 ARouter.getInstance().build(RouterPath.Homework.MY_WORK)
                         .navigation();
                 break;
+            case R.id.tv_customer:
+                if (!TextUtils.isEmpty(customerId)) {
+                    openCustomerService();
+                } else {
+                    presenter.updateUserCustomerService();
+                }
+                break;
         }
     }
 
+
     private void checkPermission() {
         String[] permissions = new String[]{Manifest.permission.RECORD_AUDIO,
                 Manifest.permission.WRITE_EXTERNAL_STORAGE};
@@ -259,6 +271,7 @@ public class MineFragment extends BaseMVPFragment<FragmentMineLayoutBinding, Min
         mViewBinding.ivScan.setOnClickListener(this);
         mViewBinding.tvFeedback.setOnClickListener(this);
         mViewBinding.tvContactUs.setOnClickListener(this);
+        mViewBinding.tvCustomer.setOnClickListener(this);
     }
 
     @Override
@@ -307,6 +320,22 @@ public class MineFragment extends BaseMVPFragment<FragmentMineLayoutBinding, Min
                     .withBoolean("hintBar", true)
                     .navigation();
         }
+
+        //客服
+        this.customerId = data.getImCustomerId();
+        boolean hasCustomer = data.getCustomerServiceNum() > 0;
+        mViewBinding.groupCustomer.setVisibility(hasCustomer ? View.VISIBLE : View.GONE);
+    }
+
+    @Override
+    public void updateUserCustomerServiceSuccess(String data) {
+        if (isDetached()) {
+            return;
+        }
+        if (!TextUtils.isEmpty(data)) {
+            this.customerId = data;
+            openCustomerService();
+        }
     }
 
     private void handleVipStyle(StudentUserInfo userInfo) {
@@ -350,7 +379,7 @@ public class MineFragment extends BaseMVPFragment<FragmentMineLayoutBinding, Min
                     timeTip = EVipType.PERMANENT_SVIP.getDes();
                 } else {
                     String t = eVipType == EVipType.VIP ? userVip.getVipEndDate() : userVip.getSvipEndDate();
-                    timeTip = " "+DateUtil.dateFormat(t, "yyyy-MM-dd");
+                    timeTip = " " + DateUtil.dateFormat(t, "yyyy-MM-dd");
                 }
                 mViewBinding.tvValidity.setText(timeTip);
             }
@@ -358,4 +387,8 @@ public class MineFragment extends BaseMVPFragment<FragmentMineLayoutBinding, Min
             e.printStackTrace();
         }
     }
+
+    private void openCustomerService() {
+        ChatHelper.getInstance().goChat(customerId, "");
+    }
 }

+ 84 - 37
student/src/main/res/layout/fragment_mine_layout.xml

@@ -27,13 +27,13 @@
             app:layout_constraintTop_toTopOf="parent" />
 
         <View
-            app:layout_constraintRight_toRightOf="@+id/tv_title_tag"
-            app:layout_constraintLeft_toLeftOf="@+id/tv_mine_title"
-            app:layout_constraintBottom_toBottomOf="@+id/tv_mine_title"
-            app:layout_constraintTop_toTopOf="@+id/tv_mine_title"
-            android:background="@drawable/shape_1a30c7ab_5dp"
             android:layout_width="85dp"
-            android:layout_height="10dp"/>
+            android:layout_height="10dp"
+            android:background="@drawable/shape_1a30c7ab_5dp"
+            app:layout_constraintBottom_toBottomOf="@+id/tv_mine_title"
+            app:layout_constraintLeft_toLeftOf="@+id/tv_mine_title"
+            app:layout_constraintRight_toRightOf="@+id/tv_title_tag"
+            app:layout_constraintTop_toTopOf="@+id/tv_mine_title" />
 
 
         <TextView
@@ -108,10 +108,10 @@
             app:layout_constraintRight_toRightOf="@+id/iv_avatar" />
 
         <ImageView
-            android:layout_marginBottom="5dp"
             android:id="@+id/iv_vip"
             android:layout_width="37dp"
             android:layout_height="18dp"
+            android:layout_marginBottom="5dp"
             app:layout_constraintBottom_toBottomOf="@+id/vip_help_view"
             app:layout_constraintLeft_toLeftOf="@+id/iv_avatar"
             app:layout_constraintRight_toRightOf="@+id/iv_avatar"
@@ -140,11 +140,11 @@
             app:layout_constraintTop_toTopOf="@+id/ll_user_id" />
 
         <LinearLayout
-            android:background="@drawable/bg_white_10dp"
             android:id="@+id/ll_user_id"
             android:layout_width="wrap_content"
             android:layout_height="@dimen/dp_20"
             android:layout_marginTop="8dp"
+            android:background="@drawable/bg_white_10dp"
             android:orientation="horizontal"
             android:paddingStart="7dp"
             android:paddingEnd="7dp"
@@ -200,13 +200,13 @@
             android:text="VIP有效期剩余"
             android:textColor="@color/color_502c0c"
             android:textSize="@dimen/sp_14"
-            app:layout_constraintWidth_default="wrap"
+            app:layout_constraintBottom_toBottomOf="@+id/view_vip_star"
             app:layout_constraintHorizontal_bias="0"
             app:layout_constraintHorizontal_chainStyle="packed"
-            app:layout_constraintRight_toLeftOf="@+id/tv_validity"
-            app:layout_constraintBottom_toBottomOf="@+id/view_vip_star"
             app:layout_constraintLeft_toRightOf="@+id/view_vip_star"
-            app:layout_constraintTop_toTopOf="@+id/view_vip_star" />
+            app:layout_constraintRight_toLeftOf="@+id/tv_validity"
+            app:layout_constraintTop_toTopOf="@+id/view_vip_star"
+            app:layout_constraintWidth_default="wrap" />
 
         <TextView
             android:id="@+id/tv_validity"
@@ -216,33 +216,33 @@
             android:textSize="@dimen/sp_14"
             android:textStyle="bold"
             app:layout_constraintBaseline_toBaselineOf="@+id/tv_validity_start"
-            app:layout_constraintRight_toLeftOf="@+id/im_vip"
             app:layout_constraintLeft_toRightOf="@+id/tv_validity_start"
+            app:layout_constraintRight_toLeftOf="@+id/im_vip"
             tools:text="321" />
 
 
         <androidx.constraintlayout.widget.Group
-            android:visibility="gone"
             android:id="@+id/group_vip"
-            tools:visibility="visible"
-            app:constraint_referenced_ids="view_vip_star,tv_validity,tv_validity_start"
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"/>
+            android:layout_height="wrap_content"
+            android:visibility="gone"
+            app:constraint_referenced_ids="view_vip_star,tv_validity,tv_validity_start"
+            tools:visibility="visible" />
 
         <TextView
-            android:drawablePadding="5dp"
-            tools:visibility="gone"
-            android:visibility="gone"
             android:id="@+id/tv_vip_tip"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            android:drawablePadding="5dp"
             android:paddingStart="18dp"
             android:text="会员已过期"
             android:textColor="@color/color_502c0c"
             android:textSize="@dimen/sp_14"
+            android:visibility="gone"
             app:layout_constraintBottom_toBottomOf="@+id/im_vip"
             app:layout_constraintLeft_toLeftOf="@+id/view_vip_bg"
-            app:layout_constraintTop_toTopOf="@+id/im_vip" />
+            app:layout_constraintTop_toTopOf="@+id/im_vip"
+            tools:visibility="gone" />
 
         <ImageView
             android:id="@+id/im_vip"
@@ -529,42 +529,42 @@
             android:layout_width="0dp"
             android:layout_height="wrap_content"
             android:layout_marginTop="14dp"
-            app:layout_constraintVertical_weight="0.25"
             android:src="@drawable/icon_mine_order"
             app:layout_constraintHorizontal_chainStyle="spread"
             app:layout_constraintLeft_toLeftOf="@+id/view_serve_tools"
             app:layout_constraintRight_toLeftOf="@+id/iv_trade_record"
-            app:layout_constraintTop_toBottomOf="@+id/tv_serve_tools_title" />
+            app:layout_constraintTop_toBottomOf="@+id/tv_serve_tools_title"
+            app:layout_constraintVertical_weight="0.25" />
 
         <ImageView
-            app:layout_constraintVertical_weight="0.25"
             android:id="@+id/iv_trade_record"
             android:layout_width="0dp"
             android:layout_height="wrap_content"
             android:src="@drawable/icon_mine_trade_record"
             app:layout_constraintLeft_toRightOf="@+id/iv_order"
             app:layout_constraintRight_toLeftOf="@+id/iv_coupon"
-            app:layout_constraintTop_toTopOf="@+id/iv_order" />
+            app:layout_constraintTop_toTopOf="@+id/iv_order"
+            app:layout_constraintVertical_weight="0.25" />
 
         <ImageView
-            app:layout_constraintVertical_weight="0.25"
             android:id="@+id/iv_coupon"
             android:layout_width="0dp"
             android:layout_height="wrap_content"
             android:src="@drawable/icon_mine_coupon"
             app:layout_constraintLeft_toRightOf="@+id/iv_trade_record"
             app:layout_constraintRight_toLeftOf="@+id/iv_award"
-            app:layout_constraintTop_toTopOf="@+id/iv_order" />
+            app:layout_constraintTop_toTopOf="@+id/iv_order"
+            app:layout_constraintVertical_weight="0.25" />
 
         <ImageView
-            app:layout_constraintVertical_weight="0.25"
-            android:src="@drawable/icon_mine_award"
             android:id="@+id/iv_award"
             android:layout_width="0dp"
             android:layout_height="wrap_content"
+            android:src="@drawable/icon_mine_award"
             app:layout_constraintLeft_toRightOf="@+id/iv_coupon"
             app:layout_constraintRight_toRightOf="@+id/view_serve_tools"
-            app:layout_constraintTop_toTopOf="@+id/iv_order" />
+            app:layout_constraintTop_toTopOf="@+id/iv_order"
+            app:layout_constraintVertical_weight="0.25" />
 
         <TextView
             android:id="@+id/tv_order_title"
@@ -583,9 +583,9 @@
             android:id="@+id/tv_trade_record_title"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text="交易记录"
             android:paddingTop="7dp"
             android:paddingBottom="20dp"
+            android:text="交易记录"
             android:textColor="@color/color_333333"
             android:textSize="@dimen/sp_12"
             app:layout_constraintLeft_toLeftOf="@+id/iv_trade_record"
@@ -620,11 +620,14 @@
             app:layout_constraintTop_toBottomOf="@+id/iv_award" />
 
         <androidx.constraintlayout.widget.ConstraintLayout
+            android:id="@+id/cs_menu"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginLeft="@dimen/dp_12"
             android:layout_marginTop="@dimen/dp_10"
             android:layout_marginRight="@dimen/dp_12"
+            android:paddingTop="10dp"
+            android:paddingBottom="10dp"
             android:background="@drawable/bg_white_10dp"
             app:layout_constraintLeft_toLeftOf="parent"
             app:layout_constraintTop_toBottomOf="@+id/view_serve_tools">
@@ -634,7 +637,6 @@
                 android:id="@+id/tv_network_detection"
                 android:layout_width="match_parent"
                 android:layout_height="@dimen/dp_45"
-                android:layout_marginTop="10dp"
                 android:gravity="center_vertical"
                 android:paddingLeft="@dimen/dp_15"
                 android:text="网络检测"
@@ -675,18 +677,33 @@
                 app:layout_constraintRight_toRightOf="@+id/tv_device_detection"
                 app:layout_constraintTop_toTopOf="@+id/tv_device_detection" />
 
+
+        </androidx.constraintlayout.widget.ConstraintLayout>
+
+
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginLeft="@dimen/dp_12"
+            android:layout_marginTop="@dimen/dp_10"
+            android:layout_marginRight="@dimen/dp_12"
+            android:paddingBottom="10dp"
+            android:paddingTop="10dp"
+            android:background="@drawable/bg_white_10dp"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/cs_menu">
+
             <TextView
                 android:id="@+id/tv_help"
                 android:layout_width="match_parent"
                 android:layout_height="@dimen/dp_45"
-                android:layout_marginBottom="15dp"
                 android:gravity="center_vertical"
                 android:paddingLeft="@dimen/dp_15"
                 android:text="帮助中心"
                 android:textColor="@color/color_333333"
                 android:textSize="@dimen/sp_16"
                 app:layout_constraintLeft_toLeftOf="parent"
-                app:layout_constraintTop_toBottomOf="@+id/tv_device_detection" />
+                app:layout_constraintTop_toTopOf="parent" />
 
 
             <ImageView
@@ -725,13 +742,11 @@
                 android:id="@+id/tv_contact_us"
                 android:layout_width="match_parent"
                 android:layout_height="@dimen/dp_45"
-                android:layout_marginBottom="10dp"
                 android:gravity="center_vertical"
                 android:paddingLeft="@dimen/dp_15"
                 android:text="联系我们"
                 android:textColor="@color/color_333333"
                 android:textSize="@dimen/sp_16"
-                app:layout_constraintBottom_toBottomOf="parent"
                 app:layout_constraintLeft_toLeftOf="parent"
                 app:layout_constraintTop_toBottomOf="@+id/tv_feedback" />
 
@@ -745,7 +760,39 @@
                 app:layout_constraintRight_toRightOf="@+id/tv_contact_us"
                 app:layout_constraintTop_toTopOf="@+id/tv_contact_us" />
 
-        </androidx.constraintlayout.widget.ConstraintLayout>
 
+            <TextView
+                android:id="@+id/tv_customer"
+                android:layout_width="match_parent"
+                android:layout_height="@dimen/dp_45"
+                android:gravity="center_vertical"
+                android:paddingLeft="@dimen/dp_15"
+                android:text="在线客服"
+                android:textColor="@color/color_333333"
+                android:textSize="@dimen/sp_16"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintLeft_toLeftOf="parent"
+                app:layout_constraintTop_toBottomOf="@+id/tv_contact_us" />
+
+
+            <ImageView
+                android:id="@+id/iv_customer_arrow"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginRight="@dimen/dp_22"
+                android:background="@drawable/icon_arrow_right2"
+                app:layout_constraintBottom_toBottomOf="@+id/tv_customer"
+                app:layout_constraintRight_toRightOf="@+id/tv_customer"
+                app:layout_constraintTop_toTopOf="@+id/tv_customer" />
+
+
+            <androidx.constraintlayout.widget.Group
+                android:visibility="gone"
+                android:id="@+id/group_customer"
+                app:constraint_referenced_ids="iv_customer_arrow,tv_customer"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"/>
+
+        </androidx.constraintlayout.widget.ConstraintLayout>
     </androidx.constraintlayout.widget.ConstraintLayout>
 </ScrollView>

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

@@ -843,4 +843,12 @@ public interface APIService {
 
     @POST(TEACHER_GROUP+"tenantGroup/page")
     Observable<BaseResponse<TenantGroupListBean>> getTenantGroupList(@Body RequestBody body);
+
+    /**
+     *
+     *
+     * @return
+     */
+    @GET(TEACHER_GROUP + "teacher/updateUserCustomerService")
+    Observable<BaseResponse<String>> updateUserCustomerService();
 }

+ 1 - 0
teacher/src/main/java/com/cooleshow/teacher/contract/MineContract.java

@@ -8,6 +8,7 @@ import com.cooleshow.base.presenter.view.BaseView;
 public interface MineContract {
 
     interface MineView extends BaseView {
+        void updateUserCustomerServiceSuccess(String data);
     }
 
     interface Presenter {

+ 13 - 0
teacher/src/main/java/com/cooleshow/teacher/presenter/main/MinePresenter.java

@@ -31,4 +31,17 @@ public class MinePresenter extends BasePresenter<MineContract.MineView> implemen
             }
         });
     }
+
+
+    public void updateUserCustomerService() {
+
+        addSubscribe(create(APIService.class).updateUserCustomerService(), new BaseObserver<String>(getView()) {
+            @Override
+            protected void onSuccess(String data) {
+                if (getView() != null) {
+                    getView().updateUserCustomerServiceSuccess(data);
+                }
+            }
+        });
+    }
 }

+ 30 - 0
teacher/src/main/java/com/cooleshow/teacher/ui/main/MineFragment.java

@@ -22,6 +22,7 @@ import com.cooleshow.base.utils.Utils;
 import com.cooleshow.base.utils.helper.PermissionTipHelper;
 import com.cooleshow.base.utils.helper.WebStartHelper;
 import com.cooleshow.base.widgets.DialogUtil;
+import com.cooleshow.chatmodule.utils.helper.ChatHelper;
 import com.cooleshow.teacher.R;
 import com.cooleshow.teacher.bean.MineCommonToolAdapter;
 import com.cooleshow.teacher.bean.MineToolMenuBean;
@@ -50,6 +51,7 @@ import androidx.recyclerview.widget.GridLayoutManager;
 public class MineFragment extends BaseMVPFragment<FragmentMineLayoutBinding, MinePresenter> implements MineContract.MineView, View.OnClickListener {
     private String teacherCertStatus = TeacherInfoConstants.ENTRY_STATUS_UNPAALY;
     private MineCommonToolAdapter mMineCommonToolAdapter;
+    private String customerId = "";
 
     @Override
     protected void initView(View rootView) {
@@ -90,6 +92,7 @@ public class MineFragment extends BaseMVPFragment<FragmentMineLayoutBinding, Min
         mViewBinding.tvContactUs.setOnClickListener(this);
         mViewBinding.tvAward.setOnClickListener(this);
         mViewBinding.tvMineCourseware.setOnClickListener(this);
+        mViewBinding.tvCustomer.setOnClickListener(this);
     }
 
     @Override
@@ -177,6 +180,11 @@ public class MineFragment extends BaseMVPFragment<FragmentMineLayoutBinding, Min
             ArrayList<MineToolMenuBean> toolsData = MineFragmentToolsHelper.getData(teacherUserInfo.isSettlement ? null : MineFragmentToolsHelper.TYPE_MINE_INCOME);
             mMineCommonToolAdapter.setNewInstance(toolsData);
         }
+
+        //客服
+        this.customerId = teacherUserInfo.getImCustomerId();
+        boolean hasCustomer = teacherUserInfo.getCustomerServiceNum() > 0;
+        mViewBinding.tvCustomer.setVisibility(hasCustomer ? View.VISIBLE : View.GONE);
     }
 
     private void updateCertStatusUI(int degreeFlag, int teacherFlag) {
@@ -395,6 +403,13 @@ public class MineFragment extends BaseMVPFragment<FragmentMineLayoutBinding, Min
                 ARouter.getInstance().build(RouterPath.MineCenter.MINE_COURSE_WARE)
                         .navigation();
                 break;
+            case R.id.tv_customer:
+                if (!TextUtils.isEmpty(customerId)) {
+                    openCustomerService();
+                } else {
+                    presenter.updateUserCustomerService();
+                }
+                break;
         }
     }
 
@@ -564,4 +579,19 @@ public class MineFragment extends BaseMVPFragment<FragmentMineLayoutBinding, Min
             e.printStackTrace();
         }
     }
+
+    private void openCustomerService() {
+        ChatHelper.getInstance().goChat(customerId, "");
+    }
+
+    @Override
+    public void updateUserCustomerServiceSuccess(String data) {
+        if (isDetached()) {
+            return;
+        }
+        if (!TextUtils.isEmpty(data)) {
+            this.customerId = data;
+            openCustomerService();
+        }
+    }
 }

+ 10 - 0
teacher/src/main/res/layout/fragment_mine_layout.xml

@@ -956,6 +956,16 @@
                 android:visibility="visible"
                 app:layout_constraintLeft_toLeftOf="@+id/tv_help"
                 app:layout_constraintTop_toBottomOf="@+id/tv_help" />
+
+
+            <TextView
+                android:id="@+id/tv_customer"
+                style="@style/me_btn_style"
+                android:text="在线客服"
+                android:visibility="gone"
+                app:layout_constraintLeft_toLeftOf="@+id/tv_help"
+                app:layout_constraintTop_toBottomOf="@+id/tv_help" />
+
         </LinearLayout>
     </androidx.constraintlayout.widget.ConstraintLayout>
 </ScrollView>

+ 18 - 0
usercenter/src/main/java/com/cooleshow/usercenter/bean/StudentUserInfo.java

@@ -73,6 +73,24 @@ public class StudentUserInfo implements Serializable {
     private String tenantGroupId;
     private String tenantGroupName;
     private VipBean userVip;
+    private String imCustomerId;
+    private int customerServiceNum;
+
+    public int getCustomerServiceNum() {
+        return customerServiceNum;
+    }
+
+    public void setCustomerServiceNum(int customerServiceNum) {
+        this.customerServiceNum = customerServiceNum;
+    }
+
+    public String getImCustomerId() {
+        return imCustomerId;
+    }
+
+    public void setImCustomerId(String imCustomerId) {
+        this.imCustomerId = imCustomerId;
+    }
 
     public VipBean getUserVip() {
         return userVip;

+ 18 - 0
usercenter/src/main/java/com/cooleshow/usercenter/bean/TeacherUserInfo.java

@@ -97,6 +97,8 @@ public class TeacherUserInfo implements Serializable {
 
     private String imUserId;
     private String imToken;
+    private String imCustomerId;
+    private int customerServiceNum;
 
     private int tenantAlbumStatus;//0:没有专辑 1:有,但是未解锁,2:有,且已解锁
 
@@ -104,6 +106,22 @@ public class TeacherUserInfo implements Serializable {
 
     private Boolean customerService;
 
+    public int getCustomerServiceNum() {
+        return customerServiceNum;
+    }
+
+    public void setCustomerServiceNum(int customerServiceNum) {
+        this.customerServiceNum = customerServiceNum;
+    }
+
+    public String getImCustomerId() {
+        return imCustomerId;
+    }
+
+    public void setImCustomerId(String imCustomerId) {
+        this.imCustomerId = imCustomerId;
+    }
+
     public boolean getCustomerService() {
         if (customerService != null) {
             return customerService;