|
@@ -74,7 +74,7 @@ common={
|
|
|
if(data.info.user.user_id!=this.userInfo.user_id){
|
|
|
$("#py2_avatar").html('<img src="' + data.info.user.avatar+ '" class="layui-circle">');
|
|
|
$("#py2_username").html(data.info.user.name);
|
|
|
- _this.data.playerId=data.info.user.user_id;
|
|
|
+ _this.userInfo.playerId=data.info.user.user_id;
|
|
|
}
|
|
|
|
|
|
},round_end:function(data){
|
|
@@ -90,25 +90,25 @@ common={
|
|
|
}
|
|
|
}
|
|
|
$("#question .item").each(function(){
|
|
|
- if($(this).attr("option_id")==data.info.anwser){
|
|
|
+ if($(this).attr("data-option_id")==data.info.anwser){
|
|
|
$(this).addClass("cur_true");
|
|
|
}
|
|
|
- if($(this).attr("option_id")!=data.info.anwser&&$(this).hasClass("cur_answer")){
|
|
|
+ if($(this).attr("data-option_id")!=data.info.anwser&&$(this).hasClass("cur_answer")){
|
|
|
|
|
|
$(this).addClass("cur_error");
|
|
|
}
|
|
|
|
|
|
- if($(this).attr("option_id")==_this.data.player_answerId&&$(this).attr("option_id")==data.info.anwser){
|
|
|
+ if($(this).attr("data-option_id")==_this.data.player_answerId&&$(this).attr("data-option_id")==data.info.anwser){
|
|
|
//对方答案
|
|
|
$(this).addClass("player_true");
|
|
|
}
|
|
|
- if($(this).attr("option_id")==_this.data.player_answerId&&$(this).attr("option_id")!=data.info.anwser){
|
|
|
+ if($(this).attr("data-option_id")==_this.data.player_answerId&&$(this).attr("data-option_id")!=data.info.anwser){
|
|
|
//对方答案
|
|
|
$(this).addClass("player_error");
|
|
|
}
|
|
|
|
|
|
})
|
|
|
-
|
|
|
+ clearInterval(this.data.ts);
|
|
|
|
|
|
},onSocket:function(e){
|
|
|
var data=JSON.parse(e.data);
|
|
@@ -135,7 +135,7 @@ common={
|
|
|
case "answer":
|
|
|
if(_this.userInfo.user_id==data.user_id){
|
|
|
_this.increment($("#py1_score"),data.score);
|
|
|
- }else if(_this.data.playerId==data.user_id){
|
|
|
+ }else if(_this.userInfo.playerId==data.user_id){
|
|
|
_this.increment($("#py2_score"),data.score);
|
|
|
}
|
|
|
break;
|
|
@@ -174,7 +174,7 @@ common={
|
|
|
var question="";
|
|
|
var answers = responsedata.info.options
|
|
|
for(var i in answers){
|
|
|
- question += '<li class="btn-2 item item'+i+' answer layui-btn layui-btn-primary" data-option_id="'+answers[i].option_id+'">'+answers[i].title+'</li>';
|
|
|
+ question += '<li class="btn-2 item item'+i+' answer layui-btn layui-btn-primary" data-option_id="'+answers[i].option_id+'"><em></em>'+answers[i].title+'</li>';
|
|
|
}
|
|
|
$("#question").html(question);
|
|
|
$("#Jpage").html(responsedata.info.questions_count+"/5");
|
|
@@ -210,8 +210,7 @@ common={
|
|
|
})
|
|
|
|
|
|
|
|
|
- },increment:function(bdclass,num){
|
|
|
- var obj=$("."+bdclass);
|
|
|
+ },increment:function(obj,num){
|
|
|
var text=obj.text();
|
|
|
obj.prop('Counter',text).animate({
|
|
|
Counter: num
|