提交tmr底部文章空白

This commit is contained in:
2025-04-01 09:49:06 +08:00
parent 9cba7f3a7c
commit c109771398
2 changed files with 19 additions and 14 deletions

View File

@@ -31,9 +31,10 @@ function commonInit() {
} }
function commonGetItemHtml(doc,maxwidth) { function commonGetItemHtml(doc, maxwidth) {
var data = doc.data; 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 i = doc.i;
var img_i = doc.img_i; var img_i = doc.img_i;
var c_t_a = doc.c_t_a; var c_t_a = doc.c_t_a;
@@ -70,7 +71,7 @@ function commonGetItemHtml(doc,maxwidth) {
baseInfo.html_ = '<img src="img/link_2.png" width="14" height="16"><a href="' + imgFileUrl + 'articleHTML/' + data.file_html + '" target="_blank" class="txt_html" alt="' + data.article_id + '">HTML</a>&nbsp;(&nbsp;<span style="color: red">' + data.html_num + '</span>&nbsp;)&nbsp;&nbsp;' baseInfo.html_ = '<img src="img/link_2.png" width="14" height="16"><a href="' + imgFileUrl + 'articleHTML/' + data.file_html + '" target="_blank" class="txt_html" alt="' + data.article_id + '">HTML</a>&nbsp;(&nbsp;<span style="color: red">' + data.html_num + '</span>&nbsp;)&nbsp;&nbsp;'
} }
} else { } else {
baseInfo.html_ = '<img src="img/link_2.png" width="14" height="16"><a href="article.html?J_num=' + Jour_num + '&a_id=' + data.article_id + '&s_htm=1" target="_blank" class="txt_html" alt="' + data.article_id + '">HTML</a>&nbsp;(&nbsp;<span style="color: red">' +data.html_num + '</span>&nbsp;)&nbsp;&nbsp;' baseInfo.html_ = '<img src="img/link_2.png" width="14" height="16"><a href="article.html?J_num=' + journal_id + '&a_id=' + data.article_id + '&s_htm=1" target="_blank" class="txt_html" alt="' + data.article_id + '">HTML</a>&nbsp;(&nbsp;<span style="color: red">' + data.html_num + '</span>&nbsp;)&nbsp;&nbsp;'
} }
// if (data.mains == '') { // if (data.mains == '') {
// if (data.file_html == '') { // if (data.file_html == '') {
@@ -124,7 +125,7 @@ function commonGetItemHtml(doc,maxwidth) {
if (data.tradition_tag == '' || data.tradition_tag == null) { if (data.tradition_tag == '' || data.tradition_tag == null) {
var maxwidth = maxwidth?maxwidth:800;//显示多少字符 var maxwidth = maxwidth ? maxwidth : 800;//显示多少字符
if (data.abstract.length > maxwidth) { if (data.abstract.length > maxwidth) {
var abstNew = data.abstract.replace(/<.*?>/ig, "") var abstNew = data.abstract.replace(/<.*?>/ig, "")
abstNew = abstNew.substring(0, maxwidth) abstNew = abstNew.substring(0, maxwidth)

View File

@@ -39,9 +39,9 @@ function bf_list() {
wh_topicd = 'top' wh_topicd = 'top'
var st_top_tit = ""; var st_top_tit = "";
var st_top_con = ""; var st_top_con = "";
var forLength = arr_topic[i].title == "Diseases"?10:5 var forLength = arr_topic[i].title == "Diseases" ? 10 : 5
if (wh_number == '1') { if (wh_number == '1') {
for (var j = 0; j < arr_topic[i].children.length; j++) { for (var j = 0; j < arr_topic[i].children.length; j++) {
if (j == forLength) break; if (j == forLength) break;
@@ -229,7 +229,7 @@ function bf_list() {
var mp4_ = '' var mp4_ = ''
} }
if (arr[i].icon == '') { if (arr[i].icon == '') {
var img_i = 'img/baiss.png' var img_i = ''
} else { } else {
var img_i = imgarticleUrl + arr[i].icon var img_i = imgarticleUrl + arr[i].icon
} }
@@ -247,9 +247,13 @@ function bf_list() {
var person_img1 = '<img src="' + img_i + '" alt="" style="width: 120px">' var person_img1 = '<img src="' + img_i + '" alt="" style="width: 120px">'
} else { } else {
var person_img = '<img src="' + img_i + '" alt="" style="height:300px;object-fit: cover;">' var person_img = '<img src="' + img_i + '" alt="" style="height:300px;object-fit: cover;">'
if (img_i && img_i != '') {
var person_img1 = '<div style="height: 240px;background-image: url('+img_i+');background-size:cover;background-position:top;background-repeat:no-repeat;"></div>' var person_img1 = '<div style="height: 240px;background-image: url(' + img_i + ');background-size:cover;background-position:top;background-repeat:no-repeat;"></div>'
} else {
var person_img1 = '<div style="height: auto;background-image: url(' + img_i + ');background-size:cover;background-position:top;background-repeat:no-repeat;"></div>'
}
} }
@@ -273,17 +277,17 @@ function bf_list() {
} else { } else {
var traditionText = arr[i].tradition; var traditionText = arr[i].tradition;
var maxTradHeight = 220; // 设置最大高度 var maxTradHeight = 220; // 设置最大高度
trad_tion = `<div class="tradition-box" style="width:100%;height:auto;line-height:20px;overflow:hidden;"> trad_tion = `<div class="tradition-box" style="width:100%;height:auto;line-height:20px;overflow:hidden;">
<div class="tradition-text">${arr[i].tradition_tag}: ${traditionText}</div> <div class="tradition-text">${arr[i].tradition_tag}: ${traditionText}</div>
</div>`; </div>`;
setTimeout(() => { setTimeout(() => {
let traditionElement = document.querySelector('.tradition-text:last-of-type'); let traditionElement = document.querySelector('.tradition-text:last-of-type');
if (traditionElement.scrollHeight > maxTradHeight) { if (traditionElement.scrollHeight > maxTradHeight) {
let words = traditionText.split(" "); let words = traditionText.split(" ");
let truncatedText = ""; let truncatedText = "";
for (let j = 0; j < words.length; j++) { for (let j = 0; j < words.length; j++) {
truncatedText += words[j] + " "; truncatedText += words[j] + " ";
traditionElement.innerText = truncatedText + "..."; traditionElement.innerText = truncatedText + "...";
@@ -296,7 +300,7 @@ function bf_list() {
} }
}, 100); // 确保 DOM 渲染完成 }, 100); // 确保 DOM 渲染完成
} }
str += '<li><div class="dbt_header">' + arr[i].type + '<div class="url_top">' + lr_top + '</div></div>' + str += '<li><div class="dbt_header">' + arr[i].type + '<div class="url_top">' + lr_top + '</div></div>' +
'<a id="' + arr[i].article_id + '" target="_blank" href="article.html?J_num=' + Jour_num + '&a_id=' + arr[i].article_id + '" class="txt_biaoti">' + otStat + arr[i].title + '</a>' + '<a id="' + arr[i].article_id + '" target="_blank" href="article.html?J_num=' + Jour_num + '&a_id=' + arr[i].article_id + '" class="txt_biaoti">' + otStat + arr[i].title + '</a>' +