portal html css js resource

paperShow.js 5.8KB

    $(document).ready(function() { loginStatus(); //判断个人是否登录 var userid = $.cookie("userid"); var paperId = GetQueryString("paperId"); ifcollectionAbout(paperId, 2) getPaperMe(); //点击收藏按钮 $("#attention").on('click', function() { if(userid && userid != null && userid != "null") { if($(this).find("em").is('.icon-collected')){ alert(111) cancelCollectionAbout(paperId, 2) } else { alert(222) collectionAbout(paperId, 2); } }else{ $.MsgBox.Alert("提示", "请先登录再进行收藏"); $("#mb_btn_ok").val("去登录"); var aele = document.createElement('a'); $("#mb_btnbox").append(aele); $("#mb_btnbox a").css({ 'display': "block", 'width': '100%', 'height': '40px', 'position': 'absolute', 'bottom': '-6px', 'left': '0' }); aele.setAttribute('href', '../login.html'); } }); //关键词标签点击进去搜索 $(".tagList").on("click","li",function(){ var tagText = $(this).find("p").text(); location.href = "searchNew.html?searchContent=" + tagText + "&tagflag=6"; }) /*获取资源信息*/ function getPaperMe() { $.ajax({ "url": "/ajax/ppaper/qo", "type": "GET", "success": function(data) { console.log(data); if(data.success) { paperHtml(data.data); getPaperAuthors(data.data.id) var paperName = data.data.name + "-科袖网"; document.title = paperName; } }, "data": { "id": paperId }, dataType: "json", 'error': function() { $.MsgBox.Alert('提示', '服务器连接超时!'); } }); } /*获取论文作者信息*/ function getPaperAuthors(stritrm) { $.ajax({ "url": "/ajax/ppaper/authors", "type": "GET", "success": function(data) { console.log(data); if(data.success) { if(data.data.length>0){ for(var i=0;i<data.data.length;i++){ var authTy="",authTit="",baseInfo="",imgbg="../images/default-photo.jpg"; if(data.data[i].professorId.substring(0, 1) != "#"){ $.ajax({ type:"get", url:"/ajax/professor/editBaseInfo/" + data.data[i].professorId, async:true, success:function(data){ console.log(data) if(data.success){ if(data.hasHeadImage == 1) { imgbg = "/images/head/" + data.id + "_l.jpg"; } else { imgbg = "../images/default-photo.jpg"; } //认证 var oSty = autho(data.authType,data.orgAuth,data.authStatus); authTy = oSty.sty; authTit = oSty.title; var title = data.title || ""; var orgName = data.orgName || ""; var office = data.office || ""; if(orgName!=""){ if(title != "") { baseInfo = title + "," + orgName; }else{ if(office!=""){ baseInfo = office + "," + orgName; }else{ baseInfo = orgName; } } }else{ if(title != "") { baseInfo = title; }else{ if(office!=""){ baseInfo = office; }else{ baseInfo = ""; } } } } } }) }else{ authTy = "" authTit = "" baseInfo="" } var str=""; str +='<li class="flexCenter">' str +='<div class="madiaHead useHead" style="background-image:url('+ imgbg +')"></div>' str +='<div class="madiaInfo">' str +='<p class="ellipsisSty"><span class="h1Font">'+ data.data[i].name +'</span><em class="authiconNew '+ authTy +'" title="'+ authTit +'"></em></p>' str +='<p class="h2Font ellipsisSty">'+ baseInfo +'</p>' str +='</div></li>'; var $str=$(str) $("#aboutAuthors").append($str); } if(data.data.length>4){ var lastStr='<li class="lastBtn"><div>查看全部作者(<span>'+ data.data.length +'</span>)</div></li>'; $("#aboutAuthors").insertBefore(lastStr,$("#aboutAuthors li").eq(data.data.length-1).nextSibling) } } } }, "data": { "id": stritrm }, dataType: "json", 'error': function() { $.MsgBox.Alert('提示', '服务器连接超时!'); } }); } /*处理资源html代码*/ function paperHtml($da) { $("#paperName").text($da.name); //名字 $("#pageView").text($da.pageViews); //浏览量 $("#paperAbstract").text($da.summary); //摘要内容 if(!$da.cn4periodical){ $da.cn4periodical="" } if(!$da.en4periodical){ $da.en4periodical="" } if(!$da.cn4periodical && !$da.en4periodical){ $("#paperJournal").parents("li").hide(); }else{ $("#paperJournal").text($da.cn4periodical + $da.en4periodical); } if(!$da.pubDay){ $("#paperVolume").parents("li").hide(); }else{ $("#paperVolume").text($da.pubDay); } if($da.keywords != undefined && $da.keywords.length != 0 ){ var subs = new Array(); if($da.keywords.indexOf(',')){ subs = $da.keywords.split(','); }else{ subs[0] = $da.keywords; } if(subs.length>0){ for (var i = 0; i < subs.length; i++) { $(".tagList").append('<li><p class="h2Font">'+ subs[i] +'</p></li>'); }; }else{ $(".tagList").hide(); } } var weibopic = "http://www.ekexiu.com/images/default-resource.jpg" var weibotitle = $da.name; var weibourl = window.location.href; $("#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"); } })