|
@@ -0,0 +1,83 @@
|
|
|
+package com.cooleshow.institution.stu.utils;
|
|
|
+
|
|
|
+import android.text.TextUtils;
|
|
|
+import android.util.Log;
|
|
|
+
|
|
|
+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.
|
|
|
+ */
|
|
|
+public class JGJumpUtils {
|
|
|
+ public static final String ACTION_H5 = "h5";
|
|
|
+ public static final String ACTION_APP = "app";
|
|
|
+
|
|
|
+ public static boolean jump(RouteBean routeBean) {
|
|
|
+ if (routeBean == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+
|
|
|
+ String action = routeBean.action;
|
|
|
+
|
|
|
+ if (TextUtils.equals(action, ACTION_APP)) {
|
|
|
+ //跳转原生页面
|
|
|
+ Log.i("pq", "routeBean tag:" + routeBean.pageTag);
|
|
|
+ ARouter.getInstance().build(RouterPath.JGCenter.MESSAGE_BOX)
|
|
|
+ .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 {
|
|
|
+ paramsJson.replace("\\", "");
|
|
|
+ JSONObject jsonObject = new JSONObject(paramsJson);
|
|
|
+ return jsonObject.optString(key);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 跳转首页,选中目标页面
|
|
|
+ *
|
|
|
+ * @param selectPosition
|
|
|
+ */
|
|
|
+ public static void jumpMain(int selectPosition) {
|
|
|
+ ARouter.getInstance().build(RouterPath.APPCenter.PATH_HOME)
|
|
|
+ .withInt(Constants.MAIN_PAGE_SELECT_POTION_KEY, selectPosition)
|
|
|
+ .navigation();
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void jumpJGMainAndSelectChild(int i, int childPos) {
|
|
|
+ ARouter.getInstance().build(RouterPath.JGCenter.PATH_HOME)
|
|
|
+ .withInt(Constants.MAIN_PAGE_SELECT_POTION_KEY, i)
|
|
|
+ .withInt(Constants.MAIN_PAGE_SELECT_CHILD_POTION_KEY, childPos)
|
|
|
+ .navigation();
|
|
|
+ }
|
|
|
+}
|