$(function() {
	loginStatus();//判断个人是否登录
	var userid = $.cookie("userid");
	var professorId = GetQueryString("professorId");

	if(userid != professorId) {
		ifcollectionAbout(professorId, 1)
		$(".goSpan").show();
	}
	if(professorId) {
		getUserInfo(professorId);//获取个人详细信息
		historyEvaluate();//获取历史合作及评价
		getResource();//获取个人发布的资源
		getArticle();//获取个人发布的文章
		//点击咨询按钮
		$("#conbtn").on('click', function(){
			if(userid && userid != null && userid != 'null' && userid != undefined && userid != 'undefined') {
				ConsultApply();
				concultProInfo(professorId);
				//点击的发送
				$("#sendConsultBtn").click(function() {
					sendConsultHandler($(this).attr("proId"));
				});
			} else {
				$.MsgBox.Alert("提示", "请先登录再进行咨询");
				$("#mb_btn_ok").val("去登录");
				var aele = document.createElement('a');
				$("#mb_btnbox").append(aele);
				$("#mb_btnbox a").css({
					'display': "block",
					'width': '100%',
					'height': '40px',
					'position': 'absolute',
					'bottom': '-6px',
					'left': '0'
				});
				aele.setAttribute('href', '../login.html');
			}
		});
		//点击关注按钮
		$("#attentBtn").on('click', function() {
			if(userid && userid != null && userid != "null") {
				if($(this).is('.attenedSpan')){
					cancelCollectionAbout(professorId, 1)
				} else {
					collectionAbout(professorId, 1);
				}
			}else{
				$.MsgBox.Alert("提示", "请先登录再进行关注");
				$("#mb_btn_ok").val("去登录");
				var aele = document.createElement('a');
				$("#mb_btnbox").append(aele);
				$("#mb_btnbox a").css({
					'display': "block",
					'width': '100%',
					'height': '40px',
					'position': 'absolute',
					'bottom': '-6px',
					'left': '0'
				});
				aele.setAttribute('href', '../login.html');
			}
		});
		/*研究方向点赞*/
		var clFlag = 1;
		$("#researchAreaShow").on("click", ".plus", function() {
			if(userid && userid != null && userid != "null") {
				//点赞变化样式
				if(clFlag) {
					clFlag = 0;
				} else {
					return;
				}
				if($(this).data("isagree") > -1) {
					$(this).stop(true, true).animate({
						backgroundPositionY: 0
					}, 300); //变成未点赞样式
				} else {
					$(this).stop(true, true).animate({
						backgroundPositionY: -26
					}, 300); //变成点赞样式
				}

				$.ajax({
					"url": $(this).data("isagree") > -1 ? "/ajax/researchArea/unAgree" : "/ajax/researchArea/agree",
					"type": "POST",
					"data": {
						"targetId": $(this).data("pid"),
						"targetCaption": $(this).data("caption"),
						"opId": userid
					},
					"contentType": "application/x-www-form-urlencoded",
					"success": function($data) {
						if($data.success) {
							$.get("/ajax/professor/info/" + professorId, function($data) {
								if($data.success) {
									clFlag = 1;
									var $info = $data.data;
									if($info) {
										$("#researchAreaShow").empty("")
										if($info.researchAreas) {
											researchAreaShow($info.researchAreas, $info.editResearchAreaLogs);
										}
									}
								}
							})
						} else {
							$.MsgBox.Alert("提示", $data.msg);
						}
					}
				});
			} else {
				$.MsgBox.Alert("提示", "请登录后点赞");
			}

		})
		//点击每个研究方向弹出研究方向详情窗口
		$("#researchAreaShow").on("click", ".favorBox,.favorCount", function() {
			var cap = $(this).attr("caption");
			$.ajax({
				url: "/ajax/researchAreaLog/ql",
				dataType: 'json', //数据格式类型
				type: 'GET', //http请求类型
				timeout: 10000, //超时设置
				data: {
					"professorId": professorId,
					'caption': cap,
					"rows": 10
				},
				success: function(data) {
					console.log(data)
					if(data.success) {
						$(".listitemdiv").html("");
						var $info = data.data;
						$("#subArea").text(cap);
						$(".resAreaCover").fadeIn();
						$(".resAreaCon").show()
						if($info.length == 0) {
							$(".resAreaCon").hide();
							return;
						}
						for(var i = 0; i < $info.length; i++) {
							if($info[i].professor.hasHeadImage == 1) {
								var imgbg = "/images/head/" + $info[i].professor.id + "_l.jpg";
							} else {
								var imgbg = "../images/default-photo.jpg";
							}
							//认证
							var oSty=autho($info[i].professor.authType,$info[i].professor.orgAuth,$info[i].professor.authStatus);
							
							var title = $info[i].professor.title || "";
							var orgName = $info[i].professor.orgName || "";
							var office = $info[i].professor.office || "";
							if(title != "") {
								var ttitle = title + ",";
							}else{
								if(office!=""){
									var ttitle = office  + ",";	
								}else{
									var ttitle = office;	
								}
							}
							if(orgName != "") {
								orgName = orgName;
							}
							
							var addw ='<li class="flexCenter" data-id="'+$info[i].professor.id+'">'
							addw +='<a href="userInforShow.html?professorId='+ $info[i].professor.id +'" class="expertUrl linkhref">'
							addw +='<div class="lefthead userheadt userRadius" id="expertImg" style="background-image: url('+ imgbg +');"></div>'
							addw +='<div class="centercon" style="padding-right:0;">'
							addw +='<p class="h1font"><span class="nameSpan" id="Name">' + $info[i].professor.name + '</span><em class="authiconNew ' + oSty.sty + '" title="'+ oSty.title +'"></em></p>'
							addw +='<p class="h2font ellipsisSty">'+ ttitle + orgName + '</p>'
							addw +='</div></a></li>';

							$(".listitemdiv").append(addw);
						}
						
					    $("body").css("position", "fixed");
					}
				},
				error: function() {}
			});
		});
		//关闭按钮
		$("#workclose").click(function() {
			$(".resAreaCover").fadeOut();
		    $("body").css("position", "");
		});
		
//		
//		 var itemCon = $("#item1user").find(".coninfobox");
//		console.log(itemCon.length)
//		console.log($("#item1user").find(".coninfobox"))
//		//var itemCon = $("#item1user").find(".coninfobox:hidden").style==none;//匹配所有不可见元素,或者type为hidden的元素
//		//var itemCon2 = $("#item1user").find(".coninfobox:visible");//匹配所有的可见元素
//
//		var noneNum = 0;
//		for(i=0;i< itemCon.length;i++){//匹配所有不可见元素
//			if(itemCon[i].style.display=="none"){
//				noneNum++
//			}else{
//				
//			}
//			
//		}
//		console.log(noneNum)
//		if(noneNum == itemCon.length){
//			$("#item1user>.nodatabox").show();
//			$("#item1user>.nodatabox").find(".noContip").text("主人尚未录入基本资料")
//		}
////		var allNone = $("#descpS").parents(".coninfobox")[0].style.display == 'none' 
////		            && $("#subjectShow").parents(".coninfobox")[0].style.display == 'none'
////		             && $("#researchAreaShow").parents(".coninfobox")[0].style.display == 'none'
////			          && $("#industryShow").parents(".coninfobox")[0].style.display == 'none'
////			           && $("#showResource").parents(".coninfobox")[0].style.display == 'none'
////			            && $("#showArticle").parents(".coninfobox")[0].style.display == 'none'
////			             && $("#historyEvaluate").parents(".coninfobox")[0].style.display == 'none';
////		console.log(allNone)
////		if(allNone){
////			$("#item1user>.nodatabox").show();
////			$("#item1user>.nodatabox").find(".noContip").text("主人尚未完善详细资料")
////		}
////		
		//点击查看全部资源
		$(".coninfobox").on("click","#seeMoreR",function(){
			document.body.scrollTop = document.documentElement.scrollTop = 0;
			$(".navconBox ul>li").eq(1).addClass("liNow").siblings().removeClass("liNow");
			$("#item1user").hide();
			$("#item2user").show();
		})
		//点击查看全部文章
		$(".coninfobox").on("click","#seeMoreA",function(){
			document.body.scrollTop = document.documentElement.scrollTop = 0;
			$(".navconBox ul>li").eq(2).addClass("liNow").siblings().removeClass("liNow");
			$("#item1user").hide();
			$("#item3user").show();
		})
		//点击查看全部专利
		$(".coninfobox").on("click","#seeMoreP",function(){
			document.body.scrollTop = document.documentElement.scrollTop = 0;
			$(".navconBox ul>li").eq(3).addClass("liNow").siblings().removeClass("liNow");
			$("#item1user").hide();
			$("#item4user").show();
		})
		//点击查看全部论文
		$(".coninfobox").on("click","#seeMoreL",function(){
			document.body.scrollTop = document.documentElement.scrollTop = 0;
			$(".navconBox ul>li").eq(4).addClass("liNow").siblings().removeClass("liNow");
			$("#item1user").hide();
			$("#item5user").show();
		})
	}
	
	
	
	var subjectShow = function(data) {
		if(data != undefined && data.length != 0) {
			var subs = new Array();
			if(data.indexOf(',')) {
				subs = data.split(',');
			} else {
				subs[0] = data;
			}
			if(subs.length > 0) {
				for(var i = 0; i < subs.length; i++) {
					$("#subjectShow").append("<li>" + subs[i] + "</li>");
				};
			}
		}
	}
	var researchAreaShow = function($datas, $datarecords) {
		if($datas != undefined && $datas.length != 0) {
			var html = [];
			for(var i = 0; i < $datas.length; ++i) {
				var $data = $datas[i];
				var $photos = [];
				//获取头像					
				if($datarecords.length > 0) {
					$photos = getRecords($datarecords, $data.caption);
				}
				var isAgree = -1;
				for(var j = 0; j < $photos.length; j++) {
					if(userid == $photos[j].id)
						isAgree++;
				}
				if(professorId != userid) {
					if(isAgree) {
						var showDiv = '<li><div class="favorBox" caption="'+ $data.caption +'"><span class="like">'+ $data.count +'</span>'+ $data.caption +'</div><span class="plus" data-pid="'+ $data.professorId +'" data-caption="'+ $data.caption + '" data-isagree="' + isAgree + '"></span><div class="favorCount" caption="'+ $data.caption +'">';
					} else {
						var showDiv = '<li><div class="favorBox" caption="'+ $data.caption +'"><span class="like">'+ $data.count +'</span>'+ $data.caption +'</div><span class="plus" style="background-position-y:-26px" data-pid="'+ $data.professorId +'" data-caption="'+ $data.caption + '" data-isagree="' + isAgree + '"></span><div class="favorCount" caption="'+ $data.caption +'">';
					}
				} else {
					var showDiv = '<li><div class="favorBox" caption="'+ $data.caption +'"><span class="like">'+ $data.count +'</span>'+ $data.caption +'</div><div class="favorCount" caption="'+ $data.caption +'">';
				}
				if($photos.length < 6) {
					for(var j = 0; j < $photos.length; ++j) {
						if($photos[j].img) {
							showDiv += '<span class="like-people" style="background-image: url(../images/head/'+ $photos[j].id +'_s.jpg);"></span>';
						} else {
							showDiv += '<span class="like-people" style="background-image: url(../images/default-photo.jpg);"></span>';
						}
					}
				} else {
					for(var j = $photos.length - 5; j < $photos.length; ++j) {
						if($photos[j].img) {
							showDiv +='<span class="like-people" style="background-image: url(../images/head/'+ $photos[j].id +'_s.jpg);"></span>';
						} else {
							showDiv += '<span class="like-people" style="background-image: url(../images/default-photo.jpg);"></span>';
						}
					}
					showDiv += '<span class="like-people like-more"></span>';
				}
				showDiv += "</div></li>";
				html.push(showDiv);
			}
			document.getElementById("researchAreaShow").innerHTML = html.join('');
		}
	}
	var industryShow = function(data) {
		if(data != undefined && data.length != 0) {
			var subs = new Array();
			if(data.indexOf(',')) {
				subs = data.split(',');
			} else {
				subs[0] = data;
			}
			if(subs.length > 0) {
				for(var i = 0; i < subs.length; i++) {
					$("#industryShow").append("<li><div class='h4tit'>" + subs[i] + "</div></li>");
				};
			}
		}
	}
	var projectShow = function(data) {
		if(data.length > 0) {
			for(var i = 0; i < data.length; i++) {
				if(!data[i].descp) {
					data[i].descp = "";
				}
				if(!data[i].startMonth) {
					data[i].startMonth = '';
					data[i].stopMonth = '';
				} else {
					data[i].startMonth = data[i].startMonth.substr(0, 4) + "年" + data[i].startMonth.substr(4, 6) + "月 - "
					if(!data[i].stopMonth) {
						data[i].stopMonth = '至今';
					} else {
						data[i].stopMonth = data[i].stopMonth.substr(0, 4) + "年" + data[i].stopMonth.substr(4, 6)+ "月"
					}
				}
				var projectHtml = '<li>';
				projectHtml += '<div class="h4Font h4tit">' + data[i].name + '<small class="h6Font">' + data[i].startMonth + '' + data[i].stopMonth + '</small></div>';
				projectHtml += '<div class="h5Font">' + data[i].descp + '</div>';
				projectHtml += '</li>';

				$("#projectShow").append(projectHtml);
			}
		}
	}
	var honorShow = function(data) {
		if(data.length > 0) {
			for(var i = 0; i < data.length; i++) {
				if(!data[i].year) {
					data[i].year = "";
				}
				if(!data[i].descp) {
					data[i].descp = "";
				}
				var honorHtml = '<li>';
				honorHtml += '<div class="h4Font h4tit">' + data[i].name + '<small class="h6Font">' + data[i].year + '年</small></div>';
				honorHtml += '<div class="h5Font">' + data[i].descp + '</div>';
				honorHtml += '</li>';
				$("#honorShow").append(honorHtml);
			}
		}
	}
	var timeJobShow = function(data) {
		if(data.length > 0) {
			for(var i = 0; i < data.length; i++) {
				var sDate = "";
				var eDate = "";
				if(data[i].department) {
					var dep = "-" + data[i].department;
				} else {
					var dep = ""
				}
				if(data[i].startMonth) {
					sDate = data[i].startMonth.substr(0, 4) + "年" + data[i].startMonth.substr(4, 6) + "月 - ";
					if(data[i].stopMonth) {
						eDate = data[i].stopMonth.substr(0, 4) + "年" + data[i].stopMonth.substr(4, 6) + "月";
					} else {
						eDate = "至今";
					}
				}
				var JobHtml = '<li>';
				JobHtml += '<div class="h4Font h4tit">' + data[i].company + '-' + data[i].title + '' + dep + '<small class="h6Font">' + sDate + '' + eDate + '</small></div>';
				JobHtml += '</li>';
				$("#timeJobShow").append(JobHtml);
			}
		}
	}
	var eduBgShow = function(data) {
		if(data.length > 0) {
			for(var i = 0; i < data.length; i++) {
				var showHtml = '<li><div class="h4Font h4tit">';
				if(data[i].college && data[i].major && data[i].degree) {
					showHtml += data[i].school + '-' + data[i].college + '-' + data[i].major + '-' + data[i].degree
				} else if(!data[i].college && data[i].major && data[i].degree) {
					showHtml += data[i].school + '-' + data[i].major + '-' + data[i].degree
				} else if(data[i].college && !data[i].major && data[i].degree) {
					showHtml += data[i].school + '-' + data[i].college + '-' + data[i].degree
				} else if(data[i].college && data[i].major && !data[i].degree) {
					showHtml += data[i].school + '-' + data[i].college + '-' + data[i].major
				} else if(!data[i].college && !data[i].major && data[i].degree) {
					showHtml += data[i].school + '-' + data[i].degree
				} else if(!data[i].college && data[i].major && !data[i].degree) {
					showHtml += data[i].school + '-' + data[i].major
				} else if(data[i].college && !data[i].major && !data[i].degree) {
					showHtml += data[i].school + '-' + data[i].college
				}
				if(typeof(data[i].year) !== "undefined") {

					showHtml += '<small class="h6Font">' + data[i].year + '年</small>';
				} else {
					showHtml += "";
				}
				showHtml += "</div></li>";
				$("#eduBgShow").append(showHtml);
			}
		}
	}
	//判断点赞的用户是否有头像
	function getRecords($researchAreaLogs, caption) {
		var ret = [];
		var t = 0;
		for(var i = 0; i < $researchAreaLogs.length; i++) {
			if(caption == $researchAreaLogs[i].caption) {
				ret[t] = {
					id: $researchAreaLogs[i].opreteProfessorId,
					img: $researchAreaLogs[i].hasHeadImage
				}
				t++;
			}
		}
		return ret;
	}
	//用户详细信息
	function getUserInfo(professorId){
		$.ajax({
			type:"get",
			url:"/ajax/professor/info/"+ professorId,
			async:true,
			success: function(data) {
				var $info = data.data;
				console.log($info )
				if(data.success) {
					if($info.hasHeadImage){
						$("#proHead").css("background-image","url(/images/head/"+ $info.id +"_l.jpg)");
					}
					$("#proName").text($info.name);
					var oStyS=autho($info.authType,$info.orgAuth,$info.authStatus);
					$("#proAuth").addClass(oStyS.sty); $("#proAuth").attr("title",oStyS.title);
					if($info.address){
						$("#proAddress").html($info.address + "<span style='margin-right:10px;'></span>");
					}
					var proOther="";
					if($info.orgName){
						if($info.department){
							if($info.office){
								proOther = $info.orgName + "," + $info.department + "," + $info.office
							}else{
								proOther = $info.orgName + "," + $info.department
							}
						}else{
							proOther = $info.orgName
						}
					}
					$("#proOther").text(proOther);
					var llqtitle=$info.name + "-" + proOther.replace(/,/gi,"-") + "-科袖网";//修改浏览器title信息
					if($info.title){
						$("#proTit").html($info.title + "<span style='margin-right:10px;'></span>");
						llqtitle = $info.name + "-" + $info.title + "-" + proOther.replace(/,/gi,"-") + "-科袖网";
					}
					document.title = llqtitle;
					

					//个人简介
					if($info.descp) {
						$("#descpS").text($info.descp);
					} else {
						$("#descpS").parents(".coninfobox").hide();
					}
					//学术领域					
					if($info.subject) {
						subjectShow($info.subject);
					} else {
						$("#subjectShow").parents(".coninfobox").hide();
					}
					//研究方向
					if($info.researchAreas.length) {
						researchAreaShow($info.researchAreas, $info.editResearchAreaLogs);
					} else {
						$("#researchAreaShow").parents(".coninfobox").hide();
					}
					//行业领域	
					if($info.industry) {
						industryShow($info.industry);
					} else {
						$("#industryShow").parents(".coninfobox").hide();
					}
					//教育背景					
					if($info.edus.length) {
						eduBgShow($info.edus);
					} else {
						$("#eduBgShow").parents(".coninfobox").hide();
					}
					//兼职
					if($info.jobs.length) {
						timeJobShow($info.jobs);
					} else {
						$("#timeJobShow").parents(".coninfobox").hide();
					}
					//项目
					if($info.projects.length) {
						projectShow($info.projects)
					} else {
						$("#projectShow").parents(".coninfobox").hide();
					}
					//荣誉
					if($info.honors.length) {
						honorShow($info.honors);
					} else {
						$("#honorShow").parents(".coninfobox").hide();
					}
					
					if($info.honors.length == 0 && $info.projects.length == 0 && $info.jobs.length == 0 && $info.edus.length == 0){
						$("#item6user>.nodatabox").show();
						$("#item6user>.nodatabox").find(".noContip").text("主人尚未完善详细资料")
					}
					
					var weibotitle = $info.name;
					var weibourl = window.location.href;
					var weibopic ="http://"+window.location.host+"/images/head/"+ $info.id +"_l.jpg";
					$("#weibo").attr("href","http://service.weibo.com/share/share.php?appkey=3677230589&title="+weibotitle+"&url="+weibourl+"&pic="+weibopic+"&ralateUid=6242830109&searchPic=false&style=simple");
				
				}
			},
			error: function() {
				$.MsgBox.Alert('提示', '链接服务器超时')
			}
		});
	}
	//合作历史及评价
	function historyEvaluate(){
		var ass;
		$.ajax({
			"url": "/ajax/consult/pqAssessHis",
			"type": "get",
			"data": {
				"professorId": professorId
			},
			"async": false,
			"success": function(response) {
				if(response.success) {
					var $data = response.data.data;
					ass = $data.length;
					if($data.length == 0) {
						$("#historyEvaluate").parents(".coninfobox").hide();
					}
					for(var i = 0; i < $data.length; i++) {
						var assessTime = commenTime($data[i].assessTime);
						var assessContant ="";
						if($data[i].assessContant) {
							assessContant = $data[i].assessContant;
						}
						var userhed='';
						if($data[i].professor.hasHeadImage) {
							userhed = 'background-image:url(/images/head/' + $data[i].professor.id + '_l.jpg)';
						} else {
							userhed = 'background-image:url(/images/default-photo.jpg)';
						}
						var add = "";
						add += '<li class="flexCenter">';
						add += '<a href="userInforShow.html?professorId='+ $data[i].professor.id +'" class="userhref"><div class="madiaHead useHead useHeadMsg" style="'+ userhed +'"></div></a>'
						add += '<div class="madiaInfo"><div style="position: relative;">';			
						add += '<a href="userInforShow.html?professorId='+ $data[i].professor.id +'" class="userhref"><span class="h1Font messageName">'+ $data[i].professor.name +'</span></a>';
						add += '<em class="authiconNew authicon-pro" title=" "></em><span class="commenttime">'+ assessTime +'</span>';				
						add += '<ul class="starShow">';					
						add += '<li></li> <li></li> <li></li> <li></li> <li></li>';
						add += '</ul></div>';		
						add += '<p class="h2Font messageContent">'+ assessContant +'</p>';			
						add += '</div></li>';
						
						var $add = $(add);
						$("#historyEvaluate").append($add);
						$add.find(".starShow>li:lt(" + $data[i].assessStar + ")").addClass('evastar');
					}
				}
			}
		})
	}
	//获取资源
	function getResource(){
		$.ajax({
			"url": "/ajax/resource/qaProPublish",
			"type": "get",
			"async": false,
			"data": {
				"professorId": professorId
			},
			"success": function(data) {
				console.log(data);
				if(data.success) {
					var madiaHead ='';
					if(data.data.length > 0){
						for(var i = 0; i < data.data.length; i++) {
							if(data.data[i].images.length) {
								madiaHead ='/data/resource/' + data.data[i].images[0].imageSrc ;
							}else{
								madiaHead ='/images/default-resource.jpg';
							}
							var strAdd = '';
							strAdd += '<li><a href="resourceShow.html?resourceId='+ data.data[i].resourceId +'" class="flexCenter urlgo">';
							strAdd += '<div class="madiaHead resouseHead" style="background-image:url('+ madiaHead +')"></div>';
							strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty-2">'+ data.data[i].resourceName +'</p><p class="h2Font ellipsisSty">应用用途:'+ data.data[i].supportedServices+'</p></div>';				
							strAdd += '</a></li>';
							
							if(i==0){
								$("#showResource").append(strAdd);
							}
							$("#proResource").append(strAdd);
						}
					}else{
						$("#proResource + .nodatabox").show();
						$("#proResource + .nodatabox").find(".noContip").text("主人尚未发布任何资源");
						$("#showResource").parents(".coninfobox").hide();
					}
				}
			},
			"error": function() {
				$.MsgBox.Alert("提示", "服务器连接超时")
			}
		});
	}
	//获取文章
	function getArticle(){
		$.ajax({
			url: "/ajax/article/qaProPublish",
			dataType: 'json', //数据格式类型
			type: 'GET', //http请求类型
			data: {
				"professorId": professorId
			},
			timeout: 10000, //超时设置
			success: function(data) {
				if(data.success) {
					var madiaHead ='/images/default-artical.jpg';
					if(data.data.length > 0){
						for(var i = 0; i < data.data.length; i++) {
							if(data.data[i].articleImg) {
								madiaHead ='/data/article/' + data.data[i].articleImg ;
							}
							var strAdd = '';
							strAdd += '<li><a href="articalShow.html?articleId='+ data.data[i].articleId +'" class="flexCenter urlgo">';
							strAdd += '<div class="madiaHead artHead" style="background-image:url('+ madiaHead +')"></div>';
							strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty-2">'+ data.data[i].articleTitle +'</p>';
							strAdd += '<ul class="h2Font clearfix">';
							strAdd += '<li><span class="time">'+ commenTime(data.data[i].publishTime) +'</span></li>';
							strAdd += '<li><span id="pageViews">阅读量 '+ data.data[i].pageViews +'</span></li>';
							strAdd += '<li><span id="articleAgree">点赞  '+ data.data[i].articleAgree +'</span></li>';
							strAdd += '<li><span id="comment"></span></li>';
							strAdd += '</ul></div>';
							strAdd += '</a></li>';
							
							var $strAdd = $(strAdd);
							$("#proArticel").append( $strAdd);
							commentnum(data.data[i].articleId, $strAdd) //文章评论数
							if(i==0){
								$("#showArticle").append(strAdd);
								commentnum(data.data[0].articleId, $strAdd)
							}
						
						}
					}else{
						$("#proArticel + .nodatabox").show();
						$("#proArticel + .nodatabox").find(".noContip").text("主人尚未发布任何文章");
						$("#showArticle").parents(".coninfobox").hide();
					}
					

				}
			},
			error: function() {
				return;
			}
		});
		
	}
	
	//查文章评论数
	function commentnum(articleId, $itemlist) {
		$.ajax({
			"url": "/ajax/leaveWord/lwCount",
			"type": "GET",
			"dataType": "json",
			"async": false,
			"data": {
				"articleId": articleId
			},
			"success": function(data) {
				if(data.success) {
					$itemlist.find("#comment").text("评论 " + data.data);
				}
			},
			"error": function() {
				$.MsgBox.Alert('提示', '链接服务器超时')
			}
		});
	}

		
})