Reiskuchen 5 éve
szülő
commit
378b7a7258

+ 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 {

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

@@ -30,7 +30,7 @@
             
             
             //获取
-            $.post("./prize/luckDrawList", {}, function(resp) {
+            $.post("../prize/luckDrawList", {}, function(resp) {
 				if (resp.code == 'error') {
 					console.log(resp.code);
 				}else{
@@ -40,16 +40,16 @@
 				}
 			});
             
-            //点击
+            //点击查看结果
             $(".check_result").click(function(){
-            	window.location.href = "result.html";
+            	window.location.href = "result.html?id=" + id;
             })
             
             //点击抽奖
             $(".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{
@@ -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{

+ 24 - 8
minigame/WebContent/static/result.html

@@ -16,15 +16,31 @@
     <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 = null;
+	    	var url = location.search;
+			if (url.indexOf("?") != -1) {
+			   var str = url.substr(1);
+			   strs = str.split("=");
+			   id = strs[1];
+			}
+			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>");
+						}
+						
 					}
-				}
-			});
+				});
+			}
 		})
 	</script>
 </head>

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

@@ -0,0 +1,76 @@
+<!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>" +
+								"不明地址" +
+								"</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>
+		</tr>
+	</table>
+</body>
+</html>