数字公式

This commit is contained in:
2025-03-25 09:23:51 +08:00
parent 46f3923a06
commit 3ce099e454
14 changed files with 670 additions and 872 deletions

View File

@@ -151,6 +151,7 @@
:isAutomaticUpdate="true"
:value="picStyle.note"
@getContent="getContent"
@openLatexEditor="openLatexEditor"
v-if="pictVisible"
@updateChange="(res) => updateChange(res, 'imgNote')"
:height="120"
@@ -162,8 +163,8 @@
<span slot="footer" class="dialog-footer">
<el-button @click="pictVisible = false"> Cancel </el-button>
<el-button type="primary" @click="savePic" >
<i class="el-icon-finished" style="margin-right: 5px;"></i>
<el-button type="primary" @click="savePic">
<i class="el-icon-finished" style="margin-right: 5px"></i>
Save Figure
</el-button>
</span>
@@ -171,81 +172,26 @@
<!-- 添加表格 -->
<el-drawer
title="我嵌套了表格!"
class="editTableDialog"
destroy-on-close
v-if="threeVisible"
:title="lineStyle.visiTitle"
:visible.sync="threeVisible"
:wrapperClosable ="false"
:close-on-click-modal="false"
direction="rtl"
size="70%">
<el-form ref="editMes" :model="lineStyle" label-width="80px">
<!-- <common-late-x></common-late-x> -->
<el-form-item label="Title:">
<common-content
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-title`"
:isAutomaticUpdate="true"
:value="lineStyle.title"
@getContent="getContent"
v-if="threeVisible"
@updateChange="(res) => updateChange(res, 'title')"
:height="120"
ref="tinymceChildTitle"
style="margin-left: -115px"
></common-content>
</el-form-item>
<el-form-item label="Word">
<span slot="label">
<font style="color: #f56c6c; margin-right: 5px">*</font>
Table:
</span>
<common-table
@getContent="getContent"
v-if="threeVisible"
ref="commonTable"
:lineStyle="lineStyle"
></common-table>
</el-form-item>
<el-form-item label="Note:">
<common-content
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-note`"
:isAutomaticUpdate="true"
:value="lineStyle.note"
@getContent="getContent"
v-if="threeVisible"
@updateChange="(res) => updateChange(res, 'note')"
:height="120"
ref="tinymceChildNote"
></common-content>
</el-form-item>
</el-form>
<p style="margin-top: 20px; text-align: right">
<el-button @click="threeVisible = false"> Cancel </el-button>
<el-button type="primary" plain @click="handleSaveTable" style="background-color: #006699 !important;background: #006699 !important;margin-right: 20px;color: #fff !important;"> save Table </el-button>
</p>
</el-drawer>
<!-- <el-dialog
title="我嵌套了表格!"
class="editTableDialog"
destroy-on-close
v-if="threeVisible"
:title="lineStyle.visiTitle"
:visible.sync="threeVisible"
width="1200px"
:wrapperClosable="false"
:close-on-click-modal="false"
direction="rtl"
size="70%"
>
<el-form ref="editMes" :model="lineStyle" label-width="80px">
<!-- <common-late-x></common-late-x> -->
<el-form-item label="Title:">
<common-content
:id="`editor-${new Date().getTime()}-${lineStyle.am_id}-${lineStyle.amt_id}-title`"
:isAutomaticUpdate="true"
:value="lineStyle.title"
@getContent="getContent"
@openLatexEditor="openLatexEditor"
v-if="threeVisible"
@updateChange="(res) => updateChange(res, 'title')"
:height="120"
@@ -262,7 +208,7 @@
@getContent="getContent"
v-if="threeVisible"
ref="commonTable"
style="margin-left: -115px"
@openLatexEditor="openLatexEditor"
:lineStyle="lineStyle"
></common-table>
</el-form-item>
@@ -272,20 +218,27 @@
:isAutomaticUpdate="true"
:value="lineStyle.note"
@getContent="getContent"
@openLatexEditor="openLatexEditor"
v-if="threeVisible"
@updateChange="(res) => updateChange(res, 'note')"
:height="120"
ref="tinymceChildNote"
style="margin-left: -115px"
></common-content>
</el-form-item>
</el-form>
<p style="margin: 20px 0; text-align: right">
<p style="margin-top: 20px; text-align: right">
<el-button @click="threeVisible = false"> Cancel </el-button>
<el-button type="primary" plain @click="handleSaveTable"> save Table </el-button>
<el-button
type="primary"
plain
@click="handleSaveTable"
style="background-color: #006699 !important; background: #006699 !important; margin-right: 20px; color: #fff !important"
>
save Table
</el-button>
</p>
</el-dialog> -->
<el-dialog
</el-drawer>
<el-dialog
destroy-on-close
v-if="commentVisible"
title="Comment"
@@ -342,6 +295,7 @@
<common-content
:value="currentContent.content"
@getContent="getContent"
@openLatexEditor="openLatexEditor"
v-if="editVisible"
ref="commonContent"
style="margin-left: -115px"
@@ -363,7 +317,6 @@
title="Add Content"
:visible.sync="addContentVisible"
width="1200px"
:close-on-click-modal="false"
>
<el-form ref="editMes" :model="addContent" label-width="115px">
@@ -375,9 +328,9 @@
<common-content
:value="addContent.content"
@getContent="getContent"
@openLatexEditor="openLatexEditor"
v-if="addContentVisible"
ref="addContent"
style="margin-left: -115px"
></common-content>
</el-form-item>
@@ -391,6 +344,7 @@
</el-button>
</span>
</el-dialog>
<common-late-x v-if="showLateX" @close="showLateX = false" @save="saveLateX" :LateXInfo="LateXInfo"></common-late-x>
</div>
</template>
@@ -404,7 +358,9 @@ import bottomTinymce from '@/components/page/components/Tinymce';
export default {
data() {
return {
LateXInfo: {},
isEditComment: false,
showLateX: false,
comments: [],
remarkImageUrl: 'https://submission.tmrjournals.com/public/usericon/20241222/4e77ba3f29ce3cf798b36f24dc411b76.png',
isFirstComponentLoaded: false,
@@ -559,6 +515,11 @@ export default {
},
methods: {
openLatexEditor(data) {
console.log('data at line 563:', data);
this.showLateX = true;
this.LateXInfo=data
},
isShowEditComment() {
if (localStorage.getItem('U_role')) {
var identity = localStorage.getItem('U_role');
@@ -602,7 +563,7 @@ export default {
console.log('content at line 539:', content);
if (type == 'content') {
content = this.$commonJS.transformHtmlString(content);
console.log('content at line 604:', content)
console.log('content at line 604:', content);
var div = document.createElement('div');
div.innerHTML = content; // 将 HTML 字符串加载到 div 中
// 替换所有 <strong> 为 <b>
@@ -632,14 +593,13 @@ export default {
type: 'warning',
message: 'Table content is not supported!'
});
return false
return false;
}
var list = this.$commonJS.cleanAndParseWordContent(content);
console.log('list at line 569:', list);
this.saveContentList(list, this.currentId);
} else if (type == 'table') {
this.saveTable(content);
} else if (type == 'comment') {
this.addComment(content);
@@ -719,7 +679,31 @@ export default {
.catch(() => {});
}
},
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);
}
}
},
async huifu(id) {
var that = this;
await this.$confirm(this.$t('commonTable.reContent'), 'Prompt', {
@@ -882,22 +866,22 @@ export default {
console.log('err at line 466:', err);
});
},
async changeSort(type,id) {
var that=this
async changeSort(type, id) {
var that = this;
await that.$api
.post(type=='up'?'/api/Preaccept/upArticleMain':'/api/Preaccept/downArticleMain', {
am_id: id
})
.then(async (res) => {
if (res.code == 0) {
setTimeout(() => {
that.getDate();
that.getCommentList();
that.$forceUpdate();
});
}
.post(type == 'up' ? '/api/Preaccept/upArticleMain' : '/api/Preaccept/downArticleMain', {
am_id: id
})
.then(async (res) => {
if (res.code == 0) {
setTimeout(() => {
that.getDate();
that.getCommentList();
that.$forceUpdate();
});
}
});
},
async addCommentSetting(content) {
console.log('content at line 602:', content);
@@ -1152,7 +1136,7 @@ export default {
}
},
updateChange(content, type) {
console.log('content at line 1154:', content)
console.log('content at line 1154:', content);
// console.log('content at line 976:', content);
var str = this.$commonJS.transformHtmlString(content);
if (type == 'imgNote') {
@@ -1600,6 +1584,12 @@ export default {
if (content && content.table && content.table.length > 0) {
if (this.lineStyle.visiTitle == 'Edit Table') {
const loading = this.$loading({
lock: true,
text: 'Loading...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$api
.post(this.urlList.editTable, {
amt_id: this.lineStyle.amt_id,
@@ -2123,5 +2113,4 @@ export default {
::-webkit-scrollbar-thumb:hover {
background: #555; /* 滑块悬停时的颜色 */
}
</style>