Explorar o código

添加老师端跳转其他老师个人主页的逻辑

Pq %!s(int64=2) %!d(string=hai) anos
pai
achega
5543ab10bc

+ 2 - 0
BaseLibrary/src/main/java/com/cooleshow/base/common/WebConstants.java

@@ -162,5 +162,7 @@ public abstract class WebConstants {
 
     //曲目详情页
     public static final String MUSIC_SHEET_DETAIL = getBaseUrlH5() + "/#/music-detail?id=";
+    //老师打开老师个人主页
+    public static final String TEACHER_HOME_PAGE_FOR_TEACHER = getBaseUrlH5() + "/#/teacherHome?teacherId=%s";
 
 }

+ 11 - 0
BaseLibrary/src/main/java/com/cooleshow/base/utils/helper/WebStartHelper.java

@@ -224,4 +224,15 @@ public class WebStartHelper {
                 .withString(WebConstants.WEB_URL,url)
                 .navigation();
     }
+
+    /**
+     * 老师打开其他老师个人主页
+     * @param targetTeacherId
+     */
+    public static void startTeacherHomePageFromTeacher(String targetTeacherId){
+        ARouter.getInstance()
+                .build(RouterPath.WebCenter.ACTIVITY_HTML)
+                .withString(WebConstants.WEB_URL,String.format(WebConstants.TEACHER_HOME_PAGE_FOR_TEACHER,targetTeacherId))
+                .navigation();
+    }
 }

+ 18 - 4
rong_im/kit/src/main/java/io/rong/imkit/utils/helper/ChatClickHelper.java

@@ -6,6 +6,7 @@ import com.alibaba.android.arouter.launcher.ARouter;
 import com.cooleshow.base.common.BaseApplication;
 import com.cooleshow.base.router.RouterPath;
 import com.cooleshow.base.utils.helper.WebStartHelper;
+import com.cooleshow.usercenter.helper.UserHelper;
 
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -48,8 +49,12 @@ public class ChatClickHelper {
             if (isTeacher) {
                 //跳转老师个人主页
                 if (BaseApplication.Companion.isTeacherClient()) {
-                    ARouter.getInstance().build(RouterPath.MineCenter.HOME_PAGE)
-                            .navigation();
+                    if (isOwn(userInfo.getUserId())) {
+                        ARouter.getInstance().build(RouterPath.MineCenter.HOME_PAGE)
+                                .navigation();
+                    } else {
+                        WebStartHelper.startTeacherHomePageFromTeacher(userInfo.getUserId());
+                    }
                 } else {
                     WebStartHelper.startTeacherHomePage(userInfo.getUserId());
                 }
@@ -75,8 +80,12 @@ public class ChatClickHelper {
                 if (isTeacher) {
                     //跳转老师个人主页
                     if (BaseApplication.Companion.isTeacherClient()) {
-                        ARouter.getInstance().build(RouterPath.MineCenter.HOME_PAGE)
-                                .navigation();
+                        if (isOwn(userInfo.getUserId())) {
+                            ARouter.getInstance().build(RouterPath.MineCenter.HOME_PAGE)
+                                    .navigation();
+                        } else {
+                            WebStartHelper.startTeacherHomePageFromTeacher(userInfo.getUserId());
+                        }
                     } else {
                         WebStartHelper.startTeacherHomePage(userInfo.getUserId());
                     }
@@ -90,4 +99,9 @@ public class ChatClickHelper {
         }
     }
 
+
+    private static boolean isOwn(String targetId) {
+        String userId = UserHelper.getUserId();
+        return TextUtils.equals(userId, targetId);
+    }
 }