portal html css js resource

userInforShow.js 38KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197
  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-2">'+ dataStr[i].resourceName +'</p><p class="h2Font ellipsisSty">应用用途:'+ 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").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. if(dataStr[i].pageViews!=0){
  727. if(dataStr[i].articleAgree!=0){
  728. sowU='<li><span>阅读量 '+dataStr[i].pageViews+'</span></li><li><span>赞 '+dataStr[i].articleAgree+'</span></li>'
  729. }else{
  730. sowU='<li><span>阅读量 '+dataStr[i].pageViews+'</span></li>'
  731. }
  732. }
  733. var strAdd = '';
  734. strAdd += '<li><a traget="_blank" href="articalShow.html?articleId='+ dataStr[i].articleId +'" class="flexCenter urlgo">';
  735. strAdd += '<div class="madiaHead artHead" style="background-image:url('+ madiaHead +')"></div>';
  736. strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty-2">'+ dataStr[i].articleTitle +'</p>';
  737. strAdd += '<ul class="h2Font clearfix">';
  738. strAdd += '<li><span class="time">'+ commenTime(dataStr[i].publishTime) +'</span></li>';
  739. strAdd += sowU
  740. strAdd += '<li><span class="comment"></span></li>';
  741. strAdd += '</ul></div>';
  742. strAdd += '</a></li>';
  743. var $strAdd = $(strAdd);
  744. $("#proArticel").append( $strAdd);
  745. commentnum(dataStr[i].articleId, $strAdd) //文章评论数
  746. if(isbind==true && i==0){
  747. var $strAddO = $(strAdd);
  748. $("#showArticle").html("");
  749. $("#showArticle").append($strAddO);
  750. commentnum(dataStr[0].articleId,$strAddO)
  751. }
  752. }
  753. //分页
  754. if(isbind==true){
  755. $("#proArticel").siblings(".tcdPageCode").createPage({
  756. pageCount: Math.ceil(data.data.total / 10),
  757. current: data.data.pageNo,
  758. backFn: function(p) {
  759. $("#proArticel").html("");
  760. getArticle(10, p,false);
  761. document.body.scrollTop = document.documentElement.scrollTop = 0;
  762. }
  763. });
  764. }
  765. }else{
  766. $("#proArticel + .nodatabox").show();
  767. $("#proArticel + .nodatabox").find(".noContip").text("用户尚未发布任何文章");
  768. }
  769. }
  770. },
  771. error: function() {
  772. return;
  773. }
  774. });
  775. }
  776. //获取专利
  777. function getPatent(pageSize, pageNo,isbind){
  778. $.ajax({
  779. url: "/ajax/ppatent/byProfessor",
  780. dataType: 'json', //数据格式类型
  781. type: 'GET', //http请求类型
  782. data: {
  783. "id": professorId,
  784. "pageSize": pageSize,
  785. "pageNo": pageNo
  786. },
  787. timeout: 10000, //超时设置
  788. success: function(data) {
  789. if(data.success) {
  790. var dataStr=data.data.data;
  791. if(dataStr.length > 0){
  792. $("#showPatent").parents(".coninfobox").removeClass("displayNone");
  793. $("#item1user>.nodatabox").addClass("displayNone");
  794. for(var i = 0; i < dataStr.length; i++) {
  795. if(!dataStr[i].reqPerson){
  796. dataStr[i].reqPerson="";
  797. }
  798. var strAdd = '';
  799. strAdd += '<li><a traget="_blank" href="patentShow.html?patentId='+ dataStr[i].id +'" class="flexCenter urlgo">';
  800. strAdd += '<div class="madiaHead patentHead"></div>';
  801. strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty">'+ dataStr[i].name +'</p>';
  802. strAdd += '<p class="h2Font ellipsisSty">发明人:'+ dataStr[i].authors.substring(0, dataStr[i].authors.length - 1) +'</p>';
  803. strAdd += '<p class="h2Font ellipsisSty">申请人:'+ dataStr[i].reqPerson +'</p>';
  804. strAdd += '</div>';
  805. strAdd += '</a></li>';
  806. var $strAdd = $(strAdd);
  807. $("#proPatent").append( $strAdd);
  808. if(isbind==true && i==0){
  809. var $strAddO=$(strAdd);
  810. $("#showPatent").html("");
  811. $("#showPatent").append($strAddO);
  812. }
  813. }
  814. //分页
  815. if(isbind==true){
  816. $("#proPatent").siblings(".tcdPageCode").createPage({
  817. pageCount: Math.ceil(data.data.total / 10),
  818. current: data.data.pageNo,
  819. backFn: function(p) {
  820. $("#proPatent").html("");
  821. getPatent(10, p,false);
  822. document.body.scrollTop = document.documentElement.scrollTop = 0;
  823. }
  824. });
  825. }
  826. }else{
  827. $("#proPatent + .nodatabox").show();
  828. $("#proPatent + .nodatabox").find(".noContip").text("用户尚未发布任何专利");
  829. }
  830. }
  831. },
  832. error: function() {
  833. return;
  834. }
  835. });
  836. }
  837. //获取论文
  838. function getPaper(pageSize, pageNo,isbind){
  839. $.ajax({
  840. url: "/ajax/ppaper/byProfessor",
  841. dataType: 'json', //数据格式类型
  842. type: 'GET', //http请求类型
  843. data: {
  844. "id": professorId,
  845. "pageSize": pageSize,
  846. "pageNo": pageNo
  847. },
  848. timeout: 10000, //超时设置
  849. success: function(data) {
  850. if(data.success) {
  851. var dataStr=data.data.data;
  852. if(dataStr.length > 0){
  853. $("#showPaper").parents(".coninfobox").removeClass("displayNone");
  854. $("#item1user>.nodatabox").addClass("displayNone");
  855. for(var i = 0; i < dataStr.length; i++) {
  856. var moreInf=""
  857. if(!dataStr[i].cn4periodical){
  858. dataStr[i].cn4periodical="";
  859. }
  860. if(!dataStr[i].en4periodical){
  861. dataStr[i].en4periodical="";
  862. }
  863. if(!dataStr[i].pubDay){
  864. dataStr[i].pubDay="";
  865. }
  866. moreInf = dataStr[i].cn4periodical+ " " +dataStr[i].en4periodical+ " " +dataStr[i].pubDay
  867. var strAdd = '';
  868. strAdd += '<li><a traget="_blank" href="paperShow.html?paperId='+ dataStr[i].id +'" class="flexCenter urlgo">';
  869. strAdd += '<div class="madiaHead paperHead"></div>';
  870. strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty">'+ dataStr[i].name +'</p>';
  871. strAdd += '<p class="h2Font ellipsisSty">作者:'+ dataStr[i].authors.substring(0, dataStr[i].authors.length - 1) +'</p>';
  872. strAdd += '<p class="h2Font ellipsisSty">期刊:'+ moreInf +'</p>';
  873. strAdd += '</div>';
  874. strAdd += '</a></li>';
  875. var $strAdd = $(strAdd);
  876. $("#proPaper").append( $strAdd);
  877. if(isbind==true && i==0){
  878. var $strAddO=$(strAdd);
  879. $("#showPaper").html();
  880. $("#showPaper").append($strAddO);
  881. }
  882. }
  883. //分页
  884. if(isbind==true){
  885. $("#proPaper").siblings(".tcdPageCode").createPage({
  886. pageCount: Math.ceil(data.data.total / 10),
  887. current: data.data.pageNo,
  888. backFn: function(p) {
  889. $("#proPaper").html("");
  890. getPaper(10, p,false);
  891. document.body.scrollTop = document.documentElement.scrollTop = 0;
  892. }
  893. });
  894. }
  895. }else{
  896. $("#proPaper + .nodatabox").show();
  897. $("#proPaper + .nodatabox").find(".noContip").text("用户尚未发布任何论文");
  898. }
  899. }
  900. },
  901. error: function() {
  902. return;
  903. }
  904. });
  905. }
  906. //查文章评论数
  907. function commentnum(articleId, $itemlist) {
  908. $.ajax({
  909. "url": "/ajax/leaveWord/lwCount",
  910. "type": "GET",
  911. "dataType": "json",
  912. "async": false,
  913. "data": {
  914. "articleId": articleId
  915. },
  916. "success": function(data) {
  917. if(data.success) {
  918. if(data.data>0){
  919. $itemlist.find(".comment").text("留言 " + data.data);
  920. }
  921. }
  922. },
  923. "error": function() {
  924. $.MsgBox.Alert('提示', '链接服务器超时')
  925. }
  926. });
  927. }
  928. //合作专家
  929. function relevantExperts(){
  930. $.ajax({
  931. "url": "/ajax/professor/coadjutant",
  932. "type": "get",
  933. "dataType" : "json",
  934. "data" :{"id":professorId},
  935. "success": function(data) {
  936. if(data.success && data.data) {
  937. console.log(data)
  938. for(var i = 0; i < data.data.length; i++) {
  939. var ExpId = data.data[i].professorId;
  940. var paperN=data.data[i].paperCount;
  941. var patentN=data.data[i].patentCount;
  942. var liItem=$('<li class="flexCenter"></li>').appendTo($("#relatePro"));
  943. relExpertsList(ExpId,paperN,patentN,liItem);
  944. }
  945. }
  946. },
  947. "error": function() {
  948. $.MsgBox.Alert('提示', '链接服务器超时')
  949. }
  950. });
  951. }
  952. //合作专家信息
  953. function relExpertsList(Id,numL,numZ,liItem){
  954. $.ajax({
  955. "url" : "/ajax/professor/info/"+Id,
  956. "type" : "GET" ,
  957. "dataType" : "json",
  958. "success" : function(data) {
  959. if (data.success && data.data!=""){
  960. $("#relatePro").parents(".conBlock").removeClass("displayNone");
  961. var itemlist = '<a traget="_blank" href="" class="urlgo">';
  962. itemlist += '<div class="madiaHead useHead" id="userimg"></div>';
  963. itemlist += '<div class="madiaInfo">';
  964. itemlist += '<p><span class="h1Font" id="userName"></span><em class="authiconNew" title=""></em></p>';
  965. itemlist += '<p class="ellipsisSty h2Font" id="usertitle"></p>';
  966. itemlist += '<p class="h2Font ellipsisSty" id="copNum"></p>';
  967. itemlist += '</div></a>';
  968. $(itemlist).appendTo(liItem);
  969. var $itemlist =liItem;
  970. if(numL){
  971. if(numZ){
  972. $itemlist.find("#copNum").text("合作:"+numZ+"项专利,"+numL+"篇论文")
  973. }else{
  974. $itemlist.find("#copNum").text("合作:"+numL+"篇论文")
  975. }
  976. }else{
  977. if(numZ){
  978. $itemlist.find("#copNum").text("合作:"+numZ+"项专利")
  979. }else{
  980. }
  981. }
  982. if(data.data.title) {
  983. if(data.data.orgName) {
  984. $itemlist.find("#usertitle").text(data.data.title +","+ data.data.orgName);
  985. }else{
  986. $itemlist.find("#usertitle").text(data.data.title);
  987. }
  988. }else{
  989. if(data.data.office) {
  990. if(data.data.orgName) {
  991. $itemlist.find("#usertitle").text(data.data.office +","+ data.data.orgName);
  992. }else{
  993. $itemlist.find("#usertitle").text(data.data.office);
  994. }
  995. }else{
  996. if(data.data.orgName) {
  997. $itemlist.find("#usertitle").text(data.data.orgName);
  998. }
  999. }
  1000. }
  1001. $itemlist.find("#userName").text(data.data.name);
  1002. $itemlist.find(".urlgo").attr("href", "userInforShow.html?professorId="+data.data.id);
  1003. if(data.data.hasHeadImage == 1) {
  1004. $itemlist.find("#userimg").attr("style", "background-image: url(/images/head/" + data.data.id + "_l.jpg);");
  1005. }
  1006. var userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
  1007. $itemlist.find(".authiconNew").attr("title", userType.title);
  1008. $itemlist.find(".authiconNew").addClass(userType.sty);
  1009. }
  1010. },
  1011. "error":function(){
  1012. $.MsgBox.Alert('提示','链接服务器超时')
  1013. }
  1014. });
  1015. }
  1016. //相关文章信息
  1017. function relevantarticalList(){
  1018. $.ajax({
  1019. "url" : "/ajax/article/byAssProfessor",
  1020. "type" : "GET" ,
  1021. "dataType" : "json",
  1022. "data" :{"id":professorId},
  1023. "traditional": true, //传数组必须加这个
  1024. "success" : function(data) {
  1025. console.log(data);
  1026. if (data.success && data.data!=""){
  1027. $("#relateArt").parents(".conBlock").removeClass("displayNone");
  1028. var itemlist = '';
  1029. $("#relateArt").html("");
  1030. for(var i = 0; i < data.data.length; i++) {
  1031. var itemlist = '<li class="flexCenter"><a traget="_blank" href="articalShow.html?articleId='+ data.data[i].articleId +'" class="urlgo">';
  1032. itemlist += '<p class="h2Font ellipsisSty-2"><em class="circlePre"></em>'+data.data[i].articleTitle+'</p>';
  1033. itemlist += '</a></li>';
  1034. $itemlist = $(itemlist);
  1035. $("#relateArt").append($itemlist);
  1036. }
  1037. }
  1038. },
  1039. "error":function(){
  1040. $.MsgBox.Alert('提示','链接服务器超时')
  1041. }
  1042. });
  1043. }
  1044. //感兴趣
  1045. function likeExperts(){
  1046. $.ajax({
  1047. "url": "/ajax/professor/ralateProfessors",
  1048. "type": "get",
  1049. "dataType" : "json",
  1050. "data" :{"professorId":professorId},
  1051. "success": function(data) {
  1052. if(data.success && data.data) {
  1053. console.log(data)
  1054. var lengthT;
  1055. if(data.data.length>5){
  1056. lengthT=5;
  1057. }else{
  1058. lengthT=data.data.length
  1059. }
  1060. for(var i = 0; i < lengthT; i++) {
  1061. var ExpId = data.data[i].id;
  1062. likeExpertsList(ExpId);
  1063. }
  1064. }
  1065. },
  1066. "error": function() {
  1067. $.MsgBox.Alert('提示', '链接服务器超时')
  1068. }
  1069. });
  1070. }
  1071. //感兴趣专家
  1072. function likeExpertsList(ExpId){
  1073. $.ajax({
  1074. "url" : "/ajax/professor/info/"+ExpId,
  1075. "type" : "GET" ,
  1076. "dataType" : "json",
  1077. "success" : function(data) {
  1078. if (data.success && data.data!=""){
  1079. console.log(data)
  1080. $("#likePro").parents(".conBlock").removeClass("displayNone");
  1081. var itemlist = '<li class="flexCenter"><a traget="_blank" href="" class="urlgo">';
  1082. itemlist += '<div class="madiaHead useHead" id="userimg"></div>';
  1083. itemlist += '<div class="madiaInfo">';
  1084. itemlist += '<p><span class="h1Font" id="userName"></span><em class="authiconNew" title=""></em></p>';
  1085. itemlist += '<p class="ellipsisSty h2Font" id="usertitle"></p>';
  1086. itemlist += '</div></a></li>';
  1087. $itemlist = $(itemlist);
  1088. $("#likePro").append($itemlist);
  1089. if(data.data.title) {
  1090. if(data.data.orgName) {
  1091. $itemlist.find("#usertitle").text(data.data.title +","+ data.data.orgName);
  1092. }else{
  1093. $itemlist.find("#usertitle").text(data.data.title);
  1094. }
  1095. }else{
  1096. if(data.data.office) {
  1097. if(data.data.orgName) {
  1098. $itemlist.find("#usertitle").text(data.data.office +","+ data.data.orgName);
  1099. }else{
  1100. $itemlist.find("#usertitle").text(data.data.office);
  1101. }
  1102. }else{
  1103. if(data.data.orgName) {
  1104. $itemlist.find("#usertitle").text(data.data.orgName);
  1105. }
  1106. }
  1107. }
  1108. $itemlist.find("#userName").text(data.data.name);
  1109. $itemlist.find(".urlgo").attr("href", "userInforShow.html?professorId="+data.data.id);
  1110. if(data.data.hasHeadImage == 1) {
  1111. $itemlist.find("#userimg").attr("style", "background-image: url(/images/head/" + data.data.id + "_l.jpg);");
  1112. }
  1113. var userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
  1114. $itemlist.find(".authiconNew").attr("title", userType.title);
  1115. $itemlist.find(".authiconNew").addClass(userType.sty);
  1116. }
  1117. },
  1118. "error":function(){
  1119. $.MsgBox.Alert('提示','链接服务器超时')
  1120. }
  1121. });
  1122. }
  1123. //纠错反馈
  1124. $(".correctSubmit").on("click",function(){
  1125. var cntCon=$(this).siblings(".correctCon").val();
  1126. var cntUser="";
  1127. if(userid && userid != null && userid != "null") {
  1128. cntUser = userid;
  1129. }
  1130. if(cntCon.length>500){
  1131. $.MsgBox.Alert('提示', '纠错反馈内容不得超过500个字');
  1132. return;
  1133. }else{
  1134. $.ajax({
  1135. "url": "/ajax/feedback/error/professor",
  1136. "type": "POST",
  1137. "dataType": "json",
  1138. "async": true,
  1139. "data": {
  1140. "id": professorId,
  1141. "cnt":cntCon,
  1142. "user":cntUser
  1143. },
  1144. "success": function(data) {
  1145. if(data.success) {
  1146. backSuccessed();
  1147. }
  1148. },
  1149. "error": function() {
  1150. $.MsgBox.Alert('提示', '链接服务器超时')
  1151. }
  1152. });
  1153. }
  1154. })
  1155. })