|
@@ -110,7 +110,8 @@ layui.use(['form','jquery'], function(){
|
|
|
sum= sum-1;
|
|
|
$("#Jvs").html(sum);
|
|
|
if(sum<=0){
|
|
|
- //getQuestion(room_id);
|
|
|
+ //cur_question++;
|
|
|
+ //getQuestion(room_id, cur_question);
|
|
|
answer();
|
|
|
sum=10;
|
|
|
}
|
|
@@ -161,7 +162,7 @@ layui.use(['form','jquery'], function(){
|
|
|
if(data.info.room_id){
|
|
|
room_id = data.info.room_id;
|
|
|
|
|
|
- getQuestion(data.info.room_id);
|
|
|
+ getQuestion(data.info.room_id, cur_question);
|
|
|
|
|
|
|
|
|
}
|
|
@@ -228,7 +229,7 @@ layui.use(['form','jquery'], function(){
|
|
|
return false;
|
|
|
}
|
|
|
if(data.cur_quc == 2&&data.is_end!=1){
|
|
|
- getQuestion(room_id);
|
|
|
+ getQuestion(room_id, cur_question);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -281,9 +282,9 @@ layui.use(['form','jquery'], function(){
|
|
|
});
|
|
|
|
|
|
//获取题目
|
|
|
- var getQuestion = function getQuestion(room_id) {
|
|
|
+ var getQuestion = function getQuestion(room_id, index) {
|
|
|
var url = '/Home/Game/Question';
|
|
|
- $.get(url, {room_id:room_id}, function(responsedata){
|
|
|
+ $.get(url, {room_id:room_id, cur_question:index}, function(responsedata){
|
|
|
if(responsedata.code == 0){
|
|
|
question_id= responsedata.info.question.question_id;
|
|
|
$("#Jqtitle").html(responsedata.info.question.title );
|
|
@@ -306,25 +307,25 @@ layui.use(['form','jquery'], function(){
|
|
|
clearInterval(ts)
|
|
|
})}
|
|
|
var answer=function(answerId) {
|
|
|
-
|
|
|
+
|
|
|
answerId= answerId?answerId:$("#question .answer").eq(0).attr("data-id");//默认第一题为答案
|
|
|
var url = '/Home/Game/Answer';
|
|
|
|
|
|
- $.post(url, {option_id:answerId,room_id:room_id,client_id:client_id,is_end:is_end,question_id:question_id}, function(responsedata){
|
|
|
+ $.post(url, {option_id:answerId,cur_question:cur_question,room_id:room_id,client_id:client_id,is_end:is_end,question_id:question_id}, function(responsedata){
|
|
|
console.log(responsedata);
|
|
|
//clearInterval(ts)
|
|
|
});
|
|
|
-
|
|
|
+ cur_question = cur_question + 1;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$("#question").on('click', '.answer',function(){
|
|
|
var answerId = $(this).data("id");
|
|
|
- if($(".cur_answer").length > 0){
|
|
|
+ if($(".cur_answer").length > 0){
|
|
|
return false;
|
|
|
}
|
|
|
- $(this).addClass("cur_answer");
|
|
|
+ $(this).addClass("cur_answer");
|
|
|
answer(answerId);
|
|
|
});
|
|
|
|