163 lines
6.8 KiB
JavaScript
163 lines
6.8 KiB
JavaScript
function initArticleCite() {
|
||
// 话题点进去的文章列表
|
||
// Top cited / Top read / Top download点进去的文章列表
|
||
var J_ID = getQueryString('J_num'); //期刊
|
||
var cite_ID = getQueryString('cite_id'); //话题
|
||
|
||
if (cite_ID != null) {
|
||
|
||
localStorage.setItem("Journals_num", cite_ID);
|
||
$('.art_main_con').append('<div id="kkpager"></div>')
|
||
$('.wenz_list').append('<div style="font-size: 12px;text-align: right;padding-top: 10px;padding-right: 27px;" class="gue_chinese_tot">all total <b class="tioashu"></b> </div>')
|
||
|
||
|
||
var urlList = {
|
||
list: 'api/Article/getTopArt'
|
||
}
|
||
var cited_top = {};
|
||
cited_top.pageIndex = 1;
|
||
cited_top.pageSize = 10;
|
||
cited_top.journal_id = cite_ID;
|
||
cited_top.type = 'cited';
|
||
var totalPage;//总页码
|
||
var totalRecords;//总数据条数
|
||
var pageNo = cited_top.pageIndex;//当前页码
|
||
|
||
|
||
$.ajax({
|
||
type: 'post', url: apiUrl + urlList.list,
|
||
data: cited_top,
|
||
success: function (result) {
|
||
if (result.code == 0) {
|
||
$('.wenz_list>h4').html('Top cited');
|
||
|
||
totalPage = result.data.count % cited_top.pageSize == 0 ? (result.data.count / cited_top.pageSize) : (Math.ceil(result.data.count / cited_top.pageSize));
|
||
totalRecords = result.data.count;
|
||
$('.wenz_list .tioashu').html(result.data.count);
|
||
var arr = result.data.articleList;
|
||
initArticle(arr)
|
||
//生成分页
|
||
//有些参数是可选的,比如lang,若不传有默认值
|
||
kkpager.generPageHtml({
|
||
pno: pageNo,
|
||
//总页码
|
||
total: totalPage,
|
||
//总数据条数
|
||
totalRecords: totalRecords,
|
||
mode: 'click',//默认值是link,可选link或者click
|
||
click: function (n) {
|
||
this.selectPage(n);
|
||
//除了第一页写逻辑跳转
|
||
cited_top.pageIndex = n;
|
||
$.ajax({
|
||
type: 'post', url: apiUrl + urlList.list,
|
||
data: cited_top,
|
||
success: function (result) {
|
||
if (result.code == 0) {
|
||
$('.goup-container').click();
|
||
totalRecords = result.data.count;
|
||
|
||
$('.wenz_list .tioashu').html(result.data.count);
|
||
|
||
$('.wenz_list>h4').html('Top cited');
|
||
|
||
initArticle(result.data.articleList)
|
||
|
||
} else {
|
||
ShowDanger("请求失败!");
|
||
}
|
||
},
|
||
error: function () {
|
||
ShowDanger("error!");
|
||
}
|
||
})
|
||
return false;
|
||
}, lang: {
|
||
firstPageText: 'First page',
|
||
firstPageTipText: 'First page',
|
||
lastPageText: 'Last page',
|
||
lastPageTipText: 'Last page',
|
||
prePageText: 'Previous page',
|
||
prePageTipText: 'Previous page',
|
||
nextPageText: 'Next page',
|
||
nextPageTipText: 'Next page',
|
||
totalPageBeforeText: '',
|
||
totalPageAfterText: '',
|
||
currPageBeforeText: 'on page ',
|
||
currPageAfterText: '',
|
||
totalInfoSplitStr: ' of ',
|
||
totalRecordsBeforeText: '',
|
||
totalRecordsAfterText: '',
|
||
gopageBeforeText: ' Go to page',
|
||
gopageButtonOkText: 'Go',
|
||
gopageAfterText: 'page',
|
||
buttonTipBeforeText: '第',
|
||
buttonTipAfterText: '页'
|
||
}
|
||
});
|
||
|
||
|
||
|
||
} else {
|
||
ShowDanger("请求失败!");
|
||
}
|
||
},
|
||
error: function () {
|
||
ShowDanger("error!");
|
||
}
|
||
})
|
||
|
||
|
||
function initArticle(arr) {
|
||
var str = "";
|
||
|
||
|
||
for (var i = 0; i < arr.length; i++) {
|
||
|
||
if ((Math.round(Date.parse(new Date()) / 1000) - arr[i].ctime) / 86400 >= 21) {
|
||
var tong_geogle = '<a href = "https://scholar.google.com/scholar?&q=' + arr[i].title.replace('<i>', '').replace('</i>', '').replace(new RegExp('"', "g"), '') + '"' +
|
||
'target = "_blank" style="color:#006699;margin-left: 10px;font-weight: 600;' +
|
||
'Google Scholar</a>' //搜索引用次数
|
||
} else {
|
||
var tong_geogle = '' //少于21天隐藏
|
||
}
|
||
|
||
if (arr[i].icon == '') {
|
||
var img_i = 'img/baiss.png'
|
||
} else {
|
||
var img_i = imgarticleUrl + arr[i].icon
|
||
}
|
||
|
||
|
||
var baseInfo = commonGetItemHtml({ data: arr[i], i: i, img_i: img_i, c_t_a: '', tong_geogle: tong_geogle })
|
||
|
||
|
||
|
||
|
||
str += ` <li>
|
||
<div class="dbt_header">${arr[i].type}${baseInfo.pub_date}<div class="url_top">${baseInfo.lr_top}</div>
|
||
</div>
|
||
<a id="${arr[i].article_id}" target="_blank"
|
||
href="article.html?J_num=${arr[i].journal_id}&a_id=${arr[i].article_id}"
|
||
class="txt_biaoti">${baseInfo.otStat}${arr[i].title}</a>
|
||
<div class="authorList"><span class="fo_fam">${arr[i].authortitle} </span><br> ${localStorage.getItem("Journals_title")}
|
||
. ${arr[i].stage_year}, ${arr[i].stage_vol}${baseInfo.stage_}${baseInfo.npp_}<a target="_blank"
|
||
href="https://doi.org/${arr[i].doi}">${baseInfo.doi_}</a> </div>
|
||
<div class="links_">${baseInfo.link_}</div>
|
||
<div class="apwrap"><a onclick="imgbig(this)" class="imgdiv">${baseInfo.person_img}</a>${baseInfo.trad_tion}<br
|
||
clear="both"></div>
|
||
</li>`
|
||
|
||
}
|
||
|
||
|
||
$('.wenz_list>ul').html(str);
|
||
$('.links_ .txt_copy').css('background', localStorage.Journals_color);
|
||
commonHandleClickHtml()
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
|