From 171ddf4761854ffb6d9e2423efd8c6dd1955e805 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: Wed, 15 Oct 2025 15:08:39 +0800 Subject: [PATCH] tijiao --- src/common/js/debounce.js | 59 + src/components/common/langs/en.js | 5 + src/components/common/langs/zh.js | 3 + src/components/page/GenerateCharts.vue | 141 +- .../components/article/onlineOperations.vue | 70 +- src/components/page/components/table/word.vue | 2189 +++++++++++++++-- 6 files changed, 2167 insertions(+), 300 deletions(-) create mode 100644 src/common/js/debounce.js diff --git a/src/common/js/debounce.js b/src/common/js/debounce.js new file mode 100644 index 0000000..b1a6087 --- /dev/null +++ b/src/common/js/debounce.js @@ -0,0 +1,59 @@ +let timeout = null + +/** + * 防抖原理:一定时间内,只有最后一次操作,再过wait毫秒后才执行函数 + * + * @param {Function} func 要执行的回调函数 + * @param {Number} wait 延时的时间 + * @param {Boolean} immediate 是否立即执行 + * @return null + */ +function debounce(func, wait = 500, immediate = false) { + // 清除定时器 + if (timeout !== null) clearTimeout(timeout) + // 立即执行,此类情况一般用不到 + if (immediate) { + const callNow = !timeout + timeout = setTimeout(() => { + timeout = null + }, wait) + if (callNow) typeof func === 'function' && func() + } else { + // 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法 + timeout = setTimeout(() => { + typeof func === 'function' && func() + }, wait) + } +} +function throttle(fn, delay = 1000, immediate = false) { + console.log("进入节流对象") + let timer + let status = false // 是否为重复点击状态 + return function () { + let _this = this + let args = arguments + + if (immediate) { + console.log("立即执行参数 执行一次方法") + fn.apply(_this, args) + immediate = false + return + } + if (status) { + console.log("当前点击状态为正在重复点击,请稍等片刻后在点击执行") + return + } + console.log("执行节流:当前执行了一次点击方法") + fn.apply(_this, args) + status = true // 修改状态 + timer = setTimeout(() => { + console.log("规定时间到,重置状态,可以重新调用") + status = false + }, delay) + } + } + + export { + debounce, + throttle + } \ No newline at end of file diff --git a/src/components/common/langs/en.js b/src/components/common/langs/en.js index f09b622..0f5522b 100644 --- a/src/components/common/langs/en.js +++ b/src/components/common/langs/en.js @@ -363,6 +363,9 @@ const en = { add: 'Add', delete: 'Delete', reply: 'Reply', + execute: 'Execute', + revoke: 'Revoke', + solve: 'Solve', cancelsolve: 'Cancel resolved', Resolved: 'Resolved', @@ -382,6 +385,8 @@ const en = { exportImg: 'Export PNG', PaperRotation: 'Paper Rotation', removeAnnotations: 'Are you sure you want to delete this Annotation?', + removeProofread +: 'Are you sure to delete this suggestion?', 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!', diff --git a/src/components/common/langs/zh.js b/src/components/common/langs/zh.js index c28e8ea..f46893e 100644 --- a/src/components/common/langs/zh.js +++ b/src/components/common/langs/zh.js @@ -354,6 +354,8 @@ const zh = { commonTable: { add: '新增', delete: '删除', + execute: '执行', + revoke: '撤回', reply: '答复', solve: '解决', cancelsolve: '取消解决', @@ -374,6 +376,7 @@ const zh = { exportImg: '导出 图片', PaperRotation: '纸张方向', removeAnnotations: '确定要删除这条批注吗?', + removeProofread: '确定要删除这条建议吗?', removeContent: '确定要删除这条内容吗?', reContent: '确定要恢复这条内容吗?', uploadImageInfo: 'Figures 只能上传 JPG、JPEG 和 PNG 格式的文件', diff --git a/src/components/page/GenerateCharts.vue b/src/components/page/GenerateCharts.vue index 2edbf79..7d3ab4e 100644 --- a/src/components/page/GenerateCharts.vue +++ b/src/components/page/GenerateCharts.vue @@ -88,7 +88,7 @@ -->
- 插入 + 插入
-

Table {{ i + 1 }}

+

Table {{ i + 1 }}

- @@ -393,6 +404,7 @@ + @@ -407,7 +419,7 @@ import bottomTinymce from '@/components/page/components/Tinymce'; export default { data() { return { - zoomNum:(window.innerWidth * 0.38) / 850, + zoomNum: (window.innerWidth * 0.38) / 850, uploadWordTables: [], tablesHtmlVisible: false, tablesHtml: '', @@ -425,6 +437,7 @@ export default { articleId: this.$route.query.id, isShowComment: false, urlList: { + executeProofreading: 'api/Proofread/change', delete: 'api/Preaccept/delArticleMains', addRow: 'api/Preaccept/addBlankRow', addComment: 'api/Preaccept/createArticleMainCheckForEditor', @@ -508,6 +521,8 @@ export default { }, txtVisible: false, addContentVisible: false, + editProofreadingContentVisible: false, + proofreadingContent: {}, addContent: {}, lineStyle: {}, lineStyle1: {}, @@ -555,7 +570,10 @@ export default { } } }, - created() { + async created() { + // await this.$api.post('api/Proofread/proofRead', { + // article_id: this.$route.query.id + // }); localStorage.removeItem('scrollPosition'); this.isShowEditComment(); this.getDate(); @@ -563,14 +581,16 @@ export default { // this.loadDictionary().catch(console.error); }, mounted() {}, - activated() { + async activated() { + // await this.$api.post('api/Proofread/proofRead', { + // article_id: this.$route.query.id + // }); this.isShowEditComment(); this.getDate(); this.getCommentList(); }, methods: { - async copyArray(data) { try { // 将数组内容转换为字符串,使用换行符分隔 @@ -585,7 +605,7 @@ export default { } }, openLatexEditor(data) { - this.showLateX = true; + this.showLateX = true; this.LateXInfo = data; }, isShowEditComment() { @@ -626,6 +646,9 @@ export default { handleSaveAddContent() { this.$refs.addContent.getTinymceContent('addcontent'); }, + handleSaveEditProofreadingContent() { + this.$refs.addContent.getTinymceContent('addcontent'); + }, async getContent(type, content) { if (type == 'content') { @@ -1136,24 +1159,22 @@ export default { }); // 处理文件上传并传递回调函数 this.$commonJS.handleFileUpload(event, function (tables) { - console.log('tables at line 1138:', tables) - if(tables.length == 0){ - loading.close() + console.log('tables at line 1138:', tables); + if (tables.length == 0) { + loading.close(); that.$message({ type: 'warning', message: 'No table found!' - }); - return false + }); + return false; } - + // 使用 Promise.all 等待所有表格解析完成 Promise.all( tables.map((table) => { return new Promise((resolve, reject) => { // 解析每个表格 that.$commonJS.parseTableToArray(table, (tableList) => { - - resolve({ table_data: tableList, html_data: '' }); }); }); @@ -1162,25 +1183,24 @@ export default { .then((result) => { // 所有表格的解析完成后,处理结果 that.uploadWordTables = result; - loading.close() + loading.close(); that.tablesHtmlVisible = true; - }) + }) .catch((error) => { - loading.close() + loading.close(); console.error('Error processing tables:', error); }); }); const file = event.target.files[0]; if (file) { // 处理文件逻辑 - } + } // 关键:重置 input 的值 event.target.value = ''; }, async onAddRow(mainId) { - await this.$api .post(this.urlList.addRow, { am_id: mainId, @@ -1211,6 +1231,59 @@ export default { this.$message.error(err.msg); }); }, + + async executeProofreading(data) { + console.log('data at line 1225:', data); + + await this.$api + .post(this.urlList.executeProofreading, { + am_id: data.am_id, + record_id: data.id, + state: 1, + article_id: this.$route.query.id + }) + .then(async (res) => { + if (res.status == 1) { + this.getDate(); + this.getCommentList(); + } else { + this.$message.error(res.msg); + } + }) + .catch((err) => { + this.$message.error(err.msg); + }); + }, + async revokeProofreading(data) { + console.log('data at line 1225:', data); + + await this.$api + .post(this.urlList.executeProofreading, { + am_id: data.am_id, + record_id: data.id, + state: 2, + article_id: this.$route.query.id + }) + .then(async (res) => { + if (res.status == 1) { + this.getDate(); + this.getCommentList(); + } else { + this.$message.error(res.msg); + } + }) + .catch((err) => { + this.$message.error(err.msg); + }); + }, + async editProofreading(data) { + console.log('data at line 1225:', data); + }, + deleteProofreading(data, index) { + console.log('comment at line 480:', data); + + }, + async cancelSolveComment(data) { await this.$api .post(this.urlList.cancelSolveComment, { @@ -1330,6 +1403,7 @@ export default { this.currentId = dataId; }, + async onDrop(event, dataId) { if (event.dataTransfer.getData('image')) { const draggedImage = JSON.parse(event.dataTransfer.getData('image')); @@ -1514,11 +1588,14 @@ export default { }, // 获取数据 async getDate() { + // await this.$api.post('api/Proofread/proofRead', { + // article_id: this.$route.query.id + // }); this.imagesList = []; let urlLInk = ''; let urlTask = {}; if (this.Art_Id != undefined) { - urlLInk = 'api/Preaccept/getArticleMains'; + urlLInk = 'api/Preaccept/getArticleMainsNew'; urlTask.article_id = this.Art_Id; } @@ -1737,7 +1814,7 @@ export default { } }; var cleanedTableList = content.table ? content.table : []; - + cleanedTableList = cleanTableData(content.table); var strTitle = this.lineStyle1.title ? this.lineStyle1.title : ''; @@ -2204,10 +2281,10 @@ export default { ::v-deep .wordTableHtml table span blue { color: rgb(0, 130, 170) !important; } -::v-deep .wordTableHtml table span blue sup{ +::v-deep .wordTableHtml table span blue sup { color: rgb(0, 130, 170) !important; } -::v-deep .wordTableHtml table span blue sub{ +::v-deep .wordTableHtml table span blue sub { color: rgb(0, 130, 170) !important; } .toolbar { @@ -2295,7 +2372,7 @@ export default { width: 38vw; position: relative; height: auto; -overflow: hidden; + overflow: hidden; padding: 10px; box-sizing: border-box; box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 12px 0px; @@ -2304,13 +2381,13 @@ overflow: hidden; margin-bottom: 0; padding: 15px; } -.uploadWordTableBox .insertTable{ - /* display: none; */ - position: absolute; - right: 10px; +.uploadWordTableBox .insertTable { + /* display: none; */ + position: absolute; + right: 10px; } .uploadWordTableBox:hover { background-color: #0066990d; - /* display: block !important; */ + /* display: block !important; */ } diff --git a/src/components/page/components/article/onlineOperations.vue b/src/components/page/components/article/onlineOperations.vue index dd92748..f84f5c5 100644 --- a/src/components/page/components/article/onlineOperations.vue +++ b/src/components/page/components/article/onlineOperations.vue @@ -11,6 +11,9 @@

Topics

+    

Relevant

@@ -26,7 +29,12 @@ Topics Relevant - Public Micro + Public Micro @@ -46,6 +54,29 @@ + + + + +

+
+ +
+ + + + + +
+ Save Abstract +
+
+
+ + Cancel + + +
@@ -140,6 +171,12 @@
+