|
@@ -147,42 +147,32 @@ var textCircle = document.querySelector(".text-circle");
|
|
|
$("#avatar").html('<img src="' + responsedata.info.avatar + '" class="layui-circle">');
|
|
|
$("#user_id").val(responsedata.info.user_id);
|
|
|
},'json');
|
|
|
-
|
|
|
- function daoshu(argument) {
|
|
|
- clearInterval(ts)
|
|
|
- sum=9;
|
|
|
- angle=0;
|
|
|
- leftContent.setAttribute('style', 'transform: rotate(0deg)');
|
|
|
- rightContent.setAttribute('style', 'transform: rotate(0deg)');
|
|
|
- ts=setInterval(function(){
|
|
|
- if(sum>=0)
|
|
|
- textCircle.innerHTML = sum;
|
|
|
-
|
|
|
- sum= sum-1;
|
|
|
- $("#Jvs .con").show();
|
|
|
- angle += 36;
|
|
|
- if(angle <=360){
|
|
|
- if(angle > 180){
|
|
|
- rightContent.setAttribute('style', 'transform: rotate('+(angle-180)+'deg)');
|
|
|
- }else{
|
|
|
- leftContent.setAttribute('style', 'transform: rotate('+angle+'deg)');
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- if(sum<-1){
|
|
|
- //cur_question++;
|
|
|
- //getQuestion(room_id, cur_question);
|
|
|
- answer();
|
|
|
- sum=9;
|
|
|
- angle=0;
|
|
|
- leftContent.setAttribute('style', 'transform: rotate(0deg)');
|
|
|
- rightContent.setAttribute('style', 'transform: rotate(0deg)');
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- },1000)
|
|
|
- }
|
|
|
+function daoshu(argument) {
|
|
|
+ clearInterval(ts) sum = 9;
|
|
|
+ angle = 0;
|
|
|
+ leftContent.setAttribute('style', 'transform: rotate(0deg)');
|
|
|
+ rightContent.setAttribute('style', 'transform: rotate(0deg)');
|
|
|
+ ts = setInterval(function() {
|
|
|
+ if (sum >= 0) textCircle.innerHTML = sum;
|
|
|
+ sum = sum - 1;
|
|
|
+ $("#Jvs .con").show();
|
|
|
+ angle += 36;
|
|
|
+ if (angle <= 360) {
|
|
|
+ if (angle > 180) {
|
|
|
+ rightContent.setAttribute('style', 'transform: rotate(' + (angle - 180) + 'deg)')
|
|
|
+ } else {
|
|
|
+ leftContent.setAttribute('style', 'transform: rotate(' + angle + 'deg)')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (sum < -1) {
|
|
|
+ answer();
|
|
|
+ sum = 9;
|
|
|
+ angle = 0;
|
|
|
+ leftContent.setAttribute('style', 'transform: rotate(0deg)');
|
|
|
+ rightContent.setAttribute('style', 'transform: rotate(0deg)')
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
+}
|
|
|
//绑定通信
|
|
|
// ws = new WebSocket("ws://www.dt.com:6390");
|
|
|
ws = new WebSocket("ws://183.234.61.252:8282");
|
|
@@ -306,7 +296,7 @@ var textCircle = document.querySelector(".text-circle");
|
|
|
case "question":
|
|
|
loadQuestion(data);
|
|
|
default :
|
|
|
- alert(e.data);
|
|
|
+ // alert(e.data);
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -354,7 +344,7 @@ var textCircle = document.querySelector(".text-circle");
|
|
|
|
|
|
//获取题目
|
|
|
function loadQuestion(responsedata) {
|
|
|
- if(responsedata.code == 0){
|
|
|
+
|
|
|
question_id= responsedata.info.question.question_id;
|
|
|
$("#Jqtitle").html(responsedata.info.question.title );
|
|
|
var question="";
|
|
@@ -366,11 +356,7 @@ var textCircle = document.querySelector(".text-circle");
|
|
|
$("#Jpage").html(responsedata.info.questions_count+"/5")
|
|
|
// is_end = responsedata.info.question.is_end;
|
|
|
daoshu();
|
|
|
- }else{
|
|
|
- layer.msg(responsedata.msg, {
|
|
|
- time: 1000 //2秒关闭(如果不配置,默认是3秒)
|
|
|
- });
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
var getQuestion = function getQuestion(room_id, index) {
|
|
|
var url = '/Home/Game/Question';
|
|
@@ -379,13 +365,13 @@ var textCircle = document.querySelector(".text-circle");
|
|
|
},'json').fail(function () {
|
|
|
layer.msg("服务器繁忙");
|
|
|
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,cur_question:cur_question,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,client_id:client_id,is_end:is_end,question_id:question_id}, function(responsedata){
|
|
|
console.log(responsedata);
|
|
|
//clearInterval(ts)
|
|
|
});
|