Parcourir la Source

聊天头像Bug修改

dell 8 ans auparavant
Parent
commit
d12e8df841
1 fichiers modifiés avec 31 ajouts et 28 suppressions
  1. 31 28
      app/js/chats.js

+ 31 - 28
app/js/chats.js

277
				success:function(data){
277
				success:function(data){
278
					var myData = data.data;
278
					var myData = data.data;
279
					for(var i = 0; i < myData.length; i++ ){
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
							if(myData[i]['professor']['hasHeadImage'] == 1){
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
							if(myData[i]['professor'] != '' && myData[i]['professor'] != undefined){
305
							if(myData[i]['professor'] != '' && myData[i]['professor'] != undefined){
303
								if(myData[i]['professor']['hasHeadImage'] == 1){
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
								}else {
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
					bindMsgList();
324
					bindMsgList();