heyang 3 years ago
parent
commit
5320bb702d
1 changed files with 15 additions and 14 deletions
  1. 15 14
      microserviceUserH5/vcloud/activationCode.html

+ 15 - 14
microserviceUserH5/vcloud/activationCode.html

@@ -65,15 +65,7 @@
 		$('.try-play')[0].addEventListener('click',()=>{
 			//是否有token
 			let type = id === ''? 'noToken': 'com.xjro.yy';
-			if (isAndroid) {
-				window.native.toGame(type);
-            }else if(isiOS){
-				window.webkit.messageHandlers.getPackageName.postMessage(type);
-			}else{
-				stopManyClick(() =>{
-					toastr.error('暂不支持当前系统')
-				})
-			}
+			    sendParm(type);
 			if(id !== ''){
 				operate(5);
 			}
@@ -109,11 +101,8 @@
 		//点击领取激活码
 		function getActivationCode(){
 			//是否有token
-			if (isAndroid && id === '') {
-				window.native.toGame('noToken');
-				return 
-            }else if(isiOS && id === ''){
-				window.webkit.messageHandlers.getPackageName.postMessage('noToken');
+			if(id === ''){
+				sendParm('noToken');
 				return
 			}
 			$.ajax({
@@ -161,6 +150,18 @@
 				},1500)
 			})
 		}
+		//传递参数给app
+		function sendParm(type) {
+			if (isAndroid) {
+				window.native.toGame(type);
+            }else if(isiOS){
+				window.webkit.messageHandlers.getPackageName.postMessage(type);
+			}else{
+				stopManyClick(() =>{
+					toastr.error('暂不支持当前系统')
+				})
+			}
+		}
 		//防止提示一秒内重复显示
 		function stopManyClick(fn) {
 			if (flag) {