$(document).ready(function() { $(".onlogin .headnavbtn li").eq(0).addClass("navcurrent"); var demandId = GetQueryString("demandId"); var consuId, demandTitle, demandContent, oDemandAim; loginStatus();//判断个人是否登录 function angleDemand() { $.ajax({ url: "/ajax/demand/queryOne", type: "GET", timeout: 10000, dataType: "json", data: { "demandId": demandId, }, beforeSend: function() {}, success: function(data, textState) { if(data.success) { var $data = data.data; var oTime, oDemandType; $("#dialog_consultTitle").text($data.demandTitle); oTime = $data["createTime"].substr(0, 4) + "年" + $data.createTime.substr(4, 2) + "月" + $data.createTime.substr(6, 2) + "日" + $data.createTime.substr(8, 2) + ":" + $data.createTime.substr(10, 2); $("#dialog_consultTime").text(oTime); if($data.demandType == 1) { oDemandType = "个人需求" } else { oDemandType = "企业需求" } $("#dialog_consultType").text(oDemandType); if($data.demandAim == 1) { oDemandAim = "技术咨询" } else if($data.demandAim == 2) { oDemandAim = "资源咨询" } else if($data.demandAim == 3) { oDemandAim = "其他咨询" } $("#demandt").text(oDemandAim); $("#dialog_consultContent").text($data.demandContent); $("#nameS").text($data.professor.name); if($data.professor.hasHeadImage == 1) { $("#headImg").attr("src", "/images/head/" + $data.professor.id + "_l.jpg") } //认证 var oSty=autho($data.professor.authType,$data.professor.orgAuth,$data.professor.authStatus); $("#sta").addClass(oSty.sty); $("#sta").attr("title",oSty.title) var oString = todStr($data.professor.title, $data.professor.office, $data.professor.department); $("#offt").text(oString); consuId = $data.professor.id; if(userid==$data.professor.id){ $(".basicBtn").hide(); } demandTitle = $data.demandTitle; demandContent = $data.demandContent; demandType = $data.demandAim } }, error: function(XMLHttpRequest, textStats, errorThrown) { } }) } /*职位职称所属机构*/ function todStr() { var arr = new Array(), i; for(i in arguments) { if(arguments[i]) { arr.push(arguments[i]) } } return arr.join(); } angleDemand(); /*确认回复*/ $(".basicBtn").find("span").click(function() { $.ajax({ url: "/ajax/consult/byDemand", type: "GET", timeout: 10000, dataType: "json", data: { "demandId": demandId, "professorId": userid }, success: function(data, textState) { if(data.success) { //console.log(data) if(data.data == null) { $.MsgBox.Confirm("消息", "确认回复此需求?", createConsult) } else { location.href="diloags.html?sendId="+userid+"&attrParams=professorId&consultId="+data.data+"&consultStatus=0&assessStatus=0&thanksStatus=0" } } }, error: function(XMLHttpRequest, textStats, errorThrown) { } }) }) function createConsult() { $.ajax({ url: "/ajax/consult", type: "POST", timeout: 10000, data: { "consultType": oDemandAim, "consultTitle": demandTitle, "consultContant": demandContent, "professorId": userid, "consultantId": consuId, "demandId": demandId }, success: function(data, textState) { if(data.success) { location.href="diloags.html?sendId="+userid+"&attrParams=professorId&consultId="+data.data+"&consultStatus=0&assessStatus=0&thanksStatus=0" } }, error: function(XMLHttpRequest, textStats, errorThrown) { } }) } })