From 85fbbd84f283a4b96ebb92ba749625f6464c985c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=8B=E4=BA=8E=E5=88=9D=E8=A7=81?= <752204717@qq.com> Date: Thu, 23 Jan 2025 10:32:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.js | 4 +- src/assets/css/main.css | 90 + src/assets/img/replyComment.png | Bin 0 -> 1640 bytes src/common/js/commonJS.js | 360 +++- src/components/common/Home.vue | 8 +- src/components/common/common.vue | 8 +- src/components/common/langs/en.js | 5 +- src/components/common/langs/zh.js | 5 +- src/components/page/Complete_profile.vue | 12 +- src/components/page/GenerateCharts.vue | 284 ++- src/components/page/PreIngestedEditor.vue | 7 +- src/components/page/articleListEditor_E.vue | 16 +- .../page/comArtHtmlCreatNew copy.vue | 299 +++ src/components/page/comArtHtmlCreatNew.vue | 1680 +++++++++++++++-- .../page/components/Tinymce/index.vue | 74 +- src/components/page/components/html/index.vue | 16 +- .../page/components/table/content.vue | 85 +- .../page/components/table/table.vue | 7 +- .../page/components/table/word copy 2.vue | 1621 ---------------- .../page/components/table/word copy.vue | 875 --------- src/components/page/components/table/word.vue | 927 +++++---- .../components/table/wordHtmlTypesetting.vue | 44 +- 22 files changed, 3164 insertions(+), 3263 deletions(-) create mode 100644 src/assets/img/replyComment.png create mode 100644 src/components/page/comArtHtmlCreatNew copy.vue delete mode 100644 src/components/page/components/table/word copy 2.vue delete mode 100644 src/components/page/components/table/word copy.vue diff --git a/src/api/index.js b/src/api/index.js index 170e883..0b11630 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -19,8 +19,8 @@ const service = axios.create({ // baseURL: 'https://submission.tmrjournals.com/', //正式 记得切换 // baseURL: 'http://www.tougao.com/', //测试本地 记得切换 // baseURL: 'http://192.168.110.110/tougao/public/index.php/', - baseURL: '/api', //本地 - // baseURL: '/', //正式 + // baseURL: '/api', //本地 + baseURL: '/', //正式 }); diff --git a/src/assets/css/main.css b/src/assets/css/main.css index 1aa41b3..876e1d5 100644 --- a/src/assets/css/main.css +++ b/src/assets/css/main.css @@ -1330,4 +1330,94 @@ a { .word-container blue { color: rgb(0, 130, 170) !important; +} + +.tinymce-custom-button-blue { + font-weight: bold !important; + color: #007bff !important; + /* 设置字体颜色 */ +} + +.tinymce-custom-button-commentadd { + font-weight: bold !important; + background-color: #fef0f0 !important; + color: #f56c6c !important; + /* 设置字体颜色 */ + fill: #f56c6c !important; + /* font-size:16px!important; */ + /* 设置字体颜色 */ +} + +.tinymce-custom-button-commentadd svg { + + fill: #f56c6c !important; + +} + +.tinymce-custom-button-delete { + font-weight: bold !important; + background-color: red !important; + color: #fff !important; + /* 设置字体颜色 */ + fill: #fff !important; + /* font-size:16px!important; */ + /* 设置字体颜色 */ +} + +.tinymce-custom-button-delete svg { + + + fill: #fff !important; + +} + +.tinymce-custom-button-edit { + font-weight: bold !important; + background-color: rgb(43, 129, 239) !important; + color: #fff !important; + /* 设置字体颜色 */ + fill: #fff !important; + /* font-size:16px!important; */ + /* 设置字体颜色 */ +} + +.tinymce-custom-button-edit svg { + + + fill: #fff !important; + +} + +.tinymce-custom-button-save { + font-weight: bold !important; + background-color: rgb(19, 188, 32) !important; + color: #fff !important; + /* 设置字体颜色 */ + fill: #fff !important; + /* font-size:16px!important; */ + /* 设置字体颜色 */ +} +.tinymce-custom-button-addrow { + font-weight: bold !important; + background-color: #cbccd1 !important; + /* color: #fff !important; */ + /* 设置字体颜色 */ + /* fill: #fff !important; */ + /* font-size:16px!important; */ + /* 设置字体颜色 */ +} + +.tinymce-custom-button-save svg { + + + fill: #fff !important; + +} + +.tinymce-custom-button-removeblue { + font-weight: bold !important; + color: #007bff !important; + /* 设置字体颜色 */ + text-decoration: line-through !important; + /* 设置字体颜色 */ } \ No newline at end of file diff --git a/src/assets/img/replyComment.png b/src/assets/img/replyComment.png new file mode 100644 index 0000000000000000000000000000000000000000..dc43ad97f78ba6b1bee186c65cec54f76fd47005 GIT binary patch literal 1640 zcmV-u2ABDXP) zzpEWZ6vsdNj9B?1iiH>z?2HzQ2x6n6#S4g_ZR)h?to$qN)XE~Y2o_o-7B&`wAQ%Y| zEHs7?NXWYeF+bkD7W;0zx!K)0Gdr_;@1E}mmJsgVnR#=*d(O=4nYk5*EEWrdjjF2p zeEk&g8BhTW-~wVEXyi2TIkoXQ{PzXm(pU|;Ck=T3JBc1(5BR3# zvjy-NFiUMy8zB!M0VI$hfMdX)fqRZJf&df(%Ckq<_y-g)z6A-OET?F9`>VWHx*=^S z1SDV#0bMbFl{bO!do`#7jR6W^5P&7-Lt*1XSO7;#R_>JJzAd0tz9zH~ zRF*w##;+K`_!cw^Nar;0iQ&H6z(1^b+XO1$GH?ZWqenT71p^8JF;rD`4ETe7M(x7_ z_zL(ic%wo<5iT;G@j0yf18O0h>{}2Z4-i9DRh!mXbKs$-599&LuxSF=p%y`OW|0Jt z#usBZpn(ebg-8)71SD|iQZEBfjog$b?g9@l|D%PV0<3iCRp80M?Q`Hc;Q1a^z6`tt zypBzDmw~4tEPxaasAHgqYYvDn5&|(JAYHIkSDleC?mHBZg$i)?_0R{r#_`auNun9ErNMRUCA3xWc=pK!qDO1 z_l|m!@(yJDegXivZYV3)!0=Q@9e;(s+%!Lk`9nRiAa3F88t{1Fp8MwPJ!rGpZQzlv zFRuSVp@EKPzKgv732IN!#S!vP5myP0Th={*p8jT9U$z*yLA~v(i}S!siRDAP-L6v$ zv6WR1pr^l?8R^D{dei6MfqVLF5C5p+vs*C*?Gra3IzXa{;RfCPnYwb=fl$tODr0!sMJ85B6s;wX20Y^t4k-QfMfiiEehO)3{!tj?o_{ zmUD-0`(21F(CPs~FGfUJz9eibvzJy{co{wg-Y4I9=@#%T^{mbEa^F0qlmPNGXWWe8 zA4uGIsu0khn3+_GE4cQ*j*>$2vCFtm{=GD?7$ksvWKF?}3l90|ZV5`c3g0OypN29A+4Fe99LCDth6 z0me!g*+m&jy~r^Q+=M*^B7)o=;I+))IqN zqBn1BRX)IW5wqxKLIT(>Vg}r;Xd37o3BWlLfO8}O=STp~kpP?{0XRnjaE=7voKgaq z@{dYbenetxD3ujFWzSLp?=X=i@!W=*%#&eY%<}-Up{!u%OxaZn0}_C9Bmn0~0M5xR z08hJfCy|6YrQN|pGYRim;(UN*$4p|Oq=6rqP!@8@a{@hugRNx}ZcL;j0XRnjaE=7v z90|ZV5`c3g0Ov>m&XE9|BLO%^0&tE5;2a6SITC<#Bmn2E9t(GXO%PMx`LiupGp{=B zm14+>iS3WuGM1-<6=CR2mdOVj8<_G2)tJkCQYeg<&}lx+(!f3w*|(R8&eLDlL%>*v zE$@(Uy7d~%lQU)f{|P?OP3jmkt@|8l8MoGRj=d4=lcqu7xdII-#WK#z_zyC(+|<@_ zW5rSHSl}%6Aq}D#^KU42Jvn2Dz_P~RW#>^UQ9q#B)!9ectZ=Y&_oAKXUr)8h&Y`?P zlLyeWE==+?+PV^Wlv*q^hJ6Y(t!rma?V&63t)Uddx+*u1yg$oom}iEXK8-a`*Ds0( zD7ia$OmZ$QPnszTK#M{VOzFM;3>iO~DR=M05q*D#5M>(Bm0636-QH2%`~l>7}j { const cells = row.querySelectorAll("td, th"); const rowArray = []; - + let colIndex = 0; - + cells.forEach((cell) => { // 跳过被合并的单元格 while (mergeMap[`${rowIndex},${colIndex}`]) { colIndex++; } - + // 获取单元格内容,如果为空则设置为默认值 let cellText = cell.innerText.trim() || " "; // 处理空值 - + // 处理样式 if (cell.style.fontWeight === "bold") { cellText = `${cellText}`; @@ -101,18 +101,18 @@ export default { if (cell.style.verticalAlign === "sub") { cellText = `${cellText}`; } - + // 检查合并单元格属性 const colspan = parseInt(cell.getAttribute("colspan") || "1", 10); const rowspan = parseInt(cell.getAttribute("rowspan") || "1", 10); - + // 保存当前单元格信息 rowArray[colIndex] = { text: cellText, colspan: colspan, rowspan: rowspan, }; - + // 更新合并单元格信息 if (rowspan > 1 || colspan > 1) { for (let i = 0; i < rowspan; i++) { @@ -122,16 +122,16 @@ export default { } } } - + colIndex++; // 移动到下一列 }); - + tableArray.push(rowArray); // 添加当前行到表格数组 }); - + allTables.push(tableArray); // 添加当前表格到所有表格数组 } - + console.log("解析后的表格数组:", allTables); callback(allTables); // 返回处理后的数组 } catch (error) { @@ -139,7 +139,7 @@ export default { callback([]); } }, - + async extractWordTablesToArrays(file, callback) { const Zip = new JSZip(); try { @@ -445,23 +445,23 @@ export default { console.log('numberingMap at line 232:', numberingMap) // 提取表格 // 获取所有的段落 - const paragraphs = xmlDoc.getElementsByTagName("w:p"); - // 获取所有的表格 - const tables = xmlDoc.getElementsByTagName("w:tbl"); + const paragraphs = xmlDoc.getElementsByTagName("w:p"); + // 获取所有的表格 + const tables = xmlDoc.getElementsByTagName("w:tbl"); - // 找到表格前的段落 - let previousParagraphs = []; - let tableIndex = 0; + // 找到表格前的段落 + let previousParagraphs = []; + let tableIndex = 0; - // 遍历段落,找到第一个表格之前的段落 - for (let i = 0; i < paragraphs.length; i++) { - if (tableIndex < tables.length && paragraphs[i].nextSibling === tables[tableIndex]) { - break; // 找到表格 + // 遍历段落,找到第一个表格之前的段落 + for (let i = 0; i < paragraphs.length; i++) { + if (tableIndex < tables.length && paragraphs[i].nextSibling === tables[tableIndex]) { + break; // 找到表格 + } + previousParagraphs.push(paragraphs[i]); } - previousParagraphs.push(paragraphs[i]); - } -// 将前一段的内容转化为 HTML 或文本 -const previousHtml = this.convertParagraphsToHtml(previousParagraphs); + // 将前一段的内容转化为 HTML 或文本 + const previousHtml = this.convertParagraphsToHtml(previousParagraphs); console.log('tables at line 17:', previousHtml) const tableHtml = this.convertTablesToHtml(tables, numberingMap); console.log('tableHtml at line 18:', tableHtml) @@ -478,45 +478,45 @@ const previousHtml = this.convertParagraphsToHtml(previousParagraphs); callback("

文件解析失败,请检查文件格式。

"); } }, -// 转换段落为 HTML -convertParagraphsToHtml(paragraphs) { - let html = ""; - paragraphs.forEach(p => { - let paragraphHtml = ""; - - // 处理段落中的所有子元素 - const runs = p.getElementsByTagName("w:r"); // 获取段落中的所有文本运行(可能包含上标、下标等) - - Array.from(runs).forEach(run => { - let text = ""; - - // 获取文本内容 - const textNodes = run.getElementsByTagName("w:t"); - Array.from(textNodes).forEach(t => { - text += t.textContent || t.text; + // 转换段落为 HTML + convertParagraphsToHtml(paragraphs) { + let html = ""; + paragraphs.forEach(p => { + let paragraphHtml = ""; + + // 处理段落中的所有子元素 + const runs = p.getElementsByTagName("w:r"); // 获取段落中的所有文本运行(可能包含上标、下标等) + + Array.from(runs).forEach(run => { + let text = ""; + + // 获取文本内容 + const textNodes = run.getElementsByTagName("w:t"); + Array.from(textNodes).forEach(t => { + text += t.textContent || t.text; + }); + + // 检查是否为上标或下标 + const isSuperscript = run.getElementsByTagName("w:vertAlign")[0] ? run.getElementsByTagName("w:vertAlign")[0].getAttribute("w:val") === "superscript" : ""; + const isSubscript = run.getElementsByTagName("w:vertAlign")[0] ? run.getElementsByTagName("w:vertAlign")[0].getAttribute("w:val") === "subscript" : ''; + + if (isSuperscript) { + text = `${text}`; + } else if (isSubscript) { + text = `${text}`; + } + + // 拼接到段落 HTML 中 + paragraphHtml += text; }); - - // 检查是否为上标或下标 - const isSuperscript = run.getElementsByTagName("w:vertAlign")[0]?run.getElementsByTagName("w:vertAlign")[0].getAttribute("w:val") === "superscript":""; - const isSubscript = run.getElementsByTagName("w:vertAlign")[0]?run.getElementsByTagName("w:vertAlign")[0].getAttribute("w:val") === "subscript":''; - if (isSuperscript) { - text = `${text}`; - } else if (isSubscript) { - text = `${text}`; - } - - // 拼接到段落 HTML 中 - paragraphHtml += text; + // 将运行的文本拼接成完整的段落 + html += `

${paragraphHtml}

`; }); - // 将运行的文本拼接成完整的段落 - html += `

${paragraphHtml}

`; - }); - - return html; -} -, + return html; + } + , convertTablesToHtml(tables, numberingMap) { const namespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; let html = ""; @@ -774,7 +774,7 @@ convertParagraphsToHtml(paragraphs) { if (['jpg', 'jpeg', 'png'].includes(extension)) { thumbnailContent = `Image ${index}`; } else if (extension === 'tif') { - thumbnailContent = ``; + thumbnailContent = ``; } else { thumbnailContent = `
{ @@ -1151,8 +1151,8 @@ convertParagraphsToHtml(paragraphs) { }, - initEditorButton(vueInstance,ed) { - + initEditorButton(vueInstance, ed) { + ed.ui.registry.addMenuButton('customDropdown', { text: 'Set Title', // 下拉框标题 fetch: function (callback) { @@ -1197,6 +1197,26 @@ convertParagraphsToHtml(paragraphs) { callback(menuItems); } }); + ed.ui.registry.addButton('addRow', { + icon:'duplicate-row', + text: 'Add Row', // 下拉框标题 + onAction: function () { + var edSelection = ed.selection; + const selectedNode = edSelection.getNode(); // 获取选中的节点 + let outerDiv = selectedNode; + while (outerDiv && outerDiv.tagName !== 'DIV') { + outerDiv = outerDiv.parentNode; + } + // 如果找到的 div 节点存在 + if (outerDiv) { + const dataId = outerDiv.getAttribute('main-id'); + console.log('dataId at line 1258:', dataId) + + vueInstance.$emit('onAddRow', dataId); + } + } + + }); // 添加自定义菜单项 ed.ui.registry.addButton('Save', { icon: 'checkmark', @@ -1215,11 +1235,11 @@ convertParagraphsToHtml(paragraphs) { var content; console.log('outerDiv at line 663:', outerDiv.innerHTML); content = outerDiv.innerHTML.replace(/<(?!\/?(img|b|i|sub|sup|span|strong|em |blue)\b)[^>]+>/g, ''); - content =content.replace(/<([a-zA-Z]+)>\s*<\/\1>/g, ''); - content = content.replace(/ /g, ' '); - - content = content.replace(/\s*style="[^"]*"/g, ''); - + content = content.replace(/<([a-zA-Z]+)>\s*<\/\1>/g, ''); + content = content.replace(/ /g, ' '); + + content = content.replace(/\s*style="[^"]*"/g, ''); + var div = document.createElement('div'); div.innerHTML = content; // 将 HTML 字符串加载到 div 中 // 替换所有 @@ -1243,6 +1263,72 @@ convertParagraphsToHtml(paragraphs) { } } }); + ed.ui.registry.addButton('level1', { + // icon: 'highlight-bg-color', + text: 'First level title', + onAction: function () { + var edSelection = ed.selection; + const selectedNode = edSelection.getNode(); // 获取选中的节点 + let outerDiv = selectedNode; + while (outerDiv && outerDiv.tagName !== 'DIV') { + outerDiv = outerDiv.parentNode; + } + // 如果找到的 div 节点存在 + if (outerDiv) { + const dataId = outerDiv.getAttribute('main-id'); + console.log('dataId at line 1258:', dataId) + vueInstance.$emit('onEditTitle', { + mainId: dataId, + value: 1 + }); + + } + } + }); + ed.ui.registry.addButton('level2', { + // icon: 'highlight-bg-color', + text: 'Second level Title', + onAction: function () { + var edSelection = ed.selection; + const selectedNode = edSelection.getNode(); // 获取选中的节点 + let outerDiv = selectedNode; + while (outerDiv && outerDiv.tagName !== 'DIV') { + outerDiv = outerDiv.parentNode; + } + // 如果找到的 div 节点存在 + if (outerDiv) { + const dataId = outerDiv.getAttribute('main-id'); + console.log('dataId at line 1258:', dataId) + vueInstance.$emit('onEditTitle', { + mainId: dataId, + value: 2 + }); + + } + } + }); + ed.ui.registry.addButton('level3', { + // icon: 'highlight-bg-color', + text: 'Third level title', + onAction: function () { + var edSelection = ed.selection; + const selectedNode = edSelection.getNode(); // 获取选中的节点 + let outerDiv = selectedNode; + while (outerDiv && outerDiv.tagName !== 'DIV') { + outerDiv = outerDiv.parentNode; + } + // 如果找到的 div 节点存在 + if (outerDiv) { + const dataId = outerDiv.getAttribute('main-id'); + console.log('dataId at line 1258:', dataId) + vueInstance.$emit('onEditTitle', { + mainId: dataId, + value: 3 + }); + + } + } + }); ed.ui.registry.addButton('Edit', { icon: 'highlight-bg-color', text: 'Edit', @@ -1277,15 +1363,87 @@ convertParagraphsToHtml(paragraphs) { // 如果找到的 div 节点存在 if (outerDiv) { const dataId = outerDiv.getAttribute('main-id'); - let selectedText = edSelection.getContent({ format: 'text' }); - vueInstance.$emit('onAddComment', { - mainId: dataId, - label: selectedText ? selectedText : '' + const type = outerDiv.getAttribute('type'); + + console.log('type:', type); + + // 获取选中的内容(HTML格式) + let selectedContent = edSelection.getContent({ format: 'html' }); + + // 创建一个临时容器来处理 HTML + const tempDiv = document.createElement('div'); + tempDiv.innerHTML = selectedContent; + + // 检查是否包含 标签 + const hasImage = tempDiv.querySelector('img') !== null; + if (hasImage) { + vueInstance.$message.error(vueInstance.$t('commonTable.selectComment')); + return; // 如果包含图片,停止处理 + } + + // 获取清理后的纯文本内容 + let selectedText = tempDiv.innerText.trim(); // 使用 trim() 清理前后的空格 + + // 处理文本中的多余空格:替换多个连续空格为一个空格 + selectedText = selectedText.replace(/\s+/g, ' '); + + // 确保保留的标签 + const allowedTags = ['sup', 'sub', 'strong', 'em', 'b', 'i', 'blue', 'tr', 'td']; + + // 遍历选中的节点并保留需要的标签 + function preserveTags(node) { + if (node.nodeType === 3) { // 文本节点 + return node.nodeValue; + } + if (node.nodeType === 1 && allowedTags.includes(node.nodeName.toLowerCase())) { + return node.outerHTML; // 保留整个标签 + } + return ''; + } + + let preservedContent = ''; + Array.from(tempDiv.childNodes).forEach((childNode) => { + preservedContent += preserveTags(childNode); }); + + // 检查选中的内容是否已经包含嵌套批注 + const containsPositionRemark = tempDiv.querySelector('.positionRemarkIndex'); + if (containsPositionRemark) { + vueInstance.$message.error(vueInstance.$t('commonTable.alreadyCommented')); + return; // 如果已有嵌套批注,停止处理 + } + + // 如果内容不为空,发送批注请求 + if (type == 0) { + if (selectedText !== '') { + vueInstance.$emit('onAddComment', { + mainId: dataId, + label: preservedContent // 发送保留标签的内容 + }); + } else { + vueInstance.$message.error(vueInstance.$t('commonTable.selectComment')); + } + } else if (type == 1) { + vueInstance.$emit('onAddComment', { + mainId: dataId, + label: preservedContent // 发送保留标签的内容 + }); + } else if (type == 2) { + vueInstance.$emit('onAddComment', { + mainId: dataId, + label: preservedContent // 发送保留标签的内容 + }); + } } } } }); + + + + + + ed.ui.registry.addButton('delete', { icon: 'remove', text: 'Delete', @@ -1301,10 +1459,10 @@ convertParagraphsToHtml(paragraphs) { // 如果找到的 div 节点存在 if (outerDiv) { const dataId = outerDiv.getAttribute('main-id'); - vueInstance.$emit('onDelete',dataId); + vueInstance.$emit('onDelete', dataId); } } - + } }); @@ -1320,6 +1478,8 @@ convertParagraphsToHtml(paragraphs) { ed.ui.registry.addButton('customBlue', { text: 'Blue', // 按钮文本 + className: 'custom-button-blue', // 添加自定义类 + // shortcut: "Ctrl+J", onAction: function () { // 在选中的文本周围包裹 标签 var selectedText = ed.selection.getContent(); @@ -1369,7 +1529,39 @@ convertParagraphsToHtml(paragraphs) { } }); }, - + inTinymceButtonClass() { + setTimeout(function () { + // 查找该按钮并添加 className + const commentaddbutton = document.querySelector('.tox-toolbar .tox-toolbar__group .tox-tbtn[data-mce-name="commentadd"]'); + if (commentaddbutton) { + commentaddbutton.classList.add('tinymce-custom-button-commentadd'); + } + const addrowbutton = document.querySelector('.tox-toolbar .tox-toolbar__group .tox-tbtn[data-mce-name="addrow"]'); + if (addrowbutton) { + addrowbutton.classList.add('tinymce-custom-button-addrow'); + } + const deletebutton = document.querySelector('.tox-toolbar .tox-toolbar__group .tox-tbtn[data-mce-name="delete"]'); + if (deletebutton) { + deletebutton.classList.add('tinymce-custom-button-delete'); + } + const editbutton = document.querySelector('.tox-toolbar .tox-toolbar__group .tox-tbtn[data-mce-name="edit"]'); + if (editbutton) { + editbutton.classList.add('tinymce-custom-button-edit'); + } + const savebutton = document.querySelector('.tox-toolbar .tox-toolbar__group .tox-tbtn[data-mce-name="save"]'); + if (savebutton) { + savebutton.classList.add('tinymce-custom-button-save'); + } + const button = document.querySelector('.tox-toolbar .tox-toolbar__group .tox-tbtn[data-mce-name="customblue"]'); + if (button) { + button.classList.add('tinymce-custom-button-blue'); + } + const removebutton = document.querySelector('.tox-toolbar .tox-toolbar__group .tox-tbtn[data-mce-name="removeblue"]'); + if (removebutton) { + removebutton.classList.add('tinymce-custom-button-removeblue'); + } + }, 100); // 延迟执行,确保按钮渲染完成 + } // 通用递归方法 diff --git a/src/components/common/Home.vue b/src/components/common/Home.vue index 272242f..97382ae 100644 --- a/src/components/common/Home.vue +++ b/src/components/common/Home.vue @@ -21,11 +21,11 @@
- - + + - - + +
diff --git a/src/components/common/common.vue b/src/components/common/common.vue index 78346a5..e985d78 100644 --- a/src/components/common/common.vue +++ b/src/components/common/common.vue @@ -2,12 +2,12 @@ //记得切换 //正式 -// const mediaUrl = '/public/'; -// const baseUrl = '/'; +const mediaUrl = '/public/'; +const baseUrl = '/'; -const mediaUrl = 'https://submission.tmrjournals.com/public/'; -const baseUrl = '/api'; +// const mediaUrl = 'https://submission.tmrjournals.com/public/'; +// const baseUrl = '/api'; diff --git a/src/components/common/langs/en.js b/src/components/common/langs/en.js index b6c4ef3..b77b830 100644 --- a/src/components/common/langs/en.js +++ b/src/components/common/langs/en.js @@ -358,6 +358,7 @@ const en = { delete: 'Delete', reply: 'Reply', solve: 'Solve', + cancelsolve: 'Cancel resolved', Resolved: 'Resolved', preview: 'Preview', link: 'Positioning', @@ -377,7 +378,9 @@ const en = { removeAnnotations:'Are you sure you want to delete this Annotation?', removeContent:'Are you sure you want to delete this content?', reContent:'Are you sure you want to restore this content?', - uploadImageInfo:'Figures can only upload files in JPG, JPEG, and PNG formats!' + uploadImageInfo:'Figures can only upload files in JPG, JPEG, and PNG formats!', + selectComment:'Please select the text to add annotations to!', + alreadyCommented:'There are already annotations in the text, please select again!' }, pendingPayment:{ title:'Title', diff --git a/src/components/common/langs/zh.js b/src/components/common/langs/zh.js index f8681aa..0a058d2 100644 --- a/src/components/common/langs/zh.js +++ b/src/components/common/langs/zh.js @@ -351,6 +351,7 @@ const zh = { delete: '删除', reply: '答复', solve: '解决', + cancelsolve: '取消解决', Resolved: '已解决', preview: '预览', positioning: '定位', @@ -370,7 +371,9 @@ const zh = { removeAnnotations: '确定要删除这条批注吗?', removeContent: '确定要删除这条内容吗?', reContent: '确定要恢复这条内容吗?', - uploadImageInfo: 'Figures 只能上传 JPG、JPEG 和 PNG 格式的文件' + uploadImageInfo: 'Figures 只能上传 JPG、JPEG 和 PNG 格式的文件', + selectComment: '请选择要添加批注的文本', + alreadyCommented:'文本中已有批注内容请重新选择', }, pendingPayment: { title: 'Title', diff --git a/src/components/page/Complete_profile.vue b/src/components/page/Complete_profile.vue index 833546b..fd31b4a 100644 --- a/src/components/page/Complete_profile.vue +++ b/src/components/page/Complete_profile.vue @@ -270,12 +270,16 @@ export default { }, // 跳转到图表编辑页面 goGenerateCharts(id) { - this.$router.push({ - path: 'GenerateCharts', + window.open(this.$router.resolve({ path: '/GenerateCharts', query: { id: id - } - }); + } }).href, '_blank'); + // this.$router.push({ + // path: 'GenerateCharts', + // query: { + // id: id + // } + // }); }, // 隐藏alert diff --git a/src/components/page/GenerateCharts.vue b/src/components/page/GenerateCharts.vue index 4a475b9..b2108e1 100644 --- a/src/components/page/GenerateCharts.vue +++ b/src/components/page/GenerateCharts.vue @@ -86,6 +86,7 @@
--> - + @getContent="getContent" + v-if="pictVisible" + @updateChange="(res) => updateChange(res, 'imgNote')" + :height="120" + ref="tinymceChildImgNote" + style="margin-left: -115px" + > @@ -163,6 +168,7 @@ - + @getContent="getContent" + v-if="threeVisible" + @updateChange="(res) => updateChange(res, 'title')" + :height="120" + ref="tinymceChildTitle" + style="margin-left: -115px" + > @@ -198,16 +204,16 @@ > - + @getContent="getContent" + v-if="threeVisible" + @updateChange="(res) => updateChange(res, 'note')" + :height="120" + ref="tinymceChildNote" + style="margin-left: -115px" + >

@@ -224,9 +230,9 @@ :close-on-click-modal="false" > - +

- {{ commentForm.commentLabel }} + {{ commentForm.content }}

@@ -234,6 +240,7 @@ * Comment : + * Content : - + @getContent="getContent" + v-if="editVisible" + ref="commonContent" + style="margin-left: -115px" + > @@ -312,7 +318,13 @@ export default { isShowComment: false, urlList: { delete: 'api/Preaccept/delArticleMains', - addComment: 'api/Preaccept/addMainsRemark', + addRow: 'api/Preaccept/addBlankRow', + addComment: 'api/Preaccept/createArticleMainCheckForEditor', + editComment: 'api/Preaccept/editArticleMainCheck', + solveComment: 'api/Preaccept/completeArticleMainCheckForAuthor', + cancelSolveComment: 'api/Preaccept/rejectArticleMainCheckForEditor', + deleteComment: 'api/Preaccept/delArticleMainCheckForEditor', + replyComment: 'api/Preaccept/rejectArticleMainCheckForAuthor', content: 'api/Preaccept/getArticleMainsRecycle', huifuContent: 'api/Preaccept/replyArticleRecycle', editContent: 'api/Preaccept/editArticleMainsForAuthor', @@ -432,12 +444,13 @@ export default { } }, created() { + localStorage.removeItem('scrollPosition'); this.isShowEditComment(); this.getDate(); this.getCommentList(); // this.loadDictionary().catch(console.error); }, - + mounted() {}, activated() { this.isShowEditComment(); this.getDate(); @@ -478,8 +491,9 @@ export default { // } // }, handleSaveContent() { - this.$refs.tinymceChild.getContent('content'); + this.$refs.commonContent.getTinymceContent('content'); }, + async getContent(type, content) { if (type == 'content') { // 使用正则表达式移除所有不允许的标签 @@ -523,7 +537,7 @@ export default { // 6. 如果需要,还可以去除 标签内部的空格 // content = content.replace(/]*>\s*([^<]+)\s*<\/span>/g, '$1'); // 清理 标签内部的空格 - this.saveContent(content); + this.saveContent(content, this.currentContent.am_id); } else if (type == 'table') { this.saveTable(content); } else if (type == 'comment') { @@ -540,12 +554,16 @@ export default { }) .then(() => { this.$api - .post('api/Preaccept/clearMainsRemark', { - am_id: comment.am_id + .post(this.urlList.deleteComment, { + amc_id: comment.amc_id }) .then((res) => { - this.getDate(); - this.getCommentList(); + if (res.code == 0) { + this.getDate(); + this.getCommentList(); + } else { + this.$message.error(res.msg); + } }); // this.comments.splice(index, 1); // 删除评论 }) @@ -570,6 +588,7 @@ export default { if (res.code == 0) { this.editVisible = false; this.getDate(); + this.getCommentList(); } }); }, @@ -605,7 +624,7 @@ export default { .then(async (res) => { if (res.code == 0) { this.ManuscirptContent = res.data.list; - this.$refs.commonWordHtmlTypeSetting.getCommentList(); + // this.$refs.commonWordHtmlTypeSetting.getCommentList(); } }); }, @@ -733,26 +752,62 @@ export default { type: 'warning', message: 'Please enter the Comment!' }); + return; + } + + if (this.commentForm.type == 'user') { + await this.$api + .post(this.urlList.replyComment, { + amc_id: this.commentForm.amc_id, + author_remark: str + }) + .then(async (res) => { + if (res.code == 0) { + this.$forceUpdate(); + this.commentVisible = false; + this.getDate(); + this.getCommentList(); + this.$nextTick(() => {}); + } else { + this.$message.error(res.msg); + } + }) + .catch((err) => { + this.$message.error(err.msg); + }); + } else { + var data = {}; + if (this.commentForm.amc_id) { + data = { + amc_id: this.commentForm.amc_id, + + remark: str + }; + } else { + data = { + article_id: this.articleId, + am_id: this.commentForm.am_id, + content: this.commentForm.content, + remark: str + }; + } + await this.$api + .post(this.commentForm.amc_id ? this.urlList.editComment : this.urlList.addComment, { ...data }) + .then(async (res) => { + if (res.code == 0) { + this.$forceUpdate(); + this.commentVisible = false; + this.getDate(); + this.getCommentList(); + this.$nextTick(() => {}); + } else { + this.$message.error(res.msg); + } + }) + .catch((err) => { + this.$message.error(err.msg); + }); } - await this.$api - .post(this.urlList.addComment, { - am_id: this.commentForm.am_id, - remark: str - }) - .then(async (res) => { - if (res.code == 0) { - this.$forceUpdate(); - this.commentVisible = false; - this.getDate(); - this.getCommentList(); - this.$nextTick(() => {}); - } else { - this.$message.error(res.msg); - } - }) - .catch((err) => { - this.$message.error(err.msg); - }); }, async onComment(dataId) { var data = this.Main_List.find((item) => item.am_id == dataId); @@ -772,18 +827,32 @@ export default { this.getDate(); this.getCommentList(); }, - editComment(comment) { + editComment(comment, type) { + console.log('comment at line 813:', comment); this.commentForm = { - ...comment + ...comment, + type: type, + remark: type == 'user' ? comment.author_remark : comment.remark }; + console.log('this.commentForm at line 815:', this.commentForm); this.commentVisible = true; }, async onAddComment(data) { - console.log('data at line 858:', data); var form = this.Main_List.find((item) => item.am_id == data.mainId); this.commentForm = { - commentLabel: data.label ? data.label : '', - ...form + ...form, + content: data.label ? data.label : '', + remark: '', + type: 'add', + role: 'editor' + }; + this.commentVisible = true; + }, + async replyComment(data) { + this.commentForm = { + ...data, + remark: data.author_remark, + type: 'user' }; this.commentVisible = true; }, @@ -814,6 +883,56 @@ export default { this.$message.error(err.msg); }); }, + async onAddRow(mainId) { + console.log('data at line 886:', mainId) + + await this.$api + .post(this.urlList.addRow, { + am_id: mainId, + article_id: this.articleId + }) + .then(async (res) => { + this.getDate(); + this.getCommentList(); + }) + .catch((err) => { + this.$message.error(err.msg); + }); + }, + async solveComment(data) { + await this.$api + .post(this.urlList.solveComment, { + amc_id: data.amc_id + }) + .then(async (res) => { + if (res.code == 0) { + this.getDate(); + this.getCommentList(); + } else { + this.$message.error(res.msg); + } + }) + .catch((err) => { + this.$message.error(err.msg); + }); + }, + async cancelSolveComment(data) { + await this.$api + .post(this.urlList.cancelSolveComment, { + amc_id: data.amc_id + }) + .then(async (res) => { + if (res.code == 0) { + this.getDate(); + this.getCommentList(); + } else { + this.$message.error(res.msg); + } + }) + .catch((err) => { + this.$message.error(err.msg); + }); + }, clearButton() { var deleteButtons = document.querySelectorAll('.wordButtonContainer'); deleteButtons.forEach(function (button) { @@ -834,10 +953,12 @@ export default { console.log('data at line 600:', data); if (type == 'img') { var extension = data.url.split('.').pop().toLowerCase(); + this.picStyle = {}; this.picStyle = { ...data, extension: extension, picUrl: data.url }; this.picStyle.visiTitle = 'Edit Figure'; this.pictVisible = true; } else if (type == 'table') { + this.lineStyle = {}; this.lineStyle = { ...data, table: JSON.parse(data.table_data), @@ -858,6 +979,9 @@ export default { } }, onEdit(dataId) { + this.currentContent = {}; + this.picStyle = {}; + this.lineStyle = {}; this.currentId = null; this.clearButton(); var data = this.Main_List.find((item) => item.am_id == dataId); @@ -958,7 +1082,7 @@ export default { }, getCommentList() { this.$api - .post('api/Preaccept/getNotes', { + .post('api/Preaccept/getArticleMainCheckList', { article_id: this.articleId }) .then((res) => { @@ -1098,6 +1222,16 @@ export default { .post(urlLInk, urlTask) .then(async (res) => { if (res.code == 0) { + // res.data.list.forEach((data) => { + // if (data.amt_id) { + // try { + // const parsedData = JSON.parse(data.table.table_data); + // } catch (e) { + // console.error(e.message); + // } + // } + // }); + this.Main_List = res.data.list; this.getManuscirptContent(); for (let i = 0; i < this.Main_List.length; i++) { @@ -1216,7 +1350,12 @@ export default { if (res.code == 0) { this.$message.success('Successfully edit Figure!'); this.pictVisible = false; - this.getDate(); + this.$nextTick(() => { + this.getDate(); + this.getCommentList(); + this.$forceUpdate(); + }); + this.$refs.commonWordHtmlTypeSetting.refresh('img'); } else { this.$message.error(res.msg); @@ -1274,8 +1413,11 @@ export default { if (res.code == 0) { this.$message.success('Successfully edit Table!'); this.threeVisible = false; - this.getDate(); - this.$refs.commonWordHtmlTypeSetting.refresh('table'); + setTimeout(() => { + this.getDate(); + this.getCommentList(); + this.$refs.commonWordHtmlTypeSetting.refresh('table'); + }); } else { this.$message.error(res.msg); } diff --git a/src/components/page/PreIngestedEditor.vue b/src/components/page/PreIngestedEditor.vue index f67bc12..7e17c7e 100644 --- a/src/components/page/PreIngestedEditor.vue +++ b/src/components/page/PreIngestedEditor.vue @@ -1671,12 +1671,11 @@ export default { // 6----校对文章 htmlContet() { - this.$router.push({ - path: '/GenerateCharts', + window.open(this.$router.resolve({ path: '/GenerateCharts', query: { id: this.$route.query.id - } - }); + } }).href, '_blank'); + }, // 6----修改时间为年月日 diff --git a/src/components/page/articleListEditor_E.vue b/src/components/page/articleListEditor_E.vue index 3584907..de920a1 100644 --- a/src/components/page/articleListEditor_E.vue +++ b/src/components/page/articleListEditor_E.vue @@ -1217,12 +1217,16 @@ export default { loading.close(); } else { this.HtmlVisible = false; - this.$router.push({ - path: '/GenerateCharts', - query: { - id: this.tg_article_id - } - }); + window.open(this.$router.resolve({ path: '/GenerateCharts', + query: { + id: this.tg_article_id + } }).href, '_blank'); + // this.$router.push({ + // path: '/GenerateCharts', + // query: { + // id: this.tg_article_id + // } + // }); } }, htmlLayout() { diff --git a/src/components/page/comArtHtmlCreatNew copy.vue b/src/components/page/comArtHtmlCreatNew copy.vue new file mode 100644 index 0000000..0743941 --- /dev/null +++ b/src/components/page/comArtHtmlCreatNew copy.vue @@ -0,0 +1,299 @@ + + + + + diff --git a/src/components/page/comArtHtmlCreatNew.vue b/src/components/page/comArtHtmlCreatNew.vue index 0743941..576e917 100644 --- a/src/components/page/comArtHtmlCreatNew.vue +++ b/src/components/page/comArtHtmlCreatNew.vue @@ -1,46 +1,98 @@ diff --git a/src/components/page/components/Tinymce/index.vue b/src/components/page/components/Tinymce/index.vue index 91df3ee..a5b877b 100644 --- a/src/components/page/components/Tinymce/index.vue +++ b/src/components/page/components/Tinymce/index.vue @@ -1,5 +1,6 @@ @@ -110,7 +111,11 @@ const tableStyle = ` b span{ table tr:last-of-type { border-bottom:1.0000pt solid #000 !important;mso-border-bottom-alt:0.5000pt solid #000 !important;; } - + table span blue { + color: rgb(0, 130, 170) !important; + }blue { + color: rgb(0, 130, 170) !important; + } `; export default { @@ -133,11 +138,9 @@ export default { }, isEdit: {}, toolbar: { - type: Array, + required: false, - default() { - return []; - } + }, menubar: { default: 'file edit insert view format table ' @@ -154,6 +157,10 @@ export default { }, isShowArtWorkButton: { default: false + }, + wordStyle: { + type: String, + default: '' } }, data() { @@ -263,8 +270,9 @@ export default { this.$forceUpdate(); }, initTinymce() { - const _this = this; + var _this = this; window.tinymce.init({ + inline: false, // 使用 iframe 模式 selector: `#${this.tinymceId}`, content_css: false, // 禁用默认样式 table_resize_bars: true, // 启用拖动调整功能 @@ -329,24 +337,14 @@ export default { } }, - content_style: `${tableStyle} - .tox-editor-header{ - background-color: #f8f9fa!important; - } - .tox-toolbar:nth-child(1) .tox-toolbar__group:nth-child(2) button.tox-tbtn:nth-child(1){ - font-weight:bold !important; - color: #007bff; /* 设置字体颜色 */ - } - .tox-toolbar:nth-child(1) .tox-toolbar__group:nth-child(2) button.tox-tbtn:nth-child(2){ - font-weight:bold !important; - color: #007bff; /* 设置字体颜色 */ - text-decoration: line-through; - } - table span blue { - color: rgb(0, 130, 170) !important; - }blue { - color: rgb(0, 130, 170) !important; - }`, + content_style: ` + ${tableStyle} + ${_this.wordStyle} + + + + + `, formats: { bold: { inline: 'b' }, @@ -359,9 +357,14 @@ export default { statusbar: false, // 关闭底部状态栏 custom_colors: false, color_map: ['0082AA', 'TMR Blue'], - plugins: 'forecolor code paste table image', // 启用 forecolor 和 code 插件 + plugins: 'forecolor code paste table image mathType', // 启用 forecolor 和 code 插件 end_container_on_empty_block: true, content_css: 'default', // 加载 TinyMCE 默认样式表 + mathjax: { + // 配置 MathJax 用于渲染数学公式 + path: 'https://cdn.mathjax.org/mathjax/latest/MathJax.js', + config: 'TeX-AMS-MML_HTMLorMML' + }, //设置自定义按钮 myCustomToolbarButton setup(ed) { _this.$commonJS.initEditorButton(_this, ed); @@ -408,30 +411,33 @@ export default { // callback(menuItems); // } // }); - + ed.on('init', function () { + _this.$commonJS.inTinymceButtonClass(); const editorBody = ed.getBody(); // 创建 MutationObserver 监听内容变化 const observer = new MutationObserver(() => { const currentContent = ed.getContent(); + if (_this.isAutomaticUpdate) { _this.$emit('updateChange', ed.getContent()); + } }); // 监听子节点和内容的变化 observer.observe(editorBody, { childList: true, subtree: true, characterData: true }); }); - // 定义自定义按钮 - ed.ui.registry.addButton('clearButton', { - text: 'Empty', + // // 定义自定义按钮 + // ed.ui.registry.addButton('clearButton', { + // text: 'Empty', - onAction: () => { - // 插入自定义表格到编辑器中 - ed.setContent(''); - } - }); + // onAction: () => { + // // 插入自定义表格到编辑器中 + // ed.setContent(''); + // } + // }); // 定义自定义按钮 ed.ui.registry.addButton('customButtonExportWord', { diff --git a/src/components/page/components/html/index.vue b/src/components/page/components/html/index.vue index 39b4f33..1c4d7fe 100644 --- a/src/components/page/components/html/index.vue +++ b/src/components/page/components/html/index.vue @@ -948,12 +948,16 @@ export default { loading.close(); } else { this.HtmlVisible = false; - this.$router.push({ - path: '/GenerateCharts', - query: { - id: this.tg_article_id - } - }); + window.open(this.$router.resolve({ path: '/GenerateCharts', + query: { + id: this.tg_article_id + } }).href, '_blank'); + // this.$router.push({ + // path: '/GenerateCharts', + // query: { + // id: this.tg_article_id + // } + // }); } }, htmlLayout() { diff --git a/src/components/page/components/table/content.vue b/src/components/page/components/table/content.vue index 4395049..340d230 100644 --- a/src/components/page/components/table/content.vue +++ b/src/components/page/components/table/content.vue @@ -1,42 +1,50 @@ @@ -111,7 +129,7 @@ td input ::placeholder { ::v-deep .paste-area { height: auto; /* A4纸高度 */ background: white; /* 纸张背景 */ - + /* padding: 25.4mm 19.1mm; //内边距 */ box-sizing: border-box; /* 确保内边距不会影响整体尺寸 */ transform-origin: top left; @@ -141,8 +159,5 @@ td input ::placeholder { overflow-wrap: break-word !important; } .text-container { - } - - diff --git a/src/components/page/components/table/table.vue b/src/components/page/components/table/table.vue index f195d67..a72148e 100644 --- a/src/components/page/components/table/table.vue +++ b/src/components/page/components/table/table.vue @@ -6,11 +6,12 @@ -
-
- -
- -
- - - - - - - - - diff --git a/src/components/page/components/table/word copy.vue b/src/components/page/components/table/word copy.vue deleted file mode 100644 index e8a70e3..0000000 --- a/src/components/page/components/table/word copy.vue +++ /dev/null @@ -1,875 +0,0 @@ - - - diff --git a/src/components/page/components/table/word.vue b/src/components/page/components/table/word.vue index 2bf4ad7..190c497 100644 --- a/src/components/page/components/table/word.vue +++ b/src/components/page/components/table/word.vue @@ -1,16 +1,16 @@