tijiao 分类变成接口

This commit is contained in:
2025-06-05 09:16:41 +08:00
parent e35f9f69c2
commit 071276e284
10 changed files with 157 additions and 255 deletions

View File

@@ -1,7 +1,9 @@
import Vue from 'vue';
import katex from 'katex';
import JSZip from 'jszip';
import mammoth from "mammoth";
import api from '../../api/index.js';
import Common from '@/components/common/common'
import Tiff from 'tiff.js';
var mediaUrl = Common.mediaUrl + 'articleImage/';
@@ -67,187 +69,25 @@ function findExtentElement(blipElement) {
}
export default {
getJournalTypeName(value) {
var list = this.journalTypeList();
list = [...list,
{ name: 'EVIDENCE-BASED MEDICINE', value: 'EM' }, // ✅ 补充项
{ name: 'PROTOCOL', value: 'PT' }, // ✅ 补充项
]
var list = JSON.parse(localStorage.getItem('journalTypeDataAll'));
const type = list.find(item => item.value === value);
return type ? type.name : 'OTHERS';
},
journalTypeList() {
var journal_type = [
{ name: 'ARTICLE', value: 'A' },
{ name: 'REVIEW', value: 'B' },
{ name: 'CASE REPORT', value: 'C' },
{ name: 'RESEARCH PROPOSAL', value: 'P' },
{ name: 'NEWS', value: 'N' },
{ name: 'COMMENT', value: 'T' },
{ name: 'CORRECTION', value: 'CT' },
{ name: 'HYPOTHESIS', value: 'HT' },
{ name: 'PREFACE', value: 'PF' },
{ name: 'EDITORIAL', value: 'ET' },
{ name: 'REPORT', value: 'RP' },
{ name: 'LETTER', value: 'LR' },
{ name: 'EMPIRICAL FORMULA', value: 'EF' },
journalTypeList(type) {
var journal_type = JSON.parse(localStorage.getItem('journalTypeData'));
{ name: 'EXPERT CONSENSUS', value: 'EC' },
{ name: 'LETTER TO EDITOR', value: 'LTE' },
{ name: 'QUESTIONNAIRE INVESTIGATION', value: 'QI' },
{ name: 'CASE SERIES', value: 'CS' },
{ name: 'RETRACTION', value: 'RT' },
{ name: 'MINI REVIEW', value: 'MR' },
{ name: 'OTHERS', value: 'O' }
];
return journal_type;
},
opMedicalList() {
var opMedical = [{
label: 'None',
value: ''
},
{
label: 'ARTICLE',
value: 'Article'
},
{
label: 'REVIEW',
value: 'Review'
},
{
label: 'CASE REPORT',
value: 'Case report'
},
{
label: 'RESEARCH PROPOSAL',
value: 'Research proposal'
},
{
label: 'NEWS',
value: 'News'
},
{
label: 'COMMENT',
value: 'Comment'
},
{
label: 'CORRECTION',
value: 'Correction'
},
{
label: 'HYPOTHESIS',
value: 'Hypothesis'
},
{
label: 'PREFACE',
value: 'Preface'
},
{
label: 'EDITORIAL',
value: 'Editorial'
},
{
label: 'REPORT',
value: 'Report'
},
{
label: 'LETTER',
value: 'Letter'
},
{
label: 'EMPIRICAL FORMULA',
value: 'Empirical formula'
},
{
label: 'EVIDENCE-BASED MEDICINE',
value: 'Evidence-based medicine'
},
{
label: 'EXPERT CONSENSUS',
value: 'Expert consensus'
},
{
label: 'LETTER TO EDITOR',
value: 'Letter to editor'
},
{
label: 'QUESTIONNAIRE INVESTIGATION',
value: 'Questionnaire investigation'
},
{
label: 'PROTOCOL',
value: 'Protocol'
},
{
label: 'CASE SERIES',
value: 'Case Series'
},
{
label: 'RETRACTION',
value: 'Retraction'
},
{
label: 'MINI REVIEW',
value: 'Mini Review'
},
{
label: '内经难经',
value: '内经难经'
},
{
label: '伤寒金匮',
value: '伤寒金匮'
},
{
label: '神农本草经',
value: '神农本草经'
},
{
label: '温病研究',
value: '温病研究'
},
{
label: '唐宋方药',
value: '唐宋方药'
},
{
label: '金元各家',
value: '金元各家'
},
{
label: '明清经典',
value: '明清经典'
},
{
label: '中西汇通',
value: '中西汇通'
},
{
label: '太湖选粹',
value: '太湖选粹'
},
{
label: '针灸推拿',
value: '针灸推拿'
},
{
label: '名医名方',
value: '名医名方'
},
{
label: '新冠肺炎',
value: '新冠肺炎'
},
{
label: '书评',
value: '书评'
}
]
var opMedical =JSON.parse(localStorage.getItem('opMedicalListData'))
return opMedical;
},
@@ -316,6 +156,7 @@ export default {
const mediaFile = rels[embedId];
if (mediaFile) {
imageInfoMap[mediaFile] = { width, height };
console.log('imageInfoMap at line 158:', imageInfoMap)
}
}
}
@@ -347,24 +188,32 @@ export default {
// html = html.replace(/<img[^>]+src="data:image\/x-emf[^"]*"[^>]*>/gi, '');
// 替换图片标签中的宽高
const imgTags = html.match(/<img[^>]*src="data:image\/[^"]+image(\d+)\.(png|jpg|jpeg)[^"]*"[^>]*>/gi);
const imgTags = html.match(/<img[^>]*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];
const info = imageInfoMap[filename]; // 从 imageInfoMap 中查找宽高信息
console.log('info at line 196:', info); // 查看是否找到了相关图片信息
if (info) {
// 如果找到了图片的信息,就添加宽度和高度到 <img> 标签
const newImgTag = imgTag.replace(
/<img/,
`<img width="${info.width}" height="${info.height}"`
);
html = html.replace(imgTag, newImgTag);
html = html.replace(imgTag, newImgTag); // 替换原始的 <img> 标签
}
}
});
}
// 提取合法表格
const tableContent = html.match(/<table[\s\S]*?<\/table>/g);
const validTables = tableContent