heyang 3 years ago
parent
commit
58e4ec4931
1 changed files with 44 additions and 8 deletions
  1. 44 8
      microserviceUserH5/vcloud/activationCode.html

+ 44 - 8
microserviceUserH5/vcloud/activationCode.html

@@ -47,7 +47,7 @@
 		toastr.options.timeOut = '1500';
 	</script>
 	<script type="text/javascript">
-        // var baseUrl = 'http://192.168.31.198'
+        var baseUrl = 'http://14.215.128.96'
 	    let timer,flag = true;
 		var url = window.location.href;
 		url = url.split('/')
@@ -55,24 +55,59 @@
 		    n1 = loc.length,//地址的总长度
 		    n2 = loc.indexOf("="),//取得=号的位置
 		    id = loc.substr(n2 + 1, n1 - n2);//从=号后面的内容
+		operate(3);
+		//激活码
 		$.ajax({
 			url: baseUrl + '/api/public/v1/game/activationCode',
 			type: 'get',
 			headers: {
-				// 'Authorization': id  //id
+				'Authorization': id  //id
 			},
 			contentType: "application/json",
 			dataType: 'json',
 			cache: false,
 			success: function (res) {
-				console.log(res)
-				$('#copy-code').text('P005242235')
-				if (res.data.friendList.length > 0) {
-					
-				}
+				$('#copy-code').text(res.data)
 			},
 		})
-
+		//试玩url
+		$.ajax({
+			url: baseUrl + '/api/public/v1/game/url',
+			type: 'get',
+			headers: {
+				'Authorization': id  //id
+			},
+			contentType: "application/json",
+			dataType: 'json',
+			cache: false,
+			success: function (res) {
+				$('.try-play')[0].addEventListener('click',()=>{
+					window.location.href = !res.data.includes('http')?'http://' + res.data: res.data;
+					operate(5);
+				},false);
+			},
+		})
+		//埋点
+		function operate(accessType){
+			$.ajax({
+				url: baseUrl + '/api/public/v1/game/user/operate',
+				type: 'post',
+				headers: {
+					'Authorization': id  //id
+				},
+				data:JSON.stringify({
+					accessType: accessType,
+					entrance: 3,
+					url: window.location.href
+				}),
+				contentType:"application/json",
+				dataType: 'json',
+				cache: false,
+				success: function (res) {
+					console.log(res)
+				},
+			})
+		}
 	    $('.get-gif')[0].addEventListener('click',handleShow,false);
 		function handleShow() {
 			$('.dialog').animate({top: '4.36rem'},"fast");
@@ -98,6 +133,7 @@
 				// 执行浏览器复制命令
 				document.execCommand("copy");
 				$('.copy-success').addClass('on');
+				operate(4);
 				setTimeout(() => {
 					$('.copy-success').removeClass('on');
 				},1500)