sunyadv 5 years ago
parent
commit
49e24e7522

File diff suppressed because it is too large
+ 584 - 584
minigame/WebContent/css/main.css


BIN
minigame/WebContent/img/cover.png


BIN
minigame/WebContent/img/poster/ewm.png


+ 19 - 11
minigame/WebContent/index.html

@@ -17,7 +17,7 @@
     <link rel="stylesheet" type="text/css" href="./css/animate.min.css?v=1">
     <link rel="stylesheet" type="text/css" href="./css/main.css?v=1">
   </head>
-<body onload="init()">
+<body onload="getInfo()">
     <!-- loading -->
     <div class="loading">
         <div class="curtain-box">
@@ -65,12 +65,14 @@
         <img src="./img/logo.png" class="logo">
         <img src="./img/poster/hsr.png" class="poster-img" id="poster">
         <div class="leads-box">
-            <img src="./img/leads_pro.png" class="pro">
+            <img src="./img/poster/headOil.png" class="pro">
             <div class="form-group">
-                <input type="text" placeholder="我想把这道菜送给TA">
+                <input id="nameInput" type="text" placeholder="我想把这道菜送给TA">
+				<div id="nameText" class='msg' style='display:none;'></div>
             </div>
             <div class="form-group">
-                <input type="text" placeholder="我想对TA说">
+                <input id="textInput" type="text" placeholder="我想对TA说">
+				<div id="text" class='msg' style='display:none;'></div>
             </div>
             <div class="user-info">
                 <div class="headimg-box">
@@ -78,22 +80,28 @@
                 </div>
                 <p>微信昵称</p>
             </div>
-            <div class="submit">
-                <img src="./img/share_btn.png">
-            </div>
+            <!-- <div class="submit" onclick='saveText()'> -->
+                <!-- <img src="./img/share_btn.png"> -->
+            <!-- </div> -->
         </div>
         <div class="qrcode-box">
-            <img src="./img/poster/qrcode.jpg">
+            <!-- <img src="./img/poster/qrcode.jpg"> -->
+			<img src="./img/poster/ewm.png">
             <p>扫码为他做菜</p>
         </div>
         <div class="replay-btn">
             <img src="./img/replay_btn.png">
         </div>
-        <div class="secret-btn">
-            <img src="./img/secret_btn.png">
+        <!-- <div class="secret-btn"> -->
+            <!-- <img src="./img/secret_btn.png"> -->
+        <!-- </div> -->
+		<div class="secret-btn" onclick='saveText()'>
+            <img src="./img/share_btn.png">
         </div>
     </div>
-
+	
+	<img id="cover" style="width: 100%;height: 103%;position: absolute;top: 0;left: 0;z-index: 99999;display: none" src="./img/cover.png" onclick="hiddenCover()">
+	
     <div class="secret-box">
         <img src="./img/poster/secret1.png" id="secret">
     </div>

+ 40 - 13
minigame/WebContent/js/main.js

@@ -114,9 +114,10 @@ function handleComplete(evt, comp) {
         window.location.href = "http://wx.ttkuaiban.com/minigame/";
         //location.reload()
     })
-    $(".secret-btn").on("click",function(){
-        $(".secret-box").fadeIn();
-    })
+    // $(".secret-btn").on("click",function(){
+		//saveText();
+        //$(".secret-box").fadeIn();
+    // })
     $(".secret-box").on("click",function(){
         $(".secret-box").fadeOut();
     })
