Browse Source

Merge branch 'master' of http://120.78.169.79:3000/zhengxiaoyu/datiGame

郑晓宇 6 years ago
parent
commit
59cf3bdb6d
1 changed files with 21 additions and 12 deletions
  1. 21 12
      public/h5/datigame/js/common.js

+ 21 - 12
public/h5/datigame/js/common.js

@@ -54,7 +54,7 @@ common={
      	   $.ajax({
              type: "POST",
              url: this.data.baseurl+this.data.Answer,
-             data:{question_id:_this.data.question_id,option_id:_this.data.option_id},
+             data:{question_id:_this.data.question_id,option_id:_this.data.option_id,anwser_time:_this.data.sum},
              dataType: "json",
              success: function(data){
                    fn&&fn(data); 
@@ -167,6 +167,11 @@ common={
           break;
           case "answer":
           if(_this.userInfo.user_id==data.user_id){
+          	if( parseInt($("#py1_score").html())==data.total_score){
+          		$("#question .cur_answer").addClass("cur_error");
+          	}else{
+          		$("#question .cur_answer").addClass("cur_true");
+          	}
           	_this.increment($("#py1_score"),data.total_score);
           }else if(_this.userInfo.playerId==data.user_id){
           	_this.increment($("#py2_score"),data.total_score);
@@ -221,6 +226,7 @@ common={
  			_this.data.option_id=$(this).attr("data-option_id");
  			if(!_this.data.isAnswer){
  				_this.data.isAnswer=true;
+ 				
 	 			_this.Answer(function(){
 	 			});
  			}
@@ -264,8 +270,19 @@ common={
 		var textCircle   = document.querySelector(".text-circle");
 	    leftContent.setAttribute('style', 'transform: rotate(0deg)');
 	    rightContent.setAttribute('style', 'transform: rotate(0deg)');
+	    var html="<b class=''>"+_this.data.sum+"</b>";
 	    this.data.ts = setInterval(function() {
-	        if (_this.data.sum >= 0) textCircle.innerHTML = _this.data.sum;
+	    	if(_this.data.sum<4){
+	    		 html="<b class='rubberBand animated'>"+_this.data.sum+"</b>";
+	        	setTimeout(function(){
+	        		$(".text-circle b").removeClass("rubberBand");
+	        		$(".text-circle b").removeClass("animated");
+	        	},900)
+	        }else{
+	        	html="<b class=''>"+_this.data.sum+"</b>";
+	        }
+
+	        if (_this.data.sum >= 0) textCircle.innerHTML = html;
 	        _this.data.sum = _this.data.sum - 1;
 	        $("#Jvs .con").show();
 	        $("#Jvs .tit").html("抢答中");
@@ -278,17 +295,9 @@ common={
 	            }
 	        }
 	        
-	        if(_this.data.sum<3){
-
-	        	$(".text-circle").addClass("rubberBand");
-	        	$(".text-circle").addClass("animated");
-	        	setTimeout(function(){
-	        		$(".text-circle").removeClass("rubberBand");
-	        		$(".text-circle").removeClass("animated");
-	        	},900)
-	        }
 	        
-	        if (_this.data.sum < -1) {
+	        
+	        if (_this.data.sum < 0) {
 	        	if(!_this.data.isAnswer)
 	           	_this.Answer();
 	            _this.data.sum = 9;