This commit is contained in:
2025-03-26 13:03:46 +08:00
parent 71efc1065f
commit 677b0d8026
5 changed files with 251 additions and 115 deletions

View File

@@ -7232,7 +7232,7 @@ function article_con() {
if (result.code == 0) {
var html_type = result.data.articleInfo.html_type
var has_html = result.data.articleInfo.has_html
if(has_html==0){
if (has_html == 0) {
$('.wen_rong #tablist .tarhtmn').css('display', 'none');
$('.wen_rong #tablist .tarfihml').css('display', 'none');
$('.wen_rong .content-box .conthtmn').css('display', 'none');
@@ -7610,7 +7610,7 @@ function article_con() {
xuhao++;
item = "<div><p>" + xuhao + '.&nbsp;' + result.data.refers[rr].author + '&nbsp;' + result.data.refers[rr].title + ".&nbsp;" + result.data.refers[rr].dateno + ".";
// 在 "Available at:" 之前插入 <br/> 标签
item += "<br/><a target='_blank' style='color:#006699; word-wrap:break-word;' href='" + result.data.refers[rr].isbn + "'>Available at:&nbsp;</a></p></div>";
item += "<br/><a target='_blank' style='color:#006699; word-wrap:break-word;' href='" + result.data.refers[rr].isbn + "'>ISBN:&nbsp;" + result.data.refers[rr].isbn + "</a></p></div>";
refs += item;
} else if (result.data.refers[rr].refer_type == 'other' && result.data.refers[rr].refer_frag != '' && result.data.refers[rr].refer_frag.length > 15) {
// other 类型,检查 refer_frag 中是否有 "Available at:"
@@ -7631,8 +7631,8 @@ function article_con() {
// 将生成的所有引用内容插入到页面中
$('.wen_rong .content-box .conthtmn').append('<div id="ArticleRef" class="ArticleRef"><p><b>References</b></p>' + refs + '</div>');
}
}
},
error: function () {
@@ -7661,90 +7661,87 @@ function article_con() {
var arr = result.data.mains;
var str = '';
var htmlContent=''
var htmlContent = ''
htmlContent += arr.map((item) => {
//批注
let contentHtml = '';
// 判断是否是图片
if (item.type == 1) {
var picsrc = 'https://submission.tmrjournals.com/public/articleImage/' + item.image.url;
var fun = "picPreview('" + picsrc + "');"
// console.log(fun)
contentHtml = `
contentHtml = `
<p contenteditable="false" main-state="${item.state}" style="display:flex;align-items: center;
justify-content: center;" class="MaxPicture pMain" data-id="${
item.ami_id
justify-content: center;" class="MaxPicture pMain" data-id="${item.ami_id
}" main-id="${item.am_id}">
<img src="${picsrc}" onclick="${fun}" style="width: ${
item.width ? `${item.width}px` : '80%'
<img src="${picsrc}" onclick="${fun}" style="width: ${item.width ? `${item.width}px` : '80%'
}" />
<div class="font" style="width: ${item.width ? `${item.width}px` : '100%'};
<p class="font" style="width: ${item.width ? `${item.width}px` : '100%'};
font-size: 14px;
font-family: 'Charis SIL';
font-weight:normal;
line-height: 22px;
text-align:center;" >${
item.image.note ? item.image.note : ''
}</div>
text-align:center;" >${item.image.note ? item.image.note : ''
}</p>
</p>
`;
} else if (item.type == 2) {
var tableList = JSON.parse(item.table.table_data);
contentHtml = `
<div contenteditable="false" data-id="${item.amt_id}" main-state="${item.state}" main-id="${
item.am_id
}" class="thumbnailTableBox wordTableHtml table_Box pMain" style="width: 100%; padding: 8px 15px; box-sizing: border-box; border-radius: 4px; position: relative;">
<div contenteditable="false" data-id="${item.amt_id}" main-state="${item.state}" main-id="${item.am_id
}" class="thumbnailTableBox wordTableHtml table_Box pMain" style="width: 100%; padding: 8px 15px; box-sizing: border-box; border-radius: 4px; position: relative;">
<font class="font tableTitle" style="width:100%;font-family: 'Charis SIL';" >${item.table.title ? item.table.title : ''}</font>
<table border="1" style="width: 100%; border-collapse: collapse; text-align: center; ">
${tableList
.map((row,i) => {
return `
<tr class="${isHeaderRow(i,tableList)?'table-header-row':''}">
${row
.map((cell) => {
.map((row, i) => {
return `
<tr class="${isHeaderRow(i, tableList) ? 'table-header-row' : ''}">
${row
.map((cell) => {
return `
<td colspan="${cell.colspan || 1}" rowspan="${cell.rowspan || 1}">
<span style="font-family: 'Charis SIL';">${cell.text || ''}</span>
</td>
`;
})
.join('')}
})
.join('')}
</tr>
`;
})
.join('')}
})
.join('')}
</table>
<div class="font" style="width: ${item.width ? `${item.width}px` : '100%'};
<p class="font" style="width: ${item.width ? `${item.width}px` : '100%'};
font-size: 14px;
font-family: 'Charis SIL';
font-weight: 500 !important;
line-height: 22px;
text-align:center;" >${
item.table.note ? item.table.note : ''
}</div>
text-align:center;" >${item.table.note ? item.table.note : ''
}</p>
</div>
`;
} else {
contentHtml = `<p class="${item.is_h1?'Ptitle pMain':'pMain' } " style="font-family: 'Charis SIL';" main-state="${item.state}" contenteditable="false" data-id="${item.am_id}" main-id="${item.am_id}">${item.content}</p>`;
item.content
console.log('item.content at line 7740:', item.am_id, item.content)
contentHtml = `<p class="${item.is_h1 ? 'Ptitle pMain' : 'pMain'} " style="font-family: 'Charis SIL';min-height:12px;" main-state="${item.state}" contenteditable="false" data-id="${item.am_id}" main-id="${item.am_id}">${item.content}</p>`;
}
// 判断是否是表格类型
return contentHtml;
}).join('');
htmlContent=`<div class="newHtml2">${htmlContent}</div>`
htmlContent = `<div class="newHtml2">${htmlContent}</div>`
$('.wen_rong .content-box .conthtmn').html(htmlContent);
// 引用
if (result.data.refers.length > 0) { // 如果有引用数据
@@ -7765,7 +7762,7 @@ var htmlContent=''
xuhao++;
item = "<div><p>" + xuhao + '.&nbsp;' + result.data.refers[rr].author + '&nbsp;' + result.data.refers[rr].title + ".&nbsp;" + result.data.refers[rr].dateno + ".";
// 在 "Available at:" 之前插入 <br/> 标签
item += "<br/><a target='_blank' style='color:#006699; word-wrap:break-word;' href='" + result.data.refers[rr].isbn + "'>Available at:&nbsp;</a></p></div>";
item += "<br/><a target='_blank' style='color:#006699; word-wrap:break-word;' href='" + result.data.refers[rr].isbn + "'>ISBN:&nbsp;" + result.data.refers[rr].isbn + "</a></p></div>";
refs += item;
} else if (result.data.refers[rr].refer_type == 'other' && result.data.refers[rr].refer_frag != '' && result.data.refers[rr].refer_frag.length > 15) {
// other 类型,检查 refer_frag 中是否有 "Available at:" 链接
@@ -7787,7 +7784,7 @@ var htmlContent=''
// 将生成的所有引用内容插入到页面中
$('.wen_rong .content-box .conthtmn').append('<div id="ArticleRef" class="ArticleRef"><p><b>References</b></p>' + refs + '</div>');
}
}
},
error: function () {
@@ -8297,15 +8294,15 @@ var htmlContent=''
}
})
}
function isHeaderRow(rowIndex,table) {
console.log('table at line 697:', table)
var head=table[0]
console.log('head at line 699:', head[0].rowspan)
return rowIndex < head[0].rowspan; // 假设前两行是表头
}
function isHeaderRow(rowIndex, table) {
console.log('table at line 697:', table)
var head = table[0]
console.log('head at line 699:', head[0].rowspan)
return rowIndex < head[0].rowspan; // 假设前两行是表头
}
// 图片预览
function picPreview(src) {
console.log(src)