';
}
} else {
var showDiv = '
'+ $data.count +''+ $data.caption +'
';
}
if($photos.length < 6) {
for(var j = 0; j < $photos.length; ++j) {
if($photos[j].img) {
showDiv += '';
} else {
showDiv += '';
}
}
} else {
for(var j = $photos.length - 5; j < $photos.length; ++j) {
if($photos[j].img) {
showDiv +='';
} else {
showDiv += '';
}
}
showDiv += '';
}
showDiv += "
";
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("
" + subs[i] + "
");
};
}
}
}
var projectShow = function(data) {
if(data.length > 0) {
for(var i = 0; i < data.length; i++) {
if(!data[i].descp) {
data[i].descp = "";
}
var sDate = "";
var eDate = "";
if(data[i].startMonth) {
sDate = data[i].startMonth.substr(0, 4) + "年" + data[i].startMonth.substr(4, 6) + "月";
sDateV = 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 projectHtml = '
';
projectHtml += '' + data[i].name + '' + sDate + eDate + '
';
projectHtml += '' + data[i].descp + '
';
projectHtml += '';
$("#projectShow").append(projectHtml);
}
}
}
var honorShow = function(data) {
if(data.length > 0) {
for(var i = 0; i < data.length; i++) {
var timeho="";
if(data[i].year){
timeho = data[i].year+'年';
}else{
data[i].year="";
}
if(!data[i].descp) {
data[i].descp = "";
}
var honorHtml = '
';
honorHtml += '' + data[i].name + '' + timeho + '
';
honorHtml += '' + data[i].descp + '
';
honorHtml += '';
$("#honorShow").append(honorHtml);
}
}
}
var timeJobShow = function(data) {
if(data.length > 0) {
for(var i = 0; i < data.length; i++) {
if(data[i].department) {
var dep = "-" + data[i].department;
} else {
var dep = ""
}
var sDate = "";
var eDate = "";
if(data[i].startMonth) {
sDate = data[i].startMonth.substr(0, 4) + "年" + data[i].startMonth.substr(4, 6) + "月";
sDateV = 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 = '
';
JobHtml += '' + data[i].company + '-' + dep + '' + data[i].title + '' + sDate + eDate + '
';
JobHtml += '';
$("#timeJobShow").append(JobHtml);
}
}
}
var eduBgShow = function(data) {
if(data.length > 0) {
for(var i = 0; i < data.length; i++) {
var college="",major="",degree=""
if(data[i].college){
college =' - ' + data[i].college
}else{
data[i].college="";
}
if(data[i].major){
major =' - ' + data[i].major
}else{
data[i].major="";
}
if(data[i].degree){
degree =' - ' + eduDegree[data[i].degree]
if(data[i].degree==0){
degree =""
}
}else{
data[i].degree="";
}
var timebiye="";
if(data[i].year){
if(data[i].year.trim()=="至今"){
timebiye=data[i].year;
}else{
timebiye=data[i].year+'年';
}
}else{
timebiye="";
}
var showHtml = '
'
showHtml += data[i].school + college + major + degree;
showHtml +='' + timebiye + '
';
$("#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;
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 + "
");
}
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 + "
");
llqtitle = $info.name + "-" + $info.title + "-" + proOther.replace(/,/gi,"-") + "-科袖网";
}
document.title = llqtitle;
//个人简介
if($info.descp) {
$("#descpS").parents(".coninfobox").removeClass("displayNone");
$("#item1user>.nodatabox").addClass("displayNone");
$("#descpS").text($info.descp);
}
//学术领域
if($info.subject) {
$("#subjectShow").parents(".coninfobox").removeClass("displayNone");
$("#item1user>.nodatabox").addClass("displayNone");
subjectShow($info.subject);
}
//研究方向
if($info.researchAreas.length) {
$("#researchAreaShow").parents(".coninfobox").removeClass("displayNone");
$("#item1user>.nodatabox").addClass("displayNone");
researchAreaShow($info.researchAreas, $info.editResearchAreaLogs);
}
//行业领域
if($info.industry) {
$("#industryShow").parents(".coninfobox").removeClass("displayNone");
$("#item1user>.nodatabox").addClass("displayNone");
industryShow($info.industry);
}
//教育背景
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(){
$.ajax({
"url": "/ajax/consult/pqAssessHis",
"type": "get",
"data": {
"professorId": professorId
},
"async": false,
"success": function(response) {
if(response.success) {
var $data = response.data.data;
if($data.length>0){
$("#historyEvaluate").parents(".coninfobox").removeClass("displayNone");
$("#item1user>.nodatabox").addClass("displayNone");
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 += '
';
add += ''
add += '';
add += '
'+ assessContant +'
';
add += '
';
var $add = $(add);
$("#historyEvaluate").append($add);
$add.find(".starShow>li:lt(" + $data[i].assessStar + ")").addClass('evastar');
}
}else{
}
}
}
})
}
//获取资源
function getResource(pageSize, pageNo,isbind){
$.ajax({
"url": "/ajax/resource/pqProPublish",
"type": "get",
"async": false,
"data": {
"professorId": professorId,
"pageSize": pageSize,
"pageNo": pageNo
},
"success": function(data) {
console.log(data);
if(data.success) {
var madiaHead ='';
var dataStr=data.data.data;
if(dataStr.length > 0){
$("#showResource").parents(".coninfobox").removeClass("displayNone");
$("#item1user>.nodatabox").addClass("displayNone");
for(var i = 0; i < dataStr.length; i++) {
if(dataStr[i].images.length) {
madiaHead ='/data/resource/' + dataStr[i].images[0].imageSrc ;
}else{
madiaHead ='/images/default-resource.jpg';
}
var strAdd = '';
strAdd += '
';
strAdd += '';
strAdd += ''+ dataStr[i].resourceName +'
应用用途:'+ dataStr[i].supportedServices+'
';
strAdd += '';
if(i==0){
$("#showResource").append(strAdd);
}
$("#proResource").append(strAdd);
}
//分页
if(isbind==true){
$("#proResource").siblings(".tcdPageCode").createPage({
pageCount: Math.ceil(data.data.total / 10),
current: data.data.pageNo,
backFn: function(p) {
$("#proResource").html("");
getResource(10, p,false);
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
});
}
}else{
$("#proResource + .nodatabox").show();
$("#proResource + .nodatabox").find(".noContip").text("用户尚未发布任何资源");
}
}
},
"error": function() {
$.MsgBox.Alert("提示", "服务器连接超时")
}
});
}
//获取文章
function getArticle(pageSize, pageNo,isbind){
$.ajax({
url: "/ajax/article/pqProPublish",
dataType: 'json', //数据格式类型
type: 'GET', //http请求类型
data: {
"professorId": professorId,
"pageSize": pageSize,
"pageNo": pageNo
},
timeout: 10000, //超时设置
success: function(data) {
if(data.success) {
var madiaHead ='/images/default-artical.jpg';
var dataStr=data.data.data;
if(dataStr.length > 0){
$("#showArticle").parents(".coninfobox").removeClass("displayNone");
$("#item1user>.nodatabox").addClass("displayNone");
for(var i = 0; i < dataStr.length; i++) {
if(dataStr[i].articleImg) {
madiaHead ='/data/article/' + dataStr[i].articleImg ;
}
var strAdd = '';
strAdd += '
';
strAdd += '';
strAdd += ''+ dataStr[i].articleTitle +'
';
strAdd += '
';
strAdd += '- '+ commenTime(dataStr[i].publishTime) +'
';
strAdd += '- 阅读量 '+ dataStr[i].pageViews +'
';
strAdd += '- 点赞 '+ dataStr[i].articleAgree +'
';
strAdd += '';
strAdd += '
';
strAdd += '';
var $strAdd = $(strAdd);
$("#proArticel").append( $strAdd);
commentnum(dataStr[i].articleId, $strAdd) //文章评论数
if(i==0){
$("#showArticle").append(strAdd);
commentnum(dataStr[0].articleId, $strAdd)
}
}
//分页
if(isbind==true){
$("#proArticel").siblings(".tcdPageCode").createPage({
pageCount: Math.ceil(data.data.total / 10),
current: data.data.pageNo,
backFn: function(p) {
$("#proArticel").html("");
getArticle(10, p,false);
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
});
}
}else{
$("#proArticel + .nodatabox").show();
$("#proArticel + .nodatabox").find(".noContip").text("用户尚未发布任何文章");
}
}
},
error: function() {
return;
}
});
}
//获取专利
function getPatent(pageSize, pageNo,isbind){
$.ajax({
url: "/ajax/ppatent/byProfessor",
dataType: 'json', //数据格式类型
type: 'GET', //http请求类型
data: {
"id": professorId,
"pageSize": pageSize,
"pageNo": pageNo
},
timeout: 10000, //超时设置
success: function(data) {
if(data.success) {
var dataStr=data.data.data;
if(dataStr.length > 0){
$("#showPatent").parents(".coninfobox").removeClass("displayNone");
$("#item1user>.nodatabox").addClass("displayNone");
for(var i = 0; i < dataStr.length; i++) {
if(!dataStr[i].reqPerson){
dataStr[i].reqPerson="";
}
var strAdd = '';
strAdd += '
';
strAdd += '';
strAdd += ''+ dataStr[i].name +'
';
strAdd += '
发明人:'+ dataStr[i].authors.substring(0, dataStr[i].authors.length - 1) +'
';
strAdd += '
申请人:'+ dataStr[i].reqPerson +'
';
strAdd += '
';
strAdd += '';
var $strAdd = $(strAdd);
$("#proPatent").append( $strAdd);
if(i==0){
$("#showPatent").append(strAdd);
}
}
//分页
if(isbind==true){
$("#proPatent").siblings(".tcdPageCode").createPage({
pageCount: Math.ceil(data.data.total / 10),
current: data.data.pageNo,
backFn: function(p) {
$("#proPatent").html("");
getArticle(10, p,false);
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
});
}
}else{
$("#proPatent + .nodatabox").show();
$("#proPatent + .nodatabox").find(".noContip").text("用户尚未发布任何专利");
}
}
},
error: function() {
return;
}
});
}
//获取论文
function getPaper(pageSize, pageNo,isbind){
$.ajax({
url: "/ajax/ppaper/byProfessor",
dataType: 'json', //数据格式类型
type: 'GET', //http请求类型
data: {
"id": professorId,
"pageSize": pageSize,
"pageNo": pageNo
},
timeout: 10000, //超时设置
success: function(data) {
if(data.success) {
var dataStr=data.data.data;
if(dataStr.length > 0){
$("#showPaper").parents(".coninfobox").removeClass("displayNone");
$("#item1user>.nodatabox").addClass("displayNone");
for(var i = 0; i < dataStr.length; i++) {
var moreInf=""
if(!dataStr[i].cn4periodical){
dataStr[i].cn4periodical="";
}
if(!dataStr[i].en4periodical){
dataStr[i].en4periodical="";
}
if(!dataStr[i].pubDay){
dataStr[i].pubDay="";
}
moreInf = dataStr[i].cn4periodical+ " " +dataStr[i].en4periodical+ " " +dataStr[i].pubDay
var strAdd = '';
strAdd += '
';
strAdd += '';
strAdd += ''+ dataStr[i].name +'
';
strAdd += '
作者:'+ dataStr[i].authors.substring(0, dataStr[i].authors.length - 1) +'
';
strAdd += '
期刊:'+ moreInf +'
';
strAdd += '
';
strAdd += '';
var $strAdd = $(strAdd);
$("#proPaper").append( $strAdd);
if(i==0){
$("#showPaper").append(strAdd);
}
}
//分页
if(isbind==true){
$("#proPaper").siblings(".tcdPageCode").createPage({
pageCount: Math.ceil(data.data.total / 10),
current: data.data.pageNo,
backFn: function(p) {
$("#proPaper").html("");
getArticle(10, p,false);
document.body.scrollTop = document.documentElement.scrollTop = 0;
}
});
}
}else{
$("#proPaper + .nodatabox").show();
$("#proPaper + .nodatabox").find(".noContip").text("用户尚未发布任何论文");
}
}
},
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('提示', '链接服务器超时')
}
});
}
//纠错反馈
$(".correctSubmit").on("click",function(){
var cntCon=$(this).siblings(".correctCon").val();
var cntUser="";
if(userid && userid != null && userid != "null") {
cntUser = userid;
}
if(cntCon.length>500){
$.MsgBox.Alert('提示', '纠错反馈内容不得超过500个字');
return;
}else{
$.ajax({
"url": "/ajax/feedback/error/professor",
"type": "POST",
"dataType": "json",
"async": true,
"data": {
"id": professorId,
"cnt":cntCon,
"user":cntUser
},
"success": function(data) {
if(data.success) {
backSuccessed();
}
},
"error": function() {
$.MsgBox.Alert('提示', '链接服务器超时')
}
});
}
})
})