tijiao
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
"install": "^0.13.0",
|
||||
"jszip": "^3.10.1",
|
||||
"mammoth": "^1.5.1",
|
||||
"mathlive": "^0.104.0",
|
||||
"mavon-editor": "^2.6.17",
|
||||
"multi-items-input": "^0.2.0",
|
||||
"pizzip": "^3.1.7",
|
||||
|
||||
@@ -360,10 +360,11 @@ export default {
|
||||
|
||||
const breaks = paragraph.getElementsByTagName("w:br");
|
||||
for (const br of breaks) {
|
||||
paragraphText += "<br>";
|
||||
paragraphText += "<br/>";
|
||||
}
|
||||
|
||||
cellText += paragraphText;
|
||||
console.log('cellText at line 366:', cellText)
|
||||
}
|
||||
|
||||
rowArray.push({
|
||||
@@ -645,26 +646,31 @@ export default {
|
||||
tempDiv.innerHTML = content; // 解析 HTML 内容
|
||||
let paragraphs = tempDiv.querySelectorAll("p"); // 选取所有 <p> 作为数据项
|
||||
|
||||
// 2️⃣ 将 <p> 内容转换为数组,处理空标签对
|
||||
// 2️⃣ 将 <p> 内容转换为数组,并处理内容
|
||||
let parsedData = Array.from(paragraphs).map(p => {
|
||||
let text = p.innerHTML.trim(); // 获取内容,去除两端空格
|
||||
|
||||
// 3️⃣ 移除 <o:p>(Word 复制的无效标签)
|
||||
text = text.replace(/<\/?o:p>/g, "");
|
||||
// 3️⃣ **正确移除 <o:p>(Word 复制的无效标签)**
|
||||
text = text.replace(/<\/?o:p[^>]*>/g, "");
|
||||
|
||||
// 4️⃣ 移除 style="..."(防止 Word 带入无用样式)
|
||||
text = text.replace(/\s*style="[^"]*"/g, "");
|
||||
// 4️⃣ **移除所有 style="..."**
|
||||
text = text.replace(/\s*style="[^"]*"/gi, "");
|
||||
|
||||
// 5️⃣ 替换 <strong> 为 <b>
|
||||
text = text.replace(/<strong>/g, "<b>").replace(/<\/strong>/g, "</b>");
|
||||
// 5️⃣ **修正标签替换**
|
||||
text = text.replace(/<strong>/gi, "<b>").replace(/<\/strong>/gi, "</b>");
|
||||
text = text.replace(/<em>/gi, "<i>").replace(/<\/em>/gi, "</i>");
|
||||
|
||||
// 6️⃣ 替换 <em> 为 <i>
|
||||
text = text.replace(/<em>/g, "<i>").replace(/<\/em>/g, "</i>");
|
||||
// 6️⃣ **移除空的 span、b、i 标签**
|
||||
text = text.replace(/<span>\s*<\/span>/gi, "");
|
||||
text = text.replace(/<b>\s*<\/b>/gi, "");
|
||||
text = text.replace(/<i>\s*<\/i>/gi, "");
|
||||
|
||||
// 7️⃣ 处理空标签对:<i> </i>、<b> </b>、<span> </span> 等
|
||||
text = text.replace(/<[^>]+>\s*<\/[^>]+>/g, "");
|
||||
// 7️⃣ **确保不移除半个标签(修复匹配规则)**
|
||||
text = text.replace(/<[^\/>]+>\s*<\/[^>]+>/gi, match => {
|
||||
return match.trim() === "" ? "" : match;
|
||||
});
|
||||
|
||||
// 8️⃣ 如果最终内容为空,则替换为 `""`
|
||||
// 8️⃣ **返回最终内容**
|
||||
return text.trim() === "" ? "" : text;
|
||||
});
|
||||
|
||||
@@ -673,6 +679,7 @@ export default {
|
||||
}
|
||||
|
||||
|
||||
|
||||
,
|
||||
|
||||
|
||||
@@ -1825,6 +1832,22 @@ export default {
|
||||
}
|
||||
}
|
||||
});
|
||||
ed.ui.registry.addButton('LateX', {
|
||||
text: 'LateX', // 按钮文本
|
||||
className: 'custom-button-blue', // 添加自定义类
|
||||
// shortcut: "Ctrl+J",
|
||||
onAction: function () {
|
||||
// 在选中的文本周围包裹 <blue> 标签
|
||||
// var selectedText = ed.selection.getContent();
|
||||
// console.log('selectedText at line 529:', selectedText);
|
||||
// if (selectedText) {
|
||||
// var wrappedText = `<blue>${selectedText}</blue>`;
|
||||
// ed.selection.setContent(wrappedText);
|
||||
// } else {
|
||||
// this.$message.error('请选择要添加蓝色的文本');
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
ed.ui.registry.addButton('myuppercase', {
|
||||
text: 'A', // 按钮文本
|
||||
|
||||
56
src/components/page/components/table/LateX.vue
Normal file
56
src/components/page/components/table/LateX.vue
Normal file
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<div>
|
||||
<label>输入 LaTeX 公式:</label>
|
||||
<div ref="mathField" class="math-container"></div>
|
||||
<p>LaTeX 代码: {{ latex }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { MathfieldElement } from 'mathlive'; // 直接导入 MathLive 组件
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
latex: '\\frac{a}{b} + \\sqrt{x^2 + y^2} + e^{i\\pi}', // 默认 LaTeX 公式,
|
||||
mathFieldInstance: null
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
latex(newVal) {
|
||||
if (this.mathFieldInstance && this.mathFieldInstance.value !== newVal) {
|
||||
this.mathFieldInstance.setValue(newVal);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
if (this.$refs.mathField) {
|
||||
// 创建 MathfieldElement 组件
|
||||
const mf = new MathfieldElement();
|
||||
mf.style.width = '100%'; // 让输入框撑满
|
||||
mf.virtualKeyboardMode = 'manual'; // 显示虚拟键盘
|
||||
mf.addEventListener('input', (event) => {
|
||||
this.latex = event.target.value; // 监听输入并更新 LaTeX 公式
|
||||
});
|
||||
mf.value = this.latex; // 设置默认值
|
||||
this.$refs.mathField.appendChild(mf); // 挂载到 DOM
|
||||
this.mathFieldInstance = mf;
|
||||
} else {
|
||||
console.error('MathLive 未正确加载');
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.mathFieldInstance = null; // 组件销毁时清除实例
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.math-container {
|
||||
min-height: 40px;
|
||||
border: 1px solid #ccc;
|
||||
padding: 5px;
|
||||
font-size: 18px;
|
||||
}
|
||||
</style>
|
||||
@@ -65,6 +65,7 @@
|
||||
<i class="el-icon-document"> </i>
|
||||
Batch Add content
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -116,6 +117,8 @@
|
||||
position: relative;
|
||||
"
|
||||
>
|
||||
|
||||
<!-- <common-late-x></common-late-x> -->
|
||||
<template v-for="(item, index) in wordList">
|
||||
<el-checkbox
|
||||
@change="updateUniqueIds"
|
||||
|
||||
34
src/main.js
34
src/main.js
@@ -32,7 +32,7 @@ Vue.use(VueQuillEditor)
|
||||
|
||||
// 时间过滤器
|
||||
// 定义时间过滤器(不含时分秒)
|
||||
Vue.filter('formatDate', function(originVal) {
|
||||
Vue.filter('formatDate', function (originVal) {
|
||||
const dt = new Date(originVal * 1000)
|
||||
const y = dt.getFullYear()
|
||||
const m = (dt.getMonth() + 1 + '').padStart(2, '0')
|
||||
@@ -41,9 +41,9 @@ Vue.filter('formatDate', function(originVal) {
|
||||
const mm = (dt.getMinutes() + '').padStart(2, '0')
|
||||
const ss = (dt.getSeconds() + '').padStart(2, '0')
|
||||
return `${y}-${m}-${d}`
|
||||
})
|
||||
// 含时分秒
|
||||
Vue.filter('formatDatehms', function(originVal) {
|
||||
})
|
||||
// 含时分秒
|
||||
Vue.filter('formatDatehms', function (originVal) {
|
||||
const dt = new Date(originVal * 1000)
|
||||
const y = dt.getFullYear()
|
||||
const m = (dt.getMonth() + 1 + '').padStart(2, '0')
|
||||
@@ -52,7 +52,7 @@ Vue.filter('formatDate', function(originVal) {
|
||||
const mm = (dt.getMinutes() + '').padStart(2, '0')
|
||||
const ss = (dt.getSeconds() + '').padStart(2, '0')
|
||||
return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
|
||||
})
|
||||
})
|
||||
// 引入wps文档编辑
|
||||
import mammoth from "mammoth";
|
||||
import commonJS from '@/common/js/commonJS.js'
|
||||
@@ -74,6 +74,8 @@ Vue.component("Editor", Editor);
|
||||
|
||||
import commonTable from '@/components/page/components/table/table.vue'
|
||||
Vue.component('common-table', commonTable);
|
||||
import commonLateX from '@/components/page/components/table/LateX.vue'
|
||||
Vue.component('common-late-x', commonLateX);
|
||||
import commonMajor from '@/components/page/components/major/index.vue'
|
||||
Vue.component('common-major', commonMajor);
|
||||
import commonMajorList from '@/components/page/components/major/list.vue'
|
||||
@@ -103,10 +105,10 @@ Vue.component('common-drag-word', commonDragWord);
|
||||
Vue.use(VueI18n);
|
||||
Vue.use(ElementUI, {
|
||||
size: 'small',
|
||||
locale
|
||||
locale
|
||||
});
|
||||
const i18n = new VueI18n({
|
||||
locale: localStorage.getItem('langs')||'en',
|
||||
locale: localStorage.getItem('langs') || 'en',
|
||||
messages
|
||||
});
|
||||
//使用钩子函数对路由进行权限跳转
|
||||
@@ -114,16 +116,16 @@ router.beforeEach((to, from, next) => {
|
||||
document.title = `${to.meta.title} | Traditional Medicine Research`;
|
||||
const role = localStorage.getItem('U_name');
|
||||
const userrole = localStorage.getItem('U_status');
|
||||
if (!role && to.path!='/register'&&to.path!=='/submission'&&to.path!=='/verification'&&to.path!=='/orcidLink'&&to.path!=='/img'&& to.path !=='/reviewer'&&to.path !=='/thanks' &&to.path !== '/login' &&to.path !== '/refuse' &&to.path !== '/managing'&&to.path.search(/retrieve/i)<0 ) {
|
||||
if (!role && to.path != '/register' && to.path !== '/submission' && to.path !== '/verification' && to.path !== '/orcidLink' && to.path !== '/img' && to.path !== '/reviewer' && to.path !== '/thanks' && to.path !== '/login' && to.path !== '/refuse' && to.path !== '/managing' && to.path.search(/retrieve/i) < 0) {
|
||||
next('/login');
|
||||
// } else if (to.meta.permission) {
|
||||
// // 如果是管理员权限则可进入,这里只是简单的模拟管理员权限而已
|
||||
// // role === 'admin' ? next() : next('/403');
|
||||
// if(userrole == to.meta.permission){
|
||||
// next();
|
||||
// }else{
|
||||
// next('/403');
|
||||
// }
|
||||
// } else if (to.meta.permission) {
|
||||
// // 如果是管理员权限则可进入,这里只是简单的模拟管理员权限而已
|
||||
// // role === 'admin' ? next() : next('/403');
|
||||
// if(userrole == to.meta.permission){
|
||||
// next();
|
||||
// }else{
|
||||
// next('/403');
|
||||
// }
|
||||
|
||||
} else {
|
||||
//审稿人导航
|
||||
|
||||
Reference in New Issue
Block a user