|
@@ -4,11 +4,14 @@ import android.text.TextUtils;
|
|
|
|
|
|
import com.alibaba.android.arouter.launcher.ARouter;
|
|
|
import com.cooleshow.base.bean.RouteBean;
|
|
|
+import com.cooleshow.base.common.BaseApplication;
|
|
|
import com.cooleshow.base.common.WebConstants;
|
|
|
import com.cooleshow.base.constanst.Constants;
|
|
|
import com.cooleshow.base.constanst.RouteConstants;
|
|
|
import com.cooleshow.base.router.RouterPath;
|
|
|
|
|
|
+import org.json.JSONObject;
|
|
|
+
|
|
|
/**
|
|
|
* Author by pq, Date on 2022/6/29.
|
|
|
*/
|
|
@@ -20,31 +23,84 @@ public class JumpUtils {
|
|
|
if (routeBean == null) {
|
|
|
return false;
|
|
|
}
|
|
|
- String action = routeBean.action;
|
|
|
-
|
|
|
- if (TextUtils.equals(action, ACTION_APP)) {
|
|
|
- //跳转原生页面
|
|
|
- if (!TextUtils.isEmpty(routeBean.pageTag)) {
|
|
|
- if (TextUtils.equals(routeBean.pageTag, RouteConstants.PAGE_TAG_BUY_PRACTICE)) {
|
|
|
- //购买陪练课,跳转首页课表
|
|
|
- ARouter.getInstance().build(RouterPath.APPCenter.PATH_HOME)
|
|
|
- .withInt(Constants.MAIN_PAGE_SELECT_POTION_KEY, 1)
|
|
|
- .navigation();
|
|
|
- return true;
|
|
|
+ try {
|
|
|
+
|
|
|
+ String action = routeBean.action;
|
|
|
+
|
|
|
+ if (TextUtils.equals(action, ACTION_APP)) {
|
|
|
+ //跳转原生页面
|
|
|
+ if (!TextUtils.isEmpty(routeBean.pageTag)) {
|
|
|
+ if (TextUtils.equals(routeBean.pageTag, RouteConstants.PAGE_TAG_BUY_PRACTICE)) {
|
|
|
+ //购买陪练课,跳转首页课表
|
|
|
+ ARouter.getInstance().build(RouterPath.APPCenter.PATH_HOME)
|
|
|
+ .withInt(Constants.MAIN_PAGE_SELECT_POTION_KEY, 1)
|
|
|
+ .navigation();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (TextUtils.equals(routeBean.pageTag, RouteConstants.PAGE_TAG_EVALUATE)) {
|
|
|
+ //跳转评价页面
|
|
|
+ if (BaseApplication.Companion.isTeacherClient()) {
|
|
|
+ ARouter.getInstance().build(RouterPath.CommentCenter.TEACHER_COURSE_COMMENT)
|
|
|
+ .navigation();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (TextUtils.equals(routeBean.pageTag, RouteConstants.PAGE_TAG_HOMEWORK)) {
|
|
|
+ //原生跳作业详情页面
|
|
|
+ if (BaseApplication.Companion.isTeacherClient()) {
|
|
|
+ //老师端 区分琴房课和陪练课
|
|
|
+// if (rowsBean != null && TextUtils.equals(CourseConstants.PIANO_ROOM_COURSE, rowsBean.type)) {
|
|
|
+// //琴房课
|
|
|
+// ARouter.getInstance().build(RouterPath.CourseCenter.PIANO_ROOM_COURSE_DETAIL)
|
|
|
+// .withString("course_id", rowsBean.courseId)
|
|
|
+// .navigation();
|
|
|
+// } else {
|
|
|
+// //陪练课
|
|
|
+// ARouter.getInstance().build(RouterPath.WorkCenter.TEACHER_WORK_ASSIGN_HOMEWORK)
|
|
|
+// .withString(TeacherConfig.COURSE_ID, rowsBean.courseId)
|
|
|
+// .withString(TeacherConfig.STUDENT_ID, rowsBean.studentId)
|
|
|
+// .navigation();
|
|
|
+// }
|
|
|
+ } else {
|
|
|
+ //学生端直接跳作业详情页面
|
|
|
+ String params = routeBean.params;
|
|
|
+ if (!TextUtils.isEmpty(params)) {
|
|
|
+ String courseId = getParams(params, "courseId");
|
|
|
+ if (TextUtils.isEmpty(courseId)) {
|
|
|
+ ARouter.getInstance().build(RouterPath.WorkCenter.STUDENT_HOMEWORK_DETAIL)
|
|
|
+ .withString("course_id", courseId)
|
|
|
+ .navigation();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ } else {
|
|
|
+ //跳转H5页面
|
|
|
+ if (TextUtils.isEmpty(routeBean.url)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ ARouter.getInstance()
|
|
|
+ .build(RouterPath.WebCenter.ACTIVITY_HTML)
|
|
|
+ .withString(WebConstants.WEB_URL, routeBean.url)
|
|
|
+ .navigation();
|
|
|
+ return true;
|
|
|
}
|
|
|
- } else {
|
|
|
- //跳转H5页面
|
|
|
- if (TextUtils.isEmpty(routeBean.url)) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- ARouter.getInstance()
|
|
|
- .build(RouterPath.WebCenter.ACTIVITY_HTML)
|
|
|
- .withString(WebConstants.WEB_URL, routeBean.url)
|
|
|
- .navigation();
|
|
|
- return true;
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ private static String getParams(String paramsJson, String key) {
|
|
|
+ try {
|
|
|
+ JSONObject jsonObject = new JSONObject(paramsJson);
|
|
|
+ return jsonObject.optString(key);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
}
|