|
@@ -2,8 +2,7 @@ common={
|
|
data:{
|
|
data:{
|
|
baseurl:"http://183.234.61.252:8090/",
|
|
baseurl:"http://183.234.61.252:8090/",
|
|
getUserInfo:"Home/User/Info",
|
|
getUserInfo:"Home/User/Info",
|
|
- register:"",
|
|
|
|
- WebSocket:"",
|
|
|
|
|
|
+ WebSocket:"ws://183.234.61.252:8282",
|
|
bdSocket:"Home/User/Bind",
|
|
bdSocket:"Home/User/Bind",
|
|
Join:"Home/User/Join",
|
|
Join:"Home/User/Join",
|
|
Answer:"Home/Game/Answer",
|
|
Answer:"Home/Game/Answer",
|
|
@@ -70,13 +69,11 @@ common={
|
|
// $("#py1_avatar").html('<img src="' + data.info.user.avatar+ '" class="layui-circle">');
|
|
// $("#py1_avatar").html('<img src="' + data.info.user.avatar+ '" class="layui-circle">');
|
|
// $("#py1_username").html(data.info.user.name + '(我)');
|
|
// $("#py1_username").html(data.info.user.name + '(我)');
|
|
// }
|
|
// }
|
|
- this.tips(data.info.user.name+"加入了房间")
|
|
|
|
|
|
+ this.tips(data.info.user.name+"加入了房间")
|
|
if(data.info.user.user_id!=this.userInfo.user_id){
|
|
if(data.info.user.user_id!=this.userInfo.user_id){
|
|
$("#py2_avatar").html('<img src="' + data.info.user.avatar+ '" class="layui-circle">');
|
|
$("#py2_avatar").html('<img src="' + data.info.user.avatar+ '" class="layui-circle">');
|
|
$("#py2_username").html(data.info.user.name);
|
|
$("#py2_username").html(data.info.user.name);
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
},onSocket:function(e){
|
|
},onSocket:function(e){
|
|
var data=JSON.parse(e.data);
|
|
var data=JSON.parse(e.data);
|
|
@@ -119,7 +116,7 @@ common={
|
|
else this.tips("登录失败");
|
|
else this.tips("登录失败");
|
|
},initSocket:function(){
|
|
},initSocket:function(){
|
|
var _this=this;
|
|
var _this=this;
|
|
- var ws = new WebSocket("ws://183.234.61.252:8282");
|
|
|
|
|
|
+ var ws = new WebSocket(this.data.WebSocket);
|
|
ws.onmessage=function(e){
|
|
ws.onmessage=function(e){
|
|
_this.onSocket(e);
|
|
_this.onSocket(e);
|
|
}
|
|
}
|
|
@@ -167,6 +164,19 @@ common={
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
+ },increment:function(bdclass,num){
|
|
|
|
+ var obj=$("."+bdclass);
|
|
|
|
+ var text=obj.text();
|
|
|
|
+ obj.prop('Counter',text).animate({
|
|
|
|
+ Counter: num
|
|
|
|
+ },{
|
|
|
|
+ duration: 1500,
|
|
|
|
+ easing: 'swing',
|
|
|
|
+ step: function (now){
|
|
|
|
+ $(this).text(Math.ceil(now));
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
},daoshu:function(argument) {
|
|
},daoshu:function(argument) {
|
|
var _this=this;
|
|
var _this=this;
|
|
clearInterval(this.data.ts);
|
|
clearInterval(this.data.ts);
|
|
@@ -240,8 +250,8 @@ common={
|
|
}
|
|
}
|
|
this.getUserInfo(function(res){
|
|
this.getUserInfo(function(res){
|
|
_this.userInfo=res.info;
|
|
_this.userInfo=res.info;
|
|
- $("#py1_username").html(res.info.name);
|
|
|
|
- $("#py1_avatar").html('<img src="' + res.info.avatar + '" class="layui-circle">');
|
|
|
|
|
|
+ $("#py1_username").html(res.info.name);
|
|
|
|
+ $("#py1_avatar").html('<img src="' + res.info.avatar + '" class="layui-circle">');
|
|
_this.initSocket();
|
|
_this.initSocket();
|
|
|
|
|
|
})
|
|
})
|