portal html css js resource

paperShow1.js 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. $(document).ready(function() {
  2. loginYesOrNo()
  3. var userid = $.cookie("userid");
  4. var userName = $.cookie("userName");
  5. var paperId = window.staticPageData.id;
  6. var hurl = window.location.host;
  7. $(".commentList").parent().append('<button class="js-load-more displayNone"></button>')
  8. module.lWord(paperId,2,1);
  9. if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){
  10. location.href="http://" + window.location.host + "/e/l.html?id="+paperId;
  11. }
  12. //分享关注按钮
  13. $('.shareWeixin').hover(function(){$(this).find('.shareCode').stop(true,false).fadeToggle();});
  14. $('.goSpan').hover(function(){$(this).find('.shareCode').stop(true,false).fadeToggle();});
  15. //微信分享
  16. var qrcode = new QRCode(document.getElementById("qrcode"), {
  17. width : 100,
  18. height : 100
  19. });
  20. function makeCode(){
  21. var elurl = "http://" + hurl + "/e/l.html?id=" + paperId ;
  22. qrcode.makeCode(elurl);
  23. }
  24. makeCode();
  25. ifcollectionAbout(paperId,$("#collectBtn"), 5)
  26. getPaperMe();
  27. pageViewLog(paperId,5)
  28. if(userid && userid != "null" && userid != null){
  29. $(".ifLoginOn").removeClass("displayNone");
  30. }else{
  31. $(".ifLoginUn").removeClass("displayNone");
  32. $(".ifLoginUn").on('click',".loginGo", function() {
  33. quickLog();
  34. operatTab();
  35. closeLog();
  36. })
  37. }
  38. //点击收藏按钮
  39. $("#collectBtn").on('click', function() {
  40. if(userid && userid != null && userid != "null") {
  41. if($(this).is('.icon-collected')){
  42. cancelCollectionAbout(paperId,$(this), 5)
  43. } else {
  44. collectionAbout(paperId,$(this), 5);
  45. }
  46. }else{
  47. quickLog();
  48. operatTab();
  49. closeLog();
  50. }
  51. });
  52. //关键词标签点击进去搜索
  53. $(".tagList").on("click","li",function(){
  54. var tagText = $(this).find("p").text();
  55. location.href = "/searchNew.html?searchContent=" + tagText + "&tagflag=6";
  56. })
  57. //点击进入个人详情页面
  58. $("#aboutAuthors").on("click","li>a",function(){
  59. var oDataId = $(this).attr("data-id");
  60. if(oDataId.substring(0,1)!="#"){
  61. $(this).attr("href","/userInforShow.html?professorId="+oDataId);
  62. }else{
  63. $(this).attr("href","javascript:void(0)");
  64. }
  65. })
  66. $("#aboutAuthors").on("click","li.lastBtn",function(){
  67. $("#aboutAuthors li").css("display","block");
  68. $(this).hide();
  69. })
  70. //点击关注按钮
  71. $("#aboutAuthors").on('click',"span.attenSpan", function() {
  72. var pId=$(this).parent().siblings("a").attr("data-id");
  73. if(userid && userid != null && userid != "null") {
  74. if($(this).is('.attenedSpan')){
  75. cancelCollectionAbout(pId,$(this),1)
  76. } else {
  77. collectionAbout(pId,$(this),1);
  78. }
  79. }else{
  80. quickLog();
  81. operatTab();
  82. closeLog();
  83. }
  84. });
  85. /*获取论文信息*/
  86. function getPaperMe() {
  87. $.ajax({
  88. "url": "/ajax/ppaper/qo",
  89. "type": "GET",
  90. "success": function(data) {
  91. console.log(data);
  92. if(data.success) {
  93. paperHtml(data.data);
  94. getPaperAuthors(data.data.id)
  95. var paperName = data.data.name + "-科袖网";
  96. document.title = paperName;
  97. }
  98. },
  99. "data": {
  100. "id": paperId
  101. },
  102. dataType: "json",
  103. 'error': function() {
  104. $.MsgBox.Alert('提示', '服务器连接超时!');
  105. }
  106. });
  107. }
  108. /*获取论文作者信息*/
  109. function getPaperAuthors(stritrm) {
  110. $.ajax({
  111. "url": "/ajax/ppaper/authors",
  112. "type": "GET",
  113. "success": function(data) {
  114. console.log(data);
  115. if(data.success) {
  116. if(data.data.length>0){
  117. $("#aboutAuthors .lastBtn span").text(data.data.length);
  118. for(var i=0;i<data.data.length;i++){
  119. var authTy="",authTit="",baseInfo="",ifPoint="",imgbg="/images/default-photo.jpg";
  120. if(data.data[i].professorId.substring(0, 1) != "#"){
  121. $.ajax({
  122. type:"get",
  123. url:"/ajax/professor/editBaseInfo/" + data.data[i].professorId,
  124. async:false,
  125. success:function($proData){
  126. console.log($proData)
  127. if($proData.success){
  128. var showPro = $proData.data;
  129. if(showPro.hasHeadImage == 1) {
  130. imgbg = "/images/head/" + showPro.id + "_l.jpg";
  131. } else {
  132. imgbg = "/images/default-photo.jpg";
  133. }
  134. ifPoint = "pointThis";
  135. //认证
  136. var oSty = autho(showPro.authType,showPro.orgAuth,showPro.authStatus);
  137. authTy = oSty.sty;
  138. authTit = oSty.title;
  139. var title = showPro.title || "";
  140. var orgName = showPro.orgName || "";
  141. var office = showPro.office || "";
  142. if(orgName!=""){
  143. if(title != "") {
  144. baseInfo = title + "," + orgName;
  145. }else{
  146. if(office!=""){
  147. baseInfo = office + "," + orgName;
  148. }else{
  149. baseInfo = orgName;
  150. }
  151. }
  152. }else{
  153. if(title != "") {
  154. baseInfo = title;
  155. }else{
  156. if(office!=""){
  157. baseInfo = office;
  158. }else{
  159. baseInfo = "";
  160. }
  161. }
  162. }
  163. var str="";
  164. str +='<li class="flexCenter"><a href="" class="'+ ifPoint +'" data-id="'+ showPro.id +'">'
  165. str +='<div class="madiaHead useHead" style="background-image:url('+ imgbg +')"></div>'
  166. str +='<div class="madiaInfo" style="margin-top:-4px" >'
  167. str +='<p class="ellipsisSty"><span class="h1Font">'+ showPro.name +'</span><em class="authiconNew '+ authTy +'" title="'+ authTit +'"></em></p>'
  168. str +='<p class="h2Font ellipsisSty">'+ baseInfo +'</p>'
  169. str +='</div></a>';
  170. if(showPro.id==userid){
  171. str +=''
  172. }else{
  173. str +='<div class="goSpan"><span class="attenSpan">关注</span></div>';
  174. }
  175. str +='</li>';
  176. var $str=$(str);
  177. $("#aboutAuthors .lastBtn").before($str);
  178. if(showPro.id!=userid){
  179. ifcollectionAbout(showPro.id,$str.find(".attenSpan"),1);
  180. }
  181. }
  182. }
  183. })
  184. }else{
  185. var str="";
  186. str +='<li class="flexCenter"><a data-id="'+ data.data[i].professorId +'">'
  187. str +='<div class="madiaHead useHead" style="background-image:url('+ imgbg +')"></div>'
  188. str +='<div class="madiaInfo">'
  189. str +='<p class="ellipsisSty"><span class="h1Font">'+ data.data[i].name +'</span></p>'
  190. str +='</div></a>';
  191. if(data.data[i].name==userName){
  192. str +='<div class="goSpan"><span class="ifMe" flag="1">是我本人</span></div>'
  193. }else{
  194. str +='<div class="goSpan"><span class="yaoqing">邀请'
  195. str +='<div class="shareCode clearfix"><div class="floatL qrcodeUser"></div>'
  196. str +='<div class="shareWord floatR"><p>打开微信“扫一扫”,<br/>打开网页后点击屏幕右上角“分享”按钮</p></div>'
  197. str +='</div></span></div>';
  198. }
  199. str +='</li>';
  200. var $str=$(str);
  201. $("#aboutAuthors .lastBtn").before($str);
  202. }
  203. if(data.data.length<5){
  204. $("#aboutAuthors li").css("display","block");
  205. $(".lastBtn").hide();
  206. }else{
  207. $("#aboutAuthors li:lt(3)").css("display","block");
  208. }
  209. }
  210. //邀请
  211. $('.goSpan').on("mouseenter",".yaoqing",function(){
  212. $(this).find('.shareCode').stop(true,false).fadeIn();
  213. }).on("mouseleave",".yaoqing",function(){
  214. $(this).find('.shareCode').stop(true,false).fadeOut();
  215. });
  216. //邀请作者
  217. var Qcu=document.getElementsByClassName("qrcodeUser");
  218. for(var i=0;i<Qcu.length;i++){
  219. var qrcode= new QRCode(Qcu[i], {
  220. width : 100,
  221. height : 100
  222. });
  223. makeCodePar();
  224. }
  225. function makeCodePar(){
  226. if(userid) {
  227. var elurl = "http://" + hurl + "/e/I.html?i=" + s16to64(paperId)+"&d="+s16to64(userid)+"&f=1";
  228. } else{
  229. var elurl = "http://" + hurl + "/e/I.html?i=" + s16to64(paperId)+"&f=1";
  230. }
  231. qrcode.makeCode(elurl);
  232. }
  233. //是我本人
  234. $('.goSpan').on("click",".ifMe",function(){
  235. var oF=$(this).attr("flag");
  236. if(oF==1){
  237. $.MsgBox.Confirm("提示", "确认这是您发表的论文?", daoRuPaper);
  238. $(this).attr("flag","0");
  239. }else{
  240. return;
  241. }
  242. });
  243. }
  244. }
  245. },
  246. "data": {
  247. "id": stritrm
  248. },
  249. dataType: "json",
  250. 'error': function() {
  251. $.MsgBox.Alert('提示', '服务器连接超时!');
  252. }
  253. });
  254. }
  255. function daoRuPaper(){
  256. $.ajax({
  257. "url": "/ajax/ppaper/ass",
  258. "type": "POST",
  259. "data": {
  260. id:paperId,
  261. uid:userid,
  262. author: userName
  263. },
  264. dataType: "json",
  265. "success": function(data) {
  266. if(data.success) {
  267. if(data.data){
  268. $(".ifMe").text("导入成功").css("background","#ccc");
  269. }
  270. }
  271. },
  272. 'error': function() {
  273. $.MsgBox.Alert('提示', '服务器连接超时!');
  274. }
  275. });
  276. }
  277. /*处理论文html代码*/
  278. function paperHtml($da) {
  279. $("#paperName").text(window.staticPageData.name); //名字
  280. $("#pageView").text($da.pageViews); //浏览量
  281. $("#paperAbstract").text(window.staticPageData.summary); //摘要内容
  282. if(!$da.cn4periodical){
  283. $da.cn4periodical=""
  284. }
  285. if(!$da.en4periodical){
  286. $da.en4periodical=""
  287. }
  288. if(!$da.cn4periodical && !$da.en4periodical){
  289. $("#paperJournal").parents("li").hide();
  290. }else{
  291. $("#paperJournal").text($da.cn4periodical +" " + $da.en4periodical);
  292. }
  293. if(!$da.pubDay){
  294. $("#paperVolume").parents("li").hide();
  295. }else{
  296. $("#paperVolume").text($da.pubDay);
  297. }
  298. if($da.keywords != undefined && $da.keywords.length != 0 ){
  299. var subs = strToAry($da.keywords)
  300. if(subs.length>0){
  301. patentRelatedList(subs)
  302. for (var i = 0; i < subs.length; i++)
  303. {
  304. $(".tagList").append('<li><p class="h2Font">'+ subs[i] +'</p></li>');
  305. };
  306. }else{
  307. $(".tagList").hide();
  308. }
  309. }
  310. var weibopic = "http://" + window.location.host + "/images/default-paper.jpg"
  311. var weibotitle = $da.name;
  312. var weibourl = window.location.href;
  313. $("#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");
  314. }
  315. isAgreeNum()
  316. function isAgreeNum() {
  317. var data = {"id": paperId}
  318. $.ajax({
  319. url:"/ajax/ppaper/agreeCount",
  320. data:data,
  321. dataType: 'json', //数据格式类型
  322. type: 'get', //http请求类型
  323. timeout: 10000,
  324. async: true,
  325. success: function(data) {
  326. if(data.success){
  327. if(userid && userid != "null" && userid != null) {
  328. isAgree(data.data) //文章点赞
  329. } else {
  330. $(".thumbBtn").html("赞 <span>" + data.data + "</span>");
  331. }
  332. }
  333. },
  334. // complete:function(){
  335. // $("#advertisement a").attr("href","/"+$("#advertisement a").attr("href"));
  336. // $("#advertisement img").attr("src","/"+$("#advertisement img").attr("src"));
  337. // },
  338. error: function() {
  339. $.MsgBox.Alert('提示',"服务器链接超时");
  340. }
  341. });
  342. }
  343. /*判断论文是否被赞*/
  344. function isAgree(articleAgree) {
  345. var data = {"id": paperId,"uid":userid ,"uname":$.cookie("userName")}
  346. $.ajax({
  347. url:"/ajax/ppaper/agree",
  348. data:data,
  349. dataType: 'json', //数据格式类型
  350. type: 'get', //http请求类型
  351. timeout: 10000,
  352. async: true,
  353. success: function(data) {
  354. if(data.success){
  355. if(data.data){
  356. $(".thumbBtn").html("已赞 <span>"+articleAgree+"</span>");
  357. $(".thumbBtn").addClass("thumbedBtn").css("cursor","auto");
  358. }else{
  359. $(".thumbBtn").html("赞 <span>"+articleAgree+"</span>");
  360. $(".thumbBtn").addClass("thunbgo");
  361. }
  362. }
  363. },
  364. error: function() {
  365. $.MsgBox.Alert('提示',"服务器链接超时");
  366. }
  367. });
  368. }
  369. //论文点击点赞
  370. $('.thumbBlock').on("click",".thunbgo",function(){
  371. if (userid && userid != "null" && userid != null) {
  372. addAgree();
  373. }else{
  374. quickLog();
  375. operatTab();
  376. closeLog();
  377. }
  378. })
  379. /*点赞*/
  380. function addAgree() {
  381. console.log(paperId)
  382. var data = {"uid": userid,"id": paperId,"uname":$.cookie("userName")}
  383. $.ajax({
  384. url:"/ajax/ppaper/agree",
  385. data:data,
  386. dataType: 'json', //数据格式类型
  387. type: 'POST', //http请求类型
  388. timeout: 10000,
  389. async: true,
  390. success: function(data) {
  391. if(data.success){
  392. var articleAgreeval = $(".thumbBtn span").text();
  393. $(".thumbBtn").html("已赞 <span>"+(parseInt(articleAgreeval)+1)+"</span>");
  394. $(".thumbBtn").addClass("thumbedBtn").css("cursor","auto");
  395. $(".thumbBtn").removeClass("thunbgo");
  396. }
  397. },
  398. error: function() {
  399. $.MsgBox.Alert('提示',"服务器链接超时");
  400. }
  401. });
  402. }
  403. //您可能感兴趣的论文
  404. paperInterestingList()
  405. function paperInterestingList(){
  406. $.ajax({
  407. "url" : "/ajax/ppaper/ralatePapers",
  408. "type" : "GET" ,
  409. "dataType" : "json",
  410. "data" :{
  411. "paperId":paperId
  412. },
  413. //"async":false,
  414. "traditional": true, //传数组必须加这个
  415. "success" : function(data) {
  416. if(data.success) {
  417. var dataStr=data.data
  418. if(dataStr.length > 0){
  419. $("#interPaper").show();
  420. var itemlist = '';
  421. $("#paperList").html("");
  422. for(var i = 0; i < dataStr.length; i++) {
  423. var moreInf=""
  424. if(!dataStr[i].cn4periodical){
  425. dataStr[i].cn4periodical="";
  426. }
  427. if(!dataStr[i].en4periodical){
  428. dataStr[i].en4periodical="";
  429. }
  430. if(!dataStr[i].pubDay){
  431. dataStr[i].pubDay="";
  432. }
  433. moreInf = dataStr[i].cn4periodical+ " " +dataStr[i].en4periodical+ " " +dataStr[i].pubDay;
  434. var itemlist = '<li>';
  435. itemlist += '<a class="flexCenter" target="_blank" href="/' + pageUrl("pp",dataStr[i]) +'" class="linkhref"><div class="madiaHead paperHead"></div>';
  436. itemlist += '<div class="madiaInfo">';
  437. itemlist += '<p class="h1Font ellipsisSty">'+ dataStr[i].name +'</p>';
  438. itemlist += '<p class="h2Font ellipsisSty">作者:'+ dataStr[i].authors.substring(0, dataStr[i].authors.length - 1) +'</p>';
  439. itemlist += '<p class="h2Font ellipsisSty">期刊:'+ moreInf +'</p>';
  440. itemlist += '</div></a></li>';
  441. $itemlist = $(itemlist);
  442. $("#paperList").append($itemlist);
  443. } }
  444. }
  445. },
  446. "error":function(){
  447. $.MsgBox.Alert('提示','链接服务器超时')
  448. }
  449. });
  450. }
  451. //纠错反馈
  452. $(".correctSubmit").on("click",function(){
  453. var cntCon=$(this).siblings(".correctCon").val();
  454. var cntUser="";
  455. if(userid && userid != null && userid != "null") {
  456. cntUser = userid;
  457. }
  458. if(cntCon.length>500){
  459. $.MsgBox.Alert('提示', '纠错反馈内容不得超过500个字');
  460. return;
  461. }else{
  462. $.ajax({
  463. "url": "/ajax/feedback/error/paper",
  464. "type": "POST",
  465. "dataType": "json",
  466. "async": true,
  467. "data": {
  468. "id": paperId,
  469. "cnt":cntCon,
  470. "user":cntUser
  471. },
  472. "success": function(data) {
  473. if(data.success) {
  474. backSuccessed();
  475. suImg()
  476. }
  477. },
  478. "error": function() {
  479. $.MsgBox.Alert('提示', '链接服务器超时')
  480. }
  481. });
  482. }
  483. })
  484. function patentRelatedList(array){
  485. $.ajax({
  486. "url":"/ajax/ppatent/assPatents",
  487. "type" : "GET" ,
  488. "dataType" : "json",
  489. "data" :{
  490. "kws":array
  491. },
  492. "traditional": true, //传数组必须加这个
  493. "success" : function(data) {
  494. if(data.success) {
  495. var dataStr=data.data
  496. if(dataStr.length > 0){
  497. $("#patentrelate").removeClass("displayNone");
  498. for(var i = 0; i < dataStr.length; i++) {
  499. var itemlist ='<li style="min-height:56px;"><a href="/'+pageUrl("pt",dataStr[i])+'"><p class="h2Font ellipsisSty-2" style="line-height:20px;"><em class="circlePre"></em>'+ dataStr[i].name +'</p></a></li>'
  500. $(".recentlyList").append(itemlist);
  501. }
  502. }
  503. }
  504. },
  505. "error":function(){
  506. $.MsgBox.Alert('提示', '链接服务器超时')
  507. }
  508. });
  509. }
  510. })