portal html css js resource

shareArticalinfor.html 11KB

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> <link rel="stylesheet" href="../css/reset.css" /> <link rel="stylesheet" href="../css/common.css" /> <style> body, html { background: #FFFFFF; } .listtit { font-size: 16px; line-height: 26px; color: #333333; } /*中标题*/ .listtit2 { font-size: 15px; line-height: 20px; color: #666666; } /*较小标题*/ .listtit3 { font-size: 13px; line-height: 18px; color: #888888; } /*小标题*/ .mui-ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } .proinfor .headblock { margin: 0 2% 0 0; } .proinfor .headblock .headimg { width: 64px; overflow: hidden; margin: auto; } .art_topicBox { position: relative; max-width: 640px; margin: 4px auto; display: block; } .art_topicBox img { width: 100%; } .art_topicbox { position: absolute; top: 0; width: 100%; height: 100%; background: -webkit-linear-gradient( rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.2)); /* Safari 5.1 - 6.0 */ background: -o-linear-gradient( rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.2)); /* Opera 11.1 - 12.0 */ background: -moz-linear-gradient( rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.2)); /* Firefox 3.6 - 15 */ background: linear-gradient( rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.2)); /* 标准的语法 */ } .art_img { width: 100%; height: 180px; overflow: hidden; background: url(../images/default-art_top.jpg) center center no-repeat; background-size: cover; } #artical_topic { position: absolute; bottom: 0; padding: 6px 10px; font-size: 18px; line-height: 24px; color: #FFFFFF } #artical_sth { font-size: 12px; line-height: 14px; color: #999999; } .articalBox { max-width: 640px; margin: 6px auto 26px; padding: 4px 16px; color: #555555; } .line01 { margin: 10px 0 4px 0; border-top: 1px dashed #ddd; height: 1px; overflow: hidden; clear: both; width: 100%; } .articalBox p { margin: 6px 0; padding: 2px; text-indent: 2em; font-size: 15px; line-height: 26px; color: #666666; } .articalBox .indentNone { text-indent: 0; text-align: center; } .articalBox .indentNone img { width: 90%; margin: 10px 0; } .articalBox .indentNone .imgTit { font-size: 12px; line-height: 20px; } .articalBox .artSTit { text-indent: 0.5em; font-size: 16px; color: #069E21; } </style> </head> <body> <div class="contentBody2"> <div class="art_topicBox"> <div class="art_img" id="articleImg"></div> <div class="art_topicbox"> <h4 id="artical_topic"></h4> </div> </div> <div class="articalBox"> <ul id="proInfor"> <li style="padding:8px 20px 8px 10px;"> <a class="proinfor clearfix"> <div class="headblock floatL"><img id="proHead" class="headimg headRadius" src="../images/default-photo.jpg"></div> <div class="media-body"> <span class="listtit"><span id="proName"></span><em class="authicon authicon-cu" style="position:absolute;margin:4px 0 0 2px ;"></em></span> <div class="listtit2"><span id="proTitle"></span><span id="proOffice"></span><span id="proOrg"></span><span id="proAddress"></span></div> <div class="mui-ellipsis listtit3" id="proRlist"></div> <div class="mui-ellipsis listtit3" id="proZlist"></div> </div> </a> </li> </ul> <div class="line01" style="margin:4px 0 10px 0;"></div> <div id="artical_real"> <!--body--> <div id="main_content"> </div> <!--body--> </div> </div> </div> <script type="text/javascript" src="../js/jquery-1.11.1.js"></script> <script> $(document).ready(function() { var articleId = GetQueryString("articleId"); function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); var context = ""; if(r != null) context = r[2]; reg = null; r = null; return context == null || context == "" || context == "undefined" ? "" : decodeURI(context); } function proInfoMain() { $.ajax({ url: "/ajax/article/query", dataType: 'json', //数据格式类型 type: 'GET', //http请求类型 data: { "articleId": articleId }, timeout: 10000, //超时设置 success: function(data) { var $info = data.data || {}; if(data.success && data.data) { var nameli = document.getElementById("nameli"); var proZlist = document.getElementById("proZlist"); //专家资源 var proRlist = document.getElementById("proRlist"); //专家资源 var proName = document.getElementById("proName"); var proTitle = document.getElementById("proTitle"); var proOffice = document.getElementById("proOffice"); var proOrg = document.getElementById("proOrg"); var proAddress = document.getElementById("proAddress"); var articleImg = document.getElementById("articleImg"); var artical_topic = document.getElementById("artical_topic"); var main_content = document.getElementById("main_content"); proName.innerText = $info.professor.name; if($info.professor.title && $info.professor.office && $info.professor.orgName && $info.professor.address) { proTitle.innerText = $info.professor.title + ","; proOffice.innerText = $info.professor.office + ","; proOrg.innerText = $info.professor.orgName + " | "; proAddress.innerText = $info.professor.address; } else if(!$info.professor.title && $info.professor.office && $info.professor.orgName && $info.professor.address) { proOffice.innerText = $info.professor.office + ","; proOrg.innerText = $info.professor.orgName + " | "; proAddress.innerText = $info.professor.address; } else if($info.professor.title && !$info.professor.office && $info.professor.orgName && $info.professor.address) { proTitle.innerText = $info.professor.title + ","; proOrg.innerText = $info.professor.orgName + " | "; proAddress.innerText = $info.professor.address; } else if($info.professor.title && $info.professor.office && !$info.professor.orgName && $info.professor.address) { proTitle.innerText = $info.professor.title + ","; proOffice.innerText = $info.professor.office + " | "; proAddress.innerText = $info.professor.address; } else if($info.professor.title && $info.professor.office && $info.professor.orgName && !$info.professor.address) { proTitle.innerText = $info.professor.title + ","; proOffice.innerText = $info.professor.office + ","; proOrg.innerText = $info.professor.orgName; } else if(!$info.professor.title && !$info.professor.office && $info.professor.orgName && $info.professor.address) { proOrg.innerText = $info.professor.orgName + " | "; proAddress.innerText = $info.professor.address; } else if(!$info.professor.title && $info.professor.office && !$info.professor.orgName && $info.professor.address) { proOffice.innerText = $info.professor.office + " | "; proAddress.innerText = $info.professor.address; } else if(!$info.professor.title && $info.professor.office && $info.professor.orgName && !$info.professor.address) { proOffice.innerText = $info.professor.office + ","; proOrg.innerText = $info.professor.orgName; } else if($info.professor.title && !$info.professor.office && !$info.professor.orgName && $info.professor.address) { proTitle.innerText = $info.professor.title + " | "; proAddress.innerText = $info.professor.address; } else if($info.professor.title && !$info.professor.office && $info.professor.orgName && !$info.professor.address) { proOffice.innerText = $info.professor.title + ","; proAddress.innerText = $info.professor.orgName; } else if($info.professor.title && $info.professor.office && !$info.professor.orgName && !$info.professor.address) { proTitle.innerText = $info.professor.title + ","; proOffice.innerText = $info.professor.office; } else if(!$info.professor.title && !$info.professor.office && !$info.professor.orgName && $info.professor.address) { proAddress.innerText = $info.professor.address; } else if(!$info.professor.title && !$info.professor.office && $info.professor.orgName && !$info.professor.address) { proOrg.innerText = $info.professor.orgName; } else if(!$info.professor.title && $info.professor.office && !$info.professor.orgName && !$info.professor.address) { proOffice.innerText = $info.professor.office; } else if($info.professor.title && !$info.professor.office && !$info.professor.orgName && !$info.professor.address) { proTitle.innerText = $info.professor.title; } var rlist = '' for(var n = 0; n < $info.professor.researchAreas.length; n++) { rlist += '<span>' + $info.professor.researchAreas[n].caption + '</span>'; if(n != $info.professor.researchAreas.length - 1) { rlist += ','; } } ($info.professor.researchAreas) ? proRlist.innerHTML = rlist: proRlist.innerText = ''; var zlist = ""; for(var n = 0; n < $info.professor.resources.length; n++) { zlist += '<span>' + $info.professor.resources[n].resourceName + '</span>'; if(n != $info.professor.resources.length - 1) { zlist += ','; } } ($info.professor.resources) ? proZlist.innerHTML = zlist: proZlist.innerText = ''; if($info.articleImg) { articleImg.style.backgroundImage = 'url(/data/article/' + $info.articleImg + ')'; } if($info.professor.hasHeadImage) { document.getElementById('proHead').src = "/images/head/" + $info.professorId + "_l.jpg"; } artical_topic.innerText = $info.articleTitle; if($info.articleContent) { main_content.innerHTML = $info.articleContent; var oImg = main_content.getElementsByTagName("img"); for(var i = 0; i < oImg.length; i++) { (function(n) { var att = oImg[n].src.substr(7); console.log(oImg[n].src) oImg[n].style.width = "100%"; oImg[n].parentNode.style.textIndent = "0em"; })(i); } } } }, error: function() { return; } }); } proInfoMain(); }) </script> </body> </html>