portal html css js resource

userInforShow.js 38KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198
  1. $(function() {
  2. loginStatus();//判断个人是否登录
  3. var userid = $.cookie("userid");
  4. var professorId = GetQueryString("professorId");
  5. var oArray=[];
  6. if(userid != professorId) {
  7. ifcollectionAbout(professorId,$(".goSpan").find(".attenSpan"), 1)
  8. $(".goSpan").show();
  9. }
  10. if(professorId) {
  11. getUserInfo(professorId);//获取个人详细信息
  12. historyEvaluate();//获取历史合作及评价
  13. getResource(10,1,true);//获取个人发布的资源
  14. getArticle(10,1,true);//获取个人发布的文章
  15. getPaper(10,1,true);//获取个人发布的论文
  16. getPatent(10,1,true);//获取个人发布的专利
  17. relevantExperts();//合作专家
  18. relevantarticalList();//相关文章
  19. likeExperts();//感兴趣专家
  20. $.ajax({//我关注的
  21. type:"get",
  22. url:"/ajax/watch/countObject",
  23. data: {
  24. id: professorId,
  25. type: 1, //1:专家 2:资源 3:文章
  26. },
  27. async:true,
  28. success:function(data){
  29. if(data.success){
  30. if(data.data){
  31. $("#myFocus").html(data.data)
  32. }else{
  33. $("#myFocus").html("0")
  34. }
  35. }
  36. }
  37. });
  38. $.ajax({//关注我的
  39. type:"get",
  40. url:"/ajax/watch/countProfessor",
  41. data: {
  42. id: professorId,
  43. type: 1,
  44. },
  45. async:true,
  46. success:function(data){
  47. if(data.success){
  48. if(data.data){
  49. $("#focusMe").html(data.data)
  50. }else{
  51. $("#focusMe").html("0")
  52. }
  53. }
  54. }
  55. });
  56. //点击咨询按钮
  57. $("#conbtn").on('click', function(){
  58. if(userid && userid != null && userid != 'null' && userid != undefined && userid != 'undefined') {
  59. ConsultApply();
  60. concultProInfo(professorId);
  61. //点击的发送
  62. $("#sendConsultBtn").click(function() {
  63. sendConsultHandler($(this).attr("proId"));
  64. });
  65. } else {
  66. $.MsgBox.Alert("提示", "请先登录再进行咨询");
  67. $("#mb_btn_ok").val("去登录");
  68. var aele = document.createElement('a');
  69. $("#mb_btnbox").append(aele);
  70. $("#mb_btnbox a").css({
  71. 'display': "block",
  72. 'width': '100%',
  73. 'height': '40px',
  74. 'position': 'absolute',
  75. 'bottom': '-6px',
  76. 'left': '0'
  77. });
  78. aele.setAttribute('href', '../login.html');
  79. }
  80. });
  81. //点击关注按钮
  82. $("#attentBtn").on('click', function() {
  83. if(userid && userid != null && userid != "null") {
  84. if($(this).is('.attenedSpan')){
  85. cancelCollectionAbout(professorId,$(this), 1)
  86. } else {
  87. collectionAbout(professorId,$(this), 1);
  88. }
  89. }else{
  90. $.MsgBox.Alert("提示", "请先登录再进行关注");
  91. $("#mb_btn_ok").val("去登录");
  92. var aele = document.createElement('a');
  93. $("#mb_btnbox").append(aele);
  94. $("#mb_btnbox a").css({
  95. 'display': "block",
  96. 'width': '100%',
  97. 'height': '40px',
  98. 'position': 'absolute',
  99. 'bottom': '-6px',
  100. 'left': '0'
  101. });
  102. aele.setAttribute('href', '../login.html');
  103. }
  104. });
  105. /*研究方向点赞*/
  106. var clFlag = 1;
  107. $("#researchAreaShow").on("click", ".plus", function() {
  108. if(userid && userid != null && userid != "null") {
  109. //点赞变化样式
  110. if(clFlag) {
  111. clFlag = 0;
  112. } else {
  113. return;
  114. }
  115. if($(this).data("isagree") > -1) {
  116. $(this).stop(true, true).animate({
  117. backgroundPositionY: 0
  118. }, 300); //变成未点赞样式
  119. } else {
  120. $(this).stop(true, true).animate({
  121. backgroundPositionY: -26
  122. }, 300); //变成点赞样式
  123. }
  124. $.ajax({
  125. "url": $(this).data("isagree") > -1 ? "/ajax/researchArea/unAgree" : "/ajax/researchArea/agree",
  126. "type": "POST",
  127. "data": {
  128. "targetId": $(this).data("pid"),
  129. "targetCaption": oArray[$(this).data("caption")],
  130. "opId": userid
  131. },
  132. "contentType": "application/x-www-form-urlencoded",
  133. "success": function($data) {
  134. if($data.success) {
  135. $.get("/ajax/professor/info/" + professorId, function($data) {
  136. if($data.success) {
  137. clFlag = 1;
  138. var $info = $data.data;
  139. if($info) {
  140. $("#researchAreaShow").empty("")
  141. if($info.researchAreas) {
  142. researchAreaShow($info.researchAreas, $info.editResearchAreaLogs);
  143. }
  144. }
  145. }
  146. })
  147. } else {
  148. $.MsgBox.Alert("提示", $data.msg);
  149. }
  150. }
  151. });
  152. } else {
  153. $.MsgBox.Alert("提示", "请登录后点赞");
  154. }
  155. })
  156. //点击每个研究方向弹出研究方向详情窗口
  157. $("#researchAreaShow").on("click", ".favorBox,.favorCount", function() {
  158. var cap = $(this).attr("caption");
  159. $.ajax({
  160. url: "/ajax/researchAreaLog/ql",
  161. dataType: 'json', //数据格式类型
  162. type: 'GET', //http请求类型
  163. timeout: 10000, //超时设置
  164. data: {
  165. "professorId": professorId,
  166. 'caption': cap,
  167. "rows": 10
  168. },
  169. success: function(data) {
  170. console.log(data)
  171. if(data.success) {
  172. $(".listitemdiv").html("");
  173. var $info = data.data;
  174. $("#subArea").text(cap);
  175. $(".resAreaCover").fadeIn();
  176. $(".resAreaCon").show()
  177. if($info.length == 0) {
  178. $(".resAreaCon").hide();
  179. return;
  180. }
  181. for(var i = 0; i < $info.length; i++) {
  182. if($info[i].professor.hasHeadImage == 1) {
  183. var imgbg = "/images/head/" + $info[i].professor.id + "_l.jpg";
  184. } else {
  185. var imgbg = "../images/default-photo.jpg";
  186. }
  187. //认证
  188. var oSty=autho($info[i].professor.authType,$info[i].professor.orgAuth,$info[i].professor.authStatus);
  189. var title = $info[i].professor.title || "";
  190. var orgName = $info[i].professor.orgName || "";
  191. var office = $info[i].professor.office || "";
  192. if(title != "") {
  193. var ttitle = title + ",";
  194. }else{
  195. if(office!=""){
  196. var ttitle = office + ",";
  197. }else{
  198. var ttitle = office;
  199. }
  200. }
  201. if(orgName != "") {
  202. orgName = orgName;
  203. }
  204. var addw ='<li class="flexCenter" data-id="'+$info[i].professor.id+'">'
  205. addw +='<a href="userInforShow.html?professorId='+ $info[i].professor.id +'" class="expertUrl linkhref">'
  206. addw +='<div class="lefthead userheadt userRadius" id="expertImg" style="background-image: url('+ imgbg +');"></div>'
  207. addw +='<div class="centercon" style="padding-right:0;">'
  208. addw +='<p class="h1font"><span class="nameSpan" id="Name">' + $info[i].professor.name + '</span><em class="authiconNew ' + oSty.sty + '" title="'+ oSty.title +'"></em></p>'
  209. addw +='<p class="h2font ellipsisSty">'+ ttitle + orgName + '</p>'
  210. addw +='</div></a></li>';
  211. $(".listitemdiv").append(addw);
  212. }
  213. $("body").css("position", "fixed");
  214. }
  215. },
  216. error: function() {}
  217. });
  218. });
  219. //关闭按钮
  220. $("#workclose").click(function() {
  221. $(".resAreaCover").fadeOut();
  222. $("body").css("position", "");
  223. });
  224. //点击查看全部资源
  225. $(".coninfobox").on("click","#seeMoreR",function(){
  226. document.body.scrollTop = document.documentElement.scrollTop = 0;
  227. $(".navconBox ul>li").eq(1).addClass("liNow").siblings().removeClass("liNow");
  228. $("#item1user").hide();
  229. $("#item2user").show();
  230. })
  231. //点击查看全部文章
  232. $(".coninfobox").on("click","#seeMoreA",function(){
  233. document.body.scrollTop = document.documentElement.scrollTop = 0;
  234. $(".navconBox ul>li").eq(2).addClass("liNow").siblings().removeClass("liNow");
  235. $("#item1user").hide();
  236. $("#item3user").show();
  237. })
  238. //点击查看全部专利
  239. $(".coninfobox").on("click","#seeMoreP",function(){
  240. document.body.scrollTop = document.documentElement.scrollTop = 0;
  241. $(".navconBox ul>li").eq(3).addClass("liNow").siblings().removeClass("liNow");
  242. $("#item1user").hide();
  243. $("#item4user").show();
  244. })
  245. //点击查看全部论文
  246. $(".coninfobox").on("click","#seeMoreL",function(){
  247. document.body.scrollTop = document.documentElement.scrollTop = 0;
  248. $(".navconBox ul>li").eq(4).addClass("liNow").siblings().removeClass("liNow");
  249. $("#item1user").hide();
  250. $("#item5user").show();
  251. })
  252. }
  253. liulanNum();
  254. function liulanNum() {
  255. $.ajax({
  256. "url": "/ajax/professor/incPageViews",
  257. "type": "POST",
  258. "dataType": "json",
  259. "async": true,
  260. "data": {
  261. "id": professorId,
  262. },
  263. "success": function(data) {
  264. if(data.success) {
  265. console.log(data);
  266. }
  267. },
  268. "error": function() {
  269. $.MsgBox.Alert('提示', '链接服务器超时')
  270. }
  271. });
  272. }
  273. //用户详细信息
  274. function getUserInfo(professorId){
  275. $.ajax({
  276. type:"get",
  277. url:"/ajax/professor/info/"+ professorId,
  278. async:true,
  279. success: function(data) {
  280. var $info = data.data;
  281. if(data.success) {
  282. console.log(data)
  283. if($info.hasHeadImage){
  284. $("#proHead").css("background-image","url(/images/head/"+ $info.id +"_l.jpg)");
  285. }
  286. $("#proName").text($info.name);
  287. var oStyS=autho($info.authType,$info.orgAuth,$info.authStatus);
  288. $("#proAuth").addClass(oStyS.sty); $("#proAuth").attr("title",oStyS.title);
  289. if($info.address){
  290. $("#proAddress").html($info.address + "<span style='margin-right:10px;'></span>");
  291. }
  292. var proOther="";
  293. if($info.orgName){
  294. if($info.department){
  295. if($info.office){
  296. proOther = $info.orgName + "," + $info.department + "," + $info.office
  297. }else{
  298. proOther = $info.orgName + "," + $info.department
  299. }
  300. }else{
  301. if($info.office){
  302. proOther = $info.orgName +"," + $info.office
  303. }else{
  304. proOther = $info.orgName
  305. }
  306. }
  307. }else{
  308. if($info.department){
  309. if($info.office){
  310. proOther = $info.department + "," + $info.office
  311. }else{
  312. proOther = $info.department
  313. }
  314. }else{
  315. if($info.office){
  316. proOther = $info.office
  317. }
  318. }
  319. }
  320. $("#proOther").text(proOther);
  321. var llqtitle=$info.name + "-" + proOther.replace(/,/gi,"-") + "-科袖网";//修改浏览器title信息
  322. if($info.title){
  323. $("#proTit").html($info.title + "<span style='margin-right:10px;'></span>");
  324. llqtitle = $info.name + "-" + $info.title + "-" + proOther.replace(/,/gi,"-") + "-科袖网";
  325. }
  326. document.title = llqtitle;
  327. //个人简介
  328. if($info.descp) {
  329. $("#descpS").parents(".coninfobox").removeClass("displayNone");
  330. $("#item1user>.nodatabox").addClass("displayNone");
  331. $("#descpS").text($info.descp);
  332. }
  333. //学术领域
  334. if($info.subject) {
  335. $("#subjectShow").parents(".coninfobox").removeClass("displayNone");
  336. $("#item1user>.nodatabox").addClass("displayNone");
  337. subjectShow($info.subject);
  338. }
  339. //研究方向
  340. if($info.researchAreas.length) {
  341. $("#researchAreaShow").parents(".coninfobox").removeClass("displayNone");
  342. $("#item1user>.nodatabox").addClass("displayNone");
  343. researchAreaShow($info.researchAreas, $info.editResearchAreaLogs);
  344. }
  345. //行业领域
  346. if($info.industry) {
  347. $("#industryShow").parents(".coninfobox").removeClass("displayNone");
  348. $("#item1user>.nodatabox").addClass("displayNone");
  349. industryShow($info.industry);
  350. }
  351. //教育背景
  352. if($info.edus.length) {
  353. eduBgShow($info.edus);
  354. } else {
  355. $("#eduBgShow").parents(".coninfobox").hide();
  356. }
  357. //兼职
  358. if($info.jobs.length) {
  359. timeJobShow($info.jobs);
  360. } else {
  361. $("#timeJobShow").parents(".coninfobox").hide();
  362. }
  363. //项目
  364. if($info.projects.length) {
  365. projectShow($info.projects)
  366. } else {
  367. $("#projectShow").parents(".coninfobox").hide();
  368. }
  369. //荣誉
  370. if($info.honors.length) {
  371. honorShow($info.honors);
  372. } else {
  373. $("#honorShow").parents(".coninfobox").hide();
  374. }
  375. if($info.honors.length == 0 && $info.projects.length == 0 && $info.jobs.length == 0 && $info.edus.length == 0){
  376. $("#item6user>.nodatabox").show();
  377. $("#item6user>.nodatabox").find(".noContip").text("用户尚未完善详细资料")
  378. }
  379. var weibotitle = $info.name;
  380. var weibourl = window.location.href;
  381. var weibopic ="http://"+window.location.host+"/images/head/"+ $info.id +"_l.jpg";
  382. $("#weibo").attr("href","http://service.weibo.com/share/share.php?appkey=3677230589&title="+weibotitle+"&url="+weibourl+"&pic="+weibopic+"&ralateUid=6242830109&searchPic=false&style=simple");
  383. }
  384. },
  385. error: function() {
  386. $.MsgBox.Alert('提示', '链接服务器超时')
  387. }
  388. });
  389. }
  390. function subjectShow(data) {
  391. if(data != undefined && data.length != 0) {
  392. var subs = new Array();
  393. if(data.indexOf(',')) {
  394. subs = data.split(',');
  395. } else {
  396. subs[0] = data;
  397. }
  398. if(subs.length > 0) {
  399. for(var i = 0; i < subs.length; i++) {
  400. $("#subjectShow").append("<li>" + subs[i] + "</li>");
  401. };
  402. }
  403. }
  404. }
  405. function researchAreaShow($datas, $datarecords) {
  406. if($datas != undefined && $datas.length != 0) {
  407. var html = [];
  408. for(var i = 0; i < $datas.length; ++i) {
  409. var $data = $datas[i];
  410. var $photos = [];
  411. //获取头像
  412. if($datarecords.length > 0) {
  413. $photos = getRecords($datarecords, $data.caption);
  414. }
  415. var isAgree = -1;
  416. for(var j = 0; j < $photos.length; j++) {
  417. if(userid == $photos[j].id)
  418. isAgree++;
  419. }
  420. oArray[i]=$data.caption;
  421. if(professorId != userid) {
  422. if(isAgree) {
  423. 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="'+ i + '" data-isagree="' + isAgree + '"></span><div class="favorCount" caption="'+ $data.caption +'">';
  424. } else {
  425. 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="'+ i + '" data-isagree="' + isAgree + '"></span><div class="favorCount" caption="'+ $data.caption +'">';
  426. }
  427. } else {
  428. var showDiv = '<li><div class="favorBox" caption="'+ $data.caption +'"><span class="like">'+ $data.count +'</span>'+ $data.caption +'</div><div class="favorCount" caption="'+ $data.caption +'">';
  429. }
  430. if($photos.length < 6) {
  431. for(var j = 0; j < $photos.length; ++j) {
  432. if($photos[j].img) {
  433. showDiv += '<span class="like-people" style="background-image: url(../images/head/'+ $photos[j].id +'_s.jpg);"></span>';
  434. } else {
  435. showDiv += '<span class="like-people" style="background-image: url(../images/default-photo.jpg);"></span>';
  436. }
  437. }
  438. } else {
  439. for(var j = $photos.length - 5; j < $photos.length; ++j) {
  440. if($photos[j].img) {
  441. showDiv +='<span class="like-people" style="background-image: url(../images/head/'+ $photos[j].id +'_s.jpg);"></span>';
  442. } else {
  443. showDiv += '<span class="like-people" style="background-image: url(../images/default-photo.jpg);"></span>';
  444. }
  445. }
  446. showDiv += '<span class="like-people like-more"></span>';
  447. }
  448. showDiv += "</div></li>";
  449. html.push(showDiv);
  450. }
  451. document.getElementById("researchAreaShow").innerHTML = html.join('');
  452. }
  453. }
  454. function industryShow(data) {
  455. if(data != undefined && data.length != 0) {
  456. var subs = new Array();
  457. if(data.indexOf(',')) {
  458. subs = data.split(',');
  459. } else {
  460. subs[0] = data;
  461. }
  462. if(subs.length > 0) {
  463. for(var i = 0; i < subs.length; i++) {
  464. $("#industryShow").append("<li><div class='h4tit'>" + subs[i] + "</div></li>");
  465. };
  466. }
  467. }
  468. }
  469. function projectShow(data) {
  470. if(data.length > 0) {
  471. for(var i = 0; i < data.length; i++) {
  472. if(!data[i].descp) {
  473. data[i].descp = "";
  474. }
  475. var sDate = "";
  476. var eDate = "";
  477. if(data[i].startMonth) {
  478. sDate = data[i].startMonth.substr(0, 4) + "年" + data[i].startMonth.substr(4, 6) + "月";
  479. sDateV = data[i].startMonth.substr(0, 4) + "-" + data[i].startMonth.substr(4, 6);
  480. if(data[i].stopMonth) {
  481. eDate =" - "+ data[i].stopMonth.substr(0, 4) + "年" + data[i].stopMonth.substr(4, 6) + "月";
  482. } else {
  483. eDate = " - "+ "至今";
  484. }
  485. }
  486. var projectHtml = '<li>';
  487. projectHtml += '<div class="h4Font h4tit">' + data[i].name + '<small class="h6Font">' + sDate + eDate + '</small></div>';
  488. projectHtml += '<div class="h5Font">' + data[i].descp + '</div>';
  489. projectHtml += '</li>';
  490. $("#projectShow").append(projectHtml);
  491. }
  492. }
  493. }
  494. function honorShow(data) {
  495. if(data.length > 0) {
  496. for(var i = 0; i < data.length; i++) {
  497. var timeho="";
  498. if(data[i].year){
  499. timeho = data[i].year+'年';
  500. }else{
  501. data[i].year="";
  502. }
  503. if(!data[i].descp) {
  504. data[i].descp = "";
  505. }
  506. var honorHtml = '<li>';
  507. honorHtml += '<div class="h4Font h4tit">' + data[i].name + '<small class="h6Font">' + timeho + '</small></div>';
  508. honorHtml += '<div class="h5Font">' + data[i].descp + '</div>';
  509. honorHtml += '</li>';
  510. $("#honorShow").append(honorHtml);
  511. }
  512. }
  513. }
  514. function timeJobShow(data) {
  515. if(data.length > 0) {
  516. for(var i = 0; i < data.length; i++) {
  517. if(data[i].department) {
  518. var dep = " - " + data[i].department;
  519. } else {
  520. var dep = ""
  521. }
  522. var sDate = "";
  523. var eDate = "";
  524. if(data[i].startMonth) {
  525. sDate = data[i].startMonth.substr(0, 4) + "年" + data[i].startMonth.substr(4, 6) + "月";
  526. sDateV = data[i].startMonth.substr(0, 4) + "-" + data[i].startMonth.substr(4, 6);
  527. if(data[i].stopMonth) {
  528. eDate =" - "+ data[i].stopMonth.substr(0, 4) + "年" + data[i].stopMonth.substr(4, 6) + "月";
  529. } else {
  530. eDate = " - "+ "至今";
  531. }
  532. }
  533. var JobHtml = '<li>';
  534. JobHtml += '<div class="h4Font h4tit">' + data[i].company + dep + ' - ' + data[i].title + '<small class="h6Font">' + sDate + eDate + '</small></div>';
  535. JobHtml += '</li>';
  536. $("#timeJobShow").append(JobHtml);
  537. }
  538. }
  539. }
  540. function eduBgShow(data) {
  541. if(data.length > 0) {
  542. for(var i = 0; i < data.length; i++) {
  543. var college="",major="",degree=""
  544. if(data[i].college){
  545. college =' - ' + data[i].college
  546. }else{
  547. data[i].college="";
  548. }
  549. if(data[i].major){
  550. major =' - ' + data[i].major
  551. }else{
  552. data[i].major="";
  553. }
  554. if(data[i].degree){
  555. degree =' - ' + data[i].degree
  556. if(data[i].degree==0){
  557. degree =""
  558. }
  559. }else{
  560. data[i].degree="";
  561. }
  562. var timebiye="";
  563. if(data[i].year){
  564. if(data[i].year.trim()=="至今"){
  565. timebiye=data[i].year;
  566. }else{
  567. timebiye=data[i].year+'年';
  568. }
  569. }else{
  570. timebiye="";
  571. }
  572. var showHtml = '<li><div class="h4Font h4tit">'
  573. showHtml += data[i].school + college + major + degree;
  574. showHtml +='<small class="h6Font">' + timebiye + '</small></div></li>';
  575. $("#eduBgShow").append(showHtml);
  576. }
  577. }
  578. }
  579. //判断点赞的用户是否有头像
  580. function getRecords($researchAreaLogs, caption) {
  581. var ret = [];
  582. var t = 0;
  583. for(var i = 0; i < $researchAreaLogs.length; i++) {
  584. if(caption == $researchAreaLogs[i].caption) {
  585. ret[t] = {
  586. id: $researchAreaLogs[i].opreteProfessorId,
  587. img: $researchAreaLogs[i].hasHeadImage
  588. }
  589. t++;
  590. }
  591. }
  592. return ret;
  593. }
  594. //合作历史及评价
  595. function historyEvaluate(){
  596. $.ajax({
  597. "url": "/ajax/consult/pqAssessHis",
  598. "type": "get",
  599. "data": {
  600. "professorId": professorId
  601. },
  602. "async": false,
  603. "success": function(response) {
  604. if(response.success) {
  605. var $data = response.data.data;
  606. if($data.length>0){
  607. $("#historyEvaluate").parents(".coninfobox").removeClass("displayNone");
  608. $("#item1user>.nodatabox").addClass("displayNone");
  609. for(var i = 0; i < $data.length; i++) {
  610. var assessTime = commenTime($data[i].assessTime);
  611. var assessContant ="";
  612. if($data[i].assessContant) {
  613. assessContant = $data[i].assessContant;
  614. }
  615. var userhed='';
  616. if($data[i].professor.hasHeadImage) {
  617. userhed = 'background-image:url(/images/head/' + $data[i].professor.id + '_l.jpg)';
  618. } else {
  619. userhed = 'background-image:url(/images/default-photo.jpg)';
  620. }
  621. var add = "";
  622. add += '<li class="flexCenter">';
  623. add += '<a href="userInforShow.html?professorId='+ $data[i].professor.id +'" class="userhref"><div class="madiaHead useHead useHeadMsg" style="'+ userhed +'"></div></a>'
  624. add += '<div class="madiaInfo"><div style="position: relative;">';
  625. add += '<a href="userInforShow.html?professorId='+ $data[i].professor.id +'" class="userhref"><span class="h1Font messageName">'+ $data[i].professor.name +'</span></a>';
  626. add += '<em class="authiconNew authicon-pro" title=" "></em><span class="commenttime">'+ assessTime +'</span>';
  627. add += '<ul class="starShow">';
  628. add += '<li></li> <li></li> <li></li> <li></li> <li></li>';
  629. add += '</ul></div>';
  630. add += '<p class="h2Font messageContent">'+ assessContant +'</p>';
  631. add += '</div></li>';
  632. var $add = $(add);
  633. $("#historyEvaluate").append($add);
  634. $add.find(".starShow>li:lt(" + $data[i].assessStar + ")").addClass('evastar');
  635. }
  636. }else{
  637. }
  638. }
  639. }
  640. })
  641. }
  642. //获取资源
  643. function getResource(pageSize, pageNo,isbind){
  644. $.ajax({
  645. "url": "/ajax/resource/pqProPublish",
  646. "type": "get",
  647. "async": false,
  648. "data": {
  649. "professorId": professorId,
  650. "pageSize": pageSize,
  651. "pageNo": pageNo
  652. },
  653. "success": function(data) {
  654. console.log(data);
  655. if(data.success) {
  656. var madiaHead ='';
  657. var dataStr=data.data.data;
  658. if(dataStr.length > 0){
  659. $("#showResource").parents(".coninfobox").removeClass("displayNone");
  660. $("#item1user>.nodatabox").addClass("displayNone");
  661. for(var i = 0; i < dataStr.length; i++) {
  662. if(dataStr[i].images.length) {
  663. madiaHead ='/data/resource/' + dataStr[i].images[0].imageSrc ;
  664. }else{
  665. madiaHead ='/images/default-resource.jpg';
  666. }
  667. var strAdd = '';
  668. strAdd += '<li><a traget="_blank" href="resourceShow.html?resourceId='+ dataStr[i].resourceId +'" class="flexCenter urlgo">';
  669. strAdd += '<div class="madiaHead resouseHead" style="background-image:url('+ madiaHead +')"></div>';
  670. strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty">'+ dataStr[i].resourceName +'</p><p class="h2Font ellipsisSty-2">用途:'+ dataStr[i].supportedServices+'</p></div>';
  671. strAdd += '</a></li>';
  672. var $strAdd = $(strAdd);
  673. $("#proResource").append(strAdd);
  674. if(isbind==true && i==0){
  675. var $strAddO=$(strAdd);
  676. $("#showResource").html("");
  677. $("#showResource").append($strAddO);
  678. }
  679. }
  680. //分页
  681. if(isbind==true){
  682. $("#proResource").siblings(".tcdPageCode").off("click").createPage({
  683. pageCount: Math.ceil(data.data.total / 10),
  684. current: data.data.pageNo,
  685. backFn: function(p) {
  686. $("#proResource").html("");
  687. getResource(10, p,false);
  688. document.body.scrollTop = document.documentElement.scrollTop = 0;
  689. }
  690. });
  691. }
  692. }else{
  693. $("#proResource + .nodatabox").show();
  694. $("#proResource + .nodatabox").find(".noContip").text("用户尚未发布任何资源");
  695. }
  696. }
  697. },
  698. "error": function() {
  699. $.MsgBox.Alert("提示", "服务器连接超时")
  700. }
  701. });
  702. }
  703. //获取文章
  704. function getArticle(pageSize, pageNo,isbind){
  705. $.ajax({
  706. url: "/ajax/article/pqProPublish",
  707. dataType: 'json', //数据格式类型
  708. type: 'GET', //http请求类型
  709. data: {
  710. "professorId": professorId,
  711. "pageSize": pageSize,
  712. "pageNo": pageNo
  713. },
  714. timeout: 10000, //超时设置
  715. success: function(data) {
  716. if(data.success) {
  717. var madiaHead ='/images/default-artical.jpg';
  718. var dataStr=data.data.data;
  719. if(dataStr.length > 0){
  720. $("#showArticle").parents(".coninfobox").removeClass("displayNone");
  721. $("#item1user>.nodatabox").addClass("displayNone");
  722. for(var i = 0; i < dataStr.length; i++) {
  723. if(dataStr[i].articleImg) {
  724. madiaHead ='/data/article/' + dataStr[i].articleImg ;
  725. }
  726. var sowU="";
  727. if(dataStr[i].pageViews!=0){
  728. if(dataStr[i].articleAgree!=0){
  729. sowU='<li><span>阅读量 '+dataStr[i].pageViews+'</span></li><li><span>赞 '+dataStr[i].articleAgree+'</span></li>'
  730. }else{
  731. sowU='<li><span>阅读量 '+dataStr[i].pageViews+'</span></li>'
  732. }
  733. }
  734. var strAdd = '';
  735. strAdd += '<li><a traget="_blank" href="articalShow.html?articleId='+ dataStr[i].articleId +'" class="flexCenter urlgo">';
  736. strAdd += '<div class="madiaHead artHead" style="background-image:url('+ madiaHead +')"></div>';
  737. strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty-2">'+ dataStr[i].articleTitle +'</p>';
  738. strAdd += '<ul class="h2Font clearfix">';
  739. strAdd += '<li><span class="time">'+ commenTime(dataStr[i].publishTime) +'</span></li>';
  740. strAdd += sowU
  741. strAdd += '<li><span class="comment"></span></li>';
  742. strAdd += '</ul></div>';
  743. strAdd += '</a></li>';
  744. var $strAdd = $(strAdd);
  745. $("#proArticel").append( $strAdd);
  746. commentnum(dataStr[i].articleId, $strAdd) //文章评论数
  747. if(isbind==true && i==0){
  748. var $strAddO = $(strAdd);
  749. $("#showArticle").html("");
  750. $("#showArticle").append($strAddO);
  751. commentnum(dataStr[0].articleId,$strAddO)
  752. }
  753. }
  754. //分页
  755. if(isbind==true){
  756. $("#proArticel").siblings(".tcdPageCode").off("click").createPage({
  757. pageCount: Math.ceil(data.data.total / 10),
  758. current: data.data.pageNo,
  759. backFn: function(p) {
  760. $("#proArticel").html("");
  761. getArticle(10, p,false);
  762. document.body.scrollTop = document.documentElement.scrollTop = 0;
  763. }
  764. });
  765. }
  766. }else{
  767. $("#proArticel + .nodatabox").show();
  768. $("#proArticel + .nodatabox").find(".noContip").text("用户尚未发布任何文章");
  769. }
  770. }
  771. },
  772. error: function() {
  773. return;
  774. }
  775. });
  776. }
  777. //获取专利
  778. function getPatent(pageSize, pageNo,isbind){
  779. $.ajax({
  780. url: "/ajax/ppatent/byProfessor",
  781. dataType: 'json', //数据格式类型
  782. type: 'GET', //http请求类型
  783. data: {
  784. "id": professorId,
  785. "pageSize": pageSize,
  786. "pageNo": pageNo
  787. },
  788. timeout: 10000, //超时设置
  789. success: function(data) {
  790. if(data.success) {
  791. var dataStr=data.data.data;
  792. if(dataStr.length > 0){
  793. $("#showPatent").parents(".coninfobox").removeClass("displayNone");
  794. $("#item1user>.nodatabox").addClass("displayNone");
  795. for(var i = 0; i < dataStr.length; i++) {
  796. if(!dataStr[i].reqPerson){
  797. dataStr[i].reqPerson="";
  798. }
  799. var strAdd = '';
  800. strAdd += '<li><a traget="_blank" href="patentShow.html?patentId='+ dataStr[i].id +'" class="flexCenter urlgo">';
  801. strAdd += '<div class="madiaHead patentHead"></div>';
  802. strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty">'+ dataStr[i].name +'</p>';
  803. strAdd += '<p class="h2Font ellipsisSty">发明人:'+ dataStr[i].authors.substring(0, dataStr[i].authors.length - 1) +'</p>';
  804. strAdd += '<p class="h2Font ellipsisSty">申请人:'+ dataStr[i].reqPerson +'</p>';
  805. strAdd += '</div>';
  806. strAdd += '</a></li>';
  807. var $strAdd = $(strAdd);
  808. $("#proPatent").append( $strAdd);
  809. if(isbind==true && i==0){
  810. var $strAddO=$(strAdd);
  811. $("#showPatent").html("");
  812. $("#showPatent").append($strAddO);
  813. }
  814. }
  815. //分页
  816. if(isbind==true){
  817. $("#proPatent").siblings(".tcdPageCode").off("click").createPage({
  818. pageCount: Math.ceil(data.data.total / 10),
  819. current: data.data.pageNo,
  820. backFn: function(p) {
  821. $("#proPatent").html("");
  822. getPatent(10, p,false);
  823. document.body.scrollTop = document.documentElement.scrollTop = 0;
  824. }
  825. });
  826. }
  827. }else{
  828. $("#proPatent + .nodatabox").show();
  829. $("#proPatent + .nodatabox").find(".noContip").text("用户尚未发布任何专利");
  830. }
  831. }
  832. },
  833. error: function() {
  834. return;
  835. }
  836. });
  837. }
  838. //获取论文
  839. function getPaper(pageSize, pageNo,isbind){
  840. $.ajax({
  841. url: "/ajax/ppaper/byProfessor",
  842. dataType: 'json', //数据格式类型
  843. type: 'GET', //http请求类型
  844. data: {
  845. "id": professorId,
  846. "pageSize": pageSize,
  847. "pageNo": pageNo
  848. },
  849. timeout: 10000, //超时设置
  850. success: function(data) {
  851. if(data.success) {
  852. var dataStr=data.data.data;
  853. if(dataStr.length > 0){
  854. $("#showPaper").parents(".coninfobox").removeClass("displayNone");
  855. $("#item1user>.nodatabox").addClass("displayNone");
  856. for(var i = 0; i < dataStr.length; i++) {
  857. var moreInf=""
  858. if(!dataStr[i].cn4periodical){
  859. dataStr[i].cn4periodical="";
  860. }
  861. if(!dataStr[i].en4periodical){
  862. dataStr[i].en4periodical="";
  863. }
  864. if(!dataStr[i].pubDay){
  865. dataStr[i].pubDay="";
  866. }
  867. moreInf = dataStr[i].cn4periodical+ " " +dataStr[i].en4periodical+ " " +dataStr[i].pubDay
  868. var strAdd = '';
  869. strAdd += '<li><a traget="_blank" href="paperShow.html?paperId='+ dataStr[i].id +'" class="flexCenter urlgo">';
  870. strAdd += '<div class="madiaHead paperHead"></div>';
  871. strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty">'+ dataStr[i].name +'</p>';
  872. strAdd += '<p class="h2Font ellipsisSty">作者:'+ dataStr[i].authors.substring(0, dataStr[i].authors.length - 1) +'</p>';
  873. strAdd += '<p class="h2Font ellipsisSty">期刊:'+ moreInf +'</p>';
  874. strAdd += '</div>';
  875. strAdd += '</a></li>';
  876. var $strAdd = $(strAdd);
  877. $("#proPaper").append( $strAdd);
  878. if(isbind==true && i==0){
  879. var $strAddO=$(strAdd);
  880. $("#showPaper").html();
  881. $("#showPaper").append($strAddO);
  882. }
  883. }
  884. //分页
  885. if(isbind==true){
  886. $("#proPaper").siblings(".tcdPageCode").off("click").createPage({
  887. pageCount: Math.ceil(data.data.total / 10),
  888. current: data.data.pageNo,
  889. backFn: function(p) {
  890. $("#proPaper").html("");
  891. getPaper(10, p,false);
  892. document.body.scrollTop = document.documentElement.scrollTop = 0;
  893. }
  894. });
  895. }
  896. }else{
  897. $("#proPaper + .nodatabox").show();
  898. $("#proPaper + .nodatabox").find(".noContip").text("用户尚未发布任何论文");
  899. }
  900. }
  901. },
  902. error: function() {
  903. return;
  904. }
  905. });
  906. }
  907. //查文章评论数
  908. function commentnum(articleId, $itemlist) {
  909. $.ajax({
  910. "url": "/ajax/leaveWord/lwCount",
  911. "type": "GET",
  912. "dataType": "json",
  913. "async": false,
  914. "data": {
  915. "articleId": articleId
  916. },
  917. "success": function(data) {
  918. if(data.success) {
  919. if(data.data>0){
  920. $itemlist.find(".comment").text("留言 " + data.data);
  921. }
  922. }
  923. },
  924. "error": function() {
  925. $.MsgBox.Alert('提示', '链接服务器超时')
  926. }
  927. });
  928. }
  929. //合作专家
  930. function relevantExperts(){
  931. $.ajax({
  932. "url": "/ajax/professor/coadjutant",
  933. "type": "get",
  934. "dataType" : "json",
  935. "data" :{"id":professorId},
  936. "success": function(data) {
  937. if(data.success && data.data) {
  938. console.log(data)
  939. for(var i = 0; i < data.data.length; i++) {
  940. var ExpId = data.data[i].professorId;
  941. var paperN=data.data[i].paperCount;
  942. var patentN=data.data[i].patentCount;
  943. var liItem=$('<li class="flexCenter"></li>').appendTo($("#relatePro"));
  944. relExpertsList(ExpId,paperN,patentN,liItem);
  945. }
  946. }
  947. },
  948. "error": function() {
  949. $.MsgBox.Alert('提示', '链接服务器超时')
  950. }
  951. });
  952. }
  953. //合作专家信息
  954. function relExpertsList(Id,numL,numZ,liItem){
  955. $.ajax({
  956. "url" : "/ajax/professor/info/"+Id,
  957. "type" : "GET" ,
  958. "dataType" : "json",
  959. "success" : function(data) {
  960. if (data.success && data.data!=""){
  961. $("#relatePro").parents(".conBlock").removeClass("displayNone");
  962. var itemlist = '<a traget="_blank" href="" class="urlgo">';
  963. itemlist += '<div class="madiaHead useHead" id="userimg"></div>';
  964. itemlist += '<div class="madiaInfo">';
  965. itemlist += '<p><span class="h1Font" id="userName"></span><em class="authiconNew" title=""></em></p>';
  966. itemlist += '<p class="ellipsisSty h2Font" id="usertitle"></p>';
  967. itemlist += '<p class="h2Font ellipsisSty" id="copNum"></p>';
  968. itemlist += '</div></a>';
  969. $(itemlist).appendTo(liItem);
  970. var $itemlist =liItem;
  971. if(numL){
  972. if(numZ){
  973. $itemlist.find("#copNum").text("合作:"+numZ+"项专利,"+numL+"篇论文")
  974. }else{
  975. $itemlist.find("#copNum").text("合作:"+numL+"篇论文")
  976. }
  977. }else{
  978. if(numZ){
  979. $itemlist.find("#copNum").text("合作:"+numZ+"项专利")
  980. }else{
  981. }
  982. }
  983. if(data.data.title) {
  984. if(data.data.orgName) {
  985. $itemlist.find("#usertitle").text(data.data.title +","+ data.data.orgName);
  986. }else{
  987. $itemlist.find("#usertitle").text(data.data.title);
  988. }
  989. }else{
  990. if(data.data.office) {
  991. if(data.data.orgName) {
  992. $itemlist.find("#usertitle").text(data.data.office +","+ data.data.orgName);
  993. }else{
  994. $itemlist.find("#usertitle").text(data.data.office);
  995. }
  996. }else{
  997. if(data.data.orgName) {
  998. $itemlist.find("#usertitle").text(data.data.orgName);
  999. }
  1000. }
  1001. }
  1002. $itemlist.find("#userName").text(data.data.name);
  1003. $itemlist.find(".urlgo").attr("href", "userInforShow.html?professorId="+data.data.id);
  1004. if(data.data.hasHeadImage == 1) {
  1005. $itemlist.find("#userimg").attr("style", "background-image: url(/images/head/" + data.data.id + "_l.jpg);");
  1006. }
  1007. var userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
  1008. $itemlist.find(".authiconNew").attr("title", userType.title);
  1009. $itemlist.find(".authiconNew").addClass(userType.sty);
  1010. }
  1011. },
  1012. "error":function(){
  1013. $.MsgBox.Alert('提示','链接服务器超时')
  1014. }
  1015. });
  1016. }
  1017. //相关文章信息
  1018. function relevantarticalList(){
  1019. $.ajax({
  1020. "url" : "/ajax/article/byAssProfessor",
  1021. "type" : "GET" ,
  1022. "dataType" : "json",
  1023. "data" :{"id":professorId},
  1024. "traditional": true, //传数组必须加这个
  1025. "success" : function(data) {
  1026. console.log(data);
  1027. if (data.success && data.data!=""){
  1028. $("#relateArt").parents(".conBlock").removeClass("displayNone");
  1029. var itemlist = '';
  1030. $("#relateArt").html("");
  1031. for(var i = 0; i < data.data.length; i++) {
  1032. var itemlist = '<li class="flexCenter"><a traget="_blank" href="articalShow.html?articleId='+ data.data[i].articleId +'" class="urlgo">';
  1033. itemlist += '<p class="h2Font ellipsisSty-2"><em class="circlePre"></em>'+data.data[i].articleTitle+'</p>';
  1034. itemlist += '</a></li>';
  1035. $itemlist = $(itemlist);
  1036. $("#relateArt").append($itemlist);
  1037. }
  1038. }
  1039. },
  1040. "error":function(){
  1041. $.MsgBox.Alert('提示','链接服务器超时')
  1042. }
  1043. });
  1044. }
  1045. //感兴趣
  1046. function likeExperts(){
  1047. $.ajax({
  1048. "url": "/ajax/professor/ralateProfessors",
  1049. "type": "get",
  1050. "dataType" : "json",
  1051. "data" :{"professorId":professorId},
  1052. "success": function(data) {
  1053. if(data.success && data.data) {
  1054. console.log(data)
  1055. var lengthT;
  1056. if(data.data.length>5){
  1057. lengthT=5;
  1058. }else{
  1059. lengthT=data.data.length
  1060. }
  1061. for(var i = 0; i < lengthT; i++) {
  1062. var ExpId = data.data[i].id;
  1063. likeExpertsList(ExpId);
  1064. }
  1065. }
  1066. },
  1067. "error": function() {
  1068. $.MsgBox.Alert('提示', '链接服务器超时')
  1069. }
  1070. });
  1071. }
  1072. //感兴趣专家
  1073. function likeExpertsList(ExpId){
  1074. $.ajax({
  1075. "url" : "/ajax/professor/info/"+ExpId,
  1076. "type" : "GET" ,
  1077. "dataType" : "json",
  1078. "success" : function(data) {
  1079. if (data.success && data.data!=""){
  1080. console.log(data)
  1081. $("#likePro").parents(".conBlock").removeClass("displayNone");
  1082. var itemlist = '<li class="flexCenter"><a traget="_blank" href="" class="urlgo">';
  1083. itemlist += '<div class="madiaHead useHead" id="userimg"></div>';
  1084. itemlist += '<div class="madiaInfo">';
  1085. itemlist += '<p><span class="h1Font" id="userName"></span><em class="authiconNew" title=""></em></p>';
  1086. itemlist += '<p class="ellipsisSty h2Font" id="usertitle"></p>';
  1087. itemlist += '</div></a></li>';
  1088. $itemlist = $(itemlist);
  1089. $("#likePro").append($itemlist);
  1090. if(data.data.title) {
  1091. if(data.data.orgName) {
  1092. $itemlist.find("#usertitle").text(data.data.title +","+ data.data.orgName);
  1093. }else{
  1094. $itemlist.find("#usertitle").text(data.data.title);
  1095. }
  1096. }else{
  1097. if(data.data.office) {
  1098. if(data.data.orgName) {
  1099. $itemlist.find("#usertitle").text(data.data.office +","+ data.data.orgName);
  1100. }else{
  1101. $itemlist.find("#usertitle").text(data.data.office);
  1102. }
  1103. }else{
  1104. if(data.data.orgName) {
  1105. $itemlist.find("#usertitle").text(data.data.orgName);
  1106. }
  1107. }
  1108. }
  1109. $itemlist.find("#userName").text(data.data.name);
  1110. $itemlist.find(".urlgo").attr("href", "userInforShow.html?professorId="+data.data.id);
  1111. if(data.data.hasHeadImage == 1) {
  1112. $itemlist.find("#userimg").attr("style", "background-image: url(/images/head/" + data.data.id + "_l.jpg);");
  1113. }
  1114. var userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
  1115. $itemlist.find(".authiconNew").attr("title", userType.title);
  1116. $itemlist.find(".authiconNew").addClass(userType.sty);
  1117. }
  1118. },
  1119. "error":function(){
  1120. $.MsgBox.Alert('提示','链接服务器超时')
  1121. }
  1122. });
  1123. }
  1124. //纠错反馈
  1125. $(".correctSubmit").on("click",function(){
  1126. var cntCon=$(this).siblings(".correctCon").val();
  1127. var cntUser="";
  1128. if(userid && userid != null && userid != "null") {
  1129. cntUser = userid;
  1130. }
  1131. if(cntCon.length>500){
  1132. $.MsgBox.Alert('提示', '纠错反馈内容不得超过500个字');
  1133. return;
  1134. }else{
  1135. $.ajax({
  1136. "url": "/ajax/feedback/error/professor",
  1137. "type": "POST",
  1138. "dataType": "json",
  1139. "async": true,
  1140. "data": {
  1141. "id": professorId,
  1142. "cnt":cntCon,
  1143. "user":cntUser
  1144. },
  1145. "success": function(data) {
  1146. if(data.success) {
  1147. backSuccessed();
  1148. }
  1149. },
  1150. "error": function() {
  1151. $.MsgBox.Alert('提示', '链接服务器超时')
  1152. }
  1153. });
  1154. }
  1155. })
  1156. })