Ver Código Fonte

聊天头像Bug修改

dell 8 anos atrás
pai
commit
d12e8df841
1 arquivos alterados com 31 adições e 28 exclusões
  1. 31 28
      app/js/chats.js

+ 31 - 28
app/js/chats.js

@ -277,45 +277,48 @@ mui.ready(function() {
277 277
				success:function(data){
278 278
					var myData = data.data;
279 279
					for(var i = 0; i < myData.length; i++ ){
280
						if(myData[i]['professor']['id'] == userid){
280
						if(myData[i]['professor']['id'] == userid){//自己说话
281
							alert('自己说话')
281 282
							/*判断是否有头像*/
282
							console.log('自己是否有头像=='+myData[i]['professor']['hasHeadImage']);
283 283
							if(myData[i]['professor']['hasHeadImage'] == 1){
284
								document.getElementById("selfImg").setAttribute('src',baseUrl + "/images/head/" + myData[i]["professor"].id + "_m.jpg")
285
							}else {
286
								if(document.getElementById("selfImg") != null){
287
									document.getElementById("selfImg").setAttribute("src","../images/default-photo.jpg");
288
								}
284
								record.push({
285
									sender: 'self',
286
									type: 'text',
287
									content: myData[i]["tidingsContant"],
288
									imgurl:baseUrl + "/images/head/" + myData[i]["professor"].id + "_m.jpg"
289
								});
289 290
								
291
							}else {
292
								record.push({
293
									sender: 'self',
294
									type: 'text',
295
									content: myData[i]["tidingsContant"],
296
									imgurl:"../images/default-photo.jpg"
297
								});
290 298
							}
299
						
291 300
							
292
							record.push({
293
								sender: 'self',
294
								type: 'text',
295
								content: myData[i]["tidingsContant"]
296
							});
297
						}else{
298
							console.log('对方是否有头像=='+myData[i]['professor']['hasHeadImage'])
301
						}else{//对方说话
302
							alert('对方说话');
303
							console.log('对方id=='+myData[i]['professor'].id)
299 304
							/*判断是否有头像*/
300
							console.log(myData[i]['professor'].id);
301
							console.log(userid);
302 305
							if(myData[i]['professor'] != '' && myData[i]['professor'] != undefined){
303 306
								if(myData[i]['professor']['hasHeadImage'] == 1){
304
									document.getElementById("thatImg").setAttribute('src',baseUrl + "/images/head/" + myData[i]["professor"].id + "_m.jpg")
307
									record.push({
308
										sender: 'zs',
309
										type: 'text',
310
										content: myData[i]["tidingsContant"],
311
										imgurl:baseUrl + "/images/head/" + myData[i]["professor"].id + "_m.jpg"
312
									});
305 313
								}else {
306
									console.log(document.getElementById("thatImg"))
307
									if(document.getElementById("thatImg") != null){
308
										document.getElementById("thatImg").setAttribute("src","../images/default-photo.jpg");
309
									}
310
									
314
									record.push({
315
										sender: 'zs',
316
										type: 'text',
317
										content: myData[i]["tidingsContant"],
318
										imgurl:"../images/default-photo.jpg"
319
									});
311 320
								}
312 321
							}
313
							
314
							record.push({
315
								sender: 'zs',
316
								type: 'text',
317
								content: myData[i]["tidingsContant"]
318
							});
319 322
						}
320 323
					}
321 324
					bindMsgList();