huanggang преди 7 години
родител
ревизия
97e6aa0309
променени са 2 файла, в които са добавени 44 реда и са изтрити 48 реда
  1. 43 0
      data/resource/mobile/comm/websocket_handles.js
  2. 1 48
      mobile/templates/default/bargain/bargain.php

+ 43 - 0
data/resource/mobile/comm/websocket_handles.js

@@ -0,0 +1,43 @@
+//发送弹幕
+var Barrage = function()
+{
+    this.sendData = null;
+    this.barrage_html = '';
+    this.dataParse = function(data)
+    {
+        return {
+            posY :parseInt(Math.random() * (100 - 20)),
+            avatar: data.avatar,
+            nickname : data.nickname,
+            msg:data.msg
+        }
+    };
+    this.add = function(send_data){
+        this.sendData = this.dataParse(send_data);
+        return this;
+    };
+    this.send = function()
+    {
+        if(this.sendData)
+        {
+            if(this.sendData.msg != null) {
+                this.barrage_html = '<div class="barrage" style="position:absolute;top:'+this.sendData.posY+'%"><img src="'+this.sendData.avatar+'">'+this.sendData.nickname+'说:<span class="price">'+this.sendData.msg+'</span></div>';
+            }
+            $('body').append(this.barrage_html);
+            this.sendData = null;
+            this.barrage_html = '';
+            this.clear();
+            return this;
+        }
+        else {
+            console.log('没有弹幕可以发送');
+        }
+    };
+    this.clear = function()
+    {
+        $('.barrage').on('webkitAnimationEnd',function(){
+            $(this).remove();
+        });
+        return this;
+    };
+};

+ 1 - 48
mobile/templates/default/bargain/bargain.php

@@ -88,9 +88,9 @@
 <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/websocket_handles.js"></script>
 <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/mobile/comm/new_bridge.js"></script>
 <script type="text/javascript" src="http://qzonestyle.gtimg.cn/qzone/qzact/common/share/share.js?<?php echo bonus_version(); ?>"></script>
-
 <script type="text/javascript">
 
     var url         = "<?php echo $output['tpl']->share_url(); ?>";
@@ -129,51 +129,6 @@
         taps:true
     });
 
-
-    //发送弹幕
-    var Barrage = function()
-    {
-        this.sendData = null;
-        this.barrage_html = '';
-        this.dataParse = function(data)
-        {
-            return {
-                posY :parseInt(Math.random() * (100 - 20)),
-                avatar: data.avatar,
-                nickname : data.nickname,
-                msg:data.msg
-            }
-        };
-        this.add = function(send_data){
-            this.sendData = this.dataParse(send_data);
-            return this;
-        };
-        this.send = function()
-        {
-            if(this.sendData)
-            {
-                if(this.sendData.msg != null) {
-                    this.barrage_html = '<div class="barrage" style="position:absolute;top:'+this.sendData.posY+'%"><img src="'+this.sendData.avatar+'">'+this.sendData.nickname+'说:<span class="price">'+this.sendData.msg+'</span></div>';
-                }
-                $('body').append(this.barrage_html);
-                this.sendData = null;
-                this.barrage_html = '';
-                this.clear();
-                return this;
-            }
-            else {
-                console.log('没有弹幕可以发送');
-            }
-        };
-        this.clear = function()
-        {
-            $('.barrage').on('webkitAnimationEnd',function(){
-                $(this).remove();
-            });
-            return this;
-        };
-    };
-
     var barrage = new Barrage();
     function ret_join(datas){
         websocket.setMeId(datas.content.me);
@@ -418,8 +373,6 @@
             }
             else if(msg_type == 'bargain_close') {
                 count_down_time = -1;
-                $('#bargain_btn').addClass('hide');
-                $('#join_btn').removeClass('hide');
             }
         }
         catch (e) {