@@ -692,8 +693,11 @@ function getInfo() {
 
 // 获取登陆信息
 function getMsg(){
-    if(URLParams['uid']){
+    if(URLParams['uid'] || localStorage.userId){
         var uid = URLParams['uid'];
+		if(localStorage.userId) {
+			uid = localStorage.userId;
+		}
         var xhr=null;
         try{
             xhr=new XMLHttpRequest();
@@ -741,6 +745,7 @@ function getMsg(){
                         var msg = JSON.parse(xhr.response);
                         if(msg.code == "ok") {
                             window.user_info.uid = msg.data.id;
+							localStorage.userId = msg.data.id;
                             window.user_info.logo = msg.data.headerPic;
                             window.user_info.nickname = msg.data.nickName;
                             $('.headimg-box img').attr("src", msg.data.headerPic);
@@ -760,7 +765,12 @@ function getMsg(){
 function saveText() {
     var value = $('#textInput').val(),
         receiver = $('#nameInput').val();
-
+	
+	if(value == '' || receiver == '') {
+		alert('请填写寄语');
+		return false;
+	}
+	
     var xhr=null;
     try{
         xhr=new XMLHttpRequest();
@@ -790,7 +800,8 @@ function saveText() {
                 if(href != document.location.href){
                     history.pushState("", "Title", href);
                 }
-
+				
+				$("#cover").show();
                 if(type == 1) {
                     setTimeout(function(){
                         window.location.href = url
@@ -806,15 +817,31 @@ function saveText() {
 $(".replay-btn").on("click",function(){
     URLParams = new Array();
     window.location.href = "http://wx.ttkuaiban.com/minigame/";
-    //location.reload()
-})
-$(".secret-btn").on("click",function(){
-    $(".secret-box").fadeIn();
-})
-$(".secret-box").on("click",function(){
-    $(".secret-box").fadeOut();
 })
 
+function hiddenCover() {
+    $("#cover").hide();
+}
+
+// 判断微信分享
+document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
+    // 发送给好友
+    WeixinJSBridge.on('menu:share:appmessage', function(argv){
+        // alert('发送给好友')
+        window.location.href = "http://wx.ttkuaiban.com/minigame/lottery.html";
+    });
+    // 分享到朋友圈
+    WeixinJSBridge.on('menu:share:timeline', function(argv){
+        // alert('分享到朋友圈')
+        window.location.href = "http://wx.ttkuaiban.com/minigame/lottery.html";
+    });
+}, false);
+
+// 判断微博分享
+document.addEventListener('WeiboJSBridgeReady', function onBridgeReady() {
+
+}, false);
+
 // 自适应
 var stageWidth, stageHeight, stageScale;
 

+ 28 - 23
minigame/WebContent/lottery.html

@@ -22,7 +22,6 @@
             $(window).resize(function () {
                 setPosition();
             });
-            
             //在这里查看是否有id
             if(id == null){
             	alert("请先登录");
@@ -31,7 +30,7 @@
             
             
             //获取
-            $.post("../prize/luckDrawList", {}, function(resp) {
+            $.post("prize/luckDrawList", {}, function(resp) {
 				if (resp.code == 'error') {
 					console.log(resp.code);
 				}else{
@@ -50,7 +49,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{
@@ -58,26 +57,33 @@
                             enable = false;
                             //设置初始速度
                             speed = 60;
-                            //设置要中奖的位置 0手账 2 1升 4谢谢惠顾 5肥皂 6 12瓶 7 500毫升
+                            //设置要中奖的位置 1.3.5没有 0十二瓶 2一升 4五百毫升 6书 7肥皂
                             if(resp.data.prizeLevel == -1){
-                                threshold = 4;
+                            	var rand = Math.round(Math.random()*3);
+                            	if(rand <= 1){
+                            		threshold = 1;
+                            	}else if(rand <= 2){
+                            		threshold = 3;                            		
+                            	}else{
+                            		threshold = 5; 
+                            	}
                             }else if(resp.data.prizeLevel == 0){
-                            	threshold = 6;
+                            	threshold = 0;
                             	src = "images/reward_oil60_2.png";
                             }else if(resp.data.prizeLevel == 1){
-                            	threshold = 7;   
+                            	threshold = 4;   
                             	src = "images/reward_oil5_2.png";           	
                             }else if(resp.data.prizeLevel == 2){
                             	threshold = 2;
                             	src = "images/reward_oil10_2.png";                          	
                             }else if(resp.data.prizeLevel == 3){
-                            	threshold = 5;
+                            	threshold = 7;
                             	src = "images/reward_soap2.png";                          	
                             }else if(resp.data.prizeLevel == 4){
-                            	threshold = 0;
+                            	threshold = 6;
                             	src = "images/reward_book2.png";        	
                             }else{
-                            	threshold = 4;
+                            	threshold = 1;
                             }
                             //配置移动次数
                             last = 56 + threshold - current;
@@ -97,7 +103,7 @@
                 if(name == "" || phone == ""){
                 	alert("请填写完整信息");
                 }else{
-                	$.post("../prize/luckDrawAddInfo", {
+                	$.post("prize/luckDrawAddInfo", {
                 		id: id,
                 		phone: phone,
                 		username: name
@@ -111,7 +117,6 @@
         			});
                 }
             });
-            
         });
 
         //重新设置内容位置
@@ -124,7 +129,7 @@
             $(".tips").css("top", $(".container").width() * 2.45);
             $(".mask").css("height", $(document).height());
             $(".result_failed_button").css("top", $(".container").width() * 1.6);
-            $(".result_success_title").css("top", $(".container").width() * 0.66);
+            $(".result_success_title").css("top", $(".container").width() * 0.69);
             $(".result_success_logo").css("top", $(".container").width() * 0.9);
             $(".result_success_name").css("top", $(".container").width() * 1.35);
             $(".result_success_phone").css("top", $(".container").width() * 1.59);
@@ -146,7 +151,7 @@
                 setTimeout(function(){next()}, speed);
             }else{
                 setTimeout(function(){
-                    if(threshold == 4){
+                    if(threshold == 1 || threshold == 3 || threshold == 5){
                     	failed();
                     }else{
                     	success();
@@ -179,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{
@@ -189,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{
@@ -205,15 +210,15 @@
     <img class="background" src="images/lottery_background.png">
     <img class="pool" src="images/lottery_pool.png">
     <div class="container">
-        <img class="item item0" src="images/reward_book.png">
-        <img class="item item1" src="images/reward_soap.png">
+        <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 item7" 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_oil5.png">
-        <img class="item item6" src="images/reward_oil60.png">
-        <img class="item item5" src="images/reward_soap.png">
-        <img class="item item4" src="images/reward_null.png">
+        <img class="item item3" src="images/reward_null.png">
+        <img class="item item6" src="images/reward_book.png">
+        <img class="item item5" src="images/reward_null.png">
+        <img class="item item4" src="images/reward_oil5.png">
     </div>
     <span class="title"><span style="color: #FF356B">活动</span>说明</span>
     <span class="tips">1.中奖者留下姓名和电话,在活动结束后会联系邮寄奖品;<br>

+ 1 - 1
minigame/WebContent/result.html

@@ -16,7 +16,7 @@
     <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) {
+	    	$.post("prize/luckDrawListBack", {}, function(resp) {
 				if (resp.code == 'error') {
 					console.log(resp.code);
 				}else{