From 68b2172a35246e28a36af5e5f4c8912b5e570705 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: Mon, 26 Jan 2026 09:47:55 +0800 Subject: [PATCH] =?UTF-8?q?pdf=E7=94=9F=E6=88=90=E4=B8=8E=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/img/icon_pdf.png | Bin 0 -> 4301 bytes src/common/js/commonJS.js | 72 +- src/components/common/common.vue | 13 +- src/components/page/GenerateCharts.vue | 92 +- src/components/page/articleListEditor_B1.vue | 112 +- .../page/components/Tinymce/index.vue | 162 +- src/components/page/components/table/111.css | 1 - .../page/components/table/LateX copy.vue | 151 - .../page/components/table/word copy.vue | 4056 ----------------- src/components/page/per_text.vue | 4 +- src/utils/tinymceStyles.js | 5 + vue.config.js | 10 +- 12 files changed, 299 insertions(+), 4379 deletions(-) create mode 100644 src/assets/img/icon_pdf.png delete mode 100644 src/components/page/components/table/111.css delete mode 100644 src/components/page/components/table/LateX copy.vue delete mode 100644 src/components/page/components/table/word copy.vue diff --git a/src/assets/img/icon_pdf.png b/src/assets/img/icon_pdf.png new file mode 100644 index 0000000000000000000000000000000000000000..f26a91fe1e908e6e6fe0a653431ae145c09f94a3 GIT binary patch literal 4301 zcmZ`-c{G%7`+sK4SQ|~gCcDPI?_umCdzS2bvZaXZvV>7#tfP`OJK48{u?&i#5FsTY zSxQW{qG<4YI=?^O_q^wQ|9I}}+@I$<_kEpfIrrzflFZEv5R9CR001D240SC*`SR~a zPYbT~_6>yqfCP+mwXMS;lmgRKZUc^lUQRWALv9RkKWN7>dBFd|y&#+pixZNZeo6Of z=6vYNH)A~UKsS^AgQnm`GtB^cSdxRp!ev8qBppRmFkI)iiZ+q~33E@w6ay@5199P% zzZVw1eOO<}-SZtcxpmZCcF@*Y+f`G$&{){8zP?b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k<&p&4g=)+QAo?2$ySj&P1si%GBqa+uxC5{A;V0~!ZVrBWsf`eFfz_IaUJ4dR6P^@a(WuW8Fe@ z@l=P-GA~F5Bq=h9{!vHuYMTGgQruVX(+o;;g9hPdZR!&?AMQ4d(ZB9t@T1(fTdoORhA$r9yq|c|lTXsYLIT(0<_k0N_;eILkIfEVb7h8gs#*dhrV= zB>f9O@}Tb)xv16f)wgff(oz$va~GXN{+ZGe8FWb*bgwh!>21pt?&K{O;)$3s1pR+s zHETLA4Rno?s(ki;0JOPGOwqycC7OYd?H?{&j-h$@Y)(%qgOd06hXoGZ8DIb=sME!* zgBHtu1)SbF_Za^z59kefrgOe{F^+mgRR)JEaZHbsuV4>%6P%>fomLxyRUmNRPtjgX z|1hW7&0fLk%5n+yU!s$#;B5%xV}OrN6!^>rMa_JWeJ|t>;V^-3;@$mjHC&VpZe(Ro zWeYDajPVWb&lW|*;3^F$*hjXaD<_Bax1PJ>8@R;@yW^IqcvZ_ zj(2meTNPuK7TfN_qUL-@y7%o|#Dm(v`r9O0Sn?vOwDcNMQZ4J&bH-$wkJerKPD~Co zwK_GXkEz_}{AC=M3(@V%oYV~s^c#MyyOac2zAMuq-8Jq!!z#{~`0)h$U|oYV_0CbO zs|-*it5TvaoNFTARY8gu-q1gE&=SI{{+9g|db_vKwBfXN^Ou~kSGoAh6MmSHH@Yw0 z0%bHeTDphUqq() tX_e(=^TiYJ;**mW5pWm*0JMKCpaGsoz08>6s_pp;8R?nnHe7JM^M5j^wzL2M literal 0 HcmV?d00001 diff --git a/src/common/js/commonJS.js b/src/common/js/commonJS.js index e6f6b8f..c1a47de 100644 --- a/src/common/js/commonJS.js +++ b/src/common/js/commonJS.js @@ -147,47 +147,53 @@ export default { - replaceWMathContent(inputHtml, callback) { - // 使用正则表达式查找所有 标签,并提取 data-latex 的内容 - var str = inputHtml.replace(/[^<]*<\/wmath>/g, function (match, latexContent) { - // 返回 标签,内容替换为 data-latex 的值 - return `${latexContent}`; + // 正则逻辑:匹配整个 wmath 标签,并捕获内部所有的属性字符串 + var str = inputHtml.replace(/]+)>[^<]*<\/wmath>/g, function (match, allProps) { + + // 1. 从所有属性中提取 data-latex 的值 + const latexMatch = allProps.match(/data-latex="([^"]+)"/); + const latexContent = latexMatch ? latexMatch[1] : ''; + + // 2. 从所有属性中提取 data-wrap 的值 + const wrapMatch = allProps.match(/data-wrap="([^"]+)"/); + const wrapAttr = wrapMatch ? ` data-wrap="${wrapMatch[1]}"` : ''; + + // 3. 重新组装:只保留 data-latex 和 data-wrap + // 注意:这里去掉了多余的 prefix/suffix,确保标签“干净” + return `${latexContent}`; }); - - // 调用回调函数并传递处理后的结果 + callback(str); - - // 输出结果到控制台 - // console.log('Processed HTML:', str); - } - - - , + } , // **解析 MathJax 公式,获取 LaTeX** async extractMathJaxLatex(cell, callback) { return new Promise((resolve, reject) => { - // Step 1: First, process the math content and extract LaTeX from tags - let updatedContent = cell.innerHTML; // Start with the cell's inner HTML - - // Find all elements + // Step 1: 获取初始 HTML + let updatedContent = cell.innerHTML; + + // 查找所有 元素 const wmathElements = cell.querySelectorAll('wmath'); + wmathElements.forEach((element) => { - // Get the LaTeX content from the data-latex attribute - const latexContent = element.getAttribute('data-latex'); - - // Replace the tag with its LaTeX content wrapped in $$...$$ - updatedContent = updatedContent.replace(element.outerHTML, `${latexContent}`); + // 1. 提取 latex 内容 + const latexContent = element.getAttribute('data-latex') || ''; + + // 2. 提取 wrap 模式 (只提取,不包裹) + const wrapMode = element.getAttribute('data-wrap') || 'block'; + + // 3. 重新组装标签:只保留属性,标签内部只放原始 latex 文本 + // 这里不加 $ 或 $$,保持数据的原始性 + const newWmathTag = `${latexContent}`; + + // 4. 执行替换 + updatedContent = updatedContent.replace(element.outerHTML, newWmathTag); }); - - - // Step 2: Now extract content without the outer tags + + // Step 2: 提取去掉外层 span 的内容 updatedContent = this.extractContentWithoutOuterSpan(updatedContent); - - // Step 3: Call the callback function with the final updated content - // callback(updatedContent); - - // Resolve the promise with the final content + + // Step 3: Resolve 结果 resolve(updatedContent); }); } @@ -843,7 +849,7 @@ export default { // 使用正则表达式删除属性(保留 data-latex) let updatedAttributes = attributes.replace(/\s([a-zA-Z0-9-]+)(="[^"]*")?/g, function (attrMatch, attrName) { - if (attrName === "data-latex" || attrName === "data-id") { + if (attrName === "data-latex" || attrName === "data-id" || attrName === "data-wrap") { return attrMatch; } if (type == 'table' && tag == 'img' && (attrName === "src" || attrName === "width" || attrName === "height")) { @@ -2098,7 +2104,7 @@ export default { const uid = 'wmath-' + Math.random().toString(36).substr(2, 9); // 3. 创建一个 标签并插入到光标处 - const wmathHtml = ``; + const wmathHtml = ``; ed.insertContent(wmathHtml); // 在光标位置插入 wmath 标签 // 4. 打开公式编辑器窗口,并传递光标位置、编辑器 ID 和 wmathId diff --git a/src/components/common/common.vue b/src/components/common/common.vue index 4a59fb9..865442c 100644 --- a/src/components/common/common.vue +++ b/src/components/common/common.vue @@ -5,16 +5,23 @@ // const mediaUrl = '/public/'; // const baseUrl = '/'; +//正式环境 + // const mediaUrl = 'https://submission.tmrjournals.com/public/'; // // const mediaUrl = 'http://zmzm.tougao.dev.com/public/'; // const baseUrl = '/api' -const mediaUrl = 'http://tougaotest.tmrjournals.com/public/'; -// const mediaUrl = 'http://zmzm.tougao.dev.com/public/'; +//测试环境 + +// const mediaUrl = 'http://tougaotest.tmrjournals.com/public/'; +// // const mediaUrl = 'http://zmzm.tougao.dev.com/public/'; +// const baseUrl = '/api'; + +////新正式环境 +const mediaUrl = 'http://mytest.tmrjournals.com/public/'; const baseUrl = '/api'; //本地(正式环境 ) - // const mediaUrl = 'https://submission.tmrjournals.com/public/'; // const baseUrl = '/api'; diff --git a/src/components/page/GenerateCharts.vue b/src/components/page/GenerateCharts.vue index a290caf..ab070ba 100644 --- a/src/components/page/GenerateCharts.vue +++ b/src/components/page/GenerateCharts.vue @@ -162,6 +162,7 @@ Figure Title : { + // 获取用户选中的文本 + const selection = document.getSelection().toString(); + + // 你可以修改剪贴板内容 + // event.clipboardData.setData('text/plain', selection + '\n---来自我的系统---'); + + console.log('用户复制了内容:', selection); + // 阻止默认行为(如果需要自定义复制逻辑的话) + // event.preventDefault(); +}); + }, async activated() { this.isShowEditComment(); @@ -604,6 +623,11 @@ export default { }, methods: { + openAddTable(content) { + this.editVisible = false; + this.threeVisible = true; + this.$forceUpdate(); + }, async copyArray(data) { try { // 将数组内容转换为字符串,使用换行符分隔 @@ -848,30 +872,45 @@ export default { } }, saveLateX(data) { - console.log('data at line 735:', data); - const { editorId, wmathId, latex } = data; - const newLatex = latex ? latex.trim() : ''; - if (!editorId || !wmathId) return; - const targetEditor = tinymce.get(editorId); - if (!targetEditor) return; - const targetWmath = targetEditor.dom.select(`wmath[data-id="${wmathId}"]`, targetEditor.getBody())[0]; - if (targetWmath) { - if (!newLatex) { - // ❌ 删除公式 - targetEditor.dom.remove(targetWmath); - } else { - // ✅ 更新公式 - targetWmath.setAttribute('data-latex', newLatex); - targetWmath.innerHTML = newLatex; - - setTimeout(() => { - if (typeof renderMathJax === 'function') { - // this.window.renderMathJax(editorId); - } - }, 10); - } + console.log('data at line 735:', data); + // 1. 从 data 中解构出 wrap (或者你命名的模式变量) + const { editorId, wmathId, latex, wrap } = data; + const newLatex = latex ? latex.trim() : ''; + + if (!editorId || !wmathId) return; + + const targetEditor = tinymce.get(editorId); + if (!targetEditor) return; + + // 2. 找到编辑器中现有的 wmath 标签 + const targetWmath = targetEditor.dom.select(`wmath[data-id="${wmathId}"]`, targetEditor.getBody())[0]; + + if (targetWmath) { + if (!newLatex) { + // ❌ 删除公式 + targetEditor.dom.remove(targetWmath); + } else { + // ✅ 更新公式 + // 保持属性纯净:同时更新 latex 内容和 wrap 属性 + targetWmath.setAttribute('data-latex', newLatex); + + // 如果 data 中传了 wrap 模式就更新它,否则可以保留原样或设为默认 + if (wrap) { + targetWmath.setAttribute('data-wrap', wrap); } - }, + + // 内部只放纯 latex 文本,不包裹 $ 符号 + targetWmath.innerHTML = newLatex; + + setTimeout(() => { + if (typeof renderMathJax === 'function') { + // 重新渲染该编辑器内的数学公式 + renderMathJax(editorId); + } + }, 10); + } + } +}, async huifu(id) { var that = this; await this.$confirm(this.$t('commonTable.reContent'), 'Prompt', { @@ -2532,4 +2571,9 @@ export default { background-color: #0066990d; /* display: block !important; */ } +wmath[data-wrap="inline"] { + display: inline-block !important; + width: auto !important; + +} diff --git a/src/components/page/articleListEditor_B1.vue b/src/components/page/articleListEditor_B1.vue index a7b3870..2e058f9 100644 --- a/src/components/page/articleListEditor_B1.vue +++ b/src/components/page/articleListEditor_B1.vue @@ -746,27 +746,36 @@
+ + {{ isGenerating ? 'Generating PDF...' : 'Generate PDF' }} Click the button below to start high-quality PDF typesetting.
-
Download list
-

