Browse Source

消息列表bug修复

jack 7 years ago
parent
commit
f37ce15b15
1 changed files with 42 additions and 5 deletions
  1. 42 5
      js/tidings.js

+ 42 - 5
js/tidings.js

13
	});
13
	});
14

14

15
	var userid = $.cookie("userid");
15
	var userid = $.cookie("userid");
16

16
	console.log(professorId)
17
	console.log(userid)
17
	function websocrket() {
18
	function websocrket() {
18
		var ws = new WebSocket("ws://192.168.3.233:8081/portal/websocket/msg?id=" + userid + "&pm=www");
19
		var ws = new WebSocket("ws://192.168.3.233:8081/portal/websocket/msg?id=" + userid + "&pm=www");
19
		ws.onopen = function() {
20
		ws.onopen = function() {
98

99

99
		}
100
		}
100
	}
101
	}
101
	myMessageList();
102
	
102
	if(professorId) {
103
	if(professorId) {
103
		firstFlag = 1;
104
		firstFlag = 1;
104
		$(".chat_content_nodata").hide();
105
		$(".chat_content_nodata").hide();
105
		$(".chat_content").show();
106
		$(".chat_content").show();
106
		angleMessageList(professorId);
107
		angleMessageList(professorId);
107
		persons(professorId)
108
		persons(professorId)
109
	}else{
110
		myMessageList()
111
		
108
	}
112
	}
109

113

110
	/*消息内容*/
114
	/*消息内容*/
127
						if(arguments[1]) {
131
						if(arguments[1]) {
128
							setRead(opId, $data[$data.length - 1].sendTime)
132
							setRead(opId, $data[$data.length - 1].sendTime)
129
						}
133
						}
134
						if(firstFlag==1) {
135
							var ostr1 = '<div class="list_item clearfix active" data-id="' + professorId + '">' +
136
								'<i class="close_icon"></i>' +
137
								'<div class="avatar fl">' +
138
								'<img src="images/default-photo.jpg" >' +
139
								'<span class="tips_num" style="display:none;">0</span>' +
140
								'</div>' +
141
								'<div class="list_item_info fl">' +
142
								'<div class="user_infos">' +
143
								'<span class="user_name"> </span><em class="authiconNew"></em>' +
144
								'</div>' +
145
								'<span class="time">' + commenTime($data[$data.length-1].sendTime) + '</span><span class="last_news">'+$data[$data.length-1].cnt.replace(/\n/g,"<br />")+'</span>' +
146
								'</div>' +
147
								'</div>'
148
							var $str1 = $(ostr1);
149
							$(".list_body").prepend($str1);
150
							personMess(professorId, $str1.find('img'), $str1.find(".user_name"), $str1.find(".authiconNew"));
151
							var m=0;
152
							for(var j=0;j<$data.length;j++) {
153
								if(professorId==$data[j].sender) {
154
									m=m+1;
155
								}
156
							}
157
							if(m==0) {
158
								setRead(professorId, $data[$data.length-1].sendTime)
159
							}
160
							myMessageList();
161
						}
130
						firstFlag = 0;
162
						firstFlag = 0;
131
						for(var i = 0; i < $data.length; i++) {
163
						for(var i = 0; i < $data.length; i++) {
132
							var le = "";
164
							var le = "";
190
							$(".chat_content_nodata").hide();
222
							$(".chat_content_nodata").hide();
191
							$(".chat_content").show();
223
							$(".chat_content").show();
192
						}
224
						}
225
						
226
						myMessageList();
227
					
193
					}
228
					}
229
					
230
					
194
				}
231
				}
195
			},
232
			},
196
			"error": function() {
233
			"error": function() {
251
			var $str = $(ostr);
288
			var $str = $(ostr);
252
			if(professorId) {
289
			if(professorId) {
253
				if(professorId == $data[i].id) {
290
				if(professorId == $data[i].id) {
254
					$(".list_body").prepend($str);
255
					$str.addClass("active");
291
					
256
				} else {
292
				} else {
257
					$(".list_body").append($str);
293
					$(".list_body").append($str);
258
				}
294
				}
567
			"success": function(data) {
603
			"success": function(data) {
568
				if(data.success) {
604
				if(data.success) {
569
					$(this).remove();
605
					$(this).remove();
570
					
606
					$(".chat_content_nodata").show();
607
					$(".chat_content").hide();
571
				}
608
				}
572
			},
609
			},
573
			"error": function() {
610
			"error": function() {