From be8ea4e4866dee8f58c6d3332aef9546e3aa33c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=8B=E4=BA=8E=E5=88=9D=E8=A7=81?= <752204717@qq.com> Date: Thu, 14 May 2026 11:26:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/js/commonJS.js | 3 +- src/components/common/Header.vue | 9 + src/components/common/Header2.vue | 6 + src/components/common/langs/en.js | 59 +- src/components/common/langs/zh.js | 55 +- .../page/components/email/MailDetail.vue | 728 ++++++++++++++++-- src/components/page/mailboxCollect.vue | 36 + src/utils/mailManuscriptAutoSubmit.js | 381 +++++++++ 8 files changed, 1200 insertions(+), 77 deletions(-) create mode 100644 src/utils/mailManuscriptAutoSubmit.js diff --git a/src/common/js/commonJS.js b/src/common/js/commonJS.js index 3f15913..0f14eea 100644 --- a/src/common/js/commonJS.js +++ b/src/common/js/commonJS.js @@ -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"); diff --git a/src/components/common/Header.vue b/src/components/common/Header.vue index dfb8064..70ba5fc 100644 --- a/src/components/common/Header.vue +++ b/src/components/common/Header.vue @@ -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); } }; diff --git a/src/components/common/Header2.vue b/src/components/common/Header2.vue index 6102e0b..3ddeab2 100644 --- a/src/components/common/Header2.vue +++ b/src/components/common/Header2.vue @@ -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); diff --git a/src/components/common/langs/en.js b/src/components/common/langs/en.js index de9c724..7687a77 100644 --- a/src/components/common/langs/en.js +++ b/src/components/common/langs/en.js @@ -657,15 +657,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}Open articleAdd', + 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', diff --git a/src/components/common/langs/zh.js b/src/components/common/langs/zh.js index b722458..e8b5e56 100644 --- a/src/components/common/langs/zh.js +++ b/src/components/common/langs/zh.js @@ -646,15 +646,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}打开 articleAdd 继续编辑', + 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: '关键词配置', diff --git a/src/components/page/components/email/MailDetail.vue b/src/components/page/components/email/MailDetail.vue index 9b0179e..f81ad0d 100644 --- a/src/components/page/components/email/MailDetail.vue +++ b/src/components/page/components/email/MailDetail.vue @@ -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') }} + @@ -82,18 +93,6 @@ {{ $t('mailboxCollect.viewAttachments') }} - - {{ $t('mailboxCollect.registerAuthorBtn') }} - @@ -142,15 +141,98 @@ ref="previewDialog" @download="downloadAttachment" /> + + + + + + + + + + + + + {{ + $t('mailboxCollect.autoSubmitPickLocalDocx') + }} + + {{ $t('mailboxCollect.autoSubmitSourceHint') }} + + {{ $t('mailboxCollect.autoSubmitLocalPicked', { name: localDocxDisplayName }) }} + + + + + + + + {{ + $t('mailboxCollect.autoSubmitDialogClose') + }} + + + {{ $t('mailboxCollect.autoSubmitCancel') }} + {{ + $t('mailboxCollect.autoSubmitConfirm') + }} + + +
{{ $t('mailboxCollect.autoSubmitSourceHint') }}
+ {{ $t('mailboxCollect.autoSubmitLocalPicked', { name: localDocxDisplayName }) }} +