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

280 lines
13 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 initArticleT() {
// 话题点进去的文章列表
// Top cited / Top read / Top download点进去的文章列表
var J_ID = getQueryString('J_num'); //期刊
var t_ID = getQueryString('t_id'); //话题
if (t_ID != null) {
$.ajax({
type: 'post', url: apiUrl + 'super/Publish/addVisitNum',
data: { 'type': Jour_num },
success: function (result) {
if (result.code == 0) {
} else {
// ShowDanger("请求失败!");
}
},
error: function () {
// ShowDanger("error");
}
});
// 分期时间
localStorage.setItem("Journals_num", t_ID);
var urlList = {
list: 'api/Article/getTopicArticles'
}
var topic_mess = {};
topic_mess.topic_id = t_ID;
topic_mess.pageIndex = 1;
topic_mess.pageSize = 10;
var totalPage;//总页码
var totalRecords;//总数据条数
var pageNo = topic_mess.pageIndex;//当前页码
// 时间轴
commonInit()
if (t_ID != '369') {
$('.wenz_list .about2').css('display', 'none')
}
$.ajax({
type: 'post', url: apiUrl + 'api/Journal/getJournalLine',
data: {
"journal_id": Jour_num
},
success: function (result) {
if (result.code == 0) {
var arr = result.data.lines;
var str = "";
var dis_ = '';
for (var i = 0; i < arr.length; i++) {
if (i == arr.length - 1) {
if (i == 0) {
dis_ = '20'
} else {
dis_ = parseInt(dis_) + parseInt(arr[i].dist * 130);
}
str += '<li style="margin-top: ' + dis_ + 'px"><h4 class="f30">' + arr[i].time + '</h4>' +
'<a href="article_list.html?J_num=' + Jour_num + '&time_id=' + arr[i].journal_line_id + '" target="_blank">' +
'<h3 class="span">>> ' + arr[i].title + '</h3></a>' +
'<img src="' + imglineUrl + arr[i].img + '" style="width: 80px;height: 100px;margin-top: 10px">' +
'<p class="f14">' + arr[i].intro + '</p></li>'
} else {
if (arr[i].time == arr[i + 1].time) {
if (i == 0) {
dis_ = '20'
} else {
dis_ = parseInt(dis_) + parseInt(arr[i].dist * 130);
}
str += '<li style="margin-top: ' + dis_ + 'px"><h4 class="f30">' + arr[i].time + '</h4>' +
'<a href="article_list.html?J_num=' + Jour_num + '&time_id=' + arr[i].journal_line_id + '" target="_blank">' +
'<h3 class="span">>> ' + arr[i].title + '</h3></a>' +
'<img src="' + imglineUrl + arr[i].img + '" style="width: 80px;height: 100px;margin-top: 10px">' +
'<p class="f14">' + arr[i].intro + '</p>' +
'<a href="article_list.html?J_num=' + Jour_num + '&time_id=' + arr[i + 1].journal_line_id + '" target="_blank">' +
'<h3 class="span">>> ' + arr[i + 1].title + '</h3></a>' +
'<img src="' + imglineUrl + arr[i + 1].img + '" style="width: 80px;height: 100px;margin-top: 10px">' +
'<p class="f14">' + arr[i + 1].intro + '</p></li>'
i = i + 1;
} else {
if (i == 0) {
dis_ = '20'
} else {
dis_ = parseInt(dis_) + parseInt(arr[i].dist * 130);
}
str += '<li style="margin-top: ' + dis_ + 'px"><h4 class="f30">' + arr[i].time + '</h4>' +
'<a href="article_list.html?J_num=' + Jour_num + '&time_id=' + arr[i].journal_line_id + '" target="_blank">' +
'<h3 class="span">>> ' + arr[i].title + '</h3></a>' +
'<img src="' + imglineUrl + arr[i].img + '" style="width: 80px;height: 100px;margin-top: 10px">' +
'<p class="f14">' + arr[i].intro + '</p></li>'
}
}
}
if (Jour_num == '1' && t_ID == '369') {
$('.wenz_list>.about2 ul').html(str);
$('#kkpager').css('display', 'none')
$('.gue_chinese_tot').css('display', 'none')
} else {
$('.wenz_list .about2').css('display', 'none')
}
} else {
// ShowDanger("请求失败!");
}
},
error: function () {
ShowDanger("error");
}
})
$.ajax({
type: 'post', url: apiUrl + urlList.list,
data: topic_mess,
success: function (result) {
if (result.code == 0) {
totalPage = result.data.count % topic_mess.pageSize == 0 ? (result.data.count / topic_mess.pageSize) : (Math.ceil(result.data.count / topic_mess.pageSize));
totalRecords = result.data.count;
$('.wenz_list .tioashu').html(result.data.count);
$('.wenz_list>h4').html(result.data.topicInfo.title);
if (result.data.topicInfo.intro != '') {
$('.wenz_list>h4').after('<h3 style="font-size: 12px;color: #666;margin: 0 18px 10px 18px;">' + result.data.topicInfo.intro + '</h3>');
}
// 古籍按钮
if (t_ID == '368') {
$('.wenz_list>h4').append('<a href="topic_list.html?J_num=1&t_id=369" class="ancient_btn" target="_blank">Ancient Medical Books</a>')
}
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);
//除了第一页写逻辑跳转
topic_mess.pageIndex = n;
$.ajax({
type: 'post', url: apiUrl + urlList.list,
data: topic_mess,
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(result.data.topicInfo.title);
initArticle(result.data.articleList)
} else {
ShowDanger("请求失败!");
}
},
error: function () {
ShowDanger("error");
}
})
return false;
}, lang: Jour_num == '22' ? {
firstPageText: '首页',
firstPageTipText: '首页',
lastPageText: '尾页',
lastPageTipText: '尾页',
prePageText: '上一页',
prePageTipText: '上一页',
nextPageText: '下一页',
nextPageTipText: '下一页',
totalPageBeforeText: '&nbsp;共&nbsp',
totalPageAfterText: '&nbsp;页',
currPageBeforeText: '当前第&nbsp;',
currPageAfterText: '&nbsp;页',
totalInfoSplitStr: '&nbsp;',
totalRecordsBeforeText: '',
totalRecordsAfterText: '',
gopageBeforeText: '&nbsp;&nbsp;&nbsp;Go to page',
gopageButtonOkText: 'Go',
gopageAfterText: 'page',
buttonTipBeforeText: '第',
buttonTipAfterText: '页'
} : {
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&nbsp;',
currPageAfterText: '',
totalInfoSplitStr: '&nbsp;of&nbsp;',
totalRecordsBeforeText: '',
totalRecordsAfterText: '',
gopageBeforeText: '&nbsp;&nbsp;&nbsp;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: ' + localStorage.Journals_color + ';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: 'different', 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")}
.&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">${img_i}</a>${baseInfo.trad_tion}<br
clear="both"></div>
</li>`
}
$('.wenz_list>ul').html(str);
$('.links_ .txt_copy').css('background', localStorage.Journals_color);
commonHandleClickHtml()
}
}
}