Files
journal_com/js/scientist/scientist_oid.js
2024-09-23 13:19:35 +08:00

131 lines
5.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
function initOid() {
var o_ID = getQueryString('o_id'); //Online First
// Online First点进去的文章列表
if (o_ID != null) {
var urlList = {
list: 'api/Main/getOnlineFirstArticles'
}
commonInit()
var online_first = {};
online_first.pageIndex = 1;
online_first.pageSize = 10;
var totalPage;//总页码
var totalRecords;//总数据条数
var pageNo = online_first.pageIndex;//当前页码
$.ajax({
type: 'post', url: apiUrl + urlList.list,
data: online_first,
success: function (result) {
if (result.code == 0) {
$('.wenz_list>h4').html('Online First');
totalPage = result.data.count % online_first.pageSize == 0 ? (result.data.count / online_first.pageSize) : (Math.ceil(result.data.count / online_first.pageSize));
totalRecords = result.data.count;
$('.wenz_list .tioashu').html(result.data.count);
initArticle(result.data.articles)
//生成分页
//有些参数是可选的比如lang若不传有默认值
kkpager.generPageHtml({
pno: pageNo,
//总页码
total: totalPage,
//总数据条数
totalRecords: totalRecords,
mode: 'click',//默认值是link可选link或者click
click: function (n) {
this.selectPage(n);
//除了第一页写逻辑跳转
online_first.pageIndex = n;
$.ajax({
type: 'post', url: apiUrl + urlList.list,
data: online_first,
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('Online First');
initArticle(result.data.articles)
} 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 (arr[i].icon == '') {
continue
}
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: '' })
str += `
<li>
<div class="dbt_header">${arr[i].type}${baseInfo.pub_date}</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">${arr[i].authortitle}<br>
<a href="/${arr[i].usx}" target="_blank" > ${arr[i].journal_title}</a>.&nbsp;${arr[i].stage_year},&nbsp;${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()
}
}
}