portal html css js resource

resourceShow.js 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. $(document).ready(function() {
  2. loginStatus(); //判断个人是否登录
  3. var userid = $.cookie("userid");
  4. var resourceId = GetQueryString("resourceId");
  5. if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){
  6. location.href="http://" + window.location.host + "/e/r.html?id="+resourceId;
  7. }
  8. $(".jqzoom").imagezoom();
  9. $("#thumblist").on("click", "li a", function() {
  10. $(this).parents("li").addClass("tb-selected").siblings().removeClass("tb-selected");
  11. $(".jqzoom").attr('src', $(this).find("img").attr("src"));
  12. $(".jqzoom").attr('rel', $(this).find("img").attr("src"));
  13. });
  14. $('.shareWeixin').hover(function() {
  15. $('.shareCode').stop(true, false).fadeToggle();
  16. });
  17. ifcollectionAbout(resourceId,$("#attention").find("em"), 2)
  18. pageViewLog(resourceId,2)
  19. var professorId = "";
  20. getRecourceMe();
  21. relatedArticles();
  22. relatedServices();
  23. interestingResources();
  24. //热门资源
  25. function recentlyRe(num,obj) {
  26. var ourl=num==1?"/ajax/resource/qaOrgPublish":"/ajax/resource/qaProPublish";
  27. $.ajax({
  28. "url" :ourl ,
  29. "type" : "GET" ,
  30. "dataType" : "json",
  31. "data" :obj,
  32. "success" : function(data) {
  33. if (data.success){
  34. var $data=data.data;
  35. var only=false;
  36. if($data.length>1){
  37. $(".recentlyList").parents(".currentBlock").removeClass("displayNone");
  38. var oLeng=$data.length<5?$data.length:5;
  39. for(var i=0;i<oLeng;i++) {
  40. if(resourceId==$data[i].resourceId) {
  41. only=true;
  42. continue;
  43. }
  44. if(only==true) {
  45. if(oLeng<5) {
  46. }else{
  47. oLeng=6;
  48. }
  49. }
  50. var resIM="../images/default-resource.jpg";
  51. if($data[i].images.length) {
  52. resIM='/data/resource/' + $data[i].images[0].imageSrc;
  53. }
  54. var str='<li><a class="flexCenter" style="min-height:46px;" href="resourceShow.html?resourceId='+$data[i].resourceId+'">'+
  55. '<div class="madiaHead resourceHead" style="width:50px;height:36px;margin-top:-18px;background-image: url('+ resIM +');"></div>'+
  56. '<div class="madiaInfo"><p class="h2Font ellipsisSty-2">'+$data[i].resourceName+'</p></div></a></li>'
  57. $(".recentlyList").append(str);
  58. }
  59. }
  60. }
  61. },
  62. "error":function(){
  63. $.MsgBox.Alert('提示','链接服务器超时')
  64. }
  65. });
  66. }
  67. /*获取资源信息*/
  68. function getRecourceMe() {
  69. $.ajax({
  70. "url": "/ajax/resource/queryOne",
  71. "type": "GET",
  72. "success": function(data) {
  73. console.log(data);
  74. if(data.success) {
  75. resourceHtml(data.data);
  76. var resourceName = data.data.resourceName + "-科袖网";
  77. window.setTimeout(function() {
  78. document.title = resourceName;
  79. }, 500);
  80. }
  81. },
  82. "data": {
  83. "resourceId": resourceId
  84. },
  85. dataType: "json",
  86. 'error': function() {
  87. $.MsgBox.Alert('提示', '服务器连接超时!');
  88. }
  89. });
  90. }
  91. /*合作备注及性能参数存储换行格式*/
  92. function outHTML(selecter) {
  93. var getValue = selecter;
  94. var aa = "";
  95. if(getValue) {
  96. var endValue = ((getValue.replace(/<(.+?)>/gi, "&lt;$1&gt;")).replace(/ /gi, "&nbsp;")).replace(/\n/gi, "|");
  97. var cc = endValue.split("|");
  98. for(var i = 0; i < cc.length; i++) {
  99. aa += cc[i] + '<br/>'
  100. }
  101. }
  102. return aa;
  103. }
  104. /*处理资源html代码*/
  105. function resourceHtml($da) {
  106. $("#resourceName").text($da.resourceName); //名字
  107. $("#application").text($da.supportedServices); //应用用途
  108. if($da.editProfessor) {
  109. $("#person").show();
  110. if($da.orgName) { //所属机构
  111. $("#organizationName").text($da.orgName).parents("li").show();
  112. }
  113. $("#nameS").text($da.editProfessor.name);
  114. if($da.editProfessor.title) {
  115. $("#titleOffice").text($da.editProfessor.title);
  116. } else {
  117. if($da.editProfessor.office) {
  118. $("#titleOffice").text($da.editProfessor.office);
  119. }
  120. }
  121. if($da.editProfessor.orgName) {
  122. $("#orgType").text($da.editProfessor.orgName);
  123. }
  124. professorId = $da.editProfessor.id;
  125. console.log(professorId);
  126. console.log(userid);
  127. if(userid != professorId) {
  128. ifcollectionAbout(professorId,$("#person").find(".attenSpan"), 1)
  129. $(".goSpan").show();
  130. }
  131. var professorFlag = autho($da.editProfessor.authType, $da.editProfessor.orgAuth, $da.editProfessor.authStatus);
  132. $("#authFlag").addClass(professorFlag.sty).attr("title", professorFlag.title);
  133. if($da.editProfessor.hasHeadImage == 1) {
  134. $("#headImg").css("background-image", 'url(/images/head/' + $da.editProfessor.id + '_l.jpg)');
  135. }else{
  136. $("#headImg").css("background-image", 'url(../images/default-photo.jpg)');
  137. }
  138. recentlyRe(2,{"professorId":professorId})
  139. }else{
  140. $("#enterprise").show();
  141. $(".qiyego").attr('dataid',$da.organization.id);
  142. $(".qiyego").attr("href","cmpInforShow.html?orgId="+$da.organization.id);
  143. if($da.organization.hasOrgLogo) {
  144. $("#companyImg").attr("src", "/images/org/" + $da.organization.id + ".jpg");
  145. }else{
  146. $("#companyImg").attr("src", "/images/default-icon.jpg");
  147. }
  148. if($da.organization.authStatus==3){
  149. $("#QauthFlag").addClass("authicon-com-ok").attr("title", "认证企业");
  150. }
  151. if($da.organization.forShort) {
  152. $("#Qname").text($da.organization.forShort).attr("href","cmpInforShow.html?orgId="+$da.organization.id);
  153. }else{
  154. $("#Qname").text($da.organization.name).attr("href","cmpInforShow.html?orgId="+$da.organization.id);
  155. }
  156. if($da.organization.industry) {
  157. $("#Qindustry").text($da.organization.industry.replace(/,/gi, " | "));
  158. }
  159. if(userid){
  160. ifcollectionAbout($da.organization.id,$("#enterprise").find(".attenSpan"), 6)
  161. }
  162. recentlyRe(1,{"orgId":$da.organization.id})
  163. }
  164. if($da.spec) { //厂商型号
  165. $("#modelNumber").text($da.spec).parents("li").show();
  166. }
  167. if($da.parameter) { //性能参数
  168. $("#performancePa").html(outHTML($da.parameter)).parents("li").show();
  169. }
  170. if($da.cooperationNotes) { //合作备注
  171. $("#remarkContent").html(outHTML($da.cooperationNotes)).parents("li").show();
  172. }
  173. if($da.pageViews>0){
  174. $("#pageView").html($da.pageViews)
  175. }
  176. if($da.subject) {
  177. var oSub = $da.subject.split(",");
  178. var oSt = "";
  179. for(var i = 0; i < oSub.length; i++) {
  180. oSt += '<li><p class="h2Font">' + oSub[i] + '</p></li>'
  181. }
  182. $(".tagList").html(oSt);
  183. }
  184. if($da.descp) { //编辑器
  185. $("#descp").html($da.descp).parents("li").show();
  186. }
  187. var weibotitle = $da.resourceName;
  188. var weibourl = window.location.href;
  189. //return;
  190. if($da.images.length) {
  191. var weibopic = "http://" + window.location.host + "/data/resource/" + $da.images[0].imageSrc;
  192. $("#firstFigure").attr({
  193. "src": "/data/resource/" + $da.images[0].imageSrc,
  194. "rel": "/data/resource/" + $da.images[0].imageSrc
  195. }).parent().attr("href", "/data/resource/" + $da.images[0].imageSrc);
  196. var arr = "";
  197. for(var i = 0; i < $da.images.length; i++) {
  198. if($da.images[i] == $da.images[0]) {
  199. var oString = '<li class="tb-selected">' +
  200. '<div class="tb-pic tb-s66">' +
  201. '<a href="javascript:void(0);">' +
  202. '<img src="/data/resource/' + $da.images[i].imageSrc + '"/>' +
  203. '</a>' +
  204. '</div>' +
  205. '</li>'
  206. } else {
  207. var oString = '<li >' +
  208. '<div class="tb-pic tb-s66">' +
  209. '<a href="javascript:void(0);">' +
  210. '<img src="/data/resource/' + $da.images[i].imageSrc + '"/>' +
  211. '</a>' +
  212. '</div>' +
  213. '</li>'
  214. }
  215. arr += oString;
  216. }
  217. $("#thumblist").html(arr);
  218. } else {
  219. var weibopic = "http://" + window.location.host + "../images/default-resource.jpg";
  220. $("#firstFigure").attr({
  221. "src": '../images/default-resource.jpg',
  222. "rel": '../images/default-resource.jpg'
  223. });
  224. }
  225. $("#weibo").attr("href","http://service.weibo.com/share/share.php?appkey=3677230589&title="+encodeURIComponent(weibotitle)+"&url="+encodeURIComponent(weibourl)+"&pic="+encodeURIComponent(weibopic)+"&content=utf-8"+"&ralateUid=6242830109&searchPic=false&style=simple");
  226. }
  227. /*点击名字及头像跳转个人浏览页面*/
  228. $("#nameS,#headImg").click(function() {
  229. location.href = "userInforShow.html?professorId=" + professorId;
  230. })
  231. //关键词标签点击进去搜索
  232. $(".tagList").on("click","li",function(){
  233. var tagText = $(this).find("p").text();
  234. location.href = "searchNew.html?searchContent=" + tagText + "&tagflag=2";
  235. })
  236. /*资源里面相关文章*/
  237. function relatedArticles() {
  238. $.ajax({
  239. "url": "/ajax/article/byAssResource",
  240. "type": "GET",
  241. "data": {
  242. "id": resourceId,
  243. },
  244. dataType: "json",
  245. "success": function(data) {
  246. console.log(data);
  247. if(data.success) {
  248. if(data.data.length> 0) {
  249. $("#oArticle").parents(".otherShow").removeClass("displayNone");
  250. var StrData = data.data
  251. var lengthT;
  252. if(StrData.length>5){
  253. lengthT=5;
  254. }else{
  255. lengthT=StrData.length
  256. }
  257. for(var i = 0; i < lengthT; i++) {
  258. relatedArticlesHtml(StrData[i]);
  259. }
  260. }
  261. }
  262. },
  263. 'error': function() {
  264. $.MsgBox.Alert('提示', '服务器连接超时!');
  265. }
  266. });
  267. }
  268. /*资源相关文章html*/
  269. function relatedArticlesHtml($html) {
  270. var oURL;
  271. if($html.articleType==1) {
  272. oURL="/ajax/professor/baseInfo/" + $html.ownerId;
  273. }else if($html.articleType==2) {
  274. oURL="/ajax/org/" + $html.ownerId;
  275. }else if($html.articleType==2) {
  276. oURL="/ajax/platform/info";
  277. }
  278. $.ajax({
  279. "url":oURL,
  280. "data":{id:$html.ownerId},
  281. "type": "GET",
  282. "success": function(data) {
  283. if(data.success) {
  284. var cmpname="";
  285. if(data.data.forShort){
  286. cmpname=data.data.forShort;
  287. }else{
  288. cmpname=data.data.name;
  289. }
  290. if($html.articleType==1) {
  291. var stl = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
  292. }else if($html.articleType==2){
  293. var stl={};
  294. stl.sty="";
  295. stl.title="";
  296. if(data.data.authStatus==3) {
  297. stl.sty="authicon-com-ok";
  298. stl.title="认证企业";
  299. }
  300. }else if($html.articleType==3){
  301. var stl={};
  302. stl.sty="";
  303. stl.title="";
  304. }
  305. var sowU=''
  306. if($html.pageViews!=0){
  307. if($html.articleAgree!=0){
  308. sowU='<span>阅读量 '+$html.pageViews+'</span><span>赞 '+$html.articleAgree+'</span>'
  309. }else{
  310. sowU='<span>阅读量 '+$html.pageViews+'</span>'
  311. }
  312. }
  313. var str = ""
  314. str += '<li data-id="' + $html.articleId + '" data-createTime="' + $html.createTime + '" data-shareId="' + $html.shareId + '"><a class="flexCenter OflexCenter">'
  315. if($html.articleImg) {
  316. str += '<div class="madiaHead artHead" style="background-image: url(/data/article/' + $html.articleImg + ')"></div>'
  317. } else {
  318. str += '<div class="madiaHead artHead"></div>'
  319. }
  320. str += '<div class="madiaInfo OmadiaInfo">'
  321. str += '<p class="h1Font ellipsisSty-2">' + $html.articleTitle + '</p>'
  322. str += '<div class="h2Font showInfo"><span>'+ cmpname +'</span><span>'+commenTime($html.publishTime)+'</span>'+sowU+'<span class="leaveMsgCount"></span></div>'
  323. str += '</div></a></li>'
  324. var $itemlist =$(str);
  325. $("#oArticle").append(str);
  326. leaveMsgCount($html.articleId,1,$itemlist);
  327. }
  328. },
  329. 'dataType': "json",
  330. 'error': function() {
  331. $.MsgBox.Alert('提示', '服务器连接超时!');
  332. }
  333. });
  334. }
  335. /*文章跳转*/
  336. $("#oArticle").on("click", "li", function() {
  337. var oArticle={
  338. shareId:$(this).attr("data-shareId"),
  339. createTime:$(this).attr("data-createTime")
  340. };
  341. location.href = "/"+pageUrl('a',oArticle)
  342. })
  343. /*服务跳转*/
  344. $("#oService").on("click", "li", function() {
  345. location.href = "sevriceShow.html?sevriceId=" + $(this).attr("data-id");
  346. })
  347. /*资源里面相关服务*/
  348. function relatedServices() {
  349. $.ajax({
  350. "url": "/ajax/ware/byResourceWithModifyTime",
  351. "type": "GET",
  352. "data": {
  353. "id": resourceId,
  354. "rows":5
  355. },
  356. dataType: "json",
  357. "success": function(data) {
  358. console.log(data);
  359. if(data.success) {
  360. if(data.data.length> 0) {
  361. $("#oService").parents(".otherShow").removeClass("displayNone");
  362. var StrData = data.data
  363. var lengthT;
  364. if(StrData.length>5){
  365. lengthT=5;
  366. }else{
  367. lengthT=StrData.length
  368. }
  369. for(var i = 0; i < lengthT; i++) {
  370. var $html=StrData[i]
  371. var cnt="", img="../images/default-service.jpg"
  372. if($html.images) {
  373. var subs = strToAry($html.images)
  374. if(subs.length > 0) {
  375. img="/data/ware" + subs[0]
  376. }
  377. }
  378. if($html.cnt){
  379. cnt="内容:"+$html.cnt
  380. }
  381. var itemlist = '<li data-id="'+$html.id+'">'
  382. itemlist += '<a class="flexCenter OflexCenter"><div class="madiaHead resourceHead" style="background-image:url('+img+')"></div>';
  383. itemlist += '<div class="madiaInfo OmadiaInfo">';
  384. itemlist += '<p class="ellipsisSty h1Font" id="usertitle">'+$html.name+'</p>';
  385. itemlist += '<p><span class="h2Font ownerName"></span><em class="ownerSty authiconNew"></em></p>';
  386. itemlist += '<p class="ellipsisSty-2 h2Font">'+cnt+'</p>';
  387. itemlist += '</div></a></li>';
  388. var $itemlist = $(itemlist);
  389. $("#oService").append($itemlist)
  390. if($html.category=="1"){
  391. (function(mo){
  392. cacheModel.getProfessor($html.owner,function(sc,value){
  393. if(sc){
  394. mo.find(".ownerName").html(value.name)
  395. var userType = autho(value.authType, value.orgAuth, value.authStatus);
  396. mo.find(".ownerSty").addClass(userType.sty).attr("title",userType.title)
  397. }else{
  398. console.log("error")
  399. }
  400. })
  401. })($itemlist);
  402. }else if($html.category=="2"){
  403. (function(mo){
  404. cacheModel.getCompany($html.owner,function(sc,value){
  405. if(sc){
  406. if(value.forShort){
  407. mo.find(".ownerName").html(value.forShort)
  408. }else{
  409. mo.find(".ownerName").html(value.name)
  410. }
  411. if(value.authStatus==3) {
  412. mo.find(".ownerSty").addClass("authicon-com-ok").attr("title","科袖认证企业")
  413. }
  414. }else{
  415. console.log("error")
  416. }
  417. })
  418. })($itemlist);
  419. }
  420. }
  421. }
  422. }
  423. }
  424. });
  425. }
  426. /*感兴趣的资源*/
  427. function interestingResources() {
  428. $.ajax({
  429. "url": "/ajax/resource/ralateResources",
  430. "type": "GET",
  431. "data":{"resourceId": resourceId},
  432. "traditional": true,
  433. dataType: "json",
  434. "success": function(data) {
  435. //console.log(data);
  436. if(data.success) {
  437. if(data.data.length == 0) {
  438. return;
  439. }
  440. $("#relateArt").parents(".otherShow").removeClass("displayNone");
  441. var StrData = data.data
  442. var lengthT;
  443. if(StrData.length>5){
  444. lengthT=5;
  445. }else{
  446. lengthT=StrData.length
  447. }
  448. for(var i = 0; i < lengthT; i++) {
  449. interestingResourcesHtml(StrData[i]);
  450. }
  451. }
  452. },
  453. 'error': function() {
  454. $.MsgBox.Alert('提示', '服务器连接超时!');
  455. }
  456. });
  457. }
  458. /*感兴趣资源的html*/
  459. function interestingResourcesHtml($respond) {
  460. var imgL="../images/default-resource.jpg";
  461. if($respond.images.length){
  462. imgL='/data/resource/' + $respond.images[0].imageSrc
  463. }
  464. var oURL;
  465. if($respond.resourceType==1) {
  466. oURL="/ajax/professor/baseInfo/"+$respond.professorId;
  467. }else{
  468. oURL="/ajax/org/" + $respond.orgId;
  469. }
  470. $.ajax({
  471. "url":oURL,
  472. "type": "GET",
  473. 'dataType': "json",
  474. "success": function(data) {
  475. if(data.success){
  476. //console.log(data)
  477. var thisName,userType,thisAuth,thisTitle
  478. if(data.data.forShort){
  479. thisName=data.data.forShort;
  480. }else{
  481. thisName=data.data.name;
  482. }
  483. if($respond.resourceType==1) {
  484. userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
  485. thisTitle = userType.title;
  486. thisAuth = userType.sty;
  487. }else {
  488. if(data.data.authStatus==3) {
  489. thisTitle = "科袖认证企业";
  490. thisAuth = "authicon-com-ok";
  491. }
  492. }
  493. var add = document.createElement("li");
  494. add.className = "mui-table-view-cell";
  495. add.setAttribute("data-id",$respond.resourceId);
  496. var itemlist = '<a class="flexCenter OflexCenter"><div class="madiaHead resourceHead" style="background-image:url('+imgL+')"></div>';
  497. itemlist += '<div class="madiaInfo OmadiaInfo">';
  498. itemlist += '<p class="ellipsisSty h1Font" id="usertitle">'+$respond.resourceName+'</p>';
  499. itemlist += '<p><span class="h2Font">'+thisName+'</span><em class="authiconNew '+thisAuth+'" title="'+thisTitle+'"></em></p>';
  500. itemlist += '<p class="ellipsisSty-2 h2Font">用途:'+$respond.supportedServices+'</p>';
  501. itemlist += '</div></a>';
  502. add.innerHTML=itemlist;
  503. document.getElementById("relateArt").appendChild(add);
  504. }
  505. },
  506. 'error': function() {
  507. $.MsgBox.Alert('提示', '服务器连接超时!');
  508. }
  509. });
  510. }
  511. /*点击资源列表*/
  512. $("#relateArt").on("click", "li", function() {
  513. location.href = "resourceShow.html?resourceId=" + $(this).attr("data-id");
  514. })
  515. /*点击咨询*/
  516. $("#consultin").on('click', function(){
  517. if(userid && userid != null && userid != 'null' && userid != undefined && userid != 'undefined') {
  518. location.href="tidings.html?id="+professorId
  519. } else {
  520. quickLog();
  521. operatTab();
  522. closeLog();
  523. }
  524. });
  525. $("#expertli").on("click",".addbtn",function(event) {
  526. if(userid && userid != null && userid != 'null' && userid != undefined && userid != 'undefined') {
  527. var id=$(this).attr("data-id");
  528. location.href="tidings.html?id="+id;
  529. } else {
  530. quickLog();
  531. operatTab();
  532. closeLog();
  533. }
  534. event.stopPropagation()
  535. });
  536. $("#expertli").on("click",'li',".addbtn",function() {
  537. var id=$(this).attr("data-id");
  538. location.href="userInforShow.html?professorId="+id;
  539. });
  540. //点击专家关注
  541. $("#person").on("click",'.attenSpan',function() {
  542. if(userid && userid != "null" && userid != null) {
  543. if($(this).is('.attenedSpan')){
  544. cancelCollectionAbout(professorId,$(this), 1)
  545. } else {
  546. collectionAbout(professorId,$(this),1);
  547. }
  548. } else {
  549. quickLog();
  550. operatTab();
  551. closeLog();
  552. }
  553. })
  554. $("#enterprise").on("click",'.attenSpan',function() {
  555. if(userid && userid != "null" && userid != null) {
  556. if($(this).is('.attenedSpan')){
  557. cancelCollectionAbout($(".qiyego").attr('dataid'),$(this), 6)
  558. } else {
  559. collectionAbout($(".qiyego").attr('dataid'),$(this),6);
  560. }
  561. } else {
  562. quickLog();
  563. operatTab();
  564. closeLog();
  565. }
  566. })
  567. //点击资源收藏
  568. $('#attention em').click(function() {
  569. if (userid && userid != "null" && userid != null) {
  570. if($(this).is('.icon-collected')){
  571. cancelCollectionAbout(resourceId,$(this),2)
  572. }else{
  573. collectionAbout(resourceId,$(this),2)
  574. }
  575. } else {
  576. quickLog();
  577. operatTab();
  578. closeLog();
  579. }
  580. })
  581. selUse();
  582. function selUse() {
  583. $.ajax({
  584. url: "/ajax/resource/qaLinkman",
  585. type: "GET",
  586. timeout: 10000,
  587. dataType: "json",
  588. async: true,
  589. data: {
  590. "resourceId": resourceId,
  591. },
  592. success: function(data, textState) {
  593. console.log(data)
  594. if(data.success) {
  595. if(data.data.length>0){
  596. $("#expertli").parents(".currentBlock").removeClass("displayNone");
  597. unauthUser(data.data);
  598. }else{
  599. $("#expertli").parents(".currentBlock").addClass("displayNone");
  600. }
  601. }
  602. },
  603. error: function(XMLHttpRequest, textStats, errorThrown) {
  604. $.MsgBox.Alert('提示', '服务器请求失败')
  605. }
  606. })
  607. }
  608. function unauthUser($res) {
  609. var osting = ""
  610. for(var i = 0; i < $res.length; i++) {
  611. var img;
  612. var styC = "";
  613. var oClass = autho($res[i].professor.authType, $res[i].professor.orgAuth, $res[i].professor.authStatus);
  614. var oTitle = "";
  615. if($res[i].professor.title) {
  616. oTitle = $res[i].professor.title;
  617. } else {
  618. if($res[i].professor.office) {
  619. oTitle = $res[i].professor.office;
  620. }
  621. }
  622. if($res[i].professor.hasHeadImage) {
  623. img = "/images/head/" + $res[i].professor.id + "_l.jpg";
  624. } else {
  625. img = "../images/default-photo.jpg"
  626. }
  627. var oSt = '<li class="flexCenter" data-id="' + $res[i].professor.id + '">'
  628. oSt += '<div class="madiaHead useHead" id="userimg" style="background-image: url(' + img + ');"></div>'
  629. oSt += '<div class = "madiaInfo">'
  630. oSt += '<p class = "ellipsisSty">'
  631. oSt += '<span class = "h1Font" id="name">' + $res[i].professor.name + '</span><em class="authiconNew ' + oClass.sty + '" title="' + oClass.title + '"></em >'
  632. oSt += '</p>'
  633. oSt += '<p class="h2Font ellipsisSty">' + oTitle + '</p>'
  634. oSt += '</div>'
  635. oSt += '<span class="addbtn" data-id="' + $res[i].professor.id + '">联系</span>'
  636. oSt += '</li>'
  637. osting += oSt;
  638. }
  639. $("#expertli").html(osting);
  640. }
  641. //纠错反馈
  642. $(".correctSubmit").on("click",function(){
  643. var cntCon=$(this).siblings(".correctCon").val();
  644. var cntUser="";
  645. if(userid && userid != null && userid != "null") {
  646. cntUser = userid;
  647. }
  648. if(cntCon.length>500){
  649. $.MsgBox.Alert('提示', '纠错反馈内容不得超过500个字');
  650. return;
  651. }else{
  652. $.ajax({
  653. "url": "/ajax/feedback/error/resource",
  654. "type": "POST",
  655. "dataType": "json",
  656. "async": true,
  657. "data": {
  658. "id": resourceId,
  659. "cnt":cntCon,
  660. "user":cntUser
  661. },
  662. "success": function(data) {
  663. if(data.success) {
  664. backSuccessed();
  665. }
  666. },
  667. "error": function() {
  668. $.MsgBox.Alert('提示', '链接服务器超时')
  669. }
  670. });
  671. }
  672. })
  673. })