Browse Source

Merge branch 'master' of http://47.100.37.243:10080/wutt/game

seyason 5 years ago
parent
commit
0fa38a3e17

+ 5 - 0
minigame/WebContent/static/css/lottery.css

@@ -108,6 +108,11 @@ input{
     width: 52%;
     z-index: 12;
 }
+.advertisement li{
+	font-size: 10px !important;
+	line-height: 20px !important;
+	height: 20px !important;
+}
 
 /*滚动*/
 .case {

+ 18 - 18
minigame/WebContent/static/lottery.html

@@ -22,6 +22,8 @@
             $(window).resize(function () {
                 setPosition();
             });
+            //id设置进入localstorage
+            localStorage.setItem("userId", id);
             //在这里查看是否有id
             if(id == null){
             	alert("请先登录");
@@ -30,7 +32,7 @@
             
             
             //获取
-            $.post("./prize/luckDrawList", {}, function(resp) {
+            $.post("../prize/luckDrawList", {}, function(resp) {
 				if (resp.code == 'error') {
 					console.log(resp.code);
 				}else{
@@ -40,7 +42,7 @@
 				}
 			});
             
-            //点击
+            //点击查看结果
             $(".check_result").click(function(){
             	window.location.href = "result.html";
             })
@@ -49,7 +51,7 @@
             $(".button").click(function () {
                 if(enable == true){
 					//获取抽奖结果
-                    $.post("./prize/luckDraw", {userId: id}, function(resp) {
+                    $.post("../prize/luckDraw", {userId: id}, function(resp) {
         				if (resp.code == 'error') {
         					alert(resp.msg);
         				}else{
@@ -57,13 +59,11 @@
                             enable = false;
                             //设置初始速度
                             speed = 60;
-                            //设置要中奖的位置 1.3.5没有 0十二瓶 2一升 4五百毫升 6书 7肥皂
+                            //设置要中奖的位置 1.5没有 0十二瓶 4一升 2.6五百毫升 3书 7肥皂
                             if(resp.data.prizeLevel == -1){
-                            	var rand = Math.round(Math.random()*3);
+                            	var rand = Math.round(Math.random()*2);
                             	if(rand <= 1){
                             		threshold = 1;
-                            	}else if(rand <= 2){
-                            		threshold = 3;                            		
                             	}else{
                             		threshold = 5; 
                             	}
@@ -71,16 +71,16 @@
                             	threshold = 0;
                             	src = "images/reward_oil60_2.png";
                             }else if(resp.data.prizeLevel == 1){
-                            	threshold = 4;   
+                            	threshold = 2;   
                             	src = "images/reward_oil5_2.png";           	
                             }else if(resp.data.prizeLevel == 2){
-                            	threshold = 2;
+                            	threshold = 4;
                             	src = "images/reward_oil10_2.png";                          	
                             }else if(resp.data.prizeLevel == 3){
                             	threshold = 7;
                             	src = "images/reward_soap2.png";                          	
                             }else if(resp.data.prizeLevel == 4){
-                            	threshold = 6;
+                            	threshold = 3;
                             	src = "images/reward_book2.png";        	
                             }else{
                             	threshold = 1;
@@ -103,7 +103,7 @@
                 if(name == "" || phone == ""){
                 	alert("请填写完整信息");
                 }else{
-                	$.post("./prize/luckDrawAddInfo", {
+                	$.post("../prize/luckDrawAddInfo", {
                 		id: id,
                 		phone: phone,
                 		username: name
@@ -184,7 +184,7 @@
         document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
     		//发送给好友
     		WeixinJSBridge.on('menu:share:appmessage', function(argv){
-    			$.post("./prize/luckDrawAddShare", {uid: id}, function(resp) {
+    			$.post("../prize/luckDrawAddShare", {uid: id}, function(resp) {
     				if (resp.code == 'error') {
     					console.log(resp.code);
     				}else{
@@ -194,7 +194,7 @@
     		});
     		//分享到朋友圈
     		WeixinJSBridge.on('menu:share:timeline', function(argv){
-    			$.post("./prize/luckDrawAddShare", {uid: id}, function(resp) {
+    			$.post("../prize/luckDrawAddShare", {uid: id}, function(resp) {
     				if (resp.code == 'error') {
     					console.log(resp.code);
     				}else{
@@ -212,13 +212,13 @@
     <div class="container">
         <img class="item item0" src="images/reward_oil60.png">
         <img class="item item1" src="images/reward_null.png">
-        <img class="item item2" src="images/reward_oil10.png">
+        <img class="item item2" src="images/reward_oil5.png">
         <img class="item item7" src="images/reward_soap.png">
         <img class="item button" src="images/lottery_button.png">
-        <img class="item item3" src="images/reward_null.png">
-        <img class="item item6" src="images/reward_book.png">
+        <img class="item item3" src="images/reward_book.png">
+        <img class="item item6" src="images/reward_oil5.png">
         <img class="item item5" src="images/reward_null.png">
-        <img class="item item4" src="images/reward_oil5.png">
+        <img class="item item4" src="images/reward_oil10.png">
     </div>
     <span class="title"><span style="color: #FF356B">活动</span>说明</span>
     <span class="tips">1.中奖者留下姓名和电话,在活动结束后会联系邮寄奖品;<br>
@@ -271,6 +271,6 @@
 
     <img class="result failed" src="images/result_failed.png" style="display: none;">
     <img class="result_failed_button" src="images/result_failed_button.png" style="display: none;">
-    <span class="check_result">查看中奖结果</span>
+    <span class="check_result">查看我的中奖结果</span>
 </body>
 </html>

+ 21 - 9
minigame/WebContent/static/result.html

@@ -5,7 +5,7 @@
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
     <meta http-equiv="X-UA-Compatible" content="ie=edge">
-    <title>抽奖结果</title>
+    <title>我的抽奖结果</title>
     <style type="text/css">
     	*{
     		margin: 0;
@@ -16,15 +16,27 @@
     <link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
     <script type="text/javascript">
 	    $(function(){
-	    	$.post("./prize/luckDrawListBack", {}, function(resp) {
-				if (resp.code == 'error') {
-					console.log(resp.code);
-				}else{
-					for(let index in resp.data){
-						$("table").append("<tr><td>" + resp.data[index].nickName + "</td><td>" + resp.data[index].prize + "</td></tr>")
+	    	var id = localStorage.getItem("userId");
+			if(id != null){
+				$.post("../prize/getluckDrawByUserId", {
+					UserId: id
+				}, function(resp) {
+					if (resp.code == 'error') {
+						console.log(resp.code);
+					}else{
+						if(resp.data.length != 0){
+							for(let index in resp.data){
+								$("table").append("<tr><td>" + resp.data[index].nickName + "</td><td>" + resp.data[index].prize + "</td></tr>");
+							}
+						}else{
+							$("body").append("<p style='text-align: center'>没有中奖信息</p>");
+						}
+						
 					}
-				}
-			});
+				});
+			}else{
+				$("body").append("<p style='text-align: center'>没有中奖信息!</p>");
+			}
 		})
 	</script>
 </head>

+ 79 - 0
minigame/WebContent/static/result_all.html

@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html lang="en" style="width: 100%">
+
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>抽奖结果</title>
+    <style type="text/css">
+    	*{
+    		margin: 0;
+    		padding: 0;
+    	}
+    </style>
+    <script src="js/jquery.min.js"></script>
+    <link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
+    <script type="text/javascript">
+	    $(function(){
+			$.post("../prize/luckDrawListBack", {}, function(resp) {
+				if (resp.code == 'error') {
+					console.log(resp.code);
+				}else{
+					for(let index in resp.data){
+						$("table").append(
+								"<tr><td>" + 
+								index +
+								"</td><td>" +
+								resp.data[index].nickName + 
+								"</td><td>" +
+								resp.data[index].prize +
+								"</td><td>" +
+								resp.data[index].userName +
+								"</td><td>" +
+								resp.data[index].phone +
+								"</td><td>" +
+								formatTime(resp.data[index].indate, 'Y-M-D h:m:s') + 
+								"</td></tr>"
+							);
+					}
+				}
+			});
+		})
+		function formatNumber (n) {
+		    n = n.toString()
+		    return n[1] ? n : '0' + n;
+		}
+		function formatTime (number, format) {
+		    let time = new Date(number)
+		    let newArr = []
+		    let formatArr = ['Y', 'M', 'D', 'h', 'm', 's']
+		    newArr.push(time.getFullYear())
+		    newArr.push(formatNumber(time.getMonth() + 1))
+		    newArr.push(formatNumber(time.getDate()))
+		
+		    newArr.push(formatNumber(time.getHours()))
+		    newArr.push(formatNumber(time.getMinutes()))
+		    newArr.push(formatNumber(time.getSeconds()))
+		
+		    for (let i in newArr) {
+		        format = format.replace(formatArr[i], newArr[i])
+		    }
+		    return format;
+		}
+	</script>
+</head>
+
+<body style="width: 100%">
+    <table class="table table-condensed">
+		<tr>
+			<th>#</th>
+			<th>昵称</th>
+			<th>奖品</th>
+			<th>姓名</th>
+			<th>电话</th>
+			<th>时间</th>
+		</tr>
+	</table>
+</body>
+</html>