zhangmengjie 5 年之前
父節點
當前提交
8d3eb6839c

+ 17 - 0
android/.project

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>efunbox_mobile_8</name>
+	<comment>Project android created by Buildship.</comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
+	</natures>
+</projectDescription>

+ 2 - 0
android/.settings/org.eclipse.buildship.core.prefs

@@ -0,0 +1,2 @@
+connection.project.dir=
+eclipse.preferences.version=1

+ 6 - 0
android/app/.classpath

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
+	<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
+	<classpathentry kind="output" path="bin/default"/>
+</classpath>

+ 23 - 0
android/app/.project

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>app</name>
+	<comment>Project app created by Buildship.</comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
+	</natures>
+</projectDescription>

+ 2 - 0
android/app/.settings/org.eclipse.buildship.core.prefs

@@ -0,0 +1,2 @@
+connection.project.dir=..
+eclipse.preferences.version=1

+ 12 - 0
android/app/src/main/java/com/edufound/mobile/Util/AndroidUtil.java

@@ -13,6 +13,8 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
 import com.facebook.react.bridge.ReactMethod;
 import com.facebook.react.bridge.WritableMap;
 import com.facebook.react.modules.core.DeviceEventManagerModule;
+import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram;
+import com.theweflex.react.WeChatModule;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -58,6 +60,16 @@ public class AndroidUtil extends ReactContextBaseJavaModule {
     }
 
     @ReactMethod
+    public void toMiniProgram(String programId, String path) {
+        WXLaunchMiniProgram.Req req = new WXLaunchMiniProgram.Req();
+        req.userName = programId; // 填小程序原始id
+        req.path = path;                  //拉起小程序页面的可带参路径,不填默认拉起小程序首页
+        req.miniprogramType = WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE;// 可选打开 开发版,体验版和正式版
+        WeChatModule.api.sendReq(req);
+    }
+
+
+    @ReactMethod
     public void testJS() {
         WritableMap event = Arguments.createMap();
         //传递的参数

+ 5 - 0
pages/utils/wechat.js

@@ -1,5 +1,6 @@
 import * as WeChat from 'react-native-wechat';
 import request from '../utils/request';
+import AndroidUtil from '../../util/AndroidUtil';
 
 /**
     public static String WX_APPID = "wx51acc19c8f7a0f6f";
@@ -154,6 +155,10 @@ export default class wechat {
 			}
 		});
 	}
+
+	static toMiniProgram(programId, path) {
+		AndroidUtil.toMiniProgram(programId, path);
+	}
 }
 
 /***