portal html css js resource

userInforShow.js 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. $(function() {
  2. loginStatus();//判断个人是否登录
  3. var userid = $.cookie("userid");
  4. var professorId = GetQueryString("professorId");
  5. if(userid != professorId) {
  6. ifcollectionAbout(professorId, 1)
  7. $(".goSpan").show();
  8. }
  9. if(professorId) {
  10. getUserInfo(professorId);//获取个人详细信息
  11. historyEvaluate();//获取历史合作及评价
  12. getResource();//获取个人发布的资源
  13. getArticle();//获取个人发布的文章
  14. //点击咨询按钮
  15. $("#conbtn").on('click', function(){
  16. if(userid && userid != null && userid != 'null' && userid != undefined && userid != 'undefined') {
  17. ConsultApply();
  18. concultProInfo(professorId);
  19. //点击的发送
  20. $("#sendConsultBtn").click(function() {
  21. sendConsultHandler($(this).attr("proId"));
  22. });
  23. } else {
  24. $.MsgBox.Alert("提示", "请先登录再进行咨询");
  25. $("#mb_btn_ok").val("去登录");
  26. var aele = document.createElement('a');
  27. $("#mb_btnbox").append(aele);
  28. $("#mb_btnbox a").css({
  29. 'display': "block",
  30. 'width': '100%',
  31. 'height': '40px',
  32. 'position': 'absolute',
  33. 'bottom': '-6px',
  34. 'left': '0'
  35. });
  36. aele.setAttribute('href', '../login.html');
  37. }
  38. });
  39. //点击关注按钮
  40. $("#attentBtn").on('click', function() {
  41. if(userid && userid != null && userid != "null") {
  42. if($(this).is('.attenedSpan')){
  43. cancelCollectionAbout(professorId, 1)
  44. } else {
  45. collectionAbout(professorId, 1);
  46. }
  47. }else{
  48. $.MsgBox.Alert("提示", "请先登录再进行关注");
  49. $("#mb_btn_ok").val("去登录");
  50. var aele = document.createElement('a');
  51. $("#mb_btnbox").append(aele);
  52. $("#mb_btnbox a").css({
  53. 'display': "block",
  54. 'width': '100%',
  55. 'height': '40px',
  56. 'position': 'absolute',
  57. 'bottom': '-6px',
  58. 'left': '0'
  59. });
  60. aele.setAttribute('href', '../login.html');
  61. }
  62. });
  63. /*研究方向点赞*/
  64. var clFlag = 1;
  65. $("#researchAreaShow").on("click", ".plus", function() {
  66. if(userid && userid != null && userid != "null") {
  67. //点赞变化样式
  68. if(clFlag) {
  69. clFlag = 0;
  70. } else {
  71. return;
  72. }
  73. if($(this).data("isagree") > -1) {
  74. $(this).stop(true, true).animate({
  75. backgroundPositionY: 0
  76. }, 300); //变成未点赞样式
  77. } else {
  78. $(this).stop(true, true).animate({
  79. backgroundPositionY: -26
  80. }, 300); //变成点赞样式
  81. }
  82. $.ajax({
  83. "url": $(this).data("isagree") > -1 ? "/ajax/researchArea/unAgree" : "/ajax/researchArea/agree",
  84. "type": "POST",
  85. "data": {
  86. "targetId": $(this).data("pid"),
  87. "targetCaption": $(this).data("caption"),
  88. "opId": userid
  89. },
  90. "contentType": "application/x-www-form-urlencoded",
  91. "success": function($data) {
  92. if($data.success) {
  93. $.get("/ajax/professor/info/" + professorId, function($data) {
  94. if($data.success) {
  95. clFlag = 1;
  96. var $info = $data.data;
  97. if($info) {
  98. $("#researchAreaShow").empty("")
  99. if($info.researchAreas) {
  100. researchAreaShow($info.researchAreas, $info.editResearchAreaLogs);
  101. }
  102. }
  103. }
  104. })
  105. } else {
  106. $.MsgBox.Alert("提示", $data.msg);
  107. }
  108. }
  109. });
  110. } else {
  111. $.MsgBox.Alert("提示", "请登录后点赞");
  112. }
  113. })
  114. //点击每个研究方向弹出研究方向详情窗口
  115. $("#researchAreaShow").on("click", ".favorBox,.favorCount", function() {
  116. var cap = $(this).attr("caption");
  117. $.ajax({
  118. url: "/ajax/researchAreaLog/ql",
  119. dataType: 'json', //数据格式类型
  120. type: 'GET', //http请求类型
  121. timeout: 10000, //超时设置
  122. data: {
  123. "professorId": professorId,
  124. 'caption': cap,
  125. "rows": 10
  126. },
  127. success: function(data) {
  128. console.log(data)
  129. if(data.success) {
  130. $(".listitemdiv").html("");
  131. var $info = data.data;
  132. $("#subArea").text(cap);
  133. $(".resAreaCover").fadeIn();
  134. $(".resAreaCon").show()
  135. if($info.length == 0) {
  136. $(".resAreaCon").hide();
  137. return;
  138. }
  139. for(var i = 0; i < $info.length; i++) {
  140. if($info[i].professor.hasHeadImage == 1) {
  141. var imgbg = "/images/head/" + $info[i].professor.id + "_l.jpg";
  142. } else {
  143. var imgbg = "../images/default-photo.jpg";
  144. }
  145. //认证
  146. var oSty=autho($info[i].professor.authType,$info[i].professor.orgAuth,$info[i].professor.authStatus);
  147. var title = $info[i].professor.title || "";
  148. var orgName = $info[i].professor.orgName || "";
  149. var office = $info[i].professor.office || "";
  150. if(title != "") {
  151. var ttitle = title + ",";
  152. }else{
  153. if(office!=""){
  154. var ttitle = office + ",";
  155. }else{
  156. var ttitle = office;
  157. }
  158. }
  159. if(orgName != "") {
  160. orgName = orgName;
  161. }
  162. var addw ='<li class="flexCenter" data-id="'+$info[i].professor.id+'">'
  163. addw +='<a href="userInforShow.html?professorId='+ $info[i].professor.id +'" class="expertUrl linkhref">'
  164. addw +='<div class="lefthead userheadt userRadius" id="expertImg" style="background-image: url('+ imgbg +');"></div>'
  165. addw +='<div class="centercon" style="padding-right:0;">'
  166. addw +='<p class="h1font"><span class="nameSpan" id="Name">' + $info[i].professor.name + '</span><em class="authiconNew ' + oSty.sty + '" title="'+ oSty.title +'"></em></p>'
  167. addw +='<p class="h2font ellipsisSty">'+ ttitle + orgName + '</p>'
  168. addw +='</div></a></li>';
  169. $(".listitemdiv").append(addw);
  170. }
  171. $("body").css("position", "fixed");
  172. }
  173. },
  174. error: function() {}
  175. });
  176. });
  177. //关闭按钮
  178. $("#workclose").click(function() {
  179. $(".resAreaCover").fadeOut();
  180. $("body").css("position", "");
  181. });
  182. //
  183. // var itemCon = $("#item1user").find(".coninfobox");
  184. // console.log(itemCon.length)
  185. // console.log($("#item1user").find(".coninfobox"))
  186. // //var itemCon = $("#item1user").find(".coninfobox:hidden").style==none;//匹配所有不可见元素,或者type为hidden的元素
  187. // //var itemCon2 = $("#item1user").find(".coninfobox:visible");//匹配所有的可见元素
  188. //
  189. // var noneNum = 0;
  190. // for(i=0;i< itemCon.length;i++){//匹配所有不可见元素
  191. // if(itemCon[i].style.display=="none"){
  192. // noneNum++
  193. // }else{
  194. //
  195. // }
  196. //
  197. // }
  198. // console.log(noneNum)
  199. // if(noneNum == itemCon.length){
  200. // $("#item1user>.nodatabox").show();
  201. // $("#item1user>.nodatabox").find(".noContip").text("主人尚未录入基本资料")
  202. // }
  203. //// var allNone = $("#descpS").parents(".coninfobox")[0].style.display == 'none'
  204. //// && $("#subjectShow").parents(".coninfobox")[0].style.display == 'none'
  205. //// && $("#researchAreaShow").parents(".coninfobox")[0].style.display == 'none'
  206. //// && $("#industryShow").parents(".coninfobox")[0].style.display == 'none'
  207. //// && $("#showResource").parents(".coninfobox")[0].style.display == 'none'
  208. //// && $("#showArticle").parents(".coninfobox")[0].style.display == 'none'
  209. //// && $("#historyEvaluate").parents(".coninfobox")[0].style.display == 'none';
  210. //// console.log(allNone)
  211. //// if(allNone){
  212. //// $("#item1user>.nodatabox").show();
  213. //// $("#item1user>.nodatabox").find(".noContip").text("主人尚未完善详细资料")
  214. //// }
  215. ////
  216. //点击查看全部资源
  217. $(".coninfobox").on("click","#seeMoreR",function(){
  218. document.body.scrollTop = document.documentElement.scrollTop = 0;
  219. $(".navconBox ul>li").eq(1).addClass("liNow").siblings().removeClass("liNow");
  220. $("#item1user").hide();
  221. $("#item2user").show();
  222. })
  223. //点击查看全部文章
  224. $(".coninfobox").on("click","#seeMoreA",function(){
  225. document.body.scrollTop = document.documentElement.scrollTop = 0;
  226. $(".navconBox ul>li").eq(2).addClass("liNow").siblings().removeClass("liNow");
  227. $("#item1user").hide();
  228. $("#item3user").show();
  229. })
  230. //点击查看全部专利
  231. $(".coninfobox").on("click","#seeMoreP",function(){
  232. document.body.scrollTop = document.documentElement.scrollTop = 0;
  233. $(".navconBox ul>li").eq(3).addClass("liNow").siblings().removeClass("liNow");
  234. $("#item1user").hide();
  235. $("#item4user").show();
  236. })
  237. //点击查看全部论文
  238. $(".coninfobox").on("click","#seeMoreL",function(){
  239. document.body.scrollTop = document.documentElement.scrollTop = 0;
  240. $(".navconBox ul>li").eq(4).addClass("liNow").siblings().removeClass("liNow");
  241. $("#item1user").hide();
  242. $("#item5user").show();
  243. })
  244. }
  245. var subjectShow = function(data) {
  246. if(data != undefined && data.length != 0) {
  247. var subs = new Array();
  248. if(data.indexOf(',')) {
  249. subs = data.split(',');
  250. } else {
  251. subs[0] = data;
  252. }
  253. if(subs.length > 0) {
  254. for(var i = 0; i < subs.length; i++) {
  255. $("#subjectShow").append("<li>" + subs[i] + "</li>");
  256. };
  257. }
  258. }
  259. }
  260. var researchAreaShow = function($datas, $datarecords) {
  261. if($datas != undefined && $datas.length != 0) {
  262. var html = [];
  263. for(var i = 0; i < $datas.length; ++i) {
  264. var $data = $datas[i];
  265. var $photos = [];
  266. //获取头像
  267. if($datarecords.length > 0) {
  268. $photos = getRecords($datarecords, $data.caption);
  269. }
  270. var isAgree = -1;
  271. for(var j = 0; j < $photos.length; j++) {
  272. if(userid == $photos[j].id)
  273. isAgree++;
  274. }
  275. if(professorId != userid) {
  276. if(isAgree) {
  277. 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="'+ $data.caption + '" data-isagree="' + isAgree + '"></span><div class="favorCount" caption="'+ $data.caption +'">';
  278. } else {
  279. 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="'+ $data.caption + '" data-isagree="' + isAgree + '"></span><div class="favorCount" caption="'+ $data.caption +'">';
  280. }
  281. } else {
  282. var showDiv = '<li><div class="favorBox" caption="'+ $data.caption +'"><span class="like">'+ $data.count +'</span>'+ $data.caption +'</div><div class="favorCount" caption="'+ $data.caption +'">';
  283. }
  284. if($photos.length < 6) {
  285. for(var j = 0; j < $photos.length; ++j) {
  286. if($photos[j].img) {
  287. showDiv += '<span class="like-people" style="background-image: url(../images/head/'+ $photos[j].id +'_s.jpg);"></span>';
  288. } else {
  289. showDiv += '<span class="like-people" style="background-image: url(../images/default-photo.jpg);"></span>';
  290. }
  291. }
  292. } else {
  293. for(var j = $photos.length - 5; j < $photos.length; ++j) {
  294. if($photos[j].img) {
  295. showDiv +='<span class="like-people" style="background-image: url(../images/head/'+ $photos[j].id +'_s.jpg);"></span>';
  296. } else {
  297. showDiv += '<span class="like-people" style="background-image: url(../images/default-photo.jpg);"></span>';
  298. }
  299. }
  300. showDiv += '<span class="like-people like-more"></span>';
  301. }
  302. showDiv += "</div></li>";
  303. html.push(showDiv);
  304. }
  305. document.getElementById("researchAreaShow").innerHTML = html.join('');
  306. }
  307. }
  308. var industryShow = function(data) {
  309. if(data != undefined && data.length != 0) {
  310. var subs = new Array();
  311. if(data.indexOf(',')) {
  312. subs = data.split(',');
  313. } else {
  314. subs[0] = data;
  315. }
  316. if(subs.length > 0) {
  317. for(var i = 0; i < subs.length; i++) {
  318. $("#industryShow").append("<li><div class='h4tit'>" + subs[i] + "</div></li>");
  319. };
  320. }
  321. }
  322. }
  323. var projectShow = function(data) {
  324. if(data.length > 0) {
  325. for(var i = 0; i < data.length; i++) {
  326. if(!data[i].descp) {
  327. data[i].descp = "";
  328. }
  329. if(!data[i].startMonth) {
  330. data[i].startMonth = '';
  331. data[i].stopMonth = '';
  332. } else {
  333. data[i].startMonth = data[i].startMonth.substr(0, 4) + "年" + data[i].startMonth.substr(4, 6) + "月 - "
  334. if(!data[i].stopMonth) {
  335. data[i].stopMonth = '至今';
  336. } else {
  337. data[i].stopMonth = data[i].stopMonth.substr(0, 4) + "年" + data[i].stopMonth.substr(4, 6)+ "月"
  338. }
  339. }
  340. var projectHtml = '<li>';
  341. projectHtml += '<div class="h4Font h4tit">' + data[i].name + '<small class="h6Font">' + data[i].startMonth + '' + data[i].stopMonth + '</small></div>';
  342. projectHtml += '<div class="h5Font">' + data[i].descp + '</div>';
  343. projectHtml += '</li>';
  344. $("#projectShow").append(projectHtml);
  345. }
  346. }
  347. }
  348. var honorShow = function(data) {
  349. if(data.length > 0) {
  350. for(var i = 0; i < data.length; i++) {
  351. if(!data[i].year) {
  352. data[i].year = "";
  353. }
  354. if(!data[i].descp) {
  355. data[i].descp = "";
  356. }
  357. var honorHtml = '<li>';
  358. honorHtml += '<div class="h4Font h4tit">' + data[i].name + '<small class="h6Font">' + data[i].year + '年</small></div>';
  359. honorHtml += '<div class="h5Font">' + data[i].descp + '</div>';
  360. honorHtml += '</li>';
  361. $("#honorShow").append(honorHtml);
  362. }
  363. }
  364. }
  365. var timeJobShow = function(data) {
  366. if(data.length > 0) {
  367. for(var i = 0; i < data.length; i++) {
  368. var sDate = "";
  369. var eDate = "";
  370. if(data[i].department) {
  371. var dep = "-" + data[i].department;
  372. } else {
  373. var dep = ""
  374. }
  375. if(data[i].startMonth) {
  376. sDate = data[i].startMonth.substr(0, 4) + "年" + data[i].startMonth.substr(4, 6) + "月 - ";
  377. if(data[i].stopMonth) {
  378. eDate = data[i].stopMonth.substr(0, 4) + "年" + data[i].stopMonth.substr(4, 6) + "月";
  379. } else {
  380. eDate = "至今";
  381. }
  382. }
  383. var JobHtml = '<li>';
  384. JobHtml += '<div class="h4Font h4tit">' + data[i].company + '-' + data[i].title + '' + dep + '<small class="h6Font">' + sDate + '' + eDate + '</small></div>';
  385. JobHtml += '</li>';
  386. $("#timeJobShow").append(JobHtml);
  387. }
  388. }
  389. }
  390. var eduBgShow = function(data) {
  391. if(data.length > 0) {
  392. for(var i = 0; i < data.length; i++) {
  393. var showHtml = '<li><div class="h4Font h4tit">';
  394. if(data[i].college && data[i].major && data[i].degree) {
  395. showHtml += data[i].school + '-' + data[i].college + '-' + data[i].major + '-' + data[i].degree
  396. } else if(!data[i].college && data[i].major && data[i].degree) {
  397. showHtml += data[i].school + '-' + data[i].major + '-' + data[i].degree
  398. } else if(data[i].college && !data[i].major && data[i].degree) {
  399. showHtml += data[i].school + '-' + data[i].college + '-' + data[i].degree
  400. } else if(data[i].college && data[i].major && !data[i].degree) {
  401. showHtml += data[i].school + '-' + data[i].college + '-' + data[i].major
  402. } else if(!data[i].college && !data[i].major && data[i].degree) {
  403. showHtml += data[i].school + '-' + data[i].degree
  404. } else if(!data[i].college && data[i].major && !data[i].degree) {
  405. showHtml += data[i].school + '-' + data[i].major
  406. } else if(data[i].college && !data[i].major && !data[i].degree) {
  407. showHtml += data[i].school + '-' + data[i].college
  408. }
  409. if(typeof(data[i].year) !== "undefined") {
  410. showHtml += '<small class="h6Font">' + data[i].year + '年</small>';
  411. } else {
  412. showHtml += "";
  413. }
  414. showHtml += "</div></li>";
  415. $("#eduBgShow").append(showHtml);
  416. }
  417. }
  418. }
  419. //判断点赞的用户是否有头像
  420. function getRecords($researchAreaLogs, caption) {
  421. var ret = [];
  422. var t = 0;
  423. for(var i = 0; i < $researchAreaLogs.length; i++) {
  424. if(caption == $researchAreaLogs[i].caption) {
  425. ret[t] = {
  426. id: $researchAreaLogs[i].opreteProfessorId,
  427. img: $researchAreaLogs[i].hasHeadImage
  428. }
  429. t++;
  430. }
  431. }
  432. return ret;
  433. }
  434. //用户详细信息
  435. function getUserInfo(professorId){
  436. $.ajax({
  437. type:"get",
  438. url:"/ajax/professor/info/"+ professorId,
  439. async:true,
  440. success: function(data) {
  441. var $info = data.data;
  442. console.log($info )
  443. if(data.success) {
  444. if($info.hasHeadImage){
  445. $("#proHead").css("background-image","url(/images/head/"+ $info.id +"_l.jpg)");
  446. }
  447. $("#proName").text($info.name);
  448. var oStyS=autho($info.authType,$info.orgAuth,$info.authStatus);
  449. $("#proAuth").addClass(oStyS.sty); $("#proAuth").attr("title",oStyS.title);
  450. if($info.address){
  451. $("#proAddress").html($info.address + "<span style='margin-right:10px;'></span>");
  452. }
  453. var proOther="";
  454. if($info.orgName){
  455. if($info.department){
  456. if($info.office){
  457. proOther = $info.orgName + "," + $info.department + "," + $info.office
  458. }else{
  459. proOther = $info.orgName + "," + $info.department
  460. }
  461. }else{
  462. proOther = $info.orgName
  463. }
  464. }
  465. $("#proOther").text(proOther);
  466. var llqtitle=$info.name + "-" + proOther.replace(/,/gi,"-") + "-科袖网";//修改浏览器title信息
  467. if($info.title){
  468. $("#proTit").html($info.title + "<span style='margin-right:10px;'></span>");
  469. llqtitle = $info.name + "-" + $info.title + "-" + proOther.replace(/,/gi,"-") + "-科袖网";
  470. }
  471. document.title = llqtitle;
  472. //个人简介
  473. if($info.descp) {
  474. $("#descpS").text($info.descp);
  475. } else {
  476. $("#descpS").parents(".coninfobox").hide();
  477. }
  478. //学术领域
  479. if($info.subject) {
  480. subjectShow($info.subject);
  481. } else {
  482. $("#subjectShow").parents(".coninfobox").hide();
  483. }
  484. //研究方向
  485. if($info.researchAreas.length) {
  486. researchAreaShow($info.researchAreas, $info.editResearchAreaLogs);
  487. } else {
  488. $("#researchAreaShow").parents(".coninfobox").hide();
  489. }
  490. //行业领域
  491. if($info.industry) {
  492. industryShow($info.industry);
  493. } else {
  494. $("#industryShow").parents(".coninfobox").hide();
  495. }
  496. //教育背景
  497. if($info.edus.length) {
  498. eduBgShow($info.edus);
  499. } else {
  500. $("#eduBgShow").parents(".coninfobox").hide();
  501. }
  502. //兼职
  503. if($info.jobs.length) {
  504. timeJobShow($info.jobs);
  505. } else {
  506. $("#timeJobShow").parents(".coninfobox").hide();
  507. }
  508. //项目
  509. if($info.projects.length) {
  510. projectShow($info.projects)
  511. } else {
  512. $("#projectShow").parents(".coninfobox").hide();
  513. }
  514. //荣誉
  515. if($info.honors.length) {
  516. honorShow($info.honors);
  517. } else {
  518. $("#honorShow").parents(".coninfobox").hide();
  519. }
  520. if($info.honors.length == 0 && $info.projects.length == 0 && $info.jobs.length == 0 && $info.edus.length == 0){
  521. $("#item6user>.nodatabox").show();
  522. $("#item6user>.nodatabox").find(".noContip").text("主人尚未完善详细资料")
  523. }
  524. var weibotitle = $info.name;
  525. var weibourl = window.location.href;
  526. var weibopic ="http://"+window.location.host+"/images/head/"+ $info.id +"_l.jpg";
  527. $("#weibo").attr("href","http://service.weibo.com/share/share.php?appkey=3677230589&title="+weibotitle+"&url="+weibourl+"&pic="+weibopic+"&ralateUid=6242830109&searchPic=false&style=simple");
  528. }
  529. },
  530. error: function() {
  531. $.MsgBox.Alert('提示', '链接服务器超时')
  532. }
  533. });
  534. }
  535. //合作历史及评价
  536. function historyEvaluate(){
  537. var ass;
  538. $.ajax({
  539. "url": "/ajax/consult/pqAssessHis",
  540. "type": "get",
  541. "data": {
  542. "professorId": professorId
  543. },
  544. "async": false,
  545. "success": function(response) {
  546. if(response.success) {
  547. var $data = response.data.data;
  548. ass = $data.length;
  549. if($data.length == 0) {
  550. $("#historyEvaluate").parents(".coninfobox").hide();
  551. }
  552. for(var i = 0; i < $data.length; i++) {
  553. var assessTime = commenTime($data[i].assessTime);
  554. var assessContant ="";
  555. if($data[i].assessContant) {
  556. assessContant = $data[i].assessContant;
  557. }
  558. var userhed='';
  559. if($data[i].professor.hasHeadImage) {
  560. userhed = 'background-image:url(/images/head/' + $data[i].professor.id + '_l.jpg)';
  561. } else {
  562. userhed = 'background-image:url(/images/default-photo.jpg)';
  563. }
  564. var add = "";
  565. add += '<li class="flexCenter">';
  566. add += '<a href="userInforShow.html?professorId='+ $data[i].professor.id +'" class="userhref"><div class="madiaHead useHead useHeadMsg" style="'+ userhed +'"></div></a>'
  567. add += '<div class="madiaInfo"><div style="position: relative;">';
  568. add += '<a href="userInforShow.html?professorId='+ $data[i].professor.id +'" class="userhref"><span class="h1Font messageName">'+ $data[i].professor.name +'</span></a>';
  569. add += '<em class="authiconNew authicon-pro" title=" "></em><span class="commenttime">'+ assessTime +'</span>';
  570. add += '<ul class="starShow">';
  571. add += '<li></li> <li></li> <li></li> <li></li> <li></li>';
  572. add += '</ul></div>';
  573. add += '<p class="h2Font messageContent">'+ assessContant +'</p>';
  574. add += '</div></li>';
  575. var $add = $(add);
  576. $("#historyEvaluate").append($add);
  577. $add.find(".starShow>li:lt(" + $data[i].assessStar + ")").addClass('evastar');
  578. }
  579. }
  580. }
  581. })
  582. }
  583. //获取资源
  584. function getResource(){
  585. $.ajax({
  586. "url": "/ajax/resource/qaProPublish",
  587. "type": "get",
  588. "async": false,
  589. "data": {
  590. "professorId": professorId
  591. },
  592. "success": function(data) {
  593. console.log(data);
  594. if(data.success) {
  595. var madiaHead ='';
  596. if(data.data.length > 0){
  597. for(var i = 0; i < data.data.length; i++) {
  598. if(data.data[i].images.length) {
  599. madiaHead ='/data/resource/' + data.data[i].images[0].imageSrc ;
  600. }else{
  601. madiaHead ='/images/default-resource.jpg';
  602. }
  603. var strAdd = '';
  604. strAdd += '<li><a href="resourceShow.html?resourceId='+ data.data[i].resourceId +'" class="flexCenter urlgo">';
  605. strAdd += '<div class="madiaHead resouseHead" style="background-image:url('+ madiaHead +')"></div>';
  606. strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty-2">'+ data.data[i].resourceName +'</p><p class="h2Font ellipsisSty">应用用途:'+ data.data[i].supportedServices+'</p></div>';
  607. strAdd += '</a></li>';
  608. if(i==0){
  609. $("#showResource").append(strAdd);
  610. }
  611. $("#proResource").append(strAdd);
  612. }
  613. }else{
  614. $("#proResource + .nodatabox").show();
  615. $("#proResource + .nodatabox").find(".noContip").text("主人尚未发布任何资源");
  616. $("#showResource").parents(".coninfobox").hide();
  617. }
  618. }
  619. },
  620. "error": function() {
  621. $.MsgBox.Alert("提示", "服务器连接超时")
  622. }
  623. });
  624. }
  625. //获取文章
  626. function getArticle(){
  627. $.ajax({
  628. url: "/ajax/article/qaProPublish",
  629. dataType: 'json', //数据格式类型
  630. type: 'GET', //http请求类型
  631. data: {
  632. "professorId": professorId
  633. },
  634. timeout: 10000, //超时设置
  635. success: function(data) {
  636. if(data.success) {
  637. var madiaHead ='/images/default-artical.jpg';
  638. if(data.data.length > 0){
  639. for(var i = 0; i < data.data.length; i++) {
  640. if(data.data[i].articleImg) {
  641. madiaHead ='/data/article/' + data.data[i].articleImg ;
  642. }
  643. var strAdd = '';
  644. strAdd += '<li><a href="articalShow.html?articleId='+ data.data[i].articleId +'" class="flexCenter urlgo">';
  645. strAdd += '<div class="madiaHead artHead" style="background-image:url('+ madiaHead +')"></div>';
  646. strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty-2">'+ data.data[i].articleTitle +'</p>';
  647. strAdd += '<ul class="h2Font clearfix">';
  648. strAdd += '<li><span class="time">'+ commenTime(data.data[i].publishTime) +'</span></li>';
  649. strAdd += '<li><span id="pageViews">阅读量 '+ data.data[i].pageViews +'</span></li>';
  650. strAdd += '<li><span id="articleAgree">点赞 '+ data.data[i].articleAgree +'</span></li>';
  651. strAdd += '<li><span id="comment"></span></li>';
  652. strAdd += '</ul></div>';
  653. strAdd += '</a></li>';
  654. var $strAdd = $(strAdd);
  655. $("#proArticel").append( $strAdd);
  656. commentnum(data.data[i].articleId, $strAdd) //文章评论数
  657. if(i==0){
  658. $("#showArticle").append(strAdd);
  659. commentnum(data.data[0].articleId, $strAdd)
  660. }
  661. }
  662. }else{
  663. $("#proArticel + .nodatabox").show();
  664. $("#proArticel + .nodatabox").find(".noContip").text("主人尚未发布任何文章");
  665. $("#showArticle").parents(".coninfobox").hide();
  666. }
  667. }
  668. },
  669. error: function() {
  670. return;
  671. }
  672. });
  673. }
  674. //查文章评论数
  675. function commentnum(articleId, $itemlist) {
  676. $.ajax({
  677. "url": "/ajax/leaveWord/lwCount",
  678. "type": "GET",
  679. "dataType": "json",
  680. "async": false,
  681. "data": {
  682. "articleId": articleId
  683. },
  684. "success": function(data) {
  685. if(data.success) {
  686. $itemlist.find("#comment").text("评论 " + data.data);
  687. }
  688. },
  689. "error": function() {
  690. $.MsgBox.Alert('提示', '链接服务器超时')
  691. }
  692. });
  693. }
  694. })