pdf按钮生成

This commit is contained in:
2026-01-26 15:43:46 +08:00
parent 68b2172a35
commit 1ad05f016a
5 changed files with 59 additions and 144 deletions

View File

@@ -56,5 +56,6 @@
"less-loader": "^5.0.0",
"sass-loader": "^7.3.1",
"vue-template-compiler": "^2.6.10"
}
},
"packageManager": "pnpm@10.28.1+sha512.7d7dbbca9e99447b7c3bf7a73286afaaf6be99251eb9498baefa7d406892f67b879adb3a1d7e687fc4ccc1a388c7175fbaae567a26ab44d1067b54fcb0d6a316"
}

View File

@@ -572,6 +572,7 @@ myfigure *,
ed.on('paste', async (event) => {
const rtf = event.clipboardData.getData('text/rtf');
if (rtf && rtf.includes('\\pict')) {
const extracted = extractHexImagesFromRTF(rtf);
_this.totalUploadImages = extracted.length; // 设置总数
_this.uploadedImageCount = 0; // 重置已上传数

View File

@@ -20,6 +20,7 @@
<el-form-item style="">
<div style="position: relative; top: 4px; margin-left: 14px">
<el-upload
ref="uploadFile"
class="upload-demo up_newstyle"
@@ -83,7 +84,7 @@ export default {
figure_copyright: this.value,
user_id: localStorage.getItem('U_id'),
type: 'figurecopyright',
url: this.value==1?this.fileList[0].url:'',
url: this.fileList[0].url,
// is_figure_copyright: this.value
}
var this_ = this;

View File

@@ -45,6 +45,13 @@
$${{ latex }}$$</textarea
>
</div>
<div style="margin-bottom: 15px;">
<p style="padding: 10px 0; color: #333;">Text Wrap</p>
<el-select v-model="wrapMode" placeholder="Select wrap mode" style="width: 100%">
<el-option label="Text above and below" value="block"></el-option>
<el-option label="Inline with text" value="inline"></el-option>
</el-select>
</div>
<div style="margin-top: 10px; overflow: hidden">
<el-button type="primary" @click="SaveyLatex" style="background-color: #1654f7 !important; float: right"
>Submit</el-button
@@ -94,7 +101,8 @@ export default {
list: formulaTemplates,
latex: '', // 默认公式
mathFieldInstance: null,
showLatex: false // 控制 LaTeX 代码框的显示与隐藏
showLatex: false, // 控制 LaTeX 代码框的显示与隐藏
wrapMode: 'block',
};
},
mounted() {
@@ -102,6 +110,9 @@ export default {
if (this.$route.query.id) {
this.latex = this.$route.query.id;
}
if (this.$route.query.wrap ) {
this.wrapMode = this.$route.query.wrap;
}
if (this.$refs.mathField) {
const mf = new MathfieldElement();
mf.style.width = '100%';
@@ -202,7 +213,8 @@ export default {
type: 'update-wmath',
latex: this.latex && this.latex != '' ? `$$${this.latex}$$` : '',
editorId: editorId,
wmathId: wmathId
wmathId: wmathId,
wrapMode: this.wrapMode
},
'*'
);

View File

@@ -976,7 +976,7 @@
<div v-if="isEditComment" class="menu-item comment-feat" @mousedown="cacheSelection" @click="menuAction('comment')">
<i class="el-icon-chat-line-square"></i><span>{{ $t('commonTable.Annotations') }}</span>
</div>
<div class="row-divider" v-if="isEditComment &&currentData.type == 0"></div>
<div class="row-divider" v-if="isEditComment && currentData.type == 0"></div>
<div class="menu-item menu-link" v-if="currentData.type == 0 && !currentTag" @click="menuAction('link')">
<i class="el-icon-link"></i><span>{{ $t('commonTable.Association') }}</span>
@@ -1282,7 +1282,7 @@ export default {
// 依然保留 trim() 后的文本判断,用来决定是否显示气泡
const plainText = selection.toString().trim();
if (plainText !== ''&& selection.rangeCount > 0) {
if (plainText !== '' && selection.rangeCount > 0) {
// --- 1. 获取包含标签的 HTML 内容 ---
const fragment = range.cloneContents();
const tempDiv = document.createElement('div');
@@ -1307,15 +1307,15 @@ export default {
this.currentId = allIds[0];
this.currentData = rootItem;
}
}else{
this.currentTag= '';
this.currentTagData={};
this.currentSelection={
label: '',
mainId: '',
index: 0,
content: {}
}
} else {
this.currentTag = '';
this.currentTagData = {};
this.currentSelection = {
label: '',
mainId: '',
index: 0,
content: {}
};
}
});
},
@@ -1472,7 +1472,6 @@ export default {
this.bubbleVisible = true;
this.$forceUpdate();
},
handleGlobalClick(e) {
@@ -1500,101 +1499,6 @@ export default {
document.querySelectorAll('.glowing-border').forEach((el) => el.classList.remove('glowing-border'));
},
// handleMouseUp(e) {
// const selection = window.getSelection();
// // 1. 检查是否有文字选中
// if (selection.isCollapsed || selection.toString().trim() === '') {
// this.bubbleVisible = false;
// return;
// }
// let selectedText = selection.toString().trim();
// // 2. 核心逻辑:只抓取选区“起点”所在的段落
// let anchorNode = selection.anchorNode;
// if (anchorNode.nodeType === 3) anchorNode = anchorNode.parentElement;
// // 向上寻找最近的带有 data-id 的主节点
// const mainNode = anchorNode.closest('[data-id]') || e.target.closest('[data-id]');
// if (mainNode) {
// // --- A. 提取 ID、Index 等关键信息 ---
// const id = mainNode.getAttribute('data-id');
// const mainId = mainNode.getAttribute('main-id');
// const index = parseInt(mainNode.getAttribute('data-index'));
// let typeNode = mainNode;
// let type = typeNode.getAttribute('type');
// // 如果当前节点没有 type向上递归寻找直到找到或到达顶层
// while (typeNode && !type) {
// typeNode = typeNode.parentElement;
// if (typeNode) {
// type = typeNode.getAttribute('type');
// } else {
// break;
// }
// }
// // 最终赋值,如果都没找到则默认为 'text'
// this.menuType = type || 'text';
// // --- B. 强制单一赋值 ---
// this.currentId = mainId || id;
// this.currentIndex = index;
// this.currentData = this.wordList[index];
// // --- C. 选区体验优化 (核心改进点) ---
// const range = selection.getRangeAt(0);
// // 逻辑:如果选区的结束点不在 mainNode 内部(说明选多了/跨段了)
// if (!mainNode.contains(range.endContainer)) {
// const newRange = document.createRange();
// newRange.setStart(range.startContainer, range.startOffset);
// // 强制将终点设置在当前段落的末尾
// newRange.setEndAfter(mainNode.lastChild);
// selection.removeAllRanges();
// selection.addRange(newRange);
// // 重新获取裁剪后的文本
// selectedText = selection.toString().trim();
// }
// // --- D. 记录选中的内容数据 ---
// this.currentSelection = {
// label: selectedText,
// mainId: this.currentId,
// index: index,
// content: this.wordList[index] ? this.wordList[index].content : ''
// };
// // --- E. 业务初始化(拉取按钮数据) ---
// if (!this.isPreview) {
// this.getProofreadingList([id]);
// this.getPList(id);
// }
// // --- F. 定位逻辑 (Fixed 定位) ---
// const rect = selection.getRangeAt(0).getBoundingClientRect();
// const bubbleHeight = 75;
// const toolbarHeight = 125;
// // 判断是否被顶部工具栏挡住
// const isOverlappingToolbar = rect.top < toolbarHeight + bubbleHeight;
// this.bubbleDirection = isOverlappingToolbar ? 'bottom' : 'top';
// const finalTop = isOverlappingToolbar ? rect.bottom + 10 : rect.top - bubbleHeight - 5;
// this.bubbleStyle = {
// position: 'fixed',
// left: `${rect.left + rect.width / 2}px`,
// top: `${finalTop}px`,
// zIndex: 9999,
// display: 'block'
// };
// this.isMenuVisible = true;
// this.bubbleVisible = true;
// }
// },
convertWordListToHtml() {
let htmlString = '';
const mediaUrl = this.mediaUrl || ''; // 确保 mediaUrl 存在
@@ -1844,11 +1748,6 @@ export default {
async initMarkersList() {
await this.getPList();
await this.calcMarkers();
// if (this.markers.length > 0) {
// this.totalItems = this.markers.length;
// // this.currentItem = 1;
// // await this.getProofreadingList([this.markers[this.currentItem - 1].am_id]);
// }
},
async calcMarkers() {
const colors = { 2: '#f97316', 1: '#3b82f6', 3: '#10b981' }; // 可自定义
@@ -2040,13 +1939,12 @@ export default {
this.isMenuVisible = true;
},
closeMenu() {
this.bubbleVisible = false;
this.bubbleVisible = false;
this.isMenuVisible = false;
},
handleAIProofreading() {
if (this.currentId) {
this.$api
.post('api/Proofread/proofReadByLine', {
am_id: this.currentId,
@@ -2078,12 +1976,12 @@ export default {
case 'jump':
this.handleClickJump();
break;
case 'editLink':
this.handleEditLink();
break;
case 'unbindLink':
this.handleUnbindLink();
break;
case 'editLink':
this.handleEditLink();
break;
case 'unbindLink':
this.handleUnbindLink();
break;
case 'proofreading':
this.handleAIProofreading();
break;
@@ -2553,7 +2451,6 @@ export default {
// 确保选择到最外层 div
const outerDiv = e.target.closest('.drop-target') || e.target;
if (outerDiv) {
}
},
@@ -2838,7 +2735,6 @@ export default {
await this.initializeEditor(event, item.am_id, 'text', item, index);
},
initializeEditor: throttle(async function (event, id, type, data, index) {
this.isInternalAction = true; // 开启锁定
if (event && event.stopPropagation) {
event.stopPropagation();
@@ -2874,8 +2770,8 @@ export default {
}
}
setTimeout(() => {
this.isInternalAction = false;
}, 100);
this.isInternalAction = false;
}, 100);
}, 100),
dblclickEdit(id, type, data, index) {
if (!this.isPreview) {
@@ -2931,12 +2827,11 @@ export default {
await this.goToComment(data.am_id, fn);
},
divOnScroll() {
// if (this.isInternalAction) return; // 如果是内部点击引起的微调,直接跳过
const newScrollTop = this.$refs.scrollDiv.scrollTop;
// 如果滚动距离变化极小(可能是点击微调),则跳过
if (Math.abs(newScrollTop - (this.lastScrollTop || 0)) < 10) return;
this.lastScrollTop = newScrollTop;
// 如果滚动距离变化极小(可能是点击微调),则跳过
if (Math.abs(newScrollTop - (this.lastScrollTop || 0)) < 10) return;
this.lastScrollTop = newScrollTop;
this.clearHighlight();
@@ -4307,7 +4202,8 @@ export default {
}
.table-box tr:first-child td {
border-top: 1px solid #000 !important;
}.tableNote {
}
.tableNote {
line-height: 22px;
font-size: 14px;
@@ -4449,9 +4345,13 @@ wmath {
}
}
.menu-jump {
color: #67c23a;
color: #67c23a;
}
.pMain{
.pMain {
cursor: pointer;
}
::v-deep wmath[data-wrap='inline'] {
display: inline-block !important;
width: auto !important;
}
</style>