This commit is contained in:
2026-04-08 13:03:54 +08:00
parent 36f6c02376
commit 0d35b76c3a
11 changed files with 3866 additions and 589 deletions

View File

@@ -71,7 +71,51 @@ function findExtentElement(blipElement) {
export default {
async searchTitleByDOI(doi) {
if (!doi) {
this.$message.warning('Please enter a DOI');
return null;
}
// 开启全局 Loading防止编辑重复点击
try {
// 1. 数据清洗
const cleanDoi = doi.trim()
.replace(/^doi:/i, '')
.replace(/https?:\/\/doi\.org\//i, '');
// 2. 请求 Crossref 接口
const response = await fetch(`https://api.crossref.org/works/${encodeURIComponent(cleanDoi)}`, {
method: 'GET',
headers: { 'Accept': 'application/json' }
});
if (!response.ok) throw new Error('DOI not found');
const data = await response.json();
// 3. 提取标题并跳转
const title = data.message?data.message.title?data.message.title[0]:'':'';
if (title) {
const searchUrl = `https://www.google.com/search?q=${encodeURIComponent(title)}`;
window.open(searchUrl, '_blank');
return title;
} else {
this.$message.error('Title not found in metadata.');
}
} catch (error) {
console.error("DOI Retrieval Error:", error);
this.$message.error('Failed to fetch title. Please check the DOI.');
} finally {
}
return null;
},
getJournalTypeName(value) {
var list = JSON.parse(localStorage.getItem('journalTypeDataAll'));
@@ -916,9 +960,9 @@ str = str.replace(regex, function (match, content, offset, fullString) {
});
// 2. 删除所有不需要的标签 (除 `strong`, `em`, `sub`, `sup`, `b`, `i` 外的所有标签)
if (type == 'table') {
inputHtml = inputHtml.replace(/<(?!\/?(strong|em|sub|sup|b|i|blue|wmath|img|myfigure|mytable|myh3|autocite))[^>]+>/g, ''); // 删除不需要的标签
inputHtml = inputHtml.replace(/<(?!\/?(strong|em|sub|sup|b|i|blue|wmath|img|myfigure|mytable|myh3|mycite))[^>]+>/g, ''); // 删除不需要的标签
} else {
inputHtml = inputHtml.replace(/<(?!\/?(strong|em|sub|sup|b|i|blue|wmath|myfigure|mytable|myh3|autocite))[^>]+>/g, ''); // 删除不需要的标签
inputHtml = inputHtml.replace(/<(?!\/?(strong|em|sub|sup|b|i|blue|wmath|myfigure|mytable|myh3|mycite))[^>]+>/g, ''); // 删除不需要的标签
}