portal html css js resource

paperShow.js 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. $(document).ready(function() {
  2. loginStatus(); //判断个人是否登录
  3. var userid = $.cookie("userid");
  4. var userName = $.cookie("userName");
  5. var paperId = GetQueryString("paperId");
  6. ifcollectionAbout(paperId, 5)
  7. getPaperMe();
  8. pageViewsVal();
  9. //点击收藏按钮
  10. $("#collectBtn").on('click', function() {
  11. if(userid && userid != null && userid != "null") {
  12. if($(this).is('.icon-collected')){
  13. cancelCollectionAbout(paperId, 5)
  14. } else {
  15. collectionAbout(paperId, 5);
  16. }
  17. }else{
  18. $.MsgBox.Alert("提示", "请先登录再进行收藏");
  19. $("#mb_btn_ok").val("去登录");
  20. var aele = document.createElement('a');
  21. $("#mb_btnbox").append(aele);
  22. $("#mb_btnbox a").css({
  23. 'display': "block",
  24. 'width': '100%',
  25. 'height': '40px',
  26. 'position': 'absolute',
  27. 'bottom': '-6px',
  28. 'left': '0'
  29. });
  30. aele.setAttribute('href', '../login.html');
  31. }
  32. });
  33. //关键词标签点击进去搜索
  34. $(".tagList").on("click","li",function(){
  35. var tagText = $(this).find("p").text();
  36. location.href = "searchNew.html?searchContent=" + tagText + "&tagflag=6";
  37. })
  38. //点击进入个人详情页面
  39. $("#aboutAuthors").on("click","li>a",function(){
  40. var oDataId = $(this).attr("data-id");
  41. if(oDataId.substring(0,1)!="#"){
  42. $(this).attr("href","userInforShow.html?professorId="+oDataId);
  43. }else{
  44. $(this).attr("href","javascript:void(0)");
  45. }
  46. })
  47. $("#aboutAuthors").on("click","li.lastBtn",function(){
  48. $("#aboutAuthors li").css("display","block");
  49. $(this).hide();
  50. })
  51. //点击关注按钮
  52. $("#aboutAuthors").on('click',"span.attenSpan", function() {
  53. var pId=$(this).parent().siblings("a").attr("data-id");
  54. if(userid && userid != null && userid != "null") {
  55. if($(this).is('.attenedSpan')){
  56. cancelCollectionAbout(pId, 1)
  57. } else {
  58. collectionAbout(pId, 1);
  59. }
  60. }else{
  61. $.MsgBox.Alert("提示", "请先登录再进行关注");
  62. $("#mb_btn_ok").val("去登录");
  63. var aele = document.createElement('a');
  64. $("#mb_btnbox").append(aele);
  65. $("#mb_btnbox a").css({
  66. 'display': "block",
  67. 'width': '100%',
  68. 'height': '40px',
  69. 'position': 'absolute',
  70. 'bottom': '-6px',
  71. 'left': '0'
  72. });
  73. aele.setAttribute('href', '../login.html');
  74. }
  75. });
  76. /*获取论文信息*/
  77. function getPaperMe() {
  78. $.ajax({
  79. "url": "/ajax/ppaper/qo",
  80. "type": "GET",
  81. "success": function(data) {
  82. console.log(data);
  83. if(data.success) {
  84. paperHtml(data.data);
  85. getPaperAuthors(data.data.id)
  86. var paperName = data.data.name + "-科袖网";
  87. document.title = paperName;
  88. }
  89. },
  90. "data": {
  91. "id": paperId
  92. },
  93. dataType: "json",
  94. 'error': function() {
  95. $.MsgBox.Alert('提示', '服务器连接超时!');
  96. }
  97. });
  98. }
  99. /*获取论文作者信息*/
  100. function getPaperAuthors(stritrm) {
  101. $.ajax({
  102. "url": "/ajax/ppaper/authors",
  103. "type": "GET",
  104. "success": function(data) {
  105. console.log(data);
  106. if(data.success) {
  107. if(data.data.length>0){
  108. $("#aboutAuthors .lastBtn span").text(data.data.length);
  109. for(var i=0;i<data.data.length;i++){
  110. var authTy="",authTit="",baseInfo="",ifPoint="",imgbg="../images/default-photo.jpg";
  111. if(data.data[i].professorId.substring(0, 1) != "#"){
  112. $.ajax({
  113. type:"get",
  114. url:"/ajax/professor/editBaseInfo/" + data.data[i].professorId,
  115. async:false,
  116. success:function($proData){
  117. console.log($proData)
  118. if($proData.success){
  119. var showPro = $proData.data;
  120. if(showPro.hasHeadImage == 1) {
  121. imgbg = "/images/head/" + showPro.id + "_l.jpg";
  122. } else {
  123. imgbg = "../images/default-photo.jpg";
  124. }
  125. ifPoint = "pointThis";
  126. //认证
  127. var oSty = autho(showPro.authType,showPro.orgAuth,showPro.authStatus);
  128. authTy = oSty.sty;
  129. authTit = oSty.title;
  130. var title = showPro.title || "";
  131. var orgName = showPro.orgName || "";
  132. var office = showPro.office || "";
  133. if(orgName!=""){
  134. if(title != "") {
  135. baseInfo = title + "," + orgName;
  136. }else{
  137. if(office!=""){
  138. baseInfo = office + "," + orgName;
  139. }else{
  140. baseInfo = orgName;
  141. }
  142. }
  143. }else{
  144. if(title != "") {
  145. baseInfo = title;
  146. }else{
  147. if(office!=""){
  148. baseInfo = office;
  149. }else{
  150. baseInfo = "";
  151. }
  152. }
  153. }
  154. var str="";
  155. str +='<li class="flexCenter"><a href="" class="'+ ifPoint +'" data-id="'+ showPro.id +'">'
  156. str +='<div class="madiaHead useHead" style="background-image:url('+ imgbg +')"></div>'
  157. str +='<div class="madiaInfo" style="margin-top:-8px" >'
  158. str +='<p class="ellipsisSty"><span class="h1Font">'+ showPro.name +'</span><em class="authiconNew '+ authTy +'" title="'+ authTit +'"></em></p>'
  159. str +='<p class="h2Font ellipsisSty">'+ baseInfo +'</p>'
  160. str +='</div></a>';
  161. if(showPro.id==userid){
  162. str +=''
  163. }else{
  164. str +='<div class="goSpan"><span class="attenSpan">关注</span></div>';
  165. }
  166. str +='</li>';
  167. var $str=$(str);
  168. $("#aboutAuthors .lastBtn").before($str);
  169. if(showPro.id!=userid){
  170. ifcollectionAbout(showPro.id, 1)
  171. }
  172. }
  173. }
  174. })
  175. }else{
  176. var str="";
  177. str +='<li class="flexCenter"><a data-id="'+ data.data[i].professorId +'">'
  178. str +='<div class="madiaHead useHead" style="background-image:url('+ imgbg +')"></div>'
  179. str +='<div class="madiaInfo">'
  180. str +='<p class="ellipsisSty"><span class="h1Font">'+ data.data[i].name +'</span></p>'
  181. str +='</div></a>';
  182. if(data.data[i].name==userName){
  183. str +='<div class="goSpan"><span class="ifMe" flag="1">是我本人</span></div>'
  184. }else{
  185. str +='<div class="goSpan"><span class="yaoqing">邀请'
  186. str +='<div class="shareCode clearfix"><div class="floatL qrcodeUser"></div>'
  187. str +='<div class="shareWord floatR"><p>打开微信“扫一扫”,<br/>打开网页后点击屏幕右上角“分享”按钮</p></div>'
  188. str +='</div></span></div>';
  189. }
  190. str +='</li>';
  191. var $str=$(str);
  192. $("#aboutAuthors .lastBtn").before($str);
  193. }
  194. if(data.data.length<5){
  195. $("#aboutAuthors li").css("display","block");
  196. $(".lastBtn").hide();
  197. }else{
  198. $("#aboutAuthors li:lt(3)").css("display","block");
  199. }
  200. }
  201. //邀请
  202. $('.goSpan').on("mouseenter",".yaoqing",function(){
  203. $(this).find('.shareCode').stop(true,false).fadeIn();
  204. }).on("mouseleave",".yaoqing",function(){
  205. $(this).find('.shareCode').stop(true,false).fadeOut();
  206. });
  207. //邀请作者
  208. var Qcu=document.getElementsByClassName("qrcodeUser");
  209. for(var i=0;i<Qcu.length;i++){
  210. var qrcode= new QRCode(Qcu[i], {
  211. width : 100,
  212. height : 100
  213. });
  214. makeCode();
  215. }
  216. function makeCode(){
  217. var hurl = window.location.host;
  218. if(userid) {
  219. var elurl = "http://" + hurl + "/e/I.html?i=" + s16to64(paperId)+"&d="+s16to64(userid)+"&f=1";
  220. } else{
  221. var elurl = "http://" + hurl + "/e/I.html?i=" + s16to64(paperId)+"&f=1";
  222. }
  223. qrcode.makeCode(elurl);
  224. }
  225. //是我本人
  226. $('.goSpan').on("click",".ifMe",function(){
  227. var oF=$(this).attr("flag");
  228. if(oF==1){
  229. $.MsgBox.Confirm("提示", "确认这是您发表的论文?", daoRuPaper);
  230. $(this).attr("flag","0");
  231. }else{
  232. return;
  233. }
  234. });
  235. }
  236. }
  237. },
  238. "data": {
  239. "id": stritrm
  240. },
  241. dataType: "json",
  242. 'error': function() {
  243. $.MsgBox.Alert('提示', '服务器连接超时!');
  244. }
  245. });
  246. }
  247. function daoRuPaper(){
  248. $.ajax({
  249. "url": "/ajax/ppaper/ass",
  250. "type": "POST",
  251. "data": {
  252. id:paperId,
  253. uid:userid,
  254. author: userName
  255. },
  256. dataType: "json",
  257. "success": function(data) {
  258. if(data.success) {
  259. if(data.data){
  260. $(".ifMe").text("导入成功").css("background","#ccc");
  261. }
  262. }
  263. },
  264. 'error': function() {
  265. $.MsgBox.Alert('提示', '服务器连接超时!');
  266. }
  267. });
  268. }
  269. /*处理论文html代码*/
  270. function paperHtml($da) {
  271. $("#paperName").text($da.name); //名字
  272. $("#pageView").text($da.pageViews); //浏览量
  273. $("#paperAbstract").text($da.summary); //摘要内容
  274. if(!$da.cn4periodical){
  275. $da.cn4periodical=""
  276. }
  277. if(!$da.en4periodical){
  278. $da.en4periodical=""
  279. }
  280. if(!$da.cn4periodical && !$da.en4periodical){
  281. $("#paperJournal").parents("li").hide();
  282. }else{
  283. $("#paperJournal").text($da.cn4periodical +" " + $da.en4periodical);
  284. }
  285. if(!$da.pubDay){
  286. $("#paperVolume").parents("li").hide();
  287. }else{
  288. $("#paperVolume").text($da.pubDay);
  289. }
  290. if($da.keywords != undefined && $da.keywords.length != 0 ){
  291. var subs = new Array();
  292. if($da.keywords.indexOf(',')){
  293. subs = $da.keywords.split(',');
  294. }else{
  295. subs[0] = $da.keywords;
  296. }
  297. if(subs.length>0){
  298. for (var i = 0; i < subs.length; i++)
  299. {
  300. $(".tagList").append('<li><p class="h2Font">'+ subs[i] +'</p></li>');
  301. };
  302. }else{
  303. $(".tagList").hide();
  304. }
  305. }
  306. var weibopic = "http://" + window.location.host + "/images/default-paper.jpg"
  307. var weibotitle = $da.name;
  308. var weibourl = window.location.href;
  309. $("#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");
  310. }
  311. //浏览量
  312. function pageViewsVal() {
  313. $.ajax({
  314. "url": "/ajax/ppaper/incPageViews",
  315. "type": "POST",
  316. "dataType": "json",
  317. "data": {
  318. "id": paperId
  319. },
  320. "success": function(data) {
  321. console.log(data);
  322. if(data.success) {}
  323. },
  324. "error": function() {
  325. $.MsgBox.Alert('提示', '链接服务器超时')
  326. }
  327. });
  328. }
  329. //纠错反馈
  330. $(".correctSubmit").on("click",function(){
  331. var cntCon=$(this).siblings(".correctCon").val();
  332. var cntUser="";
  333. if(userid && userid != null && userid != "null") {
  334. cntUser = userid;
  335. }
  336. if(cntCon.length>500){
  337. $.MsgBox.Alert('提示', '纠错反馈内容不得超过500个字');
  338. return;
  339. }else{
  340. $.ajax({
  341. "url": "/ajax/feedback/error/paper",
  342. "type": "POST",
  343. "dataType": "json",
  344. "async": true,
  345. "data": {
  346. "id": paperId,
  347. "cnt":cntCon,
  348. "user":cntUser
  349. },
  350. "success": function(data) {
  351. if(data.success) {
  352. backSuccessed();
  353. }
  354. },
  355. "error": function() {
  356. $.MsgBox.Alert('提示', '链接服务器超时')
  357. }
  358. });
  359. }
  360. })
  361. })