diff --git a/dist.zip b/dist.zip
index afcc597..5896582 100644
Binary files a/dist.zip and b/dist.zip differ
diff --git a/src/api/index.js b/src/api/index.js
index 2e9d78d..0ba741d 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -19,8 +19,8 @@ const service = axios.create({
// baseURL: 'https://submission.tmrjournals.com/', //正式 记得切换
// baseURL: 'http://www.tougao.com/', //测试本地 记得切换
// baseURL: 'http://192.168.110.110/tougao/public/index.php/',
- // baseURL: '/api', //本地
- baseURL: '/', //正式
+ baseURL: '/api', //本地
+ // baseURL: '/', //正式
});
diff --git a/src/common/js/commonJS.js b/src/common/js/commonJS.js
index bf315a1..77b78e4 100644
--- a/src/common/js/commonJS.js
+++ b/src/common/js/commonJS.js
@@ -52,9 +52,10 @@ const capitalizeFirstLetter = function (text) {
//px
function emuToPixels(emu) {
// 将 EMU 转换为厘米,并进一步转换为像素
- const emuToPixels = emu / 914400 * 2.54 * 96;
+ const emuToPixels = emu * 96 / 914400;
+ // return parseFloat((emu * 96 / 914400).toFixed(2)); // ✅
// 四舍五入并保留两位小数
- return (Math.round(emuToPixels * 100) / 100).toFixed(2);
+ return (Math.round(emuToPixels * 100) / 100).toFixed(0);
}
function findExtentElement(blipElement) {
let current = blipElement.parentElement;
@@ -87,7 +88,7 @@ export default {
},
opMedicalList() {
- var opMedical =JSON.parse(localStorage.getItem('opMedicalListData'))
+ var opMedical = JSON.parse(localStorage.getItem('opMedicalListData'))
return opMedical;
},
@@ -113,37 +114,37 @@ export default {
- handleFileUpload(event, callback) {
+ handleFileUpload(event, callback) {
const file = event.target.files[0];
if (!file || file.type !== 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') {
- alert('请上传一个有效的 Word 文件');
+ alert('Please upload a valid Word file !');
return;
}
-
+
const reader = new FileReader();
-
+
reader.onload = (e) => {
const arrayBuffer = e.target.result;
const zip = new JSZip();
-
+
zip.loadAsync(arrayBuffer).then(async (zip) => {
const relsXml = await zip.files['word/_rels/document.xml.rels'].async('string');
const docXml = await zip.files['word/document.xml'].async('string');
-
+
const parser = new DOMParser();
const relDoc = parser.parseFromString(relsXml, "text/xml");
const docDom = parser.parseFromString(docXml, "text/xml");
-
+
const rels = {};
Array.from(relDoc.getElementsByTagName('Relationship')).forEach((rel) => {
const id = rel.getAttribute('Id');
- const target = rel.getAttribute('Target'); // e.g., 'media/image1.jpeg'
+ const target = rel.getAttribute('Target');
rels[id] = target;
});
-
+
const imageInfoMap = {};
const blips = docDom.getElementsByTagName('a:blip');
-
+
Array.from(blips).forEach((blip) => {
const embedId = blip.getAttribute('r:embed');
const extent = findExtentElement(blip);
@@ -153,84 +154,57 @@ export default {
if (cx && cy) {
const width = emuToPixels(cx);
const height = emuToPixels(cy);
- const mediaFile = rels[embedId];
- if (mediaFile) {
- imageInfoMap[mediaFile] = { width, height };
- console.log('imageInfoMap at line 158:', imageInfoMap)
- }
+ imageInfoMap[embedId] = { width, height };
}
}
});
-
- mammoth.convertToHtml({ arrayBuffer },
- {
- convertImage: mammoth.images.inline(async function (image) {
- const contentType = image.contentType.toLowerCase();
-
- // 只允许这三种格式
- const allowedTypes = ['image/jpeg', 'image/jpg', 'image/png'];
- if (!allowedTypes.includes(contentType)) {
- // 跳过不支持的格式(如 image/tiff、image/x-emf 等)
- return { src: '' }; // 会从 HTML 中删除这张图片
- }
-
- // 读取为 base64 并构造 src
- const imageBuffer = await image.read("base64");
- const base64Src = `data:${contentType};base64,${imageBuffer}`;
-
- return {
- src: base64Src
- };
- })
- })
- .then((result) => {
- let html = result.value;
- // html = html.replace(/
]+src="data:image\/x-emf[^"]*"[^>]*>/gi, '');
-
- // 替换图片标签中的宽高
- const imgTags = html.match(/
]*src="data:image\/(png|jpg|jpeg);base64,[^"]*"/gi);
- console.log('imgTags at line 190:', imgTags);
-
- if (imgTags) {
- imgTags.forEach((imgTag) => {
- // 提取 "image数字.png" 或 "image数字.jpg" 这样的文件名
- const match = imgTag.match(/image(\d+)\.(png|jpg|jpeg)/);
-
- if (match) {
- // 构造文件名,例如 "media/image1.png"
- const filename = `media/image${match[1]}.${match[2]}`;
- const info = imageInfoMap[filename]; // 从 imageInfoMap 中查找宽高信息
- console.log('info at line 196:', info); // 查看是否找到了相关图片信息
-
- if (info) {
- // 如果找到了图片的信息,就添加宽度和高度到
标签
- const newImgTag = imgTag.replace(
- /
标签
- }
- }
- });
+
+ mammoth.convertToHtml({ arrayBuffer }, {
+ convertImage: mammoth.images.inline(async function (image) {
+ console.log('image at line 163:', image)
+ const contentType = image.contentType.toLowerCase();
+ const allowedTypes = ['image/jpeg', 'image/jpg', 'image/png'];
+ if (!allowedTypes.includes(contentType)) {
+ return { src: '' };
}
-
- // 提取合法表格
- const tableContent = html.match(/
/g);
- const validTables = tableContent
- ? tableContent.filter(table => //.test(table))
- : [];
-
- callback(validTables);
+
+ const embedId = image.relationshipId || image.refId || '';
+ const imageBuffer = await image.read("base64");
+ const base64Src = `data:${contentType};base64,${imageBuffer}`;
+
+ let width = '', height = '';
+ if (embedId && imageInfoMap[embedId]) {
+ width = imageInfoMap[embedId].width;
+ height = imageInfoMap[embedId].height;
+ }
+
+ return {
+ src: base64Src,
+ alt: '',
+ width,
+ height,
+ refId: embedId,
+ 'content-type': contentType
+ };
})
- .catch(err => {
- console.error('mammoth 转换失败:', err);
- });
-
+ }).then((result) => {
+ let html = result.value;
+
+ // 提取合法表格
+ const tableContent = html.match(//g);
+ const validTables = tableContent
+ ? tableContent.filter(table => //.test(table))
+ : [];
+
+ callback(validTables);
+ }).catch(err => {
+ console.error('mammoth 转换失败:', err);
+ });
}).catch(err => {
console.error("Zip 读取失败:", err);
});
};
-
+
reader.readAsArrayBuffer(file);
},
diff --git a/src/components/common/langs/en.js b/src/components/common/langs/en.js
index 28d9ac3..b8813e3 100644
--- a/src/components/common/langs/en.js
+++ b/src/components/common/langs/en.js
@@ -349,10 +349,10 @@ const en = {
rulesAuthorInfo: 'Please enter the author',
rulesVolInfo: 'Please enter the publication time',
rulesArticleInfo: 'Please enter the article title',
- authorInfo: 'Six or less authors are required to list all authors while more than six authors are required to list three of them with “et al”.',
+ authorInfo: 'Six or less authors are required to list all authors while more than six authors are required to list three of them with “et al.”.',
author: 'Author(s)',
publicationTime: 'Year',
- publicationTimeInfo: 'Year;Volume(issue):Inclusive page numbers.',
+ publicationTimeInfo: 'Year;Volume(issue):Inclusive page numbers',
},
commonTable: {
add: 'Add',
diff --git a/src/components/page/GenerateCharts.vue b/src/components/page/GenerateCharts.vue
index 3f3ca5e..2edbf79 100644
--- a/src/components/page/GenerateCharts.vue
+++ b/src/components/page/GenerateCharts.vue
@@ -1128,9 +1128,23 @@ export default {
},
handleFileChange(event) {
var that = this;
-
+ const loading = this.$loading({
+ lock: true,
+ text: 'Loading...',
+ spinner: 'el-icon-loading',
+ background: 'rgba(0, 0, 0, 0.7)'
+ });
// 处理文件上传并传递回调函数
this.$commonJS.handleFileUpload(event, function (tables) {
+ console.log('tables at line 1138:', tables)
+ if(tables.length == 0){
+ loading.close()
+ that.$message({
+ type: 'warning',
+ message: 'No table found!'
+ });
+ return false
+ }
// 使用 Promise.all 等待所有表格解析完成
Promise.all(
@@ -1148,9 +1162,11 @@ export default {
.then((result) => {
// 所有表格的解析完成后,处理结果
that.uploadWordTables = result;
+ loading.close()
that.tablesHtmlVisible = true;
})
.catch((error) => {
+ loading.close()
console.error('Error processing tables:', error);
});
});
diff --git a/src/components/page/components/Tinymce/index.vue b/src/components/page/components/Tinymce/index.vue
index ecfab63..a8a1903 100644
--- a/src/components/page/components/Tinymce/index.vue
+++ b/src/components/page/components/Tinymce/index.vue
@@ -182,6 +182,8 @@ export default {
},
data() {
return {
+ baseUrl: this.Common.baseUrl,
+ mediaUrl: this.Common.mediaUrl,
typesettingType: 1,
typesettingTypeOptions: [
{
@@ -316,7 +318,6 @@ export default {
console.log('粘贴的内容包含表格');
if (_this.type == 'table') {
_this.$commonJS.parseTableToArray(content, (tableList) => {
-
var contentHtml = `
@@ -403,8 +404,9 @@ export default {
statusbar: false, // 关闭底部状态栏
custom_colors: false,
color_map: ['0082AA', 'TMR Blue'],
-
- plugins: 'texttransform noneditable table', // 启用 forecolor 和 code 插件
+
+ // image
+ plugins: 'texttransform noneditable table image', // 启用 forecolor 和 code 插件
// plugins: 'forecolor code paste table image mathType searchreplace raw', // 启用 forecolor 和 code 插件
end_container_on_empty_block: true,
content_css: 'default', // 加载 TinyMCE 默认样式表
@@ -413,6 +415,50 @@ export default {
path: 'https://cdn.mathjax.org/mathjax/latest/MathJax.js',
config: 'TeX-AMS-MML_HTMLorMML'
},
+ // automatic_uploads: false,
+ // images_upload_handler: function (blobInfo, success, failure, progress) {
+ // console.log('blobInfo at line 419:', blobInfo);
+ // return new Promise(function (resolve, reject) {
+ // const xhr = new XMLHttpRequest();
+ // const formData = new FormData();
+ // const file = blobInfo.blob();
+ // let filename = file.name;
+ // if (!filename) {
+ // // 如果没有名字,则手动生成一个
+ // const ext = file.type.split('/').pop(); // 从 MIME 类型获取扩展名,例如 'png'
+ // const timestamp = Date.now();
+ // filename = `unnamed_${timestamp}.${ext}`;
+ // }
+ // console.log('file at line 424:', file);
+
+ // xhr.withCredentials = false;
+ // xhr.open('POST', _this.baseUrl + '/api/Preaccept/up_img_mainImage');
+
+ // xhr.onload = function () {
+ // if (xhr.status !== 200) {
+ // reject('HTTP Error: ' + xhr.status);
+ // return;
+ // }
+
+ // try {
+ // const json = JSON.parse(xhr.responseText);
+ // console.log('json at line 434:', json);
+ // if (json.code != 0) {
+ // reject('Upload Error: ' + json.msg);
+ // return;
+ // }
+
+ // resolve(_this.mediaUrl + 'articleImage/' + json.data.upurl); // ✅ 返回图片 URL 给 TinyMCE 插入
+ // } catch (e) {
+ // reject('Invalid response: ' + xhr.responseText);
+ // }
+ // };
+
+ // formData.append('mainImage', file, filename);
+ // formData.append('article_id', _this.$route.query.id);
+ // xhr.send(formData);
+ // });
+ // },
//设置自定义按钮 myCustomToolbarButton
setup(ed) {
_this.$commonJS.initEditorButton(_this, ed);
diff --git a/src/components/page/components/table/table.vue b/src/components/page/components/table/table.vue
index fea10e3..8475be0 100644
--- a/src/components/page/components/table/table.vue
+++ b/src/components/page/components/table/table.vue
@@ -2,7 +2,7 @@
-
+
{{ v.title }}
-->
-
-
-
+
+
{{ $t('commonTable.singleRow') }}
- {{ $t('commonTable.Multicolumn') }}
+ {{ $t('commonTable.Multicolumn') }}
-
+
-
-
+
@@ -191,12 +196,12 @@
Figure {{ index + 1 }}
-
-
-
+
@@ -244,17 +249,30 @@
:draggable="img.has_selected == 0 ? true : false"
@dragstart="img.has_selected == 0 ? onDragStart($event, img, index, 'img') : ''"
>
-
+
-
-
-
-
+
+
+
Add Table
-
+
-
+
@@ -416,7 +449,15 @@
:draggable="table.has_selected == 0 ? true : false"
@dragstart="table.has_selected == 0 ? onDragStart($event, table, index, 'table') : ''"
>
-
+
{
@@ -892,7 +931,7 @@ export default {
});
},
async activated() {
- this.isCollapse=localStorage.getItem('isCollapse')=='true'?true:false;
+ this.isCollapse = localStorage.getItem('isCollapse') == 'true' ? true : false;
this.isFresh = false;
this.isShowEditComment();
this.$nextTick(async () => {
@@ -1070,28 +1109,26 @@ li {
height: 28px; */
width: 200px;
float: right;
-
}
-.double .item_box{
-width: 46% !important;
+.double .item_box {
+ width: 46% !important;
}
-.double .item_box .previewbox{
-display: none;
+.double .item_box .previewbox {
+ display: none;
}
.double .item_box .imgbox {
-height: 50px !important;
-width: auto !important;
+ height: 50px !important;
+ width: auto !important;
}
-.double .item_box .imgbox img{
-height: 60px !important;
-width: auto !important;
+.double .item_box .imgbox img {
+ height: 60px !important;
+ width: auto !important;
}
-.double .go-transition .title{
-font-size: 12px !important;
-padding:0 2px !important;
-line-height: 20px !important;
+.double .go-transition .title {
+ font-size: 12px !important;
+ padding: 0 2px !important;
+ line-height: 20px !important;
}
-.single{
-
+.single {
}
diff --git a/src/components/page/editPublicRefRdit.vue b/src/components/page/editPublicRefRdit.vue
index 6fcfbbd..82121db 100644
--- a/src/components/page/editPublicRefRdit.vue
+++ b/src/components/page/editPublicRefRdit.vue
@@ -243,7 +243,7 @@
>
Six or less authors are required to list all authors while more than six authors are required to list three of
- them with “et al”.
+ them with “et al.”
@@ -252,37 +252,47 @@
v-model="refenceForm.title"
placeholder="eg: The role of autophagy in the treatment of osteoporosis by Chinese medicines (natural)"
>
+
+ Automatically displayed after publication "."Don't add "."!
+
- Full Name of Book.
+ Full Name of Book Automatically displayed after publication "."Don't add "."!
- Year;Volume(issue):Inclusive page numbers.
+ Year;Volume(issue):Inclusive page numbersAutomatically displayed after publication "."Don't add "."!
- City, State (or Country if not in the US) of publisher:Publisher’s name;copyright year.
+ City, State (or Country if not in the US) of publisher:Publisher’s name;copyright yearAutomatically displayed after publication "."Don't add "."!
- Abbreviated Journal Title.
+ Abbreviated Journal Title
+ Automatically displayed after publication "."Don't add "."!
+
+
+ Automatically displayed after publication "."Don't add "."!
+
-
+
+ Automatically displayed after publication "."Don't add "."!
+
| |