14 Commits

15 changed files with 3463 additions and 417 deletions

View File

@@ -391,7 +391,8 @@ str = str.replace(regex, function (match, content, offset, fullString) {
const allTables = [];
if (!tables || tables.length === 0) {
console.warn("未找到表格内容,请检查 XML 结构");
return [];
callback([]);
return;
}
for (const table of tables) {
const rows = table.getElementsByTagNameNS(namespace, "tr");

View File

@@ -128,6 +128,7 @@ export default {
},
created() {
this.initORCID();
bus.$on('editorSessionLocalRestored', this.syncLsUserToHeader);
if (this.user_id == 24) {
this.daojishi = '2021.9.3 - 2021.9.30';
this.curStartTime = '2021-10-01 00:00:00';
@@ -162,6 +163,11 @@ export default {
}
},
methods: {
syncLsUserToHeader() {
this.user_id = localStorage.getItem('U_id');
this.user_cap = localStorage.getItem('U_role');
this.$forceUpdate();
},
goHome() {
this.$router.push('/');
},
@@ -295,6 +301,9 @@ export default {
},
immediate: true
}
},
beforeDestroy() {
bus.$off('editorSessionLocalRestored', this.syncLsUserToHeader);
}
};
</script>

View File

@@ -120,6 +120,7 @@ export default {
},
created() {
this.initORCID();
bus.$on('editorSessionLocalRestored', this.onEditorSessionLocalRestored);
if (this.user_id == 24) {
this.daojishi = '2021.9.3 - 2021.9.30';
this.curStartTime = '2021-10-01 00:00:00';
@@ -155,6 +156,10 @@ export default {
}
},
methods: {
onEditorSessionLocalRestored() {
this.updateUsername();
this.$forceUpdate();
},
updateUsername() {
this.localUsername = localStorage.getItem('U_name');
@@ -290,6 +295,7 @@ export default {
}
},
beforeDestroy() {
bus.$off('editorSessionLocalRestored', this.onEditorSessionLocalRestored);
// 步骤 C2: 销毁前移除监听器
if (this.$bus) {
this.$bus.$off('user-name-updated', this.updateUsername);

View File

@@ -50,10 +50,22 @@ const en = {
plagiarismNotChecked: 'Not checked',
plagiarismChecking: 'Checking…',
plagiarismRecheck: 'Re-check',
plagiarismDuplicateCheck: 'Re-check',
plagiarismCheckFailed: 'Failed to start plagiarism check.',
plagiarismStatusFailed: 'Failed to load plagiarism status.',
plagiarismNoReportUrl: 'Report link is not available yet.',
plagiarismReportDetailFailed: 'Could not load manuscript details. Please try again.',
plagiarismListTitle: 'Plagiarism check history',
plagiarismAutoCheck: 'Auto plagiarism check',
plagiarismRefresh: 'Refresh',
plagiarismEmptyList: 'No plagiarism checks yet',
plagiarismSimilarity: 'Similarity',
plagiarismFile: 'File',
plagiarismPreviewPdf: 'Preview report',
plagiarismReportLink: 'Report',
plagiarismNoPdfLink: 'No link',
plagiarismPreviewClose: 'Close',
plagiarismPreviewOpenTab: 'Open in new tab',
},
menu: {
main: 'Personal Center',
@@ -510,7 +522,7 @@ const en = {
languagePlaceholder: 'Language',
searchBtn: 'Search',
createTemplate: 'Create Template',
colTitle: 'Template title',
colTitle: 'Template title',
colSubject: 'Email subject',
colScene: 'Scene',
colLanguage: 'Language',
@@ -526,6 +538,23 @@ colTitle: 'Template title',
deleteFail: 'Delete failed',
previewTitle: 'Template preview',
previewClose: 'Close',
batchImportBtn: 'Batch import',
batchImportTitle: 'Batch import templates (JSON)',
batchImportHint:
'Paste a JSON array. Each item is saved via the same API as the editor (omit template_id to create; include template_id to update). Fields: title, subject, scene, language (or lang), version, body_html (or body), variables_json (or variables), is_active.',
batchImportCommonTip: 'Journal ID is set in the field below; when non-empty it overrides journal_id / journalId on every row.',
batchImportJournalId: 'Journal ID',
batchImportJournalPlaceholder: 'Match list filter or type manually',
batchImportRun: 'Run import',
batchImportBadJson: 'Invalid JSON',
batchImportEmpty: 'Array must contain at least one object',
batchImportMissingJournal: 'Row {index}: missing journal_id (use the input above or put journal_id in JSON)',
batchImportMissingField: 'Row {index}: missing {field}',
batchImportRowFail: 'Row {index} failed: {msg}',
batchImportRowNetwork: 'Row {index}: request error',
batchImportDone: 'Done: {ok} succeeded, {fail} failed',
batchImportErrorsTitle: 'Errors (first 8)',
batchImportSaveFail: 'Save failed',
},
mailboxStyle: {
title: 'Email Styles',
@@ -657,15 +686,72 @@ colTitle: 'Template title',
printBtn: 'Print',
previewNotSupported: 'This file format cannot be previewed online',
downloadToView: 'Download to view locally',
registerAuthorBtn: 'Create author account',
registerAuthorBtn: 'Auto submit',
registerAuthorConfirm:
'Create an account via the same admin API as User Management: login name "{account}", display name "{realname}", email "{email}", initial password 123456qwe (no captcha). Continue?',
registerAuthorSuccess: 'Author account created.',
registerAuthorSuccessWithEmail: 'Created: {email}, password: 123456qwe',
registerAuthorFail: 'Creation failed. Try again later or add the user manually in User Management.',
registerAuthorExistsEmail: 'This email is already registered.',
registerAuthorExistsAccount: 'This login name is already taken. Edit the sender display name or add the user manually.',
registerAuthorNeedEmail: 'Sender email is missing; cannot create an account.',
registerAuthorNoQq: 'QQ Mail is not supported for author accounts. Please add the user manually.',
registerAuthorConfirmShort: 'Email: {email}\nPassword: {password}',
registerAuthorPickEmailFail: 'Could not allocate an available email after several attempts. Try again later or add the user manually.',
autoSubmitBtn: 'Submit first .docx as manuscript',
autoSubmitTitle: 'Log in as author and upload the first .docx attachment',
autoSubmitSessionTip:
'Author checkLogin does not change your U_* local account. The server cookie is the author during upload. After finishing, enter your editor password below and log in again to restore the editor server session.',
autoSubmitUsername: 'Username',
autoSubmitPassword: 'Password',
autoSubmitSenderEmailLabel: 'Sender email',
autoSubmitSenderEmailPlaceholder: '(No sender email)',
autoSubmitCode: 'Captcha',
autoSubmitCodePh: 'Fill only if the server requires captcha; often leave empty',
autoSubmitCancel: 'Cancel',
autoSubmitDialogTitle: 'Auto submit',
autoSubmitConfirm: 'Auto submit',
autoSubmitExistingAccountTip:
'This sender email may already have an account. Enter your password. Re-selecting a local file replaces the previous one.',
autoSubmitNotifyMailSubject: '[{journal}] Please complete your submission',
autoSubmitNotifyMailFail: 'Could not send the notification email. You can resend from the compose page.',
autoSubmitNotifyMailSkipped: 'No sender mailbox (j_email_id) found; skipped automatic email.',
autoSubmitNoDocx: 'No .docx attachment in this message (only .docx is supported, same as new submission).',
autoSubmitDownloadFail: 'Could not download the attachment. Try again later.',
autoSubmitSuccessTitle: 'Manuscript created',
autoSubmitDialogClose: 'Close',
autoSubmitSuccessLineAccount: 'Account: {account}',
autoSubmitSuccessLinePassword: 'Password: {password}',
autoSubmitSuccessLineDraft: 'Manuscript ID: {id}. Draft created in staging.',
autoSubmitSuccessLineLinkPrefix: 'Submission link: ',
autoSubmitSuccessMailSent: 'Notification email sent',
autoSubmitSuccessMailSkipped: 'No notification email (journal sender mailbox not configured).',
autoSubmitSuccessMailSkippedRecipient: 'No notification email (no valid From address on this message).',
autoSubmitSuccessMailFailed: 'Notification email was not sent; try again from the compose page.',
autoSubmitSuccessBodyLocalOnly:
'Article ID: {id}. The UI still shows your editor account; the server session may still be the author after author login. Refresh or log in again as editor.',
autoSubmitSuccessBodyServerRestored:
'Article ID: {id}. Logged in again as editor; both local storage and server session should match your editor account.',
autoSubmitSuccessNotify:
'Article ID: {id}<br/><a href="{link}" target="_blank" rel="noopener noreferrer">Open articleAdd</a>',
autoSubmitEditorRestorePwd: 'Editor password (restore session)',
autoSubmitEditorRestorePwdPh:
'Optional: password for the current editor account shown in the header, used after success to restore the server session',
autoSubmitEditorReloginFail:
'Could not restore the editor server session; local values were restored where possible. Refresh the page or log in again as editor.',
autoSubmitFail: 'Submission failed. Check credentials or network and try again.',
autoSubmitUsernameRequired: 'Username is required',
autoSubmitPasswordRequired: 'Password is required',
autoSubmitJournalLabel: 'Journal',
autoSubmitJournalUnknown: 'No journal (switch to a mailbox account that is bound to a journal)',
autoSubmitNeedJournal:
'This mailbox has no journal ID; staging backfill cannot match the submission page. Switch mailbox account first.',
autoSubmitFailPartial: '(If contribute succeeded, article ID may be {id}; please verify in admin.)',
autoSubmitManuscriptSource: 'Manuscript file',
autoSubmitPickLocalDocx: 'Upload .docx from disk',
autoSubmitSourceHint: 'Optional: upload a file; otherwise the first .docx in the email is used. Choosing again replaces the current local file.',
autoSubmitLocalPicked: 'Local file: {name}',
autoSubmitNeedDocxSource: 'Upload a .docx file, or ensure the email has a .docx attachment.',
},
crawlerKeywords: {
pageTitle: 'Keyword Configuration',
@@ -1011,8 +1097,8 @@ colTitle: 'Template title',
step3: 'References',
step: 'step',
Information: 'Fill in information',
startPreAccept: 'Start the pre-acceptance process',
startPreAcceptWithPayment: 'Start the pre-acceptance process and complete your payment',
},
Formula: {
FormulaTemplate: 'Formula Template'
@@ -1187,6 +1273,55 @@ colTitle: 'Template title',
onlySaveConfig: 'Save configuration only',
enableNowNextDay: 'Enable auto promotion now (starts next day)',
factoryCreateBtn: 'Create automated promotion task',
factoryBatchImportBtn: 'Batch import (JSON)',
factoryBatchImportTitle: 'Batch create tasks (JSON)',
factoryBatchImportHintShort: 'Submit a JSON array; non-empty fields merge into each row. You can still edit JSON.',
factoryBatchImportHint:
'Paste a JSON array… Pick journal (getAllJournal) or type ID; template/style/fetch_ids below override JSON when non-empty. Load promotion fields to tick IDs or type comma-separated fetch_ids; load accounts for j_email_id. expert_type "5" needs partitions/countries. Shorthand: zones, countries, email_id_list.',
factoryBatchImportCommonTip: 'Journal from cover or ID field; non-empty template ID, style ID, or fetch_ids override JSON on every row.',
factoryBatchImportJournalId: 'Journal ID',
factoryBatchImportJournalPick: 'Journal',
factoryBatchImportJournalEmpty: 'No journals returned. Check api/Journal/getAllJournal.',
factoryBatchImportJournalManualPlaceholder: 'Filled when you pick a cover, or type manually',
factoryBatchImportTemplateId: 'Template ID',
factoryBatchImportStyleId: 'Style ID',
factoryBatchImportJournalPlaceholder: 'Merged into payload',
factoryBatchImportTemplatePlaceholder: 'Merged into payload',
factoryBatchImportStylePlaceholder: 'Merged into payload',
factoryBatchImportFetchIdsLabel: 'Promotion fields (fetch_ids)',
factoryBatchImportLoadFields: 'Load available fields',
factoryBatchImportFetchTip: 'Uses current journal: pick journal, then load. Search by name or ID (multiple tokens: space or comma). “Select all” selects the filtered list when search is set, otherwise all fields. Checkboxes sync with the comma text; when non-empty, overrides fetch_ids on every row.',
factoryBatchImportFetchIdsManual: 'Merged IDs (comma-separated, editable)',
factoryBatchImportFetchIdsPlaceholder: 'e.g. 1,2,3 or use checkboxes',
factoryBatchImportNeedJournalForFields: 'Select or enter journal ID first',
factoryBatchImportLoadAccounts: 'Load accounts for journal',
factoryBatchImportAccountsApiTip: 'POST api/email_client/getAccounts with journal_id',
factoryBatchImportColEmailId: 'j_email_id',
factoryBatchImportColAddress: 'Sender address',
factoryBatchImportColQuota: 'Remaining / daily limit',
factoryBatchImportCopyEmailIds: 'Copy email_ids (comma)',
factoryBatchImportNeedJournalForAccounts: 'Enter journal ID first',
factoryBatchImportNoAccounts: 'No mailbox accounts for this journal',
factoryBatchImportAccountsFail: 'Failed to load accounts',
factoryBatchImportCopyEmailIdsEmpty: 'Load the account list first',
factoryBatchImportIdsCopied: 'Copied j_email_id list to clipboard',
factoryBatchImportCopyFail: 'Copy failed; select and copy manually',
factoryBatchImportSyncToJson: 'Apply top form to JSON',
factoryBatchImportSyncFromJson: 'Load first row into form',
factoryBatchImportSyncIncludeEmails: 'When applying, set each row email_ids from loaded accounts',
factoryBatchImportSyncTip: 'You can still edit JSON manually; non-empty top fields are merged again on submit.',
factoryBatchImportJsonFromUiOk: 'JSON updated from the form',
factoryBatchImportUiFromJsonOk: 'Form updated from the first JSON row',
factoryBatchImportRun: 'Run batch create',
factoryBatchImportBadJson: 'Invalid JSON; check brackets and quotes',
factoryBatchImportEmpty: 'Array must contain at least one object',
factoryBatchImportMissing: 'Row {index}: missing field {field}',
factoryBatchImportNeedFetch: 'Row {index}: expert database requires fetch_ids',
factoryBatchImportNeedZone: 'Row {index}: expert database requires target_partitions or target_country_ids',
factoryBatchImportRowFail: 'Row {index} failed: {msg}',
factoryBatchImportRowNetwork: 'Row {index}: request error',
factoryBatchImportDone: 'Done: {ok} succeeded, {fail} failed',
factoryBatchImportErrorsTitle: 'Errors (first 8)',
factoryDialogTitle: 'Create task',
factoryJournal: 'Journal',
factoryJournalPlaceholder: 'Select a journal',
@@ -1240,6 +1375,8 @@ colTitle: 'Template title',
factoryExpertYoungBoard: 'Young editorial board',
factoryExpertAuthor: 'Author',
factoryExpertDb: 'Expert database',
factoryExpertYoungBoardBefore2025: 'Young board (before 2025)',
factoryExpertAuthorBefore2025: 'Author (before 2025)',
factoryExpertJump: 'View',
factoryOfficialEmailTip: 'For this type, the system uses the official sender email by default. No account selection is required.',
factoryScenario: 'Scenario',

View File

@@ -48,10 +48,22 @@ const zh = {
plagiarismNotChecked: '未检测',
plagiarismChecking: '正在检测…',
plagiarismRecheck: '重新查重',
plagiarismDuplicateCheck: '重复检查',
plagiarismCheckFailed: '查重任务启动失败。',
plagiarismStatusFailed: '获取查重状态失败。',
plagiarismNoReportUrl: '报告链接暂不可用。',
plagiarismReportDetailFailed: '获取稿件详情失败,请稍后重试。',
plagiarismListTitle: '自动查重记录',
plagiarismAutoCheck: '自动查重',
plagiarismRefresh: '刷新',
plagiarismEmptyList: '暂无查重记录',
plagiarismSimilarity: '相似度',
plagiarismFile: '文件',
plagiarismPreviewPdf: '预览报告',
plagiarismReportLink: '报告',
plagiarismNoPdfLink: '无链接',
plagiarismPreviewClose: '关闭',
plagiarismPreviewOpenTab: '新窗口打开',
},
menu: {
main: '个人中心',
@@ -515,6 +527,23 @@ const zh = {
deleteFail: '删除失败',
previewTitle: '模板预览',
previewClose: '关闭',
batchImportBtn: '批量导入',
batchImportTitle: '批量导入邮件模板JSON',
batchImportHint:
'粘贴 JSON 数组,每条对应一次保存接口(新建不传 template_id更新可带 template_id。字段与编辑页一致title、subject、scene、language可用 lang、version、body_html可用 body、variables_json可用 variables、is_active。',
batchImportCommonTip: '期刊 ID 在下方单独填写;若填写非空,会覆盖每条 JSON 中的 journal_id / journalId。',
batchImportJournalId: '期刊 ID',
batchImportJournalPlaceholder: '可与列表筛选一致,或手填',
batchImportRun: '开始导入',
batchImportBadJson: 'JSON 解析失败',
batchImportEmpty: '请至少包含一条对象',
batchImportMissingJournal: '第 {index} 条:缺少期刊 ID请填写上方输入框或在 JSON 中提供 journal_id',
batchImportMissingField: '第 {index} 条:缺少字段 {field}',
batchImportRowFail: '第 {index} 条保存失败:{msg}',
batchImportRowNetwork: '第 {index} 条请求异常',
batchImportDone: '完成:成功 {ok},失败 {fail}',
batchImportErrorsTitle: '失败明细(最多 8 条)',
batchImportSaveFail: '保存失败',
},
mailboxStyle: {
title: '邮件风格',
@@ -646,15 +675,68 @@ const zh = {
printBtn: '打印',
previewNotSupported: '该文件格式无法在线预览',
downloadToView: '下载到本地查看',
registerAuthorBtn: '创建作者账号',
registerAuthorBtn: '自动投稿',
registerAuthorConfirm:
'将使用推广后台「添加用户」接口创建账号:登录名「{account}」,显示名「{realname}」,邮箱「{email}」,初始密码 123456qwe无需验证码。是否继续',
registerAuthorSuccess: '作者账号已创建。',
registerAuthorSuccessWithEmail: '已创建:{email}密码123456qwe',
registerAuthorFail: '创建失败,请稍后重试或到用户管理中手动添加。',
registerAuthorExistsEmail: '该邮箱已被注册。',
registerAuthorExistsAccount: '该登录名已被占用,请人工处理或修改发件人显示名后重试。',
registerAuthorNeedEmail: '缺少发件人邮箱,无法创建账号。',
registerAuthorNoQq: '本站不支持 QQ 邮箱作为作者账号,请在用户管理中手动添加。',
registerAuthorConfirmShort: '邮箱:{email}\n密码{password}',
registerAuthorPickEmailFail: '多次尝试后仍无法分配到可用邮箱,请稍后重试或手动添加用户。',
autoSubmitBtn: '附件一键建稿',
autoSubmitTitle: '用作者账号登录并上传首份 .docx 附件',
autoSubmitSessionTip:
'作者 checkLogin 不会修改顶部 U_* 本地账号;上传期间服务端 Cookie 为作者。完成后请填写「编辑密码」再登录一次以恢复编辑服务端会话。',
autoSubmitUsername: '登录名',
autoSubmitPassword: '密码',
autoSubmitSenderEmailLabel: '发件人邮箱',
autoSubmitSenderEmailPlaceholder: '(未识别发件人邮箱)',
autoSubmitCode: '验证码',
autoSubmitCodePh: '若后台要求验证码则填写,一般可留空',
autoSubmitCancel: '取消',
autoSubmitDialogTitle: '自动投稿',
autoSubmitConfirm: '自动投稿',
autoSubmitExistingAccountTip:
'该发件邮箱可能已有账号。请填写密码;本地文件可多次重选,新文件会替换上一份。',
autoSubmitNotifyMailSubject: '【{journal}】投稿完善提醒',
autoSubmitNotifyMailFail: '通知邮件发送失败,可稍后在发件页手动补发。',
autoSubmitNotifyMailSkipped: '未识别发件邮箱账号,已跳过自动发信。',
autoSubmitNoDocx: '邮件中无 .docx 附件(仅支持 docx与新增稿件一致。',
autoSubmitDownloadFail: '无法下载附件,请稍后重试。',
autoSubmitSuccessTitle: '建稿成功',
autoSubmitDialogClose: '关闭',
autoSubmitSuccessLineAccount: '账号{account}',
autoSubmitSuccessLinePassword: '密码{password}',
autoSubmitSuccessLineDraft: '稿号id{id} 已创建草稿箱',
autoSubmitSuccessLineLinkPrefix: '稿件链接地址是:',
autoSubmitSuccessMailSent: '邮件通知已发送',
autoSubmitSuccessMailSkipped: '未发送通知邮件(未配置期刊发件邮箱)',
autoSubmitSuccessMailSkippedRecipient: '未发送通知邮件(邮件中缺少有效发件人邮箱)',
autoSubmitSuccessMailFailed: '邮件通知未发送,请稍后在发件页补发',
autoSubmitSuccessBodyLocalOnly:
'文章 ID{id}。界面仍为当前编辑账号;服务端在作者登录后可能仍为作者会话,请刷新或重新登录编辑账号。',
autoSubmitSuccessBodyServerRestored: '文章 ID{id}。已通过编辑账号重新登录,本地与服务端会话均已恢复为编辑。',
autoSubmitSuccessNotify:
'文章 ID{id}<br/><a href="{link}" target="_blank" rel="noopener noreferrer">打开 articleAdd 继续编辑</a>',
autoSubmitEditorRestorePwd: '编辑密码(恢复会话)',
autoSubmitEditorRestorePwdPh: '选填:与顶部当前登录名对应的编辑密码,用于上传成功后恢复服务端会话',
autoSubmitEditorReloginFail: '恢复编辑服务端会话失败,已尽量恢复本地信息,请刷新页面或重新登录。',
autoSubmitFail: '建稿失败,请检查账号密码或网络后重试。',
autoSubmitUsernameRequired: '请填写登录名',
autoSubmitPasswordRequired: '请填写密码',
autoSubmitJournalLabel: '目标期刊',
autoSubmitJournalUnknown: '未识别期刊(请先在邮件列表切换绑定期刊的邮箱账号)',
autoSubmitNeedJournal: '当前邮箱账号没有期刊信息,无法与投稿页一致回填。请通过「切换邮箱账号」选择绑定期刊的账号。',
autoSubmitFailPartial: '(若 contribute 已成功,文章 ID 可能为:{id},请到后台核对)',
autoSubmitManuscriptSource: '稿件文件',
autoSubmitPickLocalDocx: '本地上传 .docx',
autoSubmitSourceHint: '可选本地上传;否则使用邮件中第一份 .docx。再次选择会替换当前本机文件。',
autoSubmitLocalPicked: '当前本机文件:{name}',
autoSubmitNeedDocxSource: '请在本地上传 .docx或确保邮件中带有 .docx 附件。',
},
crawlerKeywords: {
pageTitle: '关键词配置',
@@ -1000,8 +1082,8 @@ const zh = {
step3: '参考',
step: 'step',
Information: 'Fill in information',
startPreAccept: '开始预接收流程',
startPreAcceptWithPayment: '开始预接收流程并完成支付',
},
Formula:{
FormulaTemplate:'公式模版'
@@ -1172,6 +1254,55 @@ const zh = {
onlySaveConfig: '仅保存配置',
enableNowNextDay: '立即激活自动推广(次日开始自动推广)',
factoryCreateBtn: '创建自动化推广任务',
factoryBatchImportBtn: '临时批量导入',
factoryBatchImportTitle: '批量创建推广任务JSON',
factoryBatchImportHintShort: '数组提交;上方非空项会合并进每条请求,仍可直接改 JSON。',
factoryBatchImportHint:
'粘贴 JSON 数组…期刊用封面getAllJournal或手填 ID模板/样式/推广领域 fetch_ids 在下方非空则覆盖 JSON。推广领域可「加载可选领域」勾选或手改逗号 ID填期刊后可查邮箱 j_email_idgetAccounts。expert_type 为 5 时须分区或国家。简写zones、countries、email_id_list。',
factoryBatchImportCommonTip: '期刊以封面或下方 ID 为准;模板 ID、样式 ID、推广领域 fetch_ids 任一非空则覆盖每条 JSON 中对应字段后再请求接口。',
factoryBatchImportJournalId: '期刊 ID',
factoryBatchImportJournalPick: '选择期刊',
factoryBatchImportJournalEmpty: '未获取到期刊列表,请检查接口或稍后重试',
factoryBatchImportJournalManualPlaceholder: '点击上方封面自动填入,也可手改',
factoryBatchImportTemplateId: '模板 ID',
factoryBatchImportStyleId: '样式 ID',
factoryBatchImportJournalPlaceholder: '与 JSON 合并',
factoryBatchImportTemplatePlaceholder: '与 JSON 合并',
factoryBatchImportStylePlaceholder: '与 JSON 合并',
factoryBatchImportFetchIdsLabel: '推广领域 fetch_ids',
factoryBatchImportLoadFields: '加载可选领域',
factoryBatchImportFetchTip: '依赖当前期刊:先选期刊再加载。上方可搜索名称或 ID多关键词用空格或逗号有搜索时「全选」勾选当前筛选结果无搜索时「全选」为全部。勾选与下方逗号文本同步非空则覆盖每条 JSON 的 fetch_ids。',
factoryBatchImportFetchIdsManual: '合并用 ID逗号分隔可手改',
factoryBatchImportFetchIdsPlaceholder: '例1,2,3或与勾选联动',
factoryBatchImportNeedJournalForFields: '请先选择或填写期刊 ID',
factoryBatchImportLoadAccounts: '查询该期刊邮箱',
factoryBatchImportAccountsApiTip: 'POST api/email_client/getAccounts参数 journal_id',
factoryBatchImportColEmailId: 'j_email_id',
factoryBatchImportColAddress: '发件地址',
factoryBatchImportColQuota: '今日剩余 / 日上限',
factoryBatchImportCopyEmailIds: '复制 email_ids逗号',
factoryBatchImportNeedJournalForAccounts: '请先填写期刊 ID',
factoryBatchImportNoAccounts: '该期刊下暂无邮箱账号',
factoryBatchImportAccountsFail: '拉取邮箱列表失败',
factoryBatchImportCopyEmailIdsEmpty: '请先查询出账号列表',
factoryBatchImportIdsCopied: '已复制 j_email_id 列表到剪贴板',
factoryBatchImportCopyFail: '复制失败,请手动选中复制',
factoryBatchImportSyncToJson: '上方选项写入 JSON',
factoryBatchImportSyncFromJson: '首条 JSON 回显到上方',
factoryBatchImportSyncIncludeEmails: '写入时用当前邮箱列表覆盖每条 email_ids',
factoryBatchImportSyncTip: '写入后仍可单独改 JSON提交时若上方输入框非空仍会再合并覆盖。',
factoryBatchImportJsonFromUiOk: '已根据上方选项更新 JSON',
factoryBatchImportUiFromJsonOk: '已用首条 JSON 更新上方表单',
factoryBatchImportRun: '开始批量创建',
factoryBatchImportBadJson: 'JSON 解析失败,请检查括号与引号',
factoryBatchImportEmpty: '请至少包含一条对象',
factoryBatchImportMissing: '第 {index} 条缺少字段:{field}',
factoryBatchImportNeedFetch: '第 {index} 条:专家库需填写 fetch_ids推广领域',
factoryBatchImportNeedZone: '第 {index} 条专家库需至少填写分区或国家target_partitions / target_country_ids',
factoryBatchImportRowFail: '第 {index} 条创建失败:{msg}',
factoryBatchImportRowNetwork: '第 {index} 条请求异常',
factoryBatchImportDone: '完成:成功 {ok},失败 {fail}',
factoryBatchImportErrorsTitle: '失败明细(最多显示 8 条)',
factoryDialogTitle: '创建任务',
factoryJournal: '期刊',
factoryJournalPlaceholder: '请选择期刊',
@@ -1225,6 +1356,8 @@ const zh = {
factoryExpertYoungBoard: '青年编委',
factoryExpertAuthor: '作者',
factoryExpertDb: 'expert库',
factoryExpertYoungBoardBefore2025: '2025前青年编委',
factoryExpertAuthorBefore2025: '2025前作者',
factoryExpertJump: '查看',
factoryOfficialEmailTip: '此类型默认使用系统官方邮箱发送,无需选择邮箱账号。',
factoryScenario: '场景',

View File

@@ -1005,6 +1005,77 @@
</a>
<el-button type="text" @click="changeRepe" icon="el-icon-edit">Change</el-button>
</div>
<div v-if="plagiarismListReady" class="plagiarism-check-shell">
<el-button
v-if="!plagiarismList.length"
class="plagiarism-auto-check-btn"
icon="el-icon-search"
:loading="plagiarismSubmitLoading"
@click="submitPlagiarismCheck"
>
{{ $t('articleListEditor.plagiarismAutoCheck') }}
</el-button>
<div
v-else
class="plagiarism-check-block"
v-loading="plagiarismListLoading"
element-loading-background="transparent"
>
<div class="plagiarism-check-header">
<span class="plagiarism-check-title">{{ $t('articleListEditor.plagiarismListTitle') }}</span>
<div class="plagiarism-check-actions">
<!-- <el-button
type="text"
size="mini"
icon="el-icon-document-checked"
:loading="plagiarismSubmitLoading"
@click="submitPlagiarismCheck"
>
{{ $t('articleListEditor.plagiarismDuplicateCheck') }}
</el-button> -->
<el-button
type="text"
size="mini"
icon="el-icon-refresh"
:loading="plagiarismListLoading"
@click="fetchPlagiarismList(true)"
>
{{ $t('articleListEditor.plagiarismRefresh') }}
</el-button>
</div>
</div>
<div class="plagiarism-check-list-wrap">
<div
v-for="row in plagiarismList"
:key="row.check_id || row.id"
class="plagiarism-check-row"
:title="row.source_file_name || ''"
>
<span class="plagiarism-sim-dot" :class="getPlagiarismSimilarityLevel(row)"></span>
<span class="plagiarism-sim-pct" :class="getPlagiarismSimilarityLevel(row)">
{{ formatPlagiarismSimilarity(row) }}
</span>
<span class="plagiarism-sim-date">{{ formatPlagiarismDate(row) }}</span>
<span class="plagiarism-sim-state" :class="getPlagiarismStateClass(row)">
{{ formatPlagiarismStateLabel(row) }}
</span>
<span class="plagiarism-sim-report">
<a
v-if="hasPlagiarismPdf(row)"
href="javascript:;"
class="plagiarism-report-preview"
:title="$t('articleListEditor.plagiarismPreviewOpenTab')"
@click.prevent="openPlagiarismReportPage(row)"
>
{{ $t('articleListEditor.plagiarismPreviewPdf') }}
<i class="el-icon-link"></i>
</a>
<span v-else class="plagiarism-check-no-pdf">{{ $t('articleListEditor.plagiarismNoPdfLink') }}</span>
</span>
</div>
</div>
</div>
</div>
<div>
<span style="display: inline-block; vertical-align: top; margin-top: 7px">Manuscript : </span>
<el-upload
@@ -1200,6 +1271,31 @@
<el-button type="primary" @click="saveRepe">Save</el-button>
</span>
</el-dialog>
<el-dialog
:title="plagiarismPdfPreviewTitle"
:visible.sync="plagiarismPdfPreviewVisible"
width="90%"
top="4vh"
append-to-body
custom-class="plagiarism-pdf-preview-dialog"
@closed="onPlagiarismPdfPreviewClosed"
>
<div v-loading="plagiarismPdfPreviewLoading" class="plagiarism-pdf-preview-body">
<iframe
v-if="plagiarismPdfPreviewUrl"
:src="plagiarismPdfPreviewUrl"
class="plagiarism-pdf-preview-iframe"
frameborder="0"
@load="plagiarismPdfPreviewLoading = false"
></iframe>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="plagiarismPdfPreviewVisible = false">{{ $t('articleListEditor.plagiarismPreviewClose') }}</el-button>
<el-button size="small" type="primary" v-if="plagiarismPdfPreviewUrl" @click="openPlagiarismPdfInNewTab">
{{ $t('articleListEditor.plagiarismPreviewOpenTab') }}
</el-button>
</span>
</el-dialog>
<el-dialog
title="Resubmit the manuscript"
:visible.sync="resubmitVisible"
@@ -1808,7 +1904,16 @@ export default {
is_figure_copyright: '',
figurecopyright_file: '',
plagiarismDetailPollTimer: null,
plagiarismDetailPending: false
plagiarismDetailPending: false,
plagiarismList: [],
plagiarismListLoading: false,
plagiarismListReady: false,
plagiarismPollTimer: null,
plagiarismSubmitLoading: false,
plagiarismPdfPreviewVisible: false,
plagiarismPdfPreviewUrl: '',
plagiarismPdfPreviewTitle: '',
plagiarismPdfPreviewLoading: false
};
},
async created() {
@@ -1818,6 +1923,17 @@ export default {
this.getWordimgList();
this.getWordTablesList();
this.getFinalList();
this.startPlagiarismPolling();
},
activated() {
this.startPlagiarismPolling(false);
},
deactivated() {
this.stopPlagiarismPolling();
},
beforeDestroy() {
this.stopPlagiarismPolling();
this.detailStopPlagiarismPolling();
},
computed: {
// coverLetterUrl: function() {
@@ -2527,6 +2643,7 @@ export default {
background: 'rgba(0, 0, 0, 0.7)'
});
this.$api.post('api/Article/changeRepetition', this.repeform).then((res) => {
this.repebox = false;
load.close();
this.$message.success('success');
this.initarticle();
@@ -2942,8 +3059,7 @@ export default {
closeResubmit() {
(this.resubmitVisible = false), this.$refs['resubmitJournal'].resetFields();
},
/* ---------- Crossref plagiarism详情页右侧 ---------- */
/* ---------- Crossref plagiarism详情页 Repetition 行) ---------- */
detailPlagiarismArticleKey() {
return String(this.form.articleId || this.editform.articleId || this.$route.query.id || '');
},
@@ -3115,14 +3231,196 @@ export default {
full = base ? `${base}/${path}` : `/${path}`;
}
window.open(full, '_blank');
},
/* ---------- 自动查重列表 ---------- */
startPlagiarismPolling(resetList) {
this.stopPlagiarismPolling();
if (resetList !== false) {
this.plagiarismListReady = false;
this.plagiarismList = [];
}
this.fetchPlagiarismList(false);
this.plagiarismPollTimer = setInterval(() => {
this.fetchPlagiarismList(false);
}, 3 * 60 * 1000);
},
stopPlagiarismPolling() {
if (this.plagiarismPollTimer) {
clearInterval(this.plagiarismPollTimer);
this.plagiarismPollTimer = null;
}
},
async submitPlagiarismCheck() {
const articleId = String((this.editform && this.editform.articleId) || this.$route.query.id || '').trim();
if (!articleId) {
this.$message.warning(this.$t('articleListEditor.plagiarismReportDetailFailed'));
return;
}
this.plagiarismSubmitLoading = true;
try {
const res = await this.$api.post('api/Plagiarism/submit', { article_id: articleId });
if (res && Number(res.code) === 0) {
this.$message.success((res && res.msg) || this.$t('articleListEditor.plagiarismChecking'));
await this.fetchPlagiarismList(true);
} else {
this.$message.error((res && res.msg) || this.$t('articleListEditor.plagiarismCheckFailed'));
}
} catch (e) {
this.$message.error(this.$t('articleListEditor.plagiarismCheckFailed'));
} finally {
this.plagiarismSubmitLoading = false;
}
},
async fetchPlagiarismList(manual) {
const articleId = String((this.editform && this.editform.articleId) || this.$route.query.id || '').trim();
if (!articleId) {
this.plagiarismListReady = true;
return;
}
if (manual && this.plagiarismList.length) {
this.plagiarismListLoading = true;
}
try {
const res = await this.$api.post('api/Plagiarism/getList', { article_id: articleId });
if (res && Number(res.code) === 0) {
const payload = res.data || {};
const list = Array.isArray(payload.list) ? payload.list : Array.isArray(payload) ? payload : [];
this.plagiarismList = list;
} else if (manual) {
this.$message.error((res && res.msg) || this.$t('articleListEditor.plagiarismStatusFailed'));
}
} catch (e) {
if (manual) {
this.$message.error(this.$t('articleListEditor.plagiarismStatusFailed'));
}
} finally {
this.plagiarismListLoading = false;
this.plagiarismListReady = true;
}
},
formatPlagiarismState(state) {
const s = String(state != null ? state : '').trim();
if (!s) return '-';
return s;
},
formatPlagiarismStateLabel(row) {
if (!row || typeof row !== 'object') return '';
const label = String(row.state_label || row.stateLabel || '').trim();
if (label) return label;
const s = row.state;
if (s == null || String(s).trim() === '') return '';
return this.formatPlagiarismState(s);
},
getPlagiarismStateClass(row) {
const s = Number(row && row.state);
if (s === 1) return 'state-uploading';
if (s === 2 || s === 3) return 'state-done';
if (s === 4 || s === 5) return 'state-fail';
return '';
},
getPlagiarismSimilarityScore(row) {
if (!row || typeof row !== 'object') return null;
const raw = row.similarity_score != null ? row.similarity_score : row.similarity;
if (raw == null || String(raw).trim() === '') return null;
const n = Number(raw);
return isNaN(n) ? null : n;
},
formatPlagiarismSimilarity(row) {
const n = this.getPlagiarismSimilarityScore(row);
return n == null ? '' : n + '%';
},
/** Crossref 相似度色块0 绿、129 蓝、30+ 橙 */
getPlagiarismSimilarityLevel(row) {
const n = this.getPlagiarismSimilarityScore(row);
if (n == null) return 'sim-unknown';
if (n <= 0) return 'sim-zero';
if (n < 30) return 'sim-low';
return 'sim-high';
},
formatPlagiarismDate(row) {
if (!row || typeof row !== 'object') return '';
const raw =
row.finish_time ||
row.finished_at ||
row.update_time ||
row.ctime ||
row.create_time ||
row.created_at ||
'';
if (raw == null || String(raw).trim() === '') return '';
const s = String(raw).trim();
if (/^\d+$/.test(s)) {
const num = Number(s);
const ts = num > 1e12 ? num : num * 1000;
try {
return this.formatDate(Math.floor(ts / 1000));
} catch (e) {
return s;
}
}
const d = new Date(s.replace(/-/g, '/'));
if (!isNaN(d.getTime())) {
const pad = (v) => String(v).padStart(2, '0');
return d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate());
}
return s.length > 10 ? s.slice(0, 10) : s;
},
resolvePlagiarismPdfUrl(row) {
if (!row || typeof row !== 'object') return '';
const raw = String(row.viewer_url || row.local_pdf_url || row.localPdfUrl || '').trim();
if (!raw) return '';
if (/^https?:\/\//i.test(raw)) return raw;
let path = raw.replace(/^\/+/, '');
if (!/^public\//i.test(path)) {
const media = String(this.mediaUrl || '/public/').replace(/\/+$/, '');
if (/^https?:\/\//i.test(media)) {
return media + '/' + path;
}
path = (media.startsWith('/') ? media : '/' + media) + '/' + path;
} else {
path = '/' + path;
}
path = path.replace(/\/+/g, '/');
if (typeof window !== 'undefined' && window.location && window.location.origin && path.startsWith('/')) {
return window.location.origin + path;
}
return path;
},
hasPlagiarismPdf(row) {
return !!this.resolvePlagiarismPdfUrl(row);
},
openPlagiarismReportPage(row) {
const url = this.resolvePlagiarismPdfUrl(row);
if (!url) return;
window.open(url, '_blank', 'noopener,noreferrer');
},
openPlagiarismPdfPreview(row) {
const url = this.resolvePlagiarismPdfUrl(row);
if (!url) return;
const name = row && row.source_file_name ? String(row.source_file_name) : 'report.pdf';
const id = row && row.check_id != null ? row.check_id : '';
this.plagiarismPdfPreviewTitle =
this.$t('articleListEditor.plagiarismPreviewPdf') + (id ? ' #' + id : '') + ' - ' + name;
this.plagiarismPdfPreviewUrl = url;
this.plagiarismPdfPreviewLoading = true;
this.plagiarismPdfPreviewVisible = true;
},
onPlagiarismPdfPreviewClosed() {
this.plagiarismPdfPreviewUrl = '';
this.plagiarismPdfPreviewTitle = '';
this.plagiarismPdfPreviewLoading = false;
},
openPlagiarismPdfInNewTab() {
if (!this.plagiarismPdfPreviewUrl) return;
window.open(this.plagiarismPdfPreviewUrl, '_blank', 'noopener');
}
},
mounted() {
this.opname = this.$route.query.mark;
this.resubmitJournal.manuscriptId = this.$route.query.id;
},
beforeDestroy() {
this.detailStopPlagiarismPolling();
}
};
</script>
@@ -3182,6 +3480,169 @@ export default {
text-decoration: underline;
}
.plagiarism-check-shell {
margin: 0 0 10px 0;
}
.plagiarism-check-block >>> .el-loading-mask {
background-color: transparent !important;
}
.plagiarism-auto-check-btn.el-button {
display: block;
width: 200px;
border: none;
color: #fff;
font-size: 13px;
margin-left: 75px;
font-weight: 500;
letter-spacing: 0.3px;
padding: 11px 20px;
border-radius: 4px;
background: linear-gradient(135deg, #2ec4b6 0%, #0d9b8f 45%, #0a7f76 100%);
box-shadow: 0 2px 8px rgba(13, 155, 143, 0.35);
transition: opacity 0.2s ease, box-shadow 0.2s ease;
}
.plagiarism-auto-check-btn.el-button:hover,
.plagiarism-auto-check-btn.el-button:focus {
color: #fff;
background: linear-gradient(135deg, #3dd4c6 0%, #14b0a3 45%, #0e948a 100%);
box-shadow: 0 4px 12px rgba(13, 155, 143, 0.45);
}
.plagiarism-auto-check-btn.el-button.is-loading {
background: linear-gradient(135deg, #2ec4b6 0%, #0d9b8f 45%, #0a7f76 100%);
}
.plagiarism-check-block {
margin: 0 0 10px 0;
padding: 10px 12px;
background: #f8fafc;
border: 1px solid #e8edf3;
border-radius: 4px;
}
.plagiarism-check-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 8px;
}
.plagiarism-check-actions {
display: flex;
align-items: center;
gap: 4px;
}
.plagiarism-check-actions .el-button {
padding: 0 6px;
}
.plagiarism-check-title {
font-size: 13px;
color: #606266;
font-weight: 500;
}
.plagiarism-check-list-wrap {
min-height: 32px;
}
.plagiarism-check-row {
display: flex;
align-items: center;
gap: 10px;
padding: 6px 0;
border-top: 1px solid #eef1f5;
font-size: 12px;
line-height: 20px;
}
.plagiarism-check-row:first-child {
border-top: none;
padding-top: 0;
}
.plagiarism-sim-dot {
flex-shrink: 0;
width: 10px;
height: 10px;
border-radius: 1px;
}
.plagiarism-sim-dot.sim-zero {
background: #00a99d;
}
.plagiarism-sim-dot.sim-low {
background: #0070c0;
}
.plagiarism-sim-dot.sim-high {
background: #c87f0a;
}
.plagiarism-sim-dot.sim-unknown {
background: #c0c4cc;
}
.plagiarism-sim-pct {
flex-shrink: 0;
min-width: 36px;
font-weight: 600;
}
.plagiarism-sim-pct.sim-zero {
color: #00a99d;
}
.plagiarism-sim-pct.sim-low {
color: #0070c0;
}
.plagiarism-sim-pct.sim-high {
color: #c87f0a;
}
.plagiarism-sim-pct.sim-unknown {
color: #909399;
}
.plagiarism-sim-date {
flex-shrink: 0;
color: #909399;
}
.plagiarism-sim-state {
flex: 1;
min-width: 48px;
color: #909399;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.plagiarism-sim-state.state-uploading {
color: #e6a23c;
}
.plagiarism-sim-state.state-done {
color: #67c23a;
}
.plagiarism-sim-state.state-fail {
color: #f56c6c;
}
.plagiarism-sim-report {
flex-shrink: 0;
display: inline-flex;
align-items: center;
justify-content: flex-end;
gap: 6px;
}
.plagiarism-report-preview {
color: #409eff;
text-decoration: none;
display: inline-flex;
align-items: center;
gap: 4px;
}
.plagiarism-report-preview:hover {
text-decoration: underline;
color: #66b1ff;
}
.plagiarism-report-preview .el-icon-link {
font-size: 14px;
}
.plagiarism-check-no-pdf {
color: #f56c6c;
font-size: 12px;
}
.plagiarism-pdf-preview-body {
min-height: 70vh;
}
.plagiarism-pdf-preview-iframe {
width: 100%;
height: 70vh;
border: none;
background: #f5f7fa;
}
.el-upload__tip {
display: inline-block;
line-height: 32px;

View File

@@ -107,11 +107,11 @@
</span>
<span v-if="item.state == 6" style="text-decoration: none;margin-left: 20px;">
<span v-if="item.state == 6 && preAcceptButtonReady(item)" style="text-decoration: none;margin-left: 20px;">
<span @click="goPre_ingested(item.article_id)" class="preButton">
<!-- <el-badge is-dot class="item" > -->
<i class="el-icon-bank-card"></i>Start the pre-acceptance process and complete your payment
<i class="el-icon-bank-card"></i>{{ preAcceptEntryButtonText(item) }}
<!-- </el-badge> -->
</span>
</span>
@@ -539,6 +539,61 @@
this.getdate();
},
methods: {
/** 与 Complete_profile.vue getDetail 中订单/支付展示逻辑一致preOrderDetail → is_buy、期刊费、折后费、isFree */
_feeNum(v) {
if (v == null || v === '') return 0;
const n = Number(String(v).replace(/,/g, ''));
return Number.isFinite(n) ? n : 0;
},
computePreacceptShortButton(articleInfo, journalInfo) {
if (!articleInfo || !journalInfo) return false;
const journalFee = journalInfo.fee;
const articleFee = articleInfo.fee;
const isBuy = Number(articleInfo.is_buy) === 1;
const tableFee = journalFee ? this._feeNum(articleFee) : 0;
const isFree = isBuy && tableFee === 0;
const noJournalFee = !journalFee || this._feeNum(journalFee) === 0 || String(journalFee) === '0.00';
// Complete_profile: active=1 当已付,或 未付但期刊无 APC
if (isFree) return true;
if (isBuy) return true;
if (!isBuy && noJournalFee) return true;
return false;
},
preAcceptButtonReady(item) {
const p = item._preacceptPay;
return !!(p && p.loading === false);
},
async hydratePreacceptPaymentForList(rows) {
if (!rows || !rows.length) return;
const targets = rows.filter((r) => Number(r.state) === 6);
await Promise.all(
targets.map(async (row) => {
try {
const res = await this.$api.post('api/Order/preOrderDetail', {
article_id: row.article_id
});
if (res && Number(res.code) === 0) {
const article = res.data.article_detail || {};
const journal = res.data.journal_detail || {};
const shortButton = this.computePreacceptShortButton(article, journal);
this.$set(row, '_preacceptPay', { loading: false, shortButton });
} else {
this.$set(row, '_preacceptPay', { loading: false, shortButton: false });
}
} catch (e) {
console.error(e);
this.$set(row, '_preacceptPay', { loading: false, shortButton: false });
}
})
);
},
preAcceptEntryButtonText(item) {
const pay = item._preacceptPay;
if (!pay || pay.loading) return '';
return pay.shortButton
? this.$t('PreAccept.startPreAccept')
: this.$t('PreAccept.startPreAcceptWithPayment');
},
formatToHtml(val) {
if (!val) return '';
@@ -612,8 +667,12 @@ return processedText;
1 + '-';
let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
res.data[i].ctime = Y + M + D;
if (Number(res.data[i].state) === 6) {
this.$set(res.data[i], '_preacceptPay', { loading: true, shortButton: false });
}
}
this.tableData = res.data
this.tableData = res.data;
this.hydratePreacceptPaymentForList(res.data);
})
.catch(err => {
console.log(err);

File diff suppressed because it is too large Load Diff

View File

@@ -17,7 +17,7 @@
<span class="label">{{ $t('autoPromotion.journal') }} : </span>
{{ currentJournalName }}
<el-select
v-if="config.initialized && selectedJournalId"
v-if="selectedJournalId"
v-model="headerPromotionFactoryId"
class="header-factory-task-select custom-pipeline-select"
size="small"
@@ -61,7 +61,7 @@
</el-option-group>
</el-select>
<el-tag
v-if="config.initialized && selectedJournalId && headerFactoryTaskRunning !== null"
v-if="selectedJournalId && headerFactoryTaskRunning !== null"
:type="headerFactoryTaskRunning ? 'success' : 'info'"
size="small"
effect="plain"
@@ -74,10 +74,10 @@
<el-button type="text" size="small" style="margin-left: 10px" @click="openFactoryTaskDialogFromLogs">
<i class="el-icon-edit"></i>
{{ config.initialized ? $t('autoPromotionLogs.editConfig') : $t('autoPromotionLogs.startConfig') }}
{{ $t('autoPromotionLogs.editConfig') }}
</el-button>
</div>
<div v-if="config.initialized && selectedJournalId && headerPromotionFactoryId" class="right">
<div v-if="selectedJournalId && headerPromotionFactoryId" class="right">
<el-button
type="primary"
size="small"
@@ -92,31 +92,7 @@
</el-card>
<div v-loading="loading" class="main-body">
<el-card v-if="!config.initialized" shadow="never" class="wizard-card">
<auto-promotion-wizard
mode="inline"
:config="config"
:wizardStartDate.sync="wizardStartDate"
:selectedFieldIds.sync="selectedFieldIds"
:selectedCountryIds.sync="selectedCountryIds"
:availableFields="availableFields"
:availableCountries="availableCountries"
:fieldsLoading="fieldsLoading"
:fieldsSaving="fieldsSaving"
:currentJournalName="currentJournalName"
:selectedTemplateThumbHtml="selectedTemplateThumbHtml"
:selectedTemplateName="selectedTemplateName"
:selectedStyleName="selectedStyleName"
:saving="saving"
:title="$t('autoPromotion.title')"
@open-template-selector="showTemplateDialog = true"
@confirm-fields="savePromotionFieldsNow"
@confirm-countries="savePromotionCountriesNow"
@confirm="completeInitialization"
/>
</el-card>
<div v-else class="manage-mode">
<div class="manage-mode">
<el-card shadow="never" class="list-card">
<div class="filter-header-row">
<div class="tmr-capsule-group">
@@ -270,30 +246,6 @@
</div>
</div>
<auto-promotion-wizard
mode="dialog"
:visible.sync="showWizardDialog"
:config="config"
:wizardStartDate.sync="wizardStartDate"
:selectedFieldIds.sync="selectedFieldIds"
:selectedCountryIds.sync="selectedCountryIds"
:availableFields="availableFields"
:availableCountries="availableCountries"
:fieldsLoading="fieldsLoading"
:fieldsSaving="fieldsSaving"
:currentJournalName="currentJournalName"
:selectedTemplateThumbHtml="selectedTemplateThumbHtml"
:selectedTemplateName="selectedTemplateName"
:selectedStyleName="selectedStyleName"
:saving="saving"
:title="$t('autoPromotion.title')"
@open-template-selector="showTemplateDialog = true"
@confirm-fields="savePromotionFieldsNow"
@confirm-countries="savePromotionCountriesNow"
@cancel="showWizardDialog = false"
@confirm="completeInitialization"
/>
<template-selector-dialog
v-if="showTemplateDialog"
:visible.sync="showTemplateDialog"
@@ -359,7 +311,6 @@
<script>
import CkeditorMail from '@/components/page/components/email/CkeditorMail.vue';
import TemplateSelectorDialog from '@/components/page/components/email/TemplateSelectorDialog.vue';
import AutoPromotionWizard from '@/components/page/components/autoPromotion/AutoPromotionWizard.vue';
import PromotionFactoryTaskDialog from '@/components/page/components/autoPromotion/PromotionFactoryTaskDialog.vue';
import PromotionDetailDrawer from '@/components/page/components/autoPromotion/PromotionDetailDrawer.vue';
// 这里假设你已经定义了 API 地址
@@ -373,8 +324,8 @@ const API = {
};
export default {
name: 'autoPromotion',
components: { TemplateSelectorDialog, AutoPromotionWizard, PromotionFactoryTaskDialog, CkeditorMail, PromotionDetailDrawer },
name: 'autoPromotionLogs',
components: { TemplateSelectorDialog, PromotionFactoryTaskDialog, CkeditorMail, PromotionDetailDrawer },
data() {
return {
handleRefreshList: [],
@@ -482,12 +433,17 @@ export default {
}
},
watch: {
'$route.query.journal_id'(val) {
const s = String(val != null ? val : '').trim();
if (s === String(this.selectedJournalId || '').trim()) return;
this.initPage();
},
'$route.query.promotion_factory_id'(val) {
const s = String(val != null ? val : '').trim();
if (s === String(this.headerPromotionFactoryId || '').trim()) return;
this.headerPromotionFactoryId = s;
this.routePromotionFactoryId = s;
if (this.config.initialized && this.selectedJournalId) {
if (this.selectedJournalId) {
this.query.pageIndex = 1;
this.fetchList();
}
@@ -496,6 +452,28 @@ export default {
created() {
this.initPage();
},
activated() {
const routeJid = String((this.$route.query && this.$route.query.journal_id) || '').trim();
const curJid = String(this.selectedJournalId || '').trim();
if (routeJid && routeJid !== curJid) {
this.initPage();
return;
}
const routePid = String(
(this.$route.query && this.$route.query.promotion_factory_id) ||
(this.$route.query && this.$route.query.taskId) ||
''
).trim();
const curPid = String(this.headerPromotionFactoryId || '').trim();
if (routePid && routePid !== curPid) {
this.headerPromotionFactoryId = routePid;
this.routePromotionFactoryId = routePid;
if (this.selectedJournalId) {
this.query.pageIndex = 1;
this.fetchList();
}
}
},
methods: {
mapFactoryTaskTypeLabel(type) {
const t = String(type || '');
@@ -512,6 +490,8 @@ export default {
if (t === '3') return this.$t('autoPromotion.factoryExpertYoungBoard');
if (t === '4') return this.$t('autoPromotion.factoryExpertAuthor');
if (t === '5') return this.$t('autoPromotion.factoryExpertDb');
if (t === '6') return this.$t('autoPromotion.factoryExpertYoungBoardBefore2025');
if (t === '7') return this.$t('autoPromotion.factoryExpertAuthorBefore2025');
return '-';
},
getStatusType(status) {
@@ -635,10 +615,6 @@ export default {
try {
await this.fetchJournalDetail();
if (this.selectedJournalId) {
this.loadPromotionFields(this.selectedJournalId);
}
if (this.config.initialized) {
await this.fetchTemplates();
await this.fetchFactoryTasksForHeader();
await this.fetchList();
}
@@ -747,7 +723,7 @@ export default {
},
/** 下拉仅展示「类型 - 创建日期」,运行状态单独用 el-tag */
buildFactoryHeaderOptionMainLabel(task, pidFallback) {
console.log("🚀 ~ buildFactoryHeaderOptionMainLabel ~ task:", task);
const typePart = this.getFactoryHeaderTaskTypeLabel(task) || String(pidFallback || '').trim() || '—';
const expertTypePart = this.mapFactoryExpertTypeLabel(task.expert_type);
@@ -764,7 +740,7 @@ export default {
}
},
async fetchFactoryTasksForHeader() {
if (!this.selectedJournalId || !this.config.initialized) {
if (!this.selectedJournalId) {
this.factoryTaskOptions = [];
return;
}

View File

@@ -354,8 +354,9 @@
chief: null,
board: null,
young: null,
youngBefore2025: null,
authorBefore2025: null,
author: null,
reviewer: null,
expertDb: null
},
expertTypeCountsLoading: false,
@@ -432,6 +433,22 @@
count: counts.young,
jump: { path: '/youthList', queryKey: 'journal_id' }
},
{
value: '6',
label: this.$t('autoPromotion.factoryExpertYoungBoardBefore2025'),
desc: this.$t('autoPromotion.factoryExpertYoungBoardBefore2025'),
icon: 'el-icon-time',
count: counts.youngBefore2025,
jump: { path: '/youthList', queryKey: 'journal_id' }
},
{
value: '7',
label: this.$t('autoPromotion.factoryExpertAuthorBefore2025'),
desc: this.$t('autoPromotion.factoryExpertAuthorBefore2025'),
icon: 'el-icon-document',
count: counts.authorBefore2025,
jump: { path: '/partyListCorr', queryKey: 'journal_id' }
},
{
value: '4',
label: this.$t('autoPromotion.factoryExpertAuthor'),
@@ -884,12 +901,28 @@
this.availableFields = [];
this.factoryFieldIds = [];
this.selectedEmailIds = [];
this.expertTypeCounts = { chief: null, board: null, young: null, author: null, reviewer: null, expertDb: null };
this.expertTypeCounts = {
chief: null,
board: null,
young: null,
youngBefore2025: null,
authorBefore2025: null,
author: null,
expertDb: null
};
this.syncActiveStep();
return;
}
// 切换期刊时:先清空旧人数并立即触发 loading
this.expertTypeCounts = { chief: null, board: null, young: null, author: null, reviewer: null, expertDb: null };
this.expertTypeCounts = {
chief: null,
board: null,
young: null,
youngBefore2025: null,
authorBefore2025: null,
author: null,
expertDb: null
};
this.fetchExpertTypeCounts();
await this.loadAccounts(val);
await Promise.all([
@@ -907,6 +940,7 @@
const payload = {
from: 'promotionFactory',
journal_id: journalId != null && journalId !== '' ? String(journalId) : '',
expert_type: opt && opt.value != null ? String(opt.value) : '',
ts: Date.now(),
targetPath: String(jump.path || '')
};
@@ -939,19 +973,21 @@
return sum;
};
const [boardRes, youngRes, authorRes, reviewerRes, expertDbRes] = await Promise.all([
const yboardBase = {
journal_id: journalId,
pageIndex: 1,
pageSize: 1,
keywords: '',
fieldkey: '',
order_remark: 0
};
const [boardRes, youngRes, youngBefore2025Res, authorRes, authorBefore2025Res, expertDbRes] = await Promise.all([
this.$api.post('api/Board/getBoards', { journal_id: journalId }).catch(() => null),
this.$api
.post('api/User/getYboardlist', {
journal_id: journalId,
type: 1,
year: 0,
pageIndex: 1,
pageSize: 1,
keywords: '',
fieldkey: '',
order_remark: 0
})
.post('api/User/getYboardlist', Object.assign({}, yboardBase, { type: 1, year: 0 }))
.catch(() => null),
this.$api
.post('api/User/getYboardlist', Object.assign({}, yboardBase, { type: 6, year: 0 }))
.catch(() => null),
this.$api
.post('api/User/authorDatabase', {
@@ -962,12 +998,12 @@
})
.catch(() => null),
this.$api
.post('api/Reviewer/getReviewerListByJournal', {
username: localStorage.getItem('U_name'),
journalId: journalId,
class: 0,
pageIndex: 1,
pageSize: 1
.post('api/User/authorDatabase', {
journal_id: journalId,
type: 7,
keywords: '',
page: 1,
limit: 1
})
.catch(() => null),
this.$api
@@ -978,7 +1014,15 @@
.catch(() => null)
]);
const next = { chief: null, board: null, young: null, author: null, reviewer: null, expertDb: null };
const next = {
chief: null,
board: null,
young: null,
youngBefore2025: null,
authorBefore2025: null,
author: null,
expertDb: null
};
if (boardRes && boardRes.code === 0 && boardRes.data && boardRes.data.boards) {
const b = boardRes.data.boards || {};
@@ -991,11 +1035,14 @@
if (youngRes && youngRes.code === 0) {
next.young = safeCount(youngRes.data && youngRes.data.count);
}
if (youngBefore2025Res && youngBefore2025Res.code === 0) {
next.youngBefore2025 = safeCount(youngBefore2025Res.data && youngBefore2025Res.data.count);
}
if (authorRes && authorRes.code === 0) {
next.author = safeCount(authorRes.data && authorRes.data.count);
}
if (reviewerRes && reviewerRes.code === 0) {
next.reviewer = safeCount(reviewerRes.total);
if (authorBefore2025Res && authorBefore2025Res.code === 0) {
next.authorBefore2025 = safeCount(authorBefore2025Res.data && authorBefore2025Res.data.count);
}
if (expertDbRes && expertDbRes.code === 0) {
const total = (expertDbRes.data && (expertDbRes.data.total || expertDbRes.data.count)) || expertDbRes.total;

View File

@@ -10,13 +10,24 @@
type="primary"
size="small"
plain
icon="el-icon-user-solid"
icon="el-icon-upload2"
:loading="registerAuthorLoading"
class="register-author-btn"
@click="registerAuthorFromMail"
>
{{ $t('mailboxCollect.registerAuthorBtn') }}
</el-button>
<!-- <el-button
v-if="resolvedJournalId"
type="success"
size="small"
plain
icon="el-icon-upload2"
class="register-author-btn"
@click="openAutoSubmitDialog"
>
{{ $t('mailboxCollect.autoSubmitBtn') }}
</el-button> -->
<!-- <i class="el-icon-star-off action-icon"></i> -->
<i class="el-icon-close action-icon" @click="$emit('close')"></i>
</div>
@@ -82,18 +93,6 @@
<el-link type="primary" :underline="false" @click="scrollToAttachments" class="jump-link">
{{ $t('mailboxCollect.viewAttachments') }}
</el-link>
<el-button
v-if="hasWordAttachment"
type="primary"
size="mini"
plain
icon="el-icon-user-solid"
:loading="registerAuthorLoading"
class="register-author-btn-inline"
@click="registerAuthorFromMail"
>
{{ $t('mailboxCollect.registerAuthorBtn') }}
</el-button>
</div>
</div>
</div>
@@ -142,15 +141,98 @@
ref="previewDialog"
@download="downloadAttachment"
/>
<el-dialog
:title="
autoSubmitSuccessMode
? $t('mailboxCollect.autoSubmitSuccessTitle')
: $t('mailboxCollect.autoSubmitDialogTitle')
"
:visible.sync="autoSubmitDialogVisible"
width="580px"
append-to-body
@close="onAutoSubmitDialogClose"
>
<div v-show="!autoSubmitSuccessMode">
<el-alert
v-if="autoSubmitPrefillFromRegisterConflict"
type="warning"
:closable="false"
show-icon
class="auto-submit-existing-tip"
:title="$t('mailboxCollect.autoSubmitExistingAccountTip')"
/>
<el-form ref="autoSubmitFormRef" :model="autoSubmitForm" label-width="120px" class="auto-submit-form">
<el-form-item :label="$t('mailboxCollect.autoSubmitSenderEmailLabel')">
<el-input
class="auto-submit-email-readonly"
:value="autoSubmitReadonlyEmailDisplay || $t('mailboxCollect.autoSubmitSenderEmailPlaceholder')"
readonly
tabindex="-1"
/>
</el-form-item>
<el-form-item :label="$t('mailboxCollect.autoSubmitPassword')">
<el-input
v-model="autoSubmitForm.password"
type="password"
show-password
autocomplete="current-password"
/>
</el-form-item>
<el-form-item :label="$t('mailboxCollect.autoSubmitManuscriptSource')">
<el-upload
:key="'mail-auto-docx-' + autoSubmitUploadKey"
ref="autoSubmitLocalUpload"
class="auto-submit-local-upload"
action=""
:auto-upload="false"
:limit="1"
accept=".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
:on-change="onAutoSubmitLocalDocxChange"
:on-remove="onAutoSubmitLocalDocxRemove"
:on-exceed="onAutoSubmitLocalDocxExceed"
>
<el-button size="small" type="default" icon="el-icon-folder-open">{{
$t('mailboxCollect.autoSubmitPickLocalDocx')
}}</el-button>
</el-upload>
<p class="auto-submit-source-hint">{{ $t('mailboxCollect.autoSubmitSourceHint') }}</p>
<p v-if="localDocxDisplayName" class="auto-submit-local-picked">
{{ $t('mailboxCollect.autoSubmitLocalPicked', { name: localDocxDisplayName }) }}
</p>
</el-form-item>
</el-form>
</div>
<div v-show="autoSubmitSuccessMode" class="auto-submit-success-body" v-html="autoSubmitSuccessBodyHtml"></div>
<span slot="footer" class="dialog-footer">
<template v-if="autoSubmitSuccessMode">
<el-button type="primary" @click="autoSubmitDialogVisible = false">{{
$t('mailboxCollect.autoSubmitDialogClose')
}}</el-button>
</template>
<template v-else>
<el-button @click="autoSubmitDialogVisible = false">{{ $t('mailboxCollect.autoSubmitCancel') }}</el-button>
<el-button type="primary" :loading="autoSubmitLoading" @click="submitAutoSubmitManuscript">{{
$t('mailboxCollect.autoSubmitConfirm')
}}</el-button>
</template>
</span>
</el-dialog>
</div>
</template>
<script>
import axios from 'axios';
import Common from '@/components/common/common';
import bus from '@/components/common/bus';
import { normalizeEmailHtmlForInlineDisplay } from '@/utils/emailHtmlView';
import { runMailManuscriptPipeline, clearAuthorShadowSession } from '@/utils/mailManuscriptAutoSubmit';
import JSZip from 'jszip';
import { saveAs } from 'file-saver';
import FilePreviewDialog from './FilePreviewDialog.vue';
/** 投稿页对外链接域名(邮件与成功通知统一用线上地址,避免本地 origin */
const SUBMISSION_SITE_ORIGIN = 'https://submission.tmrjournals.com';
export default {
components: {
FilePreviewDialog
@@ -169,6 +251,20 @@ export default {
content: '',
attachments: []
})
},
/** 当前邮件列表所选邮箱账号的期刊 ID与 mailboxCollect 一致) */
journalId: {
type: [Number, String],
default: null
},
journalTitle: {
type: String,
default: ''
},
/** 当前邮箱账号 j_email_id与 mailboxSend 发信参数一致 */
jEmailId: {
type: [Number, String],
default: null
}
},
data() {
@@ -177,7 +273,22 @@ export default {
isDetailExpanded: false,
downloadingIndex: -1,
packingAll: false,
registerAuthorLoading: false
registerAuthorLoading: false,
autoSubmitDialogVisible: false,
autoSubmitLoading: false,
/** 建稿成功后在同一弹窗内展示摘要,仅保留关闭 */
autoSubmitSuccessMode: false,
autoSubmitSuccessBodyHtml: '',
autoSubmitForm: {
username: '',
password: ''
},
/** 弹窗内本机选择的 .docx优先于邮件附件下载 */
autoSubmitLocalDocxFile: null,
/** 因「邮箱/账号已存在」打开建稿弹窗时展示提示条 */
autoSubmitPrefillFromRegisterConflict: false,
/** 本地上传组件强制重建 key超限选新文件时替换 */
autoSubmitUploadKey: 0
};
},
computed: {
@@ -190,11 +301,71 @@ export default {
return /\.(doc|docx)$/i.test(n);
});
},
/** 新增稿件上传链路仅接受 .docx */
hasDocxAttachment() {
const att = (this.mailData && this.mailData.attachments) || [];
if (!att.length) return false;
return att.some((f) => {
const n = (f && f.name) || '';
return /\.docx$/i.test(n);
});
},
resolvedJournalId() {
if (this.journalId != null && String(this.journalId).trim() !== '') {
const n = Number(this.journalId);
if (!Number.isNaN(n) && n > 0) return n;
}
try {
const s = localStorage.getItem('mailboxCollect_journal_id');
if (s != null && String(s).trim() !== '') {
const n = Number(s);
if (!Number.isNaN(n) && n > 0) return n;
}
} catch (e) {
/* ignore */
}
return null;
},
resolvedJournalLabel() {
const id = this.resolvedJournalId;
if (id == null) return this.$t('mailboxCollect.autoSubmitJournalUnknown');
const t = this.journalTitle && String(this.journalTitle).trim();
return t ? `${t}ID: ${id}` : `ID: ${id}`;
},
/** 发件接口 sendOne 所需 j_email_id */
resolvedJEmailId() {
if (this.jEmailId != null && String(this.jEmailId).trim() !== '') {
return String(this.jEmailId).trim();
}
try {
const s = localStorage.getItem('mailboxCollect_j_email_id');
if (s != null && String(s).trim() !== '') return String(s).trim();
} catch (e) {
/* ignore */
}
return null;
},
/** 通知邮件正文中的期刊名称不含「ID:」后缀) */
resolvedNotifyJournalName() {
const t = this.journalTitle && String(this.journalTitle).trim();
if (t) return t;
const id = this.resolvedJournalId;
return id != null ? `ID ${id}` : this.$t('mailboxCollect.autoSubmitJournalUnknown');
},
totalAttachmentSize() {
if (!this.mailData.attachments || !this.mailData.attachments.length) return '0B';
const total = this.mailData.attachments.reduce((sum, f) => sum + (Number(f.size) || 0), 0);
return this.formatFileSize(total);
},
localDocxDisplayName() {
const f = this.autoSubmitLocalDocxFile;
if (!f || !f.name) return '';
return f.name;
},
/** 弹窗内只读展示:当前邮件发件人邮箱 */
autoSubmitReadonlyEmailDisplay() {
return this.getPrimaryMailSenderEmail() || '';
},
/** 正文:兼容 content_html / body / html纯文本时包一层 pre */
mailBodyHtml() {
const m = this.mailData || {};
@@ -236,12 +407,13 @@ export default {
if (labeled) return labeled[1].trim().slice(0, 32);
return '';
},
buildAuthorRegisterPayload() {
/** 发件人显示名(用于 realname与 partyList 校验规则一致 */
deriveRealnameFromMail() {
const m = this.mailData || {};
const email = String(m.from_email || '')
const fromEmail = String(m.from_email || '')
.trim()
.toLowerCase();
const localPart = email.split('@')[0] || 'user';
const localPart = fromEmail.split('@')[0] || 'user';
let rawName = String(m.from_name || '').trim();
let realname = rawName || localPart;
if (this.$validateString && !this.$validateString(realname)) {
@@ -250,78 +422,123 @@ export default {
realname = 'Author';
}
}
let account = rawName.replace(/[^a-zA-Z0-9_-]/g, '');
if (!account || account.length < 2) {
account = localPart.replace(/[^a-zA-Z0-9_-]/g, '');
return realname;
},
/** 当前邮件发件人邮箱(来稿真实地址),用于注册作者与通知收件人 */
getPrimaryMailSenderEmail() {
const raw = this.mailData && this.mailData.from_email != null ? String(this.mailData.from_email).trim() : '';
if (!raw) return '';
const lower = raw.toLowerCase();
if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(lower)) return lower;
return '';
},
/** 由邮箱推导登录名(与 checkUserByAccount / addUser 常用规则一致) */
deriveLoginAccountFromEmail(email) {
const e = String(email || '').toLowerCase().trim();
const at = e.indexOf('@');
if (at < 1) return 'author';
let acc = e
.slice(0, at)
.replace(/[^a-z0-9_]/gi, '_')
.replace(/_+/g, '_')
.replace(/^_|_$/g, '');
if (!acc || acc.length < 2) {
acc = 'u_' + e.replace(/[^\w]/g, '').slice(0, 24);
}
if (!account || account.length < 2) {
account = `u${email.replace(/[^a-zA-Z0-9]/g, '').slice(0, 12) || 'ser'}`;
if (!acc || acc.length < 2) {
acc = 'author_' + String(Date.now()).slice(-8);
}
const phone = this.extractPhoneFromMailBody() || '';
return { email, account, realname, phone };
if (acc.length > 32) acc = acc.slice(0, 32);
return acc;
},
openAutoSubmitDialogWithCredentialsPrefill({ usernameHint }) {
if (this.resolvedJournalId == null) {
this.$message.warning(this.$t('mailboxCollect.autoSubmitNeedJournal'));
return;
}
this.autoSubmitPrefillFromRegisterConflict = true;
this.autoSubmitSuccessMode = false;
this.autoSubmitSuccessBodyHtml = '';
this.autoSubmitForm.username = usernameHint != null ? String(usernameHint).trim() : '';
this.autoSubmitForm.password = '';
this.autoSubmitDialogVisible = true;
},
/** addUser 返回「邮箱已存在」类文案时改走手动录入 */
isRegisterDuplicateResponse(res, msg) {
const s = String(msg || '');
const lower = s.toLowerCase();
if (lower.includes('already registered') || lower.includes('email is already')) return true;
if (s.includes('已注册') && (s.includes('邮箱') || s.includes('邮件'))) return true;
const hint = String(this.$t('mailboxCollect.registerAuthorExistsEmail') || '').toLowerCase();
if (hint && lower.includes(hint.slice(0, 12))) return true;
return false;
},
async registerAuthorFromMail() {
if (!this.hasWordAttachment) return;
const { email, account, realname, phone } = this.buildAuthorRegisterPayload();
if (!email) {
this.$message.warning(this.$t('mailboxCollect.registerAuthorNeedEmail'));
return;
}
if (email.endsWith('@qq.com')) {
this.$message.warning(this.$t('mailboxCollect.registerAuthorNoQq'));
return;
}
const pwd = '123456qwe';
try {
await this.$confirm(
this.$t('mailboxCollect.registerAuthorConfirm', { email, account, realname }),
this.$t('mailboxCollect.registerAuthorBtn'),
{ type: 'warning', distinguishCancelAndClose: true }
);
} catch (e) {
const realname = this.deriveRealnameFromMail();
const email2 = this.getPrimaryMailSenderEmail();
if (!email2) {
this.$message.error(this.$t('mailboxCollect.registerAuthorNeedEmail'));
return;
}
const account2 = this.deriveLoginAccountFromEmail(email2);
this.registerAuthorLoading = true;
try {
const p = this.buildAuthorRegisterPayload();
const email2 = p.email;
const account2 = p.account;
const realname2 = p.realname;
const phone2 = p.phone;
const ef = { email: email2, account: account2 };
const r1 = await this.$api.post('api/User/checkUserByEmail', ef);
if (!r1 || Number(r1.code) !== 0) {
this.$message.error((r1 && r1.msg) || this.$t('mailboxCollect.registerAuthorFail'));
const r1 = await this.$api.post('api/User/checkUserByEmail', { email: email2, account: account2 });
const r2 = await this.$api.post('api/User/checkUserByAccount', { email: email2, account: account2 });
if (!(r1 && r2 && Number(r1.code) === 0 && Number(r2.code) === 0)) {
this.$message.error((r1 && r1.msg) || (r2 && r2.msg) || this.$t('mailboxCollect.registerAuthorFail'));
return;
}
const r2 = await this.$api.post('api/User/checkUserByAccount', ef);
if (!r2 || Number(r2.code) !== 0) {
this.$message.error((r2 && r2.msg) || this.$t('mailboxCollect.registerAuthorFail'));
if (r1.data && Number(r1.data.has) !== 0) {
this.openAutoSubmitDialogWithCredentialsPrefill({ usernameHint: email2 });
return;
}
const hasEmail = r1.data && Number(r1.data.has) === 1;
const hasAccount = r2.data && Number(r2.data.has) === 1;
if (hasEmail) {
this.$message.warning(this.$t('mailboxCollect.registerAuthorExistsEmail'));
return;
}
if (hasAccount) {
this.$message.warning(this.$t('mailboxCollect.registerAuthorExistsAccount'));
if (r2.data && Number(r2.data.has) !== 0) {
this.openAutoSubmitDialogWithCredentialsPrefill({ usernameHint: account2 });
return;
}
} catch (err) {
console.error(err);
this.$message.error(this.$t('mailboxCollect.registerAuthorFail'));
return;
} finally {
this.registerAuthorLoading = false;
}
const pwd = '123456qwe';
this.$notify({
title: this.$t('mailboxCollect.registerAuthorBtn'),
message: this.$t('mailboxCollect.registerAuthorConfirmShort', { email: email2, password: pwd }),
type: 'info',
duration: 8000
});
this.registerAuthorLoading = true;
try {
const phone2 = this.extractPhoneFromMailBody() || '';
const addForm = {
email: email2,
account: account2,
password: pwd,
repassword: pwd,
realname: realname2,
realname,
phone: phone2 || ''
};
const res = await this.$api.post('api/User/addUser', addForm);
if (res && Number(res.code) === 0) {
this.$message.success(this.$t('mailboxCollect.registerAuthorSuccess'));
this.autoSubmitForm.username = account2;
this.autoSubmitForm.password = pwd;
this.$nextTick(() => {
if (this.resolvedJournalId != null) {
this.openAutoSubmitDialog();
}
});
} else {
this.$message.error((res && res.msg) || this.$t('mailboxCollect.registerAuthorFail'));
const msg = (res && res.msg) || '';
if (this.isRegisterDuplicateResponse(res, msg)) {
this.openAutoSubmitDialogWithCredentialsPrefill({ usernameHint: email2 });
} else {
this.$message.error(msg || this.$t('mailboxCollect.registerAuthorFail'));
}
}
} catch (err) {
console.error(err);
@@ -338,6 +555,297 @@ export default {
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;');
},
buildAbsoluteArticleAddUrl(articleId) {
const id = articleId == null ? '' : String(articleId);
const base = SUBMISSION_SITE_ORIGIN.replace(/\/+$/, '');
return `${base}/articleAdd?id=${encodeURIComponent(id)}`;
},
buildAuthorNotifyMailHtml(articleUrl, username, passwordPlain) {
const j = this.escapeHtml(this.resolvedNotifyJournalName);
const a = this.escapeHtml(username);
const p = this.escapeHtml(passwordPlain);
const href = this.escapeHtml(articleUrl);
const link = `<a href="${href}" target="_blank" rel="noopener noreferrer">${href}</a>`;
const loc = (this.$i18n && this.$i18n.locale) || '';
if (String(loc).toLowerCase().startsWith('en')) {
return `<p>I am an editor of <strong>${j}</strong>. <br/>Thank you for your submission. An author account has been created for you: username <strong>${a}</strong>, default password <strong>${p}</strong>. <br/>Please complete your manuscript here: ${link}</p>`;
}
return `<p>我是《${j}》的编辑,很高兴收到你的投稿。<br/>已帮您创建好了投稿账号,登录名为 <strong>${a}</strong>,默认密码为 <strong>${p}</strong>。<br/>请您进一步完善您的稿件,投稿地址:${link}</p>`;
},
async getAutoSubmitNotifyMailResult({ articleUrl, username, passwordPlain }) {
const jEmailId = this.resolvedJEmailId;
const journalId = this.resolvedJournalId;
if (!jEmailId || journalId == null) {
return 'skipped_config';
}
const toEmail = this.getPrimaryMailSenderEmail();
if (!toEmail) {
return 'skipped_recipient';
}
try {
const journalName = this.resolvedNotifyJournalName;
const subject = this.$t('mailboxCollect.autoSubmitNotifyMailSubject', { journal: journalName });
const content = this.buildAuthorNotifyMailHtml(articleUrl, username, passwordPlain);
const res = await this.$api.post('api/email_client/sendOne', {
to_email: toEmail,
subject: String(subject || '').trim(),
content,
j_email_id: String(jEmailId),
journal_id: String(journalId)
});
if (!res || Number(res.code) !== 0) {
return 'failed';
}
return 'sent';
} catch (e) {
console.error(e);
return 'failed';
}
},
buildAutoSubmitSuccessDialogHtml({ username, passwordPlain, articleId, articleUrl, mailResult }) {
const href = this.escapeHtml(articleUrl);
const linkHtml = `<a href="${href}" target="_blank" rel="noopener noreferrer">${href}</a>`;
const line1 = this.escapeHtml(
this.$t('mailboxCollect.autoSubmitSuccessLineAccount', { account: username })
);
const line2 = this.escapeHtml(
this.$t('mailboxCollect.autoSubmitSuccessLinePassword', { password: passwordPlain })
);
const line3 = this.escapeHtml(
this.$t('mailboxCollect.autoSubmitSuccessLineDraft', { id: String(articleId == null ? '' : articleId) })
);
const linkPrefix = this.escapeHtml(this.$t('mailboxCollect.autoSubmitSuccessLineLinkPrefix'));
let line5;
if (mailResult === 'sent') {
line5 = `<p class="auto-submit-success-mail-sent">${this.escapeHtml(
this.$t('mailboxCollect.autoSubmitSuccessMailSent')
)}</p>`;
} else if (mailResult === 'skipped_config') {
line5 = `<p class="auto-submit-success-mail-muted">${this.escapeHtml(
this.$t('mailboxCollect.autoSubmitSuccessMailSkipped')
)}</p>`;
} else if (mailResult === 'skipped_recipient') {
line5 = `<p class="auto-submit-success-mail-muted">${this.escapeHtml(
this.$t('mailboxCollect.autoSubmitSuccessMailSkippedRecipient')
)}</p>`;
} else {
line5 = `<p class="auto-submit-success-mail-muted">${this.escapeHtml(
this.$t('mailboxCollect.autoSubmitSuccessMailFailed')
)}</p>`;
}
return `<div class="auto-submit-success-lines"><p>${line1}</p><p>${line2}</p><p>${line3}</p><p>${linkPrefix}${linkHtml}</p>${line5}</div>`;
},
openAutoSubmitDialog() {
if (this.resolvedJournalId == null) {
this.$message.warning(this.$t('mailboxCollect.autoSubmitNeedJournal'));
return;
}
this.autoSubmitPrefillFromRegisterConflict = false;
this.autoSubmitSuccessMode = false;
this.autoSubmitSuccessBodyHtml = '';
this.autoSubmitDialogVisible = true;
},
onAutoSubmitLocalDocxChange(file, fileList) {
const ref = this.$refs.autoSubmitLocalUpload;
if (ref && fileList && fileList.length > 1) {
try {
ref.handleRemove(fileList[0]);
} catch (e) {
/* ignore */
}
return;
}
const raw = file && file.raw;
if (!raw) return;
const name = raw.name || '';
if (!/\.docx$/i.test(name)) {
this.$message.warning(this.$t('mailboxCollect.autoSubmitNoDocx'));
this.$nextTick(() => {
if (this.$refs.autoSubmitLocalUpload) {
this.$refs.autoSubmitLocalUpload.clearFiles();
}
});
return;
}
this.autoSubmitLocalDocxFile = raw;
},
onAutoSubmitLocalDocxExceed(files) {
const wrap = files && files[0];
const raw = wrap && wrap.raw;
if (!raw || !/\.docx$/i.test(raw.name || '')) {
this.$message.warning(this.$t('mailboxCollect.autoSubmitNoDocx'));
return;
}
if (this.$refs.autoSubmitLocalUpload) {
this.$refs.autoSubmitLocalUpload.clearFiles();
}
this.autoSubmitLocalDocxFile = raw;
this.autoSubmitUploadKey += 1;
},
onAutoSubmitLocalDocxRemove() {
this.autoSubmitLocalDocxFile = null;
},
onAutoSubmitDialogClose() {
clearAuthorShadowSession();
this.autoSubmitPrefillFromRegisterConflict = false;
this.autoSubmitSuccessMode = false;
this.autoSubmitSuccessBodyHtml = '';
this.autoSubmitLocalDocxFile = null;
this.autoSubmitUploadKey = 0;
this.$nextTick(() => {
if (this.$refs.autoSubmitLocalUpload) {
this.$refs.autoSubmitLocalUpload.clearFiles();
}
if (this.$refs.autoSubmitFormRef) {
this.$refs.autoSubmitFormRef.clearValidate();
}
});
},
/**
* 从邮件附件公网路径拉取 docxaxios blob + withCredentials再走 manuscirpt 上传。
*/
async fetchMailDocxBlobFromAttachment(mailFile) {
const rel = await this.ensureFileUrl(mailFile);
if (!rel) {
throw new Error('NO_ATTACHMENT_URL');
}
const url = this.resolvePublicFileUrl(rel);
const res = await axios.get(url, {
responseType: 'blob',
withCredentials: true,
timeout: 180000
});
if (!res || res.status < 200 || res.status >= 300 || !res.data) {
throw new Error('DOWNLOAD_HTTP');
}
const blob = res.data;
if (!(blob instanceof Blob) || blob.size === 0) {
throw new Error('EMPTY_BLOB');
}
return blob;
},
getFirstDocxAttachment() {
const att = (this.mailData && this.mailData.attachments) || [];
for (let i = 0; i < att.length; i++) {
const f = att[i];
const n = (f && f.name) || '';
if (/\.docx$/i.test(n)) {
return f;
}
}
return null;
},
submitAutoSubmitManuscript() {
let username = String((this.autoSubmitForm && this.autoSubmitForm.username) || '').trim();
if (!username) {
const em = this.getPrimaryMailSenderEmail();
if (em) username = em;
}
if (!username) {
this.$message.warning(this.$t('mailboxCollect.registerAuthorNeedEmail'));
return;
}
this.autoSubmitForm.username = username;
if (!(this.autoSubmitForm && this.autoSubmitForm.password)) {
this.$message.warning(this.$t('mailboxCollect.autoSubmitPasswordRequired'));
return;
}
if (this.resolvedJournalId == null) {
this.$message.warning(this.$t('mailboxCollect.autoSubmitNeedJournal'));
return;
}
const mailDocx = this.getFirstDocxAttachment();
const localFile = this.autoSubmitLocalDocxFile;
if (!localFile && !mailDocx) {
this.$message.warning(this.$t('mailboxCollect.autoSubmitNeedDocxSource'));
return;
}
this.autoSubmitLoading = true;
(async () => {
try {
const docxMime = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
let blob;
let fileName;
if (localFile) {
blob = localFile;
fileName = localFile.name || 'manuscript.docx';
} else {
blob = await this.fetchMailDocxBlobFromAttachment(mailDocx);
fileName = mailDocx.name || 'manuscript.docx';
}
const r = await runMailManuscriptPipeline({
api: this.$api,
baseUrl: Common.baseUrl,
preserveEditorLocalStorage: true,
journal_id: this.resolvedJournalId,
extractWordTables: (consumer) =>
new Promise((resolve, reject) => {
const f = new File([blob], fileName, { type: docxMime });
this.$commonJS.extractWordTablesToArrays(f, async (wordTables) => {
try {
await consumer(wordTables || []);
} catch (e) {
reject(e);
return;
}
resolve();
});
}),
login: {
username,
password: this.autoSubmitForm.password,
code: ''
},
blob,
fileName
});
if (r.ok) {
bus.$emit('editorSessionLocalRestored');
const link = this.buildAbsoluteArticleAddUrl(r.article_id);
const passwordPlain = this.autoSubmitForm.password;
const mailResult = await this.getAutoSubmitNotifyMailResult({
articleUrl: link,
username,
passwordPlain
});
if (mailResult === 'failed') {
this.$message.warning(this.$t('mailboxCollect.autoSubmitNotifyMailFail'));
}
this.autoSubmitSuccessBodyHtml = this.buildAutoSubmitSuccessDialogHtml({
username,
passwordPlain,
articleId: r.article_id,
articleUrl: link,
mailResult
});
this.autoSubmitSuccessMode = true;
} else {
const base = r.msg || this.$t('mailboxCollect.autoSubmitFail');
const tail =
r.article_id != null
? ' ' + this.$t('mailboxCollect.autoSubmitFailPartial', { id: r.article_id })
: '';
this.$message.error(base + tail);
}
} catch (err) {
console.error(err);
const msg = (err && err.message) || '';
const httpErr = err && err.response && err.response.status;
if (
httpErr ||
msg === 'NO_ATTACHMENT_URL' ||
msg === 'DOWNLOAD_HTTP' ||
msg === 'EMPTY_BLOB'
) {
this.$message.error(this.$t('mailboxCollect.autoSubmitDownloadFail'));
} else {
this.$message.error(this.$t('mailboxCollect.autoSubmitFail'));
}
} finally {
this.autoSubmitLoading = false;
}
})();
},
scrollToAttachments() {
// 1. 获取目标元素的 DOM
const target = this.$el.querySelector('.attachment-section');
@@ -389,6 +897,22 @@ export default {
}
return '';
},
/**
* 将 Common.mediaUrl 与后端返回的 file_url 拼成可访问 URL。
* file_url 常为 /attachments/…mediaUrl 常为 …/public/,直接拼接会得到 …/public//attachments/… 导致 404。
* 稿件上传仍走 up_file/type/manuscirpt此处仅用于先把附件下载为 Blob。
*/
resolvePublicFileUrl(pathOrUrl) {
const p = pathOrUrl == null ? '' : String(pathOrUrl).trim();
if (!p) return '';
if (/^https?:\/\//i.test(p)) return p;
let base = String(this.mediaUrl || '').replace(/\/+$/, '');
let path = p.replace(/^\/+/, '');
if (/\/public$/i.test(base) && /^public\//i.test(path)) {
path = path.replace(/^public\//i, '');
}
return `${base}/${path}`;
},
async downloadAll() {
if (this.packingAll) return;
this.packingAll = true;
@@ -397,7 +921,7 @@ export default {
const promises = this.mailData.attachments.map(async (file) => {
const url = await this.ensureFileUrl(file);
if (!url) return;
const fileUrl = this.mediaUrl + url;
const fileUrl = this.resolvePublicFileUrl(url);
const resp = await fetch(fileUrl);
const blob = await resp.blob();
zip.file(file.name || 'attachment', blob);
@@ -416,7 +940,7 @@ export default {
console.log("🚀 ~ previewAttachment ~ file:", file);
var that = this;
that.$refs.previewDialog.init(file, this.mediaUrl+file.file_url || '');
that.$refs.previewDialog.init(file, this.resolvePublicFileUrl(file.file_url) || '');
// 1. 获取后端返回的 URL
const res = await this.$api.post('api/email_client/getAttachment', {
inbox_id: String(this.mailData.inbox_id),
@@ -424,7 +948,7 @@ const res = await this.$api.post('api/email_client/getAttachment', {
});
if (res.data && res.data.file_url) {
const fullUrl = this.mediaUrl + res.data.file_url;
const fullUrl = this.resolvePublicFileUrl(res.data.file_url);
// 2. 调用弹窗组件的 init 方法
// 注意:微软预览要求 fullUrl 必须是公网可访问的!
@@ -442,7 +966,7 @@ const res = await this.$api.post('api/email_client/getAttachment', {
this.$message.warning(this.$t('mailboxCollect.downloadFail') || '下载失败');
return;
}
const fileUrl = this.mediaUrl + url;
const fileUrl = this.resolvePublicFileUrl(url);
const fileName = file.name || 'attachment';
const resp = await fetch(fileUrl);
const blob = await resp.blob();
@@ -545,11 +1069,64 @@ const res = await this.$api.post('api/email_client/getAttachment', {
flex-shrink: 0;
}
.register-author-btn {
flex-shrink: 0;
margin-right: 8px;
}
.register-author-btn-inline {
margin-left: 10px;
vertical-align: middle;
.auto-submit-email-readonly /deep/ .el-input__inner {
color: #606266;
cursor: default;
background-color: #f5f7fa;
border-color: #e4e7ed;
}
.auto-submit-existing-tip {
margin-bottom: 12px;
}
.auto-submit-local-picked {
margin: 6px 0 0;
font-size: 13px;
color: #67c23a;
word-break: break-all;
}
.auto-submit-source-hint {
margin: 8px 0 0;
font-size: 12px;
color: #909399;
line-height: 1.45;
}
.auto-submit-success-body {
font-size: 14px;
color: #606266;
line-height: 1.65;
word-break: break-word;
}
.auto-submit-success-body p {
margin: 0;
}
.auto-submit-success-body a {
color: #409eff;
}
.auto-submit-success-lines p {
margin: 0 0 10px;
line-height: 1.55;
}
.auto-submit-success-lines p:last-child {
margin-bottom: 0;
}
.auto-submit-success-mail-sent {
color: #67c23a;
font-weight: 500;
}
.auto-submit-success-mail-muted {
color: #e6a23c;
font-size: 13px;
}
.auto-submit-local-upload {
display: inline-block;
}
.auto-submit-journal-readonly {
color: #606266;
font-size: 13px;
line-height: 1.5;
word-break: break-all;
}
.action-icon:hover {
color: #409eff;
@@ -844,8 +1421,11 @@ const res = await this.$api.post('api/email_client/getAttachment', {
}
.attachment-brief-bar .brief-info {
}
display: inline-flex;
align-items: center;
flex-wrap: wrap;
gap: 4px;
}
.attachment-brief-bar .first-file-name {
color: #909399;
margin-left: 4px;

View File

@@ -90,7 +90,7 @@ export default {
expert_title: "Prof", // 专家职称 (如 Prof./Dr.)
expert_name: "John Doe", // 专家姓名
expert_field: "Biomedical Engineering", // 专家研究领域
representative_work_title: "Advanced Applications of AI in Medical Imaging", // 专家代表作标题
representative_work_title: "Advanced Applications of AI in Medical Imaging.", // 专家代表作标题
ai_content_analysis: "【AI分析文章一句话总结】", // AI solicitation rationale
ai_advised_topics: "Based on your research expertise, we would particularly welcome submissions on topics such as 【这里是AI针对学者领域给特定约稿主题】, or other closely related areas that align with your work.", // AI suggested directions

View File

@@ -112,6 +112,9 @@
<mail-detail
v-if="detailMail && String(detailMail.inbox_id || '') !== ''"
:mailData="detailMail"
:journal-id="mailDetailJournalId"
:journal-title="mailDetailJournalTitle"
:j-email-id="mailDetailJEmailId"
@close="closeDetail"
/>
</div>
@@ -220,6 +223,39 @@ import { normalizeEmailHtmlForInlineDisplay } from '@/utils/emailHtmlView';
},
selectedAccountEmail() {
return this.selectedAccount ? this.selectedAccount.smtp_user : '';
},
/** 当前邮箱账号绑定的期刊,供邮件内一键建稿与 articleAdd 回填一致 */
mailDetailJournalId() {
const a = this.selectedAccount;
if (a && a.journal_id != null && String(a.journal_id).trim() !== '') {
return a.journal_id;
}
try {
const s = localStorage.getItem('mailboxCollect_journal_id');
return s != null && String(s).trim() !== '' ? s : null;
} catch (e) {
return null;
}
},
mailDetailJournalTitle() {
const id = this.mailDetailJournalId;
if (id == null) return '';
const list = this.journalList || [];
const j = list.find((x) => String(x.journal_id) === String(id));
return j && j.title ? j.title : '';
},
/** 当前发件/收件箱账号,供 sendOne 与 mailboxSend 一致 */
mailDetailJEmailId() {
const a = this.selectedAccount;
if (a && a.j_email_id != null && String(a.j_email_id).trim() !== '') {
return a.j_email_id;
}
try {
const s = localStorage.getItem('mailboxCollect_j_email_id');
return s != null && String(s).trim() !== '' ? s : null;
} catch (e) {
return null;
}
}
},
created() {

View File

@@ -50,6 +50,9 @@
</el-button>
<div class="right-actions">
<el-button type="warning" plain icon="el-icon-upload2" @click="openTemplateBatchImportDialog">{{
$t('mailboxMould.batchImportBtn')
}}</el-button>
<el-button type="primary" plain icon="el-icon-plus" @click="handleCreateTemplate">{{ $t('mailboxMould.createTemplate') }}</el-button>
</div>
</div>
@@ -136,6 +139,36 @@
<el-button @click="previewVisible = false">{{ $t('mailboxMould.previewClose') }}</el-button>
</span>
</el-dialog>
<el-dialog
:title="$t('mailboxMould.batchImportTitle')"
:visible.sync="batchTplImportVisible"
width="720px"
append-to-body
:close-on-click-modal="false"
custom-class="mailbox-mould-batch-import-dialog"
@closed="batchTplImporting = false"
>
<p class="batch-tpl-hint">{{ $t('mailboxMould.batchImportHint') }}</p>
<p class="batch-tpl-tip">{{ $t('mailboxMould.batchImportCommonTip') }}</p>
<div class="batch-tpl-journal-row">
<span class="batch-tpl-label">{{ $t('mailboxMould.batchImportJournalId') }}</span>
<el-input
v-model="batchTplImportJournalId"
clearable
size="small"
:placeholder="$t('mailboxMould.batchImportJournalPlaceholder')"
class="batch-tpl-journal-input"
/>
</div>
<el-input v-model="batchTplImportText" type="textarea" :rows="14" class="batch-tpl-textarea" spellcheck="false" />
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="batchTplImportVisible = false">{{ $t('mailboxMould.cancel') }}</el-button>
<el-button type="primary" size="small" :loading="batchTplImporting" @click="runTemplateBatchImport">{{
$t('mailboxMould.batchImportRun')
}}</el-button>
</span>
</el-dialog>
</div>
</template>
@@ -145,7 +178,8 @@ const API = {
listStyles: 'api/mail_template/listStyles',
getAllJournal: 'api/Article/getJournal',
deleteTemplate: 'api/mail_template/deleteTemplate',
deleteStyle: 'api/mail_template/deleteStyle'
deleteStyle: 'api/mail_template/deleteStyle',
saveTemplate: 'api/mail_template/saveTemplate'
};
// 仅在当前 SPA 会话内记忆筛选(刷新页面即重置)
const mailboxMouldSessionMemory = {
@@ -177,7 +211,13 @@ export default {
// --- 共用预览 ---
previewVisible: false,
previewContent: ''
previewContent: '',
/** 邮件模板 JSON 批量导入(期刊 ID 单独输入,与每条合并后调 saveTemplate */
batchTplImportVisible: false,
batchTplImportText: '',
batchTplImportJournalId: '',
batchTplImporting: false
};
},
created() {
@@ -281,6 +321,147 @@ export default {
const journalId = this.tplFilters && this.tplFilters.journalId ? String(this.tplFilters.journalId) : '';
this.$router.push({ path: '/mailboxMouldDetail', query: journalId ? { journal_id: journalId } : {} });
},
openTemplateBatchImportDialog() {
const cur = String((this.tplFilters && this.tplFilters.journalId) || '').trim();
if (cur) this.batchTplImportJournalId = cur;
if (!this.batchTplImportText || !String(this.batchTplImportText).trim()) {
this.batchTplImportText = this.defaultTemplateBatchImportSample();
}
this.batchTplImportVisible = true;
},
defaultTemplateBatchImportSample() {
return (
'[\n' +
' {\n' +
' "title": "示例标题",\n' +
' "subject": "示例主题",\n' +
' "scene": "invite_submission",\n' +
' "language": "en",\n' +
' "version": "1.0.0",\n' +
' "body_html": "<p>正文 HTML</p>",\n' +
' "variables_json": "",\n' +
' "is_active": 1\n' +
' }\n' +
']\n'
);
},
/** 与 mailboxMouldDetail._doSave 提交 saveTemplate 字段对齐;支持 body、lang、variables 别名 */
normalizeMailTemplateSavePayload(row) {
if (!row || typeof row !== 'object') return {};
const bodyHtml =
row.body_html != null
? String(row.body_html)
: row.body != null
? String(row.body)
: '';
const bodyTextRaw = row.body_text != null ? String(row.body_text) : '';
const bodyText =
bodyTextRaw.trim() ||
bodyHtml
.replace(/<[^>]+>/g, ' ')
.replace(/\s+/g, ' ')
.trim();
const lang = String(row.language != null ? row.language : row.lang != null ? row.lang : 'en').toLowerCase();
let isActive = '1';
if (row.is_active === 0 || row.is_active === '0' || row.is_active === false) isActive = '0';
const out = {
journal_id: String(row.journal_id != null ? row.journal_id : row.journalId != null ? row.journalId : '').trim(),
scene: String(row.scene || 'invite_submission'),
language: lang,
title: String(row.title || ''),
subject: String(row.subject || ''),
body_html: bodyHtml,
body_text: bodyText,
variables_json: String(
row.variables_json != null ? row.variables_json : row.variables != null ? row.variables : ''
),
version: String(row.version != null ? row.version : '1.0.0'),
is_active: isActive
};
const tid = row.template_id != null ? row.template_id : row.id;
if (tid != null && String(tid).trim() !== '') out.template_id = String(tid).trim();
return out;
},
applyTemplateBatchImportJournal(payload) {
const jid = String(this.batchTplImportJournalId || '').trim();
if (jid) payload.journal_id = jid;
},
validateMailTemplateSavePayload(p, index) {
if (!p.journal_id || !String(p.journal_id).trim()) {
return this.$t('mailboxMould.batchImportMissingJournal', { index: index + 1 });
}
if (!p.title || !String(p.title).trim()) {
return this.$t('mailboxMould.batchImportMissingField', { index: index + 1, field: 'title' });
}
if (!p.subject || !String(p.subject).trim()) {
return this.$t('mailboxMould.batchImportMissingField', { index: index + 1, field: 'subject' });
}
if (!p.body_html || !String(p.body_html).trim()) {
return this.$t('mailboxMould.batchImportMissingField', { index: index + 1, field: 'body_html' });
}
return '';
},
async runTemplateBatchImport() {
let rows;
try {
rows = JSON.parse(this.batchTplImportText || '[]');
} catch (e) {
this.$message.error(this.$t('mailboxMould.batchImportBadJson'));
return;
}
if (!Array.isArray(rows) || !rows.length) {
this.$message.warning(this.$t('mailboxMould.batchImportEmpty'));
return;
}
this.batchTplImporting = true;
let ok = 0;
let fail = 0;
const errLines = [];
try {
for (let i = 0; i < rows.length; i++) {
const payload = this.normalizeMailTemplateSavePayload(rows[i]);
this.applyTemplateBatchImportJournal(payload);
const ve = this.validateMailTemplateSavePayload(payload, i);
if (ve) {
fail++;
errLines.push(ve);
continue;
}
try {
const res = await this.$api.post(API.saveTemplate, payload);
if (res && res.code === 0) {
ok++;
} else {
fail++;
errLines.push(
this.$t('mailboxMould.batchImportRowFail', {
index: i + 1,
msg: (res && res.msg) || this.$t('mailboxMould.batchImportSaveFail')
})
);
}
} catch (e) {
console.error(e);
fail++;
errLines.push(this.$t('mailboxMould.batchImportRowNetwork', { index: i + 1 }));
}
}
this.$message.success(this.$t('mailboxMould.batchImportDone', { ok, fail }));
if (errLines.length) {
this.$notify({
title: this.$t('mailboxMould.batchImportErrorsTitle'),
message: errLines.slice(0, 8).join('\n'),
type: fail && !ok ? 'error' : 'warning',
duration: 12000
});
}
this.batchTplImportVisible = false;
this.syncTplFilterMemory();
this.fetchTemplates();
} finally {
this.batchTplImporting = false;
}
},
handleEditTemplate(row) {
this.syncTplFilterMemory();
const templateId = row && (row.template_id || row.id);
@@ -419,4 +600,39 @@ export default {
background: #fff;
box-sizing: border-box;
}
.batch-tpl-hint {
font-size: 12px;
line-height: 1.55;
color: #606266;
margin: 0 0 8px;
}
.batch-tpl-tip {
font-size: 12px;
line-height: 1.5;
color: #909399;
margin: 0 0 12px;
}
.batch-tpl-journal-row {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 12px;
}
.batch-tpl-label {
flex-shrink: 0;
font-size: 12px;
font-weight: 600;
color: #606266;
min-width: 72px;
}
.batch-tpl-journal-input {
flex: 1;
max-width: 360px;
}
.mailbox-mould-batch-import-dialog .batch-tpl-textarea >>> textarea {
font-family: Consolas, 'Courier New', monospace;
font-size: 12px;
line-height: 1.45;
}
</style>

View File

@@ -0,0 +1,381 @@
/**
* 邮件 Word → checkLogin作者→ multipart manuscirpt → contribute → 回填。
* 默认 preserveEditorLocalStorage不覆盖 U_*,作者 user_id 仅用接口返回值;作者账号写入 sessionStorage 备用键。
* 服务端会话在作者 checkLogin 后仍为作者,需用编辑密码再次 checkLogin 恢复(见 MailDetail
*/
import axios from 'axios';
const LS_KEYS = ['U_status', 'U_role', 'U_name', 'U_id', 'U_email', 'U_relname'];
export function backupEditorLocalStorage() {
const b = {};
LS_KEYS.forEach((k) => {
b[k] = localStorage.getItem(k);
});
return b;
}
export function restoreLocalStorage(backup) {
if (!backup) return;
LS_KEYS.forEach((k) => {
if (backup[k] != null) localStorage.setItem(k, backup[k]);
else localStorage.removeItem(k);
});
}
/**
* @param {*} api - this.$api
* @param {{ username: string, password: string, code?: string, baseUrl?: string }} login
*/
export async function postCheckLogin(api, login) {
const baseUrl = login.baseUrl != null ? login.baseUrl : '/api';
const random_num = Math.random();
const image = `${baseUrl}api/User/retrieveCaptcha?a=${random_num}`;
return api.post('api/User/checkLogin', {
username: login.username,
password: login.password,
random_num,
image,
code: login.code != null && login.code !== '' ? login.code : ''
});
}
/** 校验作者 checkLogin 响应,不写 localStorage */
export function validateAuthorLoginResponse(res) {
if (!res || Number(res.code) === 1) {
return { ok: false, msg: (res && res.msg) || 'Login failed' };
}
const roles = res.data && res.data.roles;
const userinfo = res.data && res.data.userinfo;
if (!userinfo) {
return { ok: false, msg: 'Invalid login response' };
}
if (roles && String(roles).includes('editor')) {
return { ok: false, msg: 'Editor accounts cannot use manuscript auto-submit in this flow' };
}
return { ok: true, userinfo };
}
const SHADOW_AUTHOR_ID = 'mailManuscript_author_id';
const SHADOW_AUTHOR_ACCOUNT = 'mailManuscript_author_account';
export function persistAuthorShadowSession(userinfo) {
if (!userinfo || typeof sessionStorage === 'undefined') return;
try {
sessionStorage.setItem(SHADOW_AUTHOR_ID, String(userinfo.user_id));
sessionStorage.setItem(SHADOW_AUTHOR_ACCOUNT, String(userinfo.account || ''));
} catch (e) {
/* ignore */
}
}
export function clearAuthorShadowSession() {
if (typeof sessionStorage === 'undefined') return;
try {
sessionStorage.removeItem(SHADOW_AUTHOR_ID);
sessionStorage.removeItem(SHADOW_AUTHOR_ACCOUNT);
} catch (e) {
/* ignore */
}
}
export function applyAuthorSessionFromLoginResponse(res) {
const v = validateAuthorLoginResponse(res);
if (!v.ok) {
return { ok: false, msg: v.msg };
}
const { userinfo } = v;
const roles = res.data && res.data.roles;
localStorage.setItem('U_status', '2');
localStorage.setItem('U_role', roles != null && roles !== '' ? roles : '');
localStorage.setItem('U_name', userinfo.account);
localStorage.setItem('U_id', userinfo.user_id);
localStorage.setItem('U_relname', userinfo.realname || '');
localStorage.setItem('U_email', userinfo.email || '');
return { ok: true };
}
/** 与 Login.vue 编辑账号成功分支一致,用于一键建稿后恢复编辑服务端会话 */
export function applyEditorSessionFromLoginResponse(res) {
if (!res || Number(res.code) === 1) {
return { ok: false, msg: (res && res.msg) || 'Login failed' };
}
const roles = res.data && res.data.roles;
const userinfo = res.data && res.data.userinfo;
if (!userinfo) {
return { ok: false, msg: 'Invalid login response' };
}
const roleStr = Array.isArray(roles) ? roles.join(',') : String(roles || '');
if (!roleStr.includes('editor')) {
return { ok: false, msg: 'Not an editor account' };
}
localStorage.setItem('U_status', '1');
localStorage.setItem('U_role', roles != null && roles !== '' ? roles : '');
localStorage.setItem('U_name', userinfo.account);
localStorage.setItem('U_id', userinfo.user_id);
localStorage.setItem('U_email', userinfo.email || '');
if (userinfo.realname) {
localStorage.setItem('U_relname', userinfo.realname);
} else {
localStorage.removeItem('U_relname');
}
return { ok: true };
}
/** 与 articleAdd.upload_manuscirpt`baseUrl + 'api/Article/up_file/type/manuscirpt'` */
export async function uploadManuscriptDocxMultipart(baseUrl, blob, filename) {
const url = `${baseUrl}api/Article/up_file/type/manuscirpt`;
const fd = new FormData();
let name = filename || 'manuscript.docx';
if (!String(name).toLowerCase().endsWith('.docx')) {
name = `${name}.docx`;
}
fd.append('manuscirpt', blob, name);
const { data } = await axios.post(url, fd, {
withCredentials: true,
headers: { 'Content-Type': 'multipart/form-data' }
});
return data;
}
export async function postContribute(api, { upurl, user_id, article_id }) {
const payload = {
file_url: '/public/manuscirpt/' + upurl,
user_id: String(user_id)
};
if (article_id != null && article_id !== '') {
payload.article_id = String(article_id);
}
return api.post('api/Contribute/contribute', payload);
}
function buildKeywordsString(article) {
if (!article || article.keywords == null || String(article.keywords).trim() === '') {
return '';
}
return String(article.keywords)
.split(',')
.map((k) => k.trim())
.filter(Boolean)
.join(',');
}
/** 与 articleAdd.addWordTablesList → api/Article/addArticleTable */
export async function postAddArticleTableFromWordTables(api, article_id, wordTables) {
if (!wordTables || !wordTables.length) return { code: 0 };
const data = {
article_id,
list: wordTables.map((e) => ({
table: JSON.stringify([...e]),
type: 0,
html_data: ''
}))
};
return api.post('api/Article/addArticleTable', data);
}
/**
* @param {*} api
* @param {{ user_id: string, article_id: string, journal_id: number, article: object, upurl: string, staging_username?: string, extractWordTables?: (consumer: (tables: any[]) => Promise<void>) => Promise<void> }} opts
*/
export async function runPostContributeArticleAddBackfill(api, opts) {
const { user_id, article_id, journal_id, article, upurl, extractWordTables, staging_username } = opts;
const relPath = 'manuscirpt/' + upurl;
const jid = journal_id != null && String(journal_id).trim() !== '' ? Number(journal_id) : NaN;
const hasJournal = !Number.isNaN(jid) && jid > 0;
if (hasJournal) {
const cj = await api.post('api/Article/changeJournal', {
article_id,
journal_id: jid
});
if (cj && Number(cj.code) !== 0) {
return { ok: false, step: 'changeJournal', msg: (cj && cj.msg) || 'changeJournal failed' };
}
}
const keyWords = buildKeywordsString(article);
const stagingPayload = {
article_id,
journal: hasJournal ? jid : article.journal_id != null ? article.journal_id : '',
title: (article && article.title) || '',
keywords: keyWords,
abstrart: (article && article.abstrart) || '',
type: article && article.type != null ? article.type : '',
username:
staging_username != null && String(staging_username).trim() !== ''
? String(staging_username).trim()
: (typeof localStorage !== 'undefined' && localStorage.getItem('U_name')) || '',
user_id,
approval: '',
approval_file: '',
approval_content: '',
fund: (article && article.fund) || ''
};
const st = await api.post('api/Article/addArticleStaging', stagingPayload);
if (!st || Number(st.status) !== 1) {
return {
ok: false,
step: 'addArticleStaging',
msg: (st && st.msg) || 'addArticleStaging failed'
};
}
const af = await api.post('api/Article/addArticlefile', {
article_id,
type: 'manuscirpt',
url: relPath
});
if (!af || Number(af.code) !== 0) {
return { ok: false, step: 'addArticlefile', msg: (af && af.msg) || 'addArticlefile failed' };
}
await api.post('api/Article/reloadArticleImages', { article_id });
await api.post('api/Article/reloadArticleTable', { article_id });
if (typeof extractWordTables === 'function') {
try {
await extractWordTables(async (tables) => {
if (tables && tables.length > 0) {
await postAddArticleTableFromWordTables(api, article_id, tables);
}
});
} catch (e) {
return {
ok: false,
step: 'addArticleTable',
msg: (e && e.message) || String(e)
};
}
}
await api.post('api/Article/getAuthors', { article_id });
await api.post('api/Article/getArticleState', { article_id, user_id });
return { ok: true };
}
/**
* @param {object} ctx
* @param {*} ctx.api
* @param {string} ctx.baseUrl
* @param {object} ctx.login
* @param {Blob} ctx.blob
* @param {string} ctx.fileName
* @param {number|string} [ctx.journal_id] — 当前邮件账号期刊(必填,与 mailbox 一致)
* @param {(consumer: (tables: any[]) => Promise<void>) => Promise<void>} [ctx.extractWordTables]
* @param {boolean} [ctx.preserveEditorLocalStorage=true] 为 true 时不改 U_*,仅用作者登录返回的 user_id
*/
export async function runMailManuscriptPipeline(ctx) {
const preserve = ctx.preserveEditorLocalStorage !== false;
const backup = backupEditorLocalStorage();
const { api, baseUrl, login, blob, fileName, journal_id, extractWordTables } = ctx;
const restoreIfNeeded = () => {
if (!preserve) {
restoreLocalStorage(backup);
}
};
try {
const loginRes = await postCheckLogin(api, { ...login, baseUrl });
let authorUserId;
let authorAccount = '';
if (preserve) {
const v = validateAuthorLoginResponse(loginRes);
if (!v.ok) {
return { ok: false, msg: v.msg, backup };
}
authorUserId = String(v.userinfo.user_id);
authorAccount = String(v.userinfo.account || '').trim();
persistAuthorShadowSession(v.userinfo);
} else {
const applied = applyAuthorSessionFromLoginResponse(loginRes);
if (!applied.ok) {
restoreIfNeeded();
return { ok: false, msg: applied.msg, backup };
}
authorUserId = localStorage.getItem('U_id');
authorAccount = String(localStorage.getItem('U_name') || '').trim();
}
if (!authorUserId) {
restoreIfNeeded();
clearAuthorShadowSession();
return { ok: false, msg: 'Missing user_id after login', backup };
}
const uploadRes = await uploadManuscriptDocxMultipart(baseUrl, blob, fileName);
if (!uploadRes || Number(uploadRes.code) !== 0) {
restoreIfNeeded();
clearAuthorShadowSession();
return {
ok: false,
msg: (uploadRes && uploadRes.msg) || 'Manuscript upload failed',
backup
};
}
const upurl = uploadRes.upurl;
if (!upurl) {
restoreIfNeeded();
clearAuthorShadowSession();
return { ok: false, msg: 'Upload response missing upurl', backup };
}
const cr = await postContribute(api, { upurl, user_id: authorUserId });
if (!cr || Number(cr.status) !== 1 || !cr.article || cr.article.article_id == null) {
restoreIfNeeded();
clearAuthorShadowSession();
return {
ok: false,
msg: (cr && cr.msg) || 'Contribute failed',
backup,
contributeRes: cr
};
}
const articleId = String(cr.article.article_id);
const jid = journal_id != null && String(journal_id).trim() !== '' ? Number(journal_id) : NaN;
if (Number.isNaN(jid) || jid <= 0) {
restoreIfNeeded();
clearAuthorShadowSession();
return {
ok: false,
msg: 'Missing journal_id for post-contribute backfill',
backup,
contributeRes: cr
};
}
const bf = await runPostContributeArticleAddBackfill(api, {
user_id: authorUserId,
article_id: articleId,
journal_id: jid,
article: cr.article,
upurl,
staging_username: authorAccount,
extractWordTables
});
if (!bf.ok) {
restoreIfNeeded();
clearAuthorShadowSession();
return {
ok: false,
msg: bf.msg || 'Post-contribute backfill failed',
backup,
step: bf.step,
article_id: articleId,
contributeRes: cr
};
}
clearAuthorShadowSession();
return { ok: true, article_id: articleId, backup };
} catch (e) {
restoreIfNeeded();
clearAuthorShadowSession();
return { ok: false, msg: (e && e.message) || String(e), backup };
}
}