//用户id var userid = $.cookie("userid"); //getConsultData参数 var pageSize = 5; var pageNo,isbind,status,timeType,sortType; //点击主页面咨询 //$(".workmenu").on("click","#consultbtn",clickConsultBtn); $(".workmenu").on("click","#consultbtn",function(){ var lookall = 0; clickConsultBtn(lookall) }); //data:需要处理的数据,htmlStr:页面中需要的html字符串拼接, //attrParams:数据中不同的参数比如:收到咨询是professorId,收到答复:consultantId function handleData(data,attrParams,btnCls){ var htmlStr = ''; var title, office, orgName, department, address; for(var i = 0; i < data.length;i++){ //text:回复/查看,state:进行中/已完成/未评价,photoUrl:头像地址,proModify:专家认证 var text,state,stateStyle,photoUrl,proModify; var modifyclass = ''; if(data[i]["professor"]){//过滤没有专家对象的数据 if(data[i]["consultStatus"] == 0){ state = "进行中"; stateStyle = 'status-1'; text = '回复'; } else if (data[i]["consultStatus"] == 1) { text = "查看"; state = "已完成"; stateStyle = 'status-3'; if(attrParams == 'consultId'){ if(data[i]["assessStatus"] == 0){ state = "待评价"; stateStyle = 'status-2'; } } }else if(data[i]["consultStatus"] == undefined){ text = ""; state = ""; } //专家头像 if(data[i]["professor"]["hasHeadImage"] == 0){ photoUrl = "images/default-photo.jpg" }else{ photoUrl = "images/head/"+data[i]["professor"]["id"]+"_l.jpg" }; //认证 // if(data[i]["professor"]["authentication"] == true){ // proModify = "display:inline-block;" // }else{ // proModify = "display:none;" // } if(data[i]["professor"].authType) {//专家 modifyclass = 'authicon authicon-cu'; } else {//普通用户 if(data[i]["professor"].authStatus) {//身份已认证 if(data[i]["professor"].authentication == 1) {//科研工作者 modifyclass = "authicon2 authicon-mana"; } else if(data[i]["professor"].authentication == 2) {//企业专家 modifyclass = "authicon2 authicon-staff"; } else {//学生 modifyclass = "authicon2 authicon-stu"; } }else{//身份未认证 } }; //未读消息 var unread = unreadConsultFn (userid,data[i]["consultId"],i); htmlStr += "
" +
"" + data[i]["professor"]["name"] +" "+ ""; if(data[i]["professor"]["title"]){ htmlStr +="" + data[i]["professor"]["title"] +", "; }; if(data[i]["professor"]["office"]){ if(data[i]["professor"]["orgName"] || data[i]["professor"]["department"]){ htmlStr +=""+data[i]["professor"]["office"]+", "; }else{ htmlStr +=""+data[i]["professor"]["office"]+""; } }; if(data[i]["professor"]["orgName"]){ if(data[i]["professor"]["department"]){ htmlStr += ""+data[i]["professor"]["orgName"] +", "; }else{ htmlStr += ""+data[i]["professor"]["orgName"] +""; } }; if(data[i]["professor"]["department"]){ htmlStr += ""+data[i]["professor"]["department"] +""; }; if(data[i]["professor"]["address"]){ htmlStr += ' | '+ ""+data[i]["professor"]["address"]+""; }; htmlStr += ""+ "咨询主题: " + data[i]["consultTitle"] +" " + " " + "咨询类型: " + data[i]["consultType"] +" " + " " + "咨询发起时间: " + data[i]["createTime"].substr(0,4) + "-" + data[i]["createTime"].substr(4,2) + "-" + data[i]["createTime"].substr(6,2) + " " + data[i]["createTime"].substr(8,2)+ ":" +data[i]["createTime"].substr(10,2)+ "" + "" + "" + lastReplyFn(userid,data[i]["consultId"])["lastReplyTime"]+ " " + " " + ""+lastReplyFn(userid,data[i]["consultId"])["lastReplyCon"]+" " + "" +
" " +
"" +
"" +
text +
"" +
"..." +
" " +
"
" +
""+state+"" +
" " +
" | " +
"
"+data[i]["tidingsContant"]+"
" + "