huanggang 7 лет назад
Родитель
Сommit
bad375a972

+ 23 - 17
data/resource/mobile/bargain/css/main.css

@@ -25,9 +25,11 @@ ul,li {
     bottom: 80px;
     left: 0;
     width: 750px;
-    overflow-y: auto;
-    overflow-x: hidden;
-    -webkit-overflow-scrolling: touch;
+    max-height: 100%;
+    overflow: hidden;
+    /*overflow-y: auto;*/
+    /*overflow-x: hidden;*/
+    /*-webkit-overflow-scrolling: touch;*/
 }
 .goods {
     display: flex;
@@ -108,31 +110,35 @@ ul,li {
 }
 .bargain_handle {
     text-align: center;
-    font-size: 35px;
+    font-size: 33px;
     color: #ffffff;
     margin-top: 50px;
     margin-bottom: 68px;
 }
 .bargain_btn {
     display: inline-block;
-    height: 81px;
-    width: 252px;
+    height: 90px;
+    width: 262px;
+    box-sizing: border-box;
     color: #ffffff;
-    background: url("../images/bargain_btn.png") no-repeat;
+    background: url(../images/bargain_btn.png) no-repeat;
     background-size: 100% 100%;
-    line-height: 81px;
+    line-height: 90px;
     text-align: center;
-    margin-right: 60px;
+    margin-right: 62px;
+    padding-left: 56px;
 }
 .join_btn {
     display: inline-block;
-    height: 81px;
-    width: 252px;
+    height: 90px;
+    width: 262px;
+    box-sizing: border-box;
     color: #ffffff;
     background: url("../images/join_btn.png") no-repeat;
     background-size: 100% 100%;
-    line-height: 81px;
+    line-height: 90px;
     text-align: center;
+    padding-left: 50px;
 }
 .avatar {
     width: 56px;
@@ -146,6 +152,7 @@ ul,li {
     font-size: 20px;
     color: #b2b2b4;
     padding-left: 84px;
+    margin-bottom: 20px;
 }
 .rules_box {
     width: 700px;
@@ -155,7 +162,6 @@ ul,li {
     position: relative;
     top: 0;
     padding-left: 50px;
-    margin-top: 20px;
 }
 .users_list li {
     background: #ffffff;
@@ -164,7 +170,7 @@ ul,li {
 }
 .rules {
     width: 700px;
-    height: 792px;
+    height: 809px;
 }
 .hide {
     display: none;
@@ -239,7 +245,7 @@ ul,li {
     -webkit-transform: translate(-50%,-50%);
 }
 .slide_containe {
-    height: 232px;
+    height: 280px;
     overflow: hidden;
 }
 .stamp {
@@ -256,7 +262,7 @@ ul,li {
 .fixed_bottom {
     height: 80px;
     width: 750px;
-    position: absolute;
+    position: fixed;
     bottom: 0;
     left: 0;
     background: #ffffff;
@@ -335,6 +341,6 @@ ul,li {
 }
 .main {
     background: url("../images/bg.jpg") no-repeat;
-    padding-top: 383px;
+    padding-top: 558px;
     box-sizing: border-box;
 }

BIN
data/resource/mobile/bargain/images/bargain_btn.png


BIN
data/resource/mobile/bargain/images/bg.jpg


BIN
data/resource/mobile/bargain/images/join_btn.png


BIN
data/resource/mobile/bargain/images/rules.jpg


BIN
data/resource/mobile/bargain/images/rules.png


Разница между файлами не показана из-за своего большого размера
+ 2170 - 0
data/resource/mobile/comm/iscroll.js


+ 69 - 24
mobile/templates/default/game/bargain.php

@@ -11,7 +11,7 @@
 </head>
 <body>
 
-<div class="maincontent">
+<div class="maincontent" id="wrapper">
     <div class="main">
         <div class="content">
             <div class="goods">
@@ -29,7 +29,8 @@
                         </div>
                     </div>
                     <div class="count_down">
-                        <p>剩: <span class="days time_color"></span> 天 <span class="hours time_color"></span>:<span class="minutes time_color"></span> :<span class="seconds time_color"></span> 结束</p>
+                        <p class="bargain_over hide">该砍价已结束</p>
+                        <p class="show_count_down">剩: <span class="days time_color"></span> 天 <span class="hours time_color"></span>:<span class="minutes time_color"></span> :<span class="seconds time_color"></span> 结束</p>
                     </div>
                 </div>
                 <img src="<?php echo RESOURCE_SITE_URL; ?>/mobile/bargain/images/stamp.png" id="stamp" class="stamp hide stamp_scale">
@@ -52,7 +53,7 @@
             </div>
         </div>
         <div class="rules_box">
-            <img src="<?php echo RESOURCE_SITE_URL; ?>/mobile/bargain/images/rules.png" class="rules">
+            <img src="<?php echo RESOURCE_SITE_URL; ?>/mobile/bargain/images/rules.jpg" class="rules">
         </div>
     </div>
 </div>
@@ -67,12 +68,18 @@
         <button class="download_app" id="download_app">下载app</button>
     </div>
 </div>
+
 <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/mobile/shake/js/zepto.min.js"></script>
 <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/mobile/comm/animate.js"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/mobile/comm/iscroll.js"></script>
 <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/mobile/comm/websocket.js"></script>
 <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/mobile/comm/new_bridge.js"></script>
 <script type="text/javascript">
 
+    window.onload = function(){
+        myScroll = new IScroll('#wrapper');
+    };
+
     //发送弹幕
     var Barrage = function()
     {
@@ -119,9 +126,9 @@
 
     var barrage = new Barrage();
 
-    var room    = <?php echo $output['room']; ?>;
-    var roomkey = "<?php echo $output['room_key']; ?>";
-    var addr    =  "<?php echo $output['addr']; ?>";
+    var room    = "<?php echo $output['room']; ?>" || 0;
+    var roomkey = "<?php echo $output['room_key']; ?>" || 0;
+    var addr    =  "<?php echo $output['addr']; ?>" || null;
 
     var room_msgs = {
         room    : room,
@@ -166,15 +173,15 @@
     }
 
     function ret_join(datas){
-        var jsonDatas = new websocket.Json_parse(datas);
-        websocket.setMeId(jsonDatas.content.me);
+//        var jsonDatas = new websocket.Json_parse(datas);
+        websocket.setMeId(datas.content.me);
     }
 
 
     //倒计时
-    var over_time = (new Date(2018,0,14).getTime())/1000;
+    var over_time = (new Date(2018,0,18).getTime())/1000;
 
-    setInterval(function(){
+    var bargain_count_down = setInterval(function(){
         var local_time = (new Date().getTime())/1000;
         var count_down_time = (over_time - local_time).toFixed(0);
         formatDuring(count_down_time);
@@ -185,6 +192,12 @@
         var hours = parseInt(mss / 60 / 60 % 24, 10); //计算剩余的小时
         var minutes = parseInt(mss / 60 % 60, 10);//计算剩余的分钟
         var seconds = parseInt(mss % 60, 10);//计算剩余的秒数
+        if(days <= 0 && hours <= 0 && minutes <= 0 && seconds <= 0) {
+            clearInterval(bargain_count_down);
+            $('.show_count_down').addClass('hide');
+            $('.bargain_over').removeClass('hide');
+            return;
+        }
         if(days < 10) {
             days = '0' + days;
         }
@@ -205,16 +218,35 @@
 
 
     //消息滚动
-    setInterval(function(){
-        var $parent =  $('#slide_list');
-        var $first = $('#slide_list li').first();
-        var height = $first.height();
-        $first.animate({
-            marginTop: -height + 'px'
-        },'ease-out',function(){
-            $parent.append($first.css('marginTop',0));
-        })
-    },2000);
+    var SlideMsgs = function($parent){
+        this.slide_play = null;
+        this.init = function(){
+            this.play();
+        };
+        this.play = function(){
+            this.slide_play = setInterval(function(){
+                var $first = $parent.find('li').first();
+                var height = $first.height();
+                $first.animate({
+                    marginTop: -height + 'px'
+                },'ease-out',function(){
+                    $parent.append($first.css('marginTop',0));
+                })
+            },2000);
+        };
+        this.addChild = function(msg){
+            this.stop();
+            $parent.append('<li><img class="avatar" src="http://img1.imgtn.bdimg.com/it/u=4026848961,760222886&fm=214&gp=0.jpg">'+msg+'</li>');
+            return this;
+        };
+        this.stop = function(){
+            clearInterval(this.slide_play);
+            return this;
+        };
+    };
+
+    var slideMsgs = new SlideMsgs($('#slide_list'));
+    slideMsgs.init();
 
 
     var random = function(){
@@ -222,7 +254,14 @@
     };
 
 
-    document.querySelector('#bargain_btn').addEventListener('click',function(){
+
+    //价格变更
+    var priceAnimated = false;
+    var priceChange = function(){
+        if(priceAnimated) {
+            return;
+        }
+        priceAnimated = true;
         $('.stamp').removeClass('hide');
         document.getElementById('stamp').addEventListener('webkitAnimationEnd',function(){
             setTimeout(function(){
@@ -235,9 +274,15 @@
                 $('.current_price').addClass('scale');
                 document.getElementById('current_price').addEventListener('webkitAnimationEnd',function(){
                     $('.current_price').removeClass('scale');
+                    priceAnimated = false;
                 });
             },500);
         });
+    };
+
+    //砍价按钮
+    document.querySelector('#bargain_btn').addEventListener('click',function(){
+        priceChange();
     });
 
     //发送信息
@@ -250,7 +295,7 @@
 
     //判断用户设备下载app
     var bridge = new Bridge();
-    function skip_download_app(){
+    function download_app(){
         if(bridge.isMobile.iOS()) {
             window.location.href = 'itms-apps://itunes.apple.com/app/id945609424';
         }
@@ -259,10 +304,10 @@
         }
     }
     $('#download_app').on('click',function(){
-        skip_download_app();
+        download_app();
     });
     $('#join_btn').on('click',function(){
-        skip_download_app();
+        download_app();
     });
 </script>
 </body>

+ 5 - 9
mobile/templates/default/game/shake_bonus.php

@@ -105,13 +105,9 @@
         };
         this.clear = function()
         {
-            setTimeout(function(){
-                for(var i=0;i<$('.barrage').length;i++) {
-                    if($('.barrage').eq(i).offset().left < -600 ) {
-                        $('.barrage').eq(i).remove();
-                    }
-                }
-            },10000);
+            $('.barrage').on('webkitAnimationEnd',function(){
+                $(this).remove();
+            });
             return this;
         };
     };
@@ -137,8 +133,8 @@
     }
 
     function ret_join(datas){
-        var jsonDatas = new websocket.Json_parse(datas);
-        websocket.setMeId(jsonDatas.content.me);
+//        var jsonDatas = new websocket.Json_parse(datas);
+        websocket.setMeId(datas.content.me);
     }
 
     var shake_start   = document.getElementById('shake_start');