No Manuscript

-
- +
Download list + + + Supplementary Material : + + +
+

No Manuscript

+
+ Typesetting {{ index + 1 }} - Time : {{ modifDate(item.ctime * 1000) }} - + Time : {{ modifDate(item.create_time * 1000) }} + +
@@ -1284,6 +1293,7 @@ export default { } ], DLfileList: [], + PDFfileList: [], UpTypeFile: { pdf: '' }, @@ -1478,44 +1488,34 @@ export default { this.getAuthorJG(); this.getCount(); this.getWorldPdf(); + this.getPdfList(); }, methods: { async generatePDF() { - // 1. 验证是否选择了模板 - if (!this.shuTter.board) { - this.$message.warning("Please select a template first!"); - return; - } + // 1. 验证逻辑(保持原样) - this.isGenerating = true; - this.percentage = 0; + try { + this.isGenerating = true; // 开启加载 - try { - // 模拟进度条逻辑(如果是真实接口,可以根据后端返回或者固定时长模拟) - let timer = setInterval(() => { - if (this.percentage < 90) this.percentage += 10; - }, 500); + // 注意:这里要加 await,确保拿到结果后再往下走 + const res = await this.$api.post('api/Production/createArticlePdf', { + p_article_id: this.p_article_id + }); - // 调用你的生成接口 (假设是 Establish 的升级版) - // const res = await api.createPDF({ board: this.shuTter.board }); - - // 模拟接口请求耗时 - await new Promise(resolve => setTimeout(resolve, 3000)); + if (res.status == 1) { + this.$message.success("The PDF document is being processed. Please wait and refresh the page in one minute."); + } else { + this.$message.error("Generation failed, please try again."); + } - this.percentage = 100; - clearInterval(timer); - - this.$message.success("PDF Generated Successfully!"); - - // 自动刷新左侧的下载列表 - // this.getDLFileList(); - - } catch (error) { - this.$message.error("Generation failed, please try again."); - } finally { - this.isGenerating = false; - } - }, + } catch (error) { + console.error(error); + this.$message.error("Network error, please try again."); + } finally { + // 只有请求真正完成后,才会执行这里 + this.isGenerating = false; + } +}, getArticleFinal(id) { // api/Finalreview/getRecord this.$api @@ -1785,6 +1785,40 @@ export default { this.$message.error(err); }); }, + refreshPdfList(){ const loading = this.$loading({ + lock: true, + text: 'Loading...', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }); + try { + this.getPdfList(); + loading.close(); + } catch (error) { + this.$message.error(error); + } + }, + getPdfList() { + // 可以下载的word列表 + + this.$api + .post('/api/Production/getProductionArticlePdf', { + p_article_id: this.p_article_id + }) + .then((res) => { + if (res.status == 1) { + + this.PDFfileList = res.data; + } else { + + this.$message.error(res.msg); + } + }) + .catch((err) => { + + this.$message.error(err); + }); + }, getCount() { // 获取国家列表 @@ -3143,7 +3177,7 @@ export default { } .right-panel { - width: 45%; /* 右侧固定宽度 */ + width: 48%; /* 右侧固定宽度 */ } .right-panel h5 { font-weight: normal; diff --git a/src/components/page/components/Tinymce/index.vue b/src/components/page/components/Tinymce/index.vue index 5b73b72..9bcd2ca 100644 --- a/src/components/page/components/Tinymce/index.vue +++ b/src/components/page/components/Tinymce/index.vue @@ -1,5 +1,6 @@ @@ -538,32 +539,35 @@ myfigure *, _this.$commonJS.initEditorButton(_this, ed); var currentWmathElement = null; ed.on('click', function (e) { - const wmathElement = e.target.closest('wmath'); - if (wmathElement) { - currentWmathElement = wmathElement; // 👈 保存当前点击的元素 - const latexContentRaw = wmathElement.getAttribute('data-latex') || ''; - console.log('at line 488: raw =', latexContentRaw); - // 去除所有 $ 符号 - const latexContent = latexContentRaw.replace(/\$/g, '').trim(); + const wmathElement = e.target.closest('wmath'); + if (wmathElement) { + currentWmathElement = wmathElement; // 保存当前点击的元素 + + // 1. 提取内容:获取 LaTeX + const latexContentRaw = wmathElement.getAttribute('data-latex') || ''; + const latexContent = latexContentRaw.replace(/\$/g, '').trim(); + const encoded = encodeURIComponent(latexContent); - // 编码后用于传递到弹窗 - const encoded = encodeURIComponent(latexContent); - // 给 wmath 添加唯一 data-id,方便后续精准替换 - let wmathId = wmathElement.getAttribute('data-id'); - if (!wmathId) { - wmathId = 'wmath-' + Math.random().toString(36).substr(2, 9); - wmathElement.setAttribute('data-id', wmathId); - } - // 当前编辑器 ID 也保存下来(如果你有多个编辑器) - const editorId = ed.id; - // 打开编辑窗口并传参(传递 data-id + 内容) - window.open( - `/LateX?id=${encoded}&wmathId=${wmathId}&editorId=${editorId}`, - '_blank', - 'width=1000,height=800,scrollbars=no,resizable=no' - ); - } - }); + // 2. 提取状态:获取之前的 wrap 模式 👈 重要新增 + const wrapMode = wmathElement.getAttribute('data-wrap') || 'block'; + + // 3. 处理唯一 ID + let wmathId = wmathElement.getAttribute('data-id'); + if (!wmathId) { + wmathId = 'wmath-' + Math.random().toString(36).substr(2, 9); + wmathElement.setAttribute('data-id', wmathId); + } + + const editorId = ed.id; + + // 4. 打开窗口:在 URL 参数中增加 wrap 模式 👈 这样弹窗就知道该默认选哪个了 + window.open( + `/LateX?id=${encoded}&wmathId=${wmathId}&editorId=${editorId}&wrap=${wrapMode}`, + '_blank', + 'width=1000,height=800,scrollbars=no,resizable=no' + ); + } +}); ed.on('paste', async (event) => { const rtf = event.clipboardData.getData('text/rtf'); @@ -712,7 +716,7 @@ myfigure *, tempDiv.innerHTML = content; if (tempDiv.querySelector('table')) { - console.log('粘贴的内容包含表格'); + if (_this.type == 'table') { // 3. 在这里直接消费外部变量 currentPasteBase64Images // content = content.replace(new RegExp(`src="${silentPlaceholder}"`, 'gi'), () => { @@ -753,21 +757,37 @@ myfigure *, args.content = container.innerHTML; // 更新处理后的内容 }); } else { +// _this.$confirm('检测到粘贴内容包含表格,是否需要以表格形式添加?', '提示', { +// confirmButtonText: '添加表格', +// cancelButtonText: '纯文本添加', +// type: 'info' +// }).then(() => { +// _this.$emit('openAddTable', content); +// return false +// }).catch(() => { + +// }); } } else { console.log('Original content:', content); // 输出原始粘贴内容 - // 改进的正则表达式,匹配 $$...$$ 格式的 LaTeX 公式 - const mathRegex = /\$\$([^$]+)\$\$/g; +// 1. 修改正则:同时匹配 $$...$$ (块级) 和 $...$ (行内) +// 注意:先匹配双美元符,再匹配单美元符,防止冲突 +const mathRegex = /\$\$([\s\S]+?)\$\$|\$([\s\S]+?)\$/g; - // 如果粘贴的内容包含 $$...$$ 格式的公式,进行处理 - content = content.replace(mathRegex, function (match, formula) { - console.log('Matched formula:', formula); // 输出每个匹配的公式 - // 将公式包裹在 标签中,保留 $$...$$ 结构 - return `${match}`; - }); +content = content.replace(mathRegex, function (match, blockFormula, inlineFormula) { + // 判断是块级还是行内 + const formula = blockFormula || inlineFormula; + const mode = blockFormula ? 'block' : 'inline'; + + console.log(`Matched ${mode} formula:`, formula); - console.log('Processed content:', content); // 输出处理后的内容 + // 2. 统一改造:标签内只放纯 formula,不带 $ 符号 + // 属性中保存 data-latex 和 data-wrap + return `${formula.trim()}`; +}); + +console.log('Processed content:', content); // 输出处理后的内容 } // 更新 args.content 为处理后的内容 // 阻止默认的粘贴行为,确保自定义处理优先执行 @@ -816,42 +836,58 @@ myfigure *, // 👂 message 监听器:处理编辑 + 新增两种情况 window.addEventListener('message', function (event) { - const data = event.data; - // console.log('data at line 648:', data); - // ✅ 编辑现有公式:替换或删除 - if (data && data.type === 'update-wmath') { - const { editorId, wmathId, latex } = data; - const newLatex = latex ? latex.trim() : ''; + const data = event.data; + + if (data && (data.type === 'update-wmath' || data.type === 'insert-wmath')) { + const { editorId, wmathId, latex } = data; + const newLatex = latex ? latex.trim() : ''; + if (!editorId) return; - if (!editorId || !wmathId) return; - const targetEditor = tinymce.get(editorId); - if (!targetEditor) return; + const targetEditor = tinymce.get(editorId); + if (!targetEditor) return; - const targetWmath = targetEditor.dom.select(`wmath[data-id="${wmathId}"]`, targetEditor.getBody())[0]; + // 尝试寻找现有标签 + const targetWmath = wmathId ? targetEditor.dom.select(`wmath[data-id="${wmathId}"]`, targetEditor.getBody())[0] : null; - if (targetWmath) { - if (!newLatex) { - // ❌ 删除公式 - targetEditor.dom.remove(targetWmath); - } else { - // ✅ 更新公式 - targetWmath.setAttribute('data-latex', newLatex); - targetWmath.innerHTML = newLatex; + if (targetWmath) { + // --- 原有的更新/删除逻辑 --- + if (!newLatex) { + targetEditor.dom.remove(targetWmath); + } else { + targetWmath.setAttribute('data-latex', newLatex); + if (data.wrapMode === 'inline') { + targetWmath.setAttribute('data-wrap', 'inline'); + } else { + targetWmath.setAttribute('data-wrap', 'block'); + } + targetWmath.innerHTML = newLatex; + } + } else if (newLatex) { + // --- ✨ 新增逻辑:如果找不到现有标签且有 latex 内容 --- + // 生成一个新的唯一 ID (如果你后端或插件没给的话) + const newId = wmathId || 'wmath_' + Date.now(); + + // 构建新的 wmath 标签字符串 + // 这里你可以根据之前选的 wrapMode (块级/行内) 来决定样式 + const htmlToInsert = `${newLatex}`; + + // 在当前光标位置插入内容 + targetEditor.insertContent(htmlToInsert); + } - setTimeout(() => { - if (typeof renderMathJax === 'function') { - this.window.renderMathJax(editorId); - } - }, 10); - } - } - } - }); + // 统一渲染 + setTimeout(() => { + if (typeof renderMathJax === 'function') { + renderMathJax(editorId); + } + }, 10); + } +}); // 🚩 标记为已注册,防止重复 window._wmath_listener_registered = true; - // 🧠 导出保存位置函数(你可以在按钮点击时调用它) + // 导出保存位置函数(你可以在按钮点击时调用它) window._recordLatexInsertContext = function (editorInstance) { latexEditorBookmark = editorInstance.selection.getBookmark(2); activeEditorId = editorInstance.id; diff --git a/src/components/page/components/table/111.css b/src/components/page/components/table/111.css deleted file mode 100644 index 8b13789..0000000 --- a/src/components/page/components/table/111.css +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/components/page/components/table/LateX copy.vue b/src/components/page/components/table/LateX copy.vue deleted file mode 100644 index bede63d..0000000 --- a/src/components/page/components/table/LateX copy.vue +++ /dev/null @@ -1,151 +0,0 @@ - - - - - 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 4f6a6e1..0000000 --- a/src/components/page/components/table/word copy.vue +++ /dev/null @@ -1,4056 +0,0 @@ - - - diff --git a/src/components/page/per_text.vue b/src/components/page/per_text.vue index 31b167e..8b85dd8 100644 --- a/src/components/page/per_text.vue +++ b/src/components/page/per_text.vue @@ -361,7 +361,7 @@ export default { this.add_apply = 0; break; - case 7: + case 7||16: // 7文章状态不在审稿中 this.add_apply = 1; break; @@ -369,7 +369,7 @@ export default { //拒绝审稿 this.add_apply = -1; break; - case 13||16: + case 13: //13 邀请审稿超过5天未同意邀请16同意审稿后14天未进行审稿 this.add_apply = 2; break; diff --git a/src/utils/tinymceStyles.js b/src/utils/tinymceStyles.js index 3adc6f8..7f85222 100644 --- a/src/utils/tinymceStyles.js +++ b/src/utils/tinymceStyles.js @@ -1,4 +1,9 @@ export const tableStyle = ` +wmath[data-wrap="inline"] { + display: inline-block !important; + width: auto !important; + +} .word-img-placeholder { background: #f0f0f0 ; } diff --git a/vue.config.js b/vue.config.js index 50632b5..c888942 100644 --- a/vue.config.js +++ b/vue.config.js @@ -70,14 +70,10 @@ module.exports = { }, proxy: { '/api': { - // target: 'https://www.tmrjournals.cn', - // target: 'http://www.tougao.com/public/index.php/', - // target: 'http://www.tougao.com/', - // target: 'http://192.168.110.110/tougao/public/index.php/', - // target: 'http://api.tmrjournals.com/public/index.php/',//正式 - // target: 'http://zmzm.tougao.dev.com/',//晓玲 + // target: 'http://zmzm.tougao.dev.com/',//晓玲本地 // target: 'https://submission.tmrjournals.com/',//正式 - target: 'http://tougaotest.tmrjournals.com/public/index.php/',//测试环境 + // target: 'http://tougaotest.tmrjournals.com/public/index.php/',//测试环境 + target: 'http://mytest.tmrjournals.com/public/index.php/',//新正式环境 changeOrigin: true, pathRewrite: { '^/api': ''