function getQueryString(key) {
// 获取参数
var url = window.location.search;
// 正则筛选地址栏
var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)");
// 匹配目标参数
var result = url.substr(1).match(reg);
//返回参数值
return result ? decodeURIComponent(result[2]) : null;
}
function commonGetAxiosData(url, type, data) {
var resultData;
$.ajax({
type: type,
url: apiUrl + url,
data: data,
}).then((result) => {
if (result.code == 0) {
resultData = result.data
} else {
ShowDanger("请求失败!");
resultData = null
}
})
return resultData;
}
function commonInit() {
$('.art_main_con').append('
')
$('.wenz_list').append('all total
')
}
function commonGetItemHtml(doc, maxwidth) {
var data = doc.data; var journal_id = doc.data.journal_id ? doc.data.journal_id : Jour_num;
console.log('journal_id at line 36:', journal_id)
var i = doc.i;
var img_i = doc.img_i;
var c_t_a = doc.c_t_a;
var tong_geogle = doc.tong_geogle;
console.log('img_i at line 31:', img_i)
var baseInfo = {
doi_: !data.doi ? '' : `https://doi.org/${data.doi}`,
npp_: data.npp == '' || data.npp == ' ' ? '' : `: ${data.npp}. `,
html_: '',
otStat: '',
pub_date: '',
mp4_: data.article_id != '172' ? '' : `
`,
c_t_a: '',
trad_tion: '',
lr_top: '',
person_img: '',
tong_geogle: tong_geogle ? tong_geogle : '',
pdf_: !data.file_pdf || data.file_pdf == '' ? '' : `
PDF ( ${data.pdf_num} )`,
cite_: !data.cite_num || data.cite_num == 0 ? '' :
`
WOS Citations ( ${data.cite_num} )
`,
abstract: data.abstract ? data.abstract.replace(new RegExp("0, 102, 204", "g"), "0,102,153") : '',
link_: '',
stage_: '',
}
if (data.has_html == 0) {
if (data.file_html == '') {
baseInfo.html_ = ''
} else {
baseInfo.html_ = '
HTML ( ' + data.html_num + ' ) '
}
} else {
baseInfo.html_ = '
HTML ( ' + data.html_num + ' ) '
}
// if (data.mains == '') {
// if (data.file_html == '') {
// baseInfo.html_ = ''
// } else {
// baseInfo.html_ = '
HTML ( ' + data.html_num + ' ) '
// }
// } else {
// baseInfo.html_ = '
HTML ( ' + data.html_num + ' ) '
// }
if (data.stage_no == '0') {
baseInfo.stage_ = ''
} else {
baseInfo.stage_ = ' (' + data.stage_no + ')'
}
if (data.other_state == 0) {
baseInfo.otStat = ''
} else if (data.other_state == 1) {
baseInfo.otStat = 'Editorial Expression of Concern'
} else if (data.other_state == 2) {
baseInfo.otStat = 'Retracted'
}
if (data.isShowOtime == 1) {
if (data.pub_date && data.pub_date != '') {
baseInfo.pub_date = `Published Date: ${data.pub_date}
`
}
}
if (data.article_id == '86' || data.article_id == '176' || data.article_id == '455' || data.article_id == '400' || data.article_id == '145' || data.article_id == '116' || data.article_id == '717' || data.article_id == '632' || data.article_id == '24') {
baseInfo.person_img = '
'
} else {
baseInfo.person_img = '
'
}
if (c_t_a == 'different') {
if (data.journal_id == 22) {
baseInfo.c_t_a = ''
} else {
baseInfo.c_t_a = ''
}
} else {
baseInfo.c_t_a = ''
}
baseInfo.link_ = `
Abstract ( ${data.abs_num} ) ${baseInfo.html_}${baseInfo.pdf_}${baseInfo.mp4_}${baseInfo.c_t_a}${baseInfo.cite_}${baseInfo.tong_geogle}
${data.cite}
${data.abstract}
`;
if (data.tradition_tag == '' || data.tradition_tag == null) {
var maxwidth = maxwidth ? maxwidth : 800;//显示多少字符
if (data.abstract && data.abstract.length > maxwidth) {
var abstNew = data.abstract.replace(/<.*?>/ig, "")
abstNew = abstNew.substring(0, maxwidth)
abstNew = abstNew.substring(0, maxwidth - abstNew.split(" ").pop().length)
baseInfo.trad_tion = '' + abstNew + '...
'
} else {
baseInfo.trad_tion = '' + data.abstract ? data.abstract : '' + '
'
}
} else {
baseInfo.trad_tion = '' + data.tradition_tag + '
' + data.tradition + '
'
}
if (data.topic && data.topic.length > 0) {
for (var t = 0; t < data.topic.length; t++) {
baseInfo.lr_top += '' + data.topic[t].title + ''
}
}
return baseInfo
}
function commonHandleClickHtml() {
// 点击Abstract显示隐藏
$('.txt_zhaiyao').click(function () {
$(this).nextAll('div').toggle();
if ($(this).nextAll('div').css("display") == 'block') {
var num = $(this).next().html();
$.ajax({
type: 'post', url: apiUrl + 'yuan/Article/addArticleNum', async: false,
data: { "article_id": $(this).attr('alt'), "type": 'abs' },
success: function (result) {
if (result.code == 0) {
num = num * 1 + 1 * 1
}
}
})
$.ajax({
type: 'post', url: apiUrl + 'super/Publish/addVisitNum',
data: { 'type': Jour_num, 'is_detail': '1' },
success: function (result) {
}
});
$(this).next().html(num);
}
})
$('.txt_html').click(function () {
var num = $(this).next().html();
$.ajax({
type: 'post', url: apiUrl + 'yuan/Article/addArticleNum', async: false,
data: { "article_id": $(this).attr('alt'), "type": 'html' },
success: function (result) {
if (result.code == 0) {
num = num * 1 + 1 * 1
}
}
})
$.ajax({
type: 'post', url: apiUrl + 'super/Publish/addVisitNum',
data: { 'type': Jour_num, 'is_detail': '1' },
success: function (result) {
}
});
$(this).next().html(num);
})
$('.txt_pdf').click(function () {
var num = $(this).next().html();
$.ajax({
type: 'post', url: apiUrl + 'yuan/Article/addArticleNum', async: false,
data: { "article_id": $(this).attr('alt'), "type": 'pdf' },
success: function (result) {
if (result.code == 0) {
num = num * 1 + 1 * 1
}
}
})
$.ajax({
type: 'post', url: apiUrl + 'super/Publish/addVisitNum',
data: { 'type': Jour_num, 'is_detail': '1' },
success: function (result) {
}
});
$(this).next().html(num);
})
$('.export_cite').css('display', 'none');
$(document).click(function (e) {
if (!$(e.target).is('.export_cite') && !$(e.target).is('.cite_box')) {
$('.export_cite').hide();
}
})
$('.cite_box').click(function () {
$('.export_cite').css('display', 'none');
commonGetCiteList($(this).attr('article_id'))
$(this).find('.export_cite').fadeIn(200);
})
$('.export_cite').click(function (e) { e.stopPropagation() })
// 点击弹窗出现 复制和下载
$('.txt_content').css('display', 'none');
$('.export').css('display', 'none');
$(document).click(function (e) {
if (!$(e.target).is('.export') && !$(e.target).is('.txt_copy')) {
$('.export').hide();
}
})
$('.txt_copy').click(function () {
$('.export').css('display', 'none');
$(this).find('.export').fadeIn(200);
})
$('.Exc_1').click(function () {
var content_ = $(this).parents('.txt_copy').nextAll('.txt_content').text();
var clipboard = new Clipboard('#' + $(this).attr('id'), {
text: function () {
return content_;
}
})
clipboard.on('success', function (e) {
ShowSuccess("Citation information has been copied!");
});
})
$('.Exc_2').click(function () {
var ecx_id = $(this).parents('.links_').siblings('.txt_biaoti').attr('id')
$.ajax({
type: 'post', url: apiUrl + 'api/Article/getArticleenw', async: false,
data: { "article_id": ecx_id },
success: function (result) {
var a = document.createElement('a');
a.href = result.data.url;
a.download = ''
a.click();
}
})
})
$('.Exc_3').click(function () {
var ecx_id = $(this).parents('.links_').siblings('.txt_biaoti').attr('id')
$.ajax({
type: 'post', url: apiUrl + 'api/Article/getArticleRis', async: false,
data: { "article_id": ecx_id },
success: function (result) {
var a = document.createElement('a');
a.href = result.data.url;
a.download = ''
a.click();
}
})
})
$('.Exc_4').click(function () {
var ecx_id = $(this).parents('.links_').siblings('.txt_biaoti').attr('id')
$.ajax({
type: 'post', url: apiUrl + 'api/Article/getArticlebib', async: false,
data: { "article_id": ecx_id },
success: function (result) {
var a = document.createElement('a');
a.href = result.data.url;
a.download = ''
a.click();
}
})
})
$('.Exc_5').click(function () {
var ecx_id = $(this).parents('.links_').siblings('.txt_biaoti').attr('id')
$.ajax({
type: 'post', url: apiUrl + 'api/Article/getArticletext', async: false,
data: { "article_id": ecx_id },
success: function (result) {
var a = document.createElement('a');
a.href = result.data.url;
a.download = ''
a.click();
}
})
})
}
//获取 cite 并添加 html
function commonGetCiteList(a_ID) {
$('.cite_box .export_cite').html('');
var journalCiteStr = ''
$.ajax({
type: 'post', url: apiUrl + 'api/Article/getArticleCites',
data: {
"article_id": a_ID
},
success: function (result) {
if (result.code == 0) {
var arr = result.data.list
for (let i in arr) {
journalCiteStr += `
${Number(i) + 1}.
${arr[i].article_name}
${arr[i].author ? `${arr[i].author},` : ''} ${arr[i].journal_name}${arr[i].vol ? `${arr[i].vol},` : ''}
`
}
journalCiteStr += ` `
$('.cite_box .export_cite').html(journalCiteStr);
}
}
})
}