1、English name这块,除了中文,数字不能用,其他都可以

2、blue空格
This commit is contained in:
2026-02-13 11:44:31 +08:00
parent 10348d1e75
commit a2497a8885
11 changed files with 68 additions and 72 deletions

View File

@@ -219,9 +219,15 @@ export default {
} }
// 获取单元格的 HTML 内容 // 获取单元格的 HTML 内容
let htmlContent = cell.trim(); let htmlContent = cell.trim();
// 在第 21 行之后添加
let processedContent = htmlContent.replace(/(<\/p>)\s*(?=<p)/gi, '$1<br>');
str = this.transformHtmlString(htmlContent, 'table')
str = this.transformHtmlString(processedContent, 'table',{ keepBr: true })
console.log("🚀 ~ extractContentWithoutOuterSpan888888 ~ str:", str);
// 创建一个临时的 DOM 元素来解析 HTML // 创建一个临时的 DOM 元素来解析 HTML
const div = document.createElement('div'); const div = document.createElement('div');
@@ -972,16 +978,22 @@ str = str.replace(regex, function (match, content, offset, fullString) {
async parseTableToArray(tableString, callback) { async parseTableToArray(tableString, callback) {
const parser = new DOMParser(); const parser = new DOMParser();
const doc = parser.parseFromString(tableString, 'text/html'); const doc = parser.parseFromString(tableString, 'text/html');
const rows = doc.querySelectorAll('table tr'); // 获取所有的行(<tr> const rows = doc.querySelectorAll('table tr'); // 获取所有的行(<tr>
// 使用 Promise 来处理异步的 MathJax 解析 // 使用 Promise 来处理异步的 MathJax 解析
const result = await Promise.all( const result = await Promise.all(
Array.from(rows).map(async (row) => { Array.from(rows).map(async (row) => {
const cells = row.querySelectorAll('th, td'); // 获取每个行中的单元格(包括 <th> 和 <td> const cells = row.querySelectorAll('th, td'); // 获取每个行中的单元格(包括 <th> 和 <td>
return await Promise.all( return await Promise.all(
Array.from(cells).map(async (cell) => { Array.from(cells).map(async (cell) => {
console.log("🚀 ~ parseTableToArray777 ~ cell:", cell);
const text = await this.extractMathJaxLatex(cell); const text = await this.extractMathJaxLatex(cell);
return { return {
text, text,
@@ -2125,14 +2137,18 @@ str = str.replace(regex, function (match, content, offset, fullString) {
text: 'Blue', text: 'Blue',
className: 'custom-button-blue', className: 'custom-button-blue',
onAction: function () { onAction: function () {
// 必须获取带 HTML 的内容,否则里面的 em/i 标签在拼接前就丢了 // 获取选中的 HTML
var selectedText = ed.selection.getContent({ format: 'html' }); var selectedText = ed.selection.getContent({ format: 'html' });
if (selectedText) { if (selectedText && selectedText.trim().length > 0) {
// 这就是你想要的:直接外层套一个 blue
var wrappedText = `<blue>${selectedText}</blue>`;
// 使用 setContent 强行回写 var processedText = selectedText.replace(/ /g, '&nbsp;');
var wrappedText = `<blue>${processedText}</blue>`;
// 使用 setContent 插入
ed.selection.setContent(wrappedText); ed.selection.setContent(wrappedText);
} }
} }

View File

@@ -2,14 +2,14 @@
//记得切换 //记得切换
//正式 //正式
// const mediaUrl = '/public/'; const mediaUrl = '/public/';
// const baseUrl = '/'; const baseUrl = '/';
//正式环境 //正式环境
const mediaUrl = 'https://submission.tmrjournals.com/public/'; // const mediaUrl = 'https://submission.tmrjournals.com/public/';
// const mediaUrl = 'http://zmzm.tougao.dev.com/public/'; // // const mediaUrl = 'http://zmzm.tougao.dev.com/public/';
const baseUrl = '/api' // const baseUrl = '/api'
//测试环境 //测试环境

View File

@@ -1974,6 +1974,7 @@ export default {
}); });
}, },
async saveTable(content) { async saveTable(content) {
const cleanTableData = (tableList) => { const cleanTableData = (tableList) => {
if (tableList.length == 0) { if (tableList.length == 0) {
return []; return [];
@@ -1981,7 +1982,8 @@ export default {
// 定义清理函数:去掉所有 br 标签和 TinyMCE 占位符 // 定义清理函数:去掉所有 br 标签和 TinyMCE 占位符
const cleanText = (text) => { const cleanText = (text) => {
if (!text) return ""; if (!text) return "";
return text.replace(/<br\s*\/?>/gi, '').trim(); // return text.replace(/<br\s*\/?>/gi, '').trim();
return text
}; };
// 1. 获取处理后的干净表头 // 1. 获取处理后的干净表头

View File

@@ -3135,11 +3135,9 @@ export default {
} else { } else {
var date1 = new Date(parseInt(date * 1000)); var date1 = new Date(parseInt(date * 1000));
var date2 = new Date().getTime(); var date2 = new Date().getTime();
console.log('date2 at line 1564:', date2);
// 计算时间差(以毫秒为单位) // 计算时间差(以毫秒为单位)
var timeDiff = Number(date2 - date1); var timeDiff = Number(date2 - date1);
console.log('timeDiff at line 1569:', timeDiff);
// 将半年转换为毫秒 // 将半年转换为毫秒
var halfYearInMilliseconds = 1000 * 60 * 60 * 24 * 182.5; // 假设一年有 365 天 var halfYearInMilliseconds = 1000 * 60 * 60 * 24 * 182.5; // 假设一年有 365 天
@@ -3152,7 +3150,7 @@ export default {
} }
return status; return status;
console.log('status at line 1578:', status);
}, },
changeSelectTabs(e) { changeSelectTabs(e) {
console.log('e at line 1536:', e); console.log('e at line 1536:', e);

View File

@@ -2209,11 +2209,10 @@ export default {
} else { } else {
var date1 = new Date(parseInt(date * 1000)); var date1 = new Date(parseInt(date * 1000));
var date2 = new Date().getTime(); var date2 = new Date().getTime();
console.log('date2 at line 1564:', date2);
// 计算时间差(以毫秒为单位) // 计算时间差(以毫秒为单位)
var timeDiff = Number(date2 - date1); var timeDiff = Number(date2 - date1);
console.log('timeDiff at line 1569:', timeDiff);
// 将半年转换为毫秒 // 将半年转换为毫秒
var halfYearInMilliseconds = 1000 * 60 * 60 * 24 * 182.5; // 假设一年有 365 天 var halfYearInMilliseconds = 1000 * 60 * 60 * 24 * 182.5; // 假设一年有 365 天

View File

@@ -473,18 +473,16 @@ export default {
const cells = doc.querySelectorAll('td, th'); const cells = doc.querySelectorAll('td, th');
cells.forEach((cell) => { cells.forEach((cell) => {
// 1. 先把单元格内的非法 < 转义
let cellText = cell.innerHTML; let cellText = cell.innerHTML;
// let cellText = escapeIllegalLT(cell.innerHTML);
// 2. 再清理空标签和多余空格
cell.innerHTML = cellText cell.innerHTML = cellText
.replace(cleanEmptyTags, '') .replace(cleanEmptyTags, '')
.replace(replaceSpaces, '&nbsp;'); .replace(replaceSpaces, '&nbsp;');
}); });
processedHtml = doc.body.innerHTML; processedHtml = doc.body.innerHTML;
} else { } else {
// 非表格逻辑也同样处理转义
// processedHtml = escapeIllegalLT(rawValue)
processedHtml = rawValue processedHtml = rawValue
.replace(cleanEmptyTags, '') .replace(cleanEmptyTags, '')
.replace(replaceSpaces, '&nbsp;'); .replace(replaceSpaces, '&nbsp;');
@@ -817,13 +815,7 @@ export default {
if (tempDiv.querySelector('table')) { if (tempDiv.querySelector('table')) {
if (_this.type == 'table') { if (_this.type == 'table') {
// 3. 在这里直接消费外部变量 currentPasteBase64Images
// content = content.replace(new RegExp(`src="${silentPlaceholder}"`, 'gi'), () => {
// // 按顺序取图
// const base64Data = currentPasteBase64Images[globalImgCounter] || '';
// globalImgCounter++;
// return `src="${base64Data}"`;
// });
_this.$commonJS.parseTableToArray(content, (tableList) => { _this.$commonJS.parseTableToArray(content, (tableList) => {
var contentHtml = ` var contentHtml = `
<div class="thumbnailTableBox wordTableHtml table_Box table_Box3333" style=""> <div class="thumbnailTableBox wordTableHtml table_Box table_Box3333" style="">
@@ -835,10 +827,10 @@ export default {
${row ${row
.map((cell) => { .map((cell) => {
return ` return `
<td colspan="${cell.colspan || 1}" rowspan="${cell.rowspan || 1}"> <td colspan="${cell.colspan || 1}" rowspan="${cell.rowspan || 1}">
<span>${cell.text || ''}</span> <span>${cell.text || ''}</span>
</td> </td>
`; `;
}) })
.join('')} .join('')}
</tr> </tr>
@@ -851,20 +843,8 @@ export default {
const container = document.createElement('div'); const container = document.createElement('div');
container.innerHTML = contentHtml; container.innerHTML = contentHtml;
// _this.updateTableStyles(container); // 根据需要应用额外的样式
args.content = container.innerHTML; // 更新处理后的内容 args.content = container.innerHTML; // 更新处理后的内容
}); });
} else {
// _this.$confirm('检测到粘贴内容包含表格,是否需要以表格形式添加?', '提示', {
// confirmButtonText: '添加表格',
// cancelButtonText: '纯文本添加',
// type: 'info'
// }).then(() => {
// _this.$emit('openAddTable', content);
// return false
// }).catch(() => {
// });
} }
} else { } else {
const mathRegex = /\$\$([\s\S]+?)\$\$|\$([\s\S]+?)\$/g; const mathRegex = /\$\$([\s\S]+?)\$\$|\$([\s\S]+?)\$/g;

View File

@@ -989,9 +989,9 @@ export default {
} }
if (this.$validateString(data.realname)) { if (this.$validateString(data.realname)) {
console.log('Input string is valid.');
} else { } else {
console.log('Input string is invalid.');
this.$message.error(this.$t('info.realname')); this.$message.error(this.$t('info.realname'));
return false; return false;
} }

View File

@@ -70,14 +70,11 @@ export default {
this.tableData.forEach((row, i) => { this.tableData.forEach((row, i) => {
modalContent += `<tr class="${this.isHeaderRow(i, this.tableData) ? 'table-header-row' : ''}">`; modalContent += `<tr class="${this.isHeaderRow(i, this.tableData) ? 'table-header-row' : ''}">`;
row.forEach((cell) => { row.forEach((cell) => {
modalContent += ` modalContent += `<td
<td
colspan="${cell.colspan || 1}" colspan="${cell.colspan || 1}"
rowspan="${cell.rowspan || 1}" rowspan="${cell.rowspan || 1}"
style="" style=""
> ><span>${cell.text}</span></td>`;
<span>${cell.text}</span>
</td>`;
}); });
modalContent += `</tr>`; modalContent += `</tr>`;
}); });

View File

@@ -394,9 +394,9 @@
if (this.$validateString(this.addForm.realname)) { if (this.$validateString(this.addForm.realname)) {
console.log('Input string is valid.');
} else { } else {
console.log('Input string is invalid.');
this.$message.error(this.$t('info.realname')) this.$message.error(this.$t('info.realname'))
return false return false
} }

View File

@@ -1608,7 +1608,7 @@ export default {
this.userMessage.majorStr = res.data.baseInfo.majorStr; this.userMessage.majorStr = res.data.baseInfo.majorStr;
this.cvitaForm.user_id = res.data.baseInfo.user_id; this.cvitaForm.user_id = res.data.baseInfo.user_id;
this.userMessage.website = res.data.baseInfo.website; this.userMessage.website = res.data.baseInfo.website;
console.log('res.data.baseInfo.majors.map at line 16124:', res.data.baseInfo.majors)
this.userMessage.majors=res.data.baseInfo.majors this.userMessage.majors=res.data.baseInfo.majors
this.majorValueList = res.data.baseInfo.majors.map((item) => ({ this.majorValueList = res.data.baseInfo.majors.map((item) => ({
@@ -1617,7 +1617,7 @@ export default {
: typeof item.shu === 'string' : typeof item.shu === 'string'
? item.shu.split(',').map(Number) ? item.shu.split(',').map(Number)
: [item.shu] : [item.shu]
}));console.log('this.majorValueList at line 1612:', this.majorValueList) }));
this.$forceUpdate() this.$forceUpdate()
this.coreTable = res.data.baseInfo; this.coreTable = res.data.baseInfo;
this.cvitaTable = res.data.cvs; this.cvitaTable = res.data.cvs;
@@ -1746,9 +1746,9 @@ export default {
// 保存个人信息 // 保存个人信息
saveMessage() { saveMessage() {
if (this.$validateString(this.MessForm.realname)) { if (this.$validateString(this.MessForm.realname)) {
console.log('Input string is valid.');
} else { } else {
console.log('Input string is invalid.');
this.$message.error(this.$t('info.realname')); this.$message.error(this.$t('info.realname'));
return false; return false;
} }
@@ -1818,13 +1818,13 @@ export default {
}, },
isEditIndex(data) { isEditIndex(data) {
console.log('data at line 1543:', this.userMessage);
var status; var status;
var date = ''; var date = '';
switch (data) { switch (data) {
case 'wos': case 'wos':
date = this.userMessage.wos_time; date = this.userMessage.wos_time;
console.log('date at line 1714:', date);
break; break;
case 'scopus': case 'scopus':
date = this.userMessage.scopus_time; date = this.userMessage.scopus_time;
@@ -1833,17 +1833,16 @@ export default {
date = this.userMessage.google_time; date = this.userMessage.google_time;
break; break;
} }
console.log('date at line 1714:', date);
if (date == 0) { if (date == 0) {
status = true; status = true;
} else { } else {
var date1 = new Date(parseInt(date * 1000)); var date1 = new Date(parseInt(date * 1000));
var date2 = new Date().getTime(); var date2 = new Date().getTime();
console.log('date2 at line 1564:', date2);
// 计算时间差(以毫秒为单位) // 计算时间差(以毫秒为单位)
var timeDiff = Number(date2 - date1); var timeDiff = Number(date2 - date1);
console.log('timeDiff at line 1569:', timeDiff);
// 将半年转换为毫秒 // 将半年转换为毫秒
var halfYearInMilliseconds = 1000 * 60 * 60 * 24 * 182.5; // 假设一年有 365 天 var halfYearInMilliseconds = 1000 * 60 * 60 * 24 * 182.5; // 假设一年有 365 天
@@ -1854,7 +1853,7 @@ export default {
status = true; status = true;
} }
} }
console.log('status at line 1578:', status);
return status; return status;
}, },
// 个人指数修改 // 个人指数修改

View File

@@ -18,8 +18,13 @@ import store from './store' // 引入 store
Vue.prototype.$bus = new Vue(); Vue.prototype.$bus = new Vue();
// Vue.prototype.$validateString = function (str) {
// return /^[a-zA-Z\s\u00C0-\u00FF\u0100-\u017F-]+$/.test(str);
// }
//除了中文,数字不能用,其他都可以
Vue.prototype.$validateString = function (str) { Vue.prototype.$validateString = function (str) {
return /^[a-zA-Z\s\u00C0-\u00FF\u0100-\u017F-]+$/.test(str); // 匹配规则:不包含数字 (0-9) 且 不包含中文字符 (\u4e00-\u9fa5)
return !/[0-9\u4e00-\u9fa5]/.test(str);
} }
window.MathJax = { window.MathJax = {
tex: { tex: {