40 Commits

Author SHA1 Message Date
48dc82326d Merge branch 'master' of https://git.nuttyreading.com/wangjinlei/tougao_web into Editorial-Board 2026-05-06 11:22:20 +08:00
8e59702f0b 申请青年编委单独页面校验显示 2026-05-06 10:49:41 +08:00
ea1564018e 必填项 变成英文提示词 2026-05-06 09:52:32 +08:00
4d7c230abe 提交 2026-04-29 17:46:12 +08:00
8b9e35287c 自动化配置增加青年编委模块 2026-04-29 17:13:40 +08:00
9234318139 自主修改邮箱 2026-04-29 12:49:55 +08:00
a4cbce2db7 自动化样式 2026-04-29 09:20:47 +08:00
56cda2c232 模版列表记忆功能 2026-04-28 13:27:09 +08:00
0c9ff0fe68 专家库退订状态+修改列表页数据显示 2026-04-28 11:12:15 +08:00
ca1b10c418 滑动选中 2026-04-24 15:05:57 +08:00
bb36bcc645 修改邮件模版预览按钮 2026-04-24 14:51:25 +08:00
fe4bd7c9b0 任务工厂 2026-04-24 11:05:22 +08:00
632913aaad 提交 2026-04-23 09:12:13 +08:00
711a3fe2ec 任务工厂列表版 2026-04-22 11:42:47 +08:00
0d913e90a7 国家 2026-04-17 13:35:56 +08:00
7458beb8b2 批量查询领域 2026-04-17 10:56:44 +08:00
8fbcf39a25 提交 2026-04-17 10:36:48 +08:00
1e2e8146cc 审稿校验空格 2026-04-16 11:02:01 +08:00
64b1d20b32 排版拖拽显示问题 2026-04-15 13:09:08 +08:00
6cb5dbccf0 修改 参考文献排序 2026-04-14 11:18:04 +08:00
26981f83c4 Merge branch 'master' of https://git.nuttyreading.com/wangjinlei/tougao_web into Editorial-Board 2026-04-14 09:10:02 +08:00
a28d0d5079 提交 2026-04-13 17:00:49 +08:00
eff107aa15 表格参考文献的预览 2026-04-13 16:42:26 +08:00
563def58a5 tijiao 2026-04-13 14:42:13 +08:00
222a00c1c7 Merge branch 'master' of https://git.nuttyreading.com/wangjinlei/tougao_web into Editorial-Board 2026-04-13 14:20:03 +08:00
1deb5bba86 tijiao 2026-04-13 13:06:31 +08:00
d613aa7d0d tijiao 2026-04-10 15:53:15 +08:00
0a56b16fe4 Merge branch 'master' of https://git.nuttyreading.com/wangjinlei/tougao_web into Editorial-Board 2026-04-10 09:21:39 +08:00
7f725cad52 Merge branch 'master' of https://git.nuttyreading.com/wangjinlei/tougao_web into Editorial-Board 2026-04-10 09:13:17 +08:00
797ca258f8 提交 2026-04-10 09:12:40 +08:00
9c44064f51 参考文献 2026-04-09 11:52:33 +08:00
7527a6ef54 参考文献的暂存 2026-04-09 09:39:58 +08:00
c4b86be0d5 提交 2026-04-08 17:25:19 +08:00
4fc78e1fe7 提交 2026-04-08 13:09:02 +08:00
0d35b76c3a 提交 2026-04-08 13:03:54 +08:00
36f6c02376 提交 2026-04-03 09:58:39 +08:00
dd07a03d7b Merge branch 'master' of https://git.nuttyreading.com/wangjinlei/tougao_web into Editorial-Board 2026-04-03 09:52:11 +08:00
620a35f958 提交 2026-04-03 09:05:56 +08:00
95b52b4d06 提交 2026-04-02 10:56:37 +08:00
1f29fb5baf 根据标签autoCite显示参考文献 2026-04-01 17:30:40 +08:00
53 changed files with 15457 additions and 1291 deletions

View File

@@ -102,6 +102,22 @@ export default {
})
},
/**
* POST x-www-form-urlencoded数组字段序列化为 list[]=a&list[]=b兼容 PHP 批量接口)
*/
postFormBracket(url, params) {
return new Promise((resolve, reject) => {
service
.post(url, qs.stringify(params, { arrayFormat: 'brackets' }))
.then((res) => {
resolve(res.data)
})
.catch((err) => {
reject(err)
})
})
},
/**
* post方法对应post请求
* @param {String} url [请求的url地址]

View File

@@ -0,0 +1,169 @@
/**
* 表格弹窗预览:将单元格内空 mycite 转为可见 [n],与 word.vue renderCiteLabels 一致(纯函数,无 Vue 依赖)
*/
export function formatCiteNumbers(nums) {
if (!nums || !nums.length) return '';
const sorted = [...new Set(nums)].sort((a, b) => a - b);
const result = [];
let i = 0;
while (i < sorted.length) {
let j = i;
while (j < sorted.length - 1 && sorted[j + 1] === sorted[j] + 1) j++;
if (j - i >= 2) {
result.push(`${sorted[i]}${sorted[j]}`);
} else {
for (let k = i; k <= j; k++) result.push(sorted[k]);
}
i = j + 1;
}
return result.join(', ');
}
export function sortAutociteIdsByCiteNumber(ids, citeMap) {
const map = citeMap || {};
const uniq = [...new Set(ids.map(String))];
return uniq.sort((a, b) => {
const na = map[a];
const nb = map[b];
const ha = na != null && na !== '';
const hb = nb != null && nb !== '';
if (ha && hb) return Number(na) - Number(nb);
if (ha) return -1;
if (hb) return 1;
return String(a).localeCompare(String(b));
});
}
/**
* @param {Array} refs - chanFerForm项含 p_refer_id
* @param {Array<string|number>} bodyCiteIdOrder - 正文首次出现顺序;空则按列表行序 1..n
*/
export function buildCiteMapFromRefs(refs, bodyCiteIdOrder) {
const refList = Array.isArray(refs) ? refs : [];
const refIdSet = new Set(
refList.map((r) => (r && r.p_refer_id != null ? String(r.p_refer_id) : '')).filter(Boolean)
);
let orderedIds = [];
if (Array.isArray(bodyCiteIdOrder) && bodyCiteIdOrder.length > 0) {
orderedIds = bodyCiteIdOrder.map(String);
}
if (orderedIds.length === 0) {
const map = {};
refList.forEach((row, idx) => {
const key = row && row.p_refer_id != null ? String(row.p_refer_id) : '';
if (key) map[key] = idx + 1;
});
return map;
}
const filtered = [];
orderedIds.forEach((id) => {
if (refIdSet.has(id) && !filtered.includes(id)) filtered.push(id);
});
const map = {};
filtered.forEach((id, idx) => {
map[id] = idx + 1;
});
let next = filtered.length + 1;
refList.forEach((r) => {
const key = r && r.p_refer_id != null ? String(r.p_refer_id) : '';
if (!key || map[key] != null) return;
map[key] = next++;
});
return map;
}
function escAttr(s) {
return String(s || '')
.replace(/&/g, '&amp;')
.replace(/"/g, '&quot;')
.replace(/</g, '&lt;');
}
/**
* @param {string} html
* @param {Array} refs - chanFerForm
* @param {Object} citeMap - p_refer_id -> 显示序号
*/
export function renderCiteLabelsInHtml(html, refs, citeMap) {
if (!html || typeof html !== 'string') return html || '';
if (!Array.isArray(refs) || refs.length === 0) return html;
/** 与稿面一致:历史/表格 JSON 中可能为 <autocite> */
let h = html.replace(/<\/autocite>/gi, '</mycite>').replace(/<autocite\b/gi, '<mycite');
const refList = refs;
const refMap = refList.reduce((acc, item) => {
const key = item && item.p_refer_id != null ? String(item.p_refer_id) : '';
if (key) acc[key] = item;
return acc;
}, {});
let normalized = h.replace(/<mycite\b[^>]*\/?>[\s\S]*?(?:<\/mycite>)?/gi, (fullTag) => {
const attrMatch = fullTag.match(/\bdata-id\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i);
const dataId = (attrMatch && (attrMatch[1] || attrMatch[2] || attrMatch[3])) || '';
if (!dataId) return '';
return `<mycite data-id="${escAttr(dataId)}"></mycite>`;
});
const citeGroupRe = /(?:<mycite\s+data-id="([^"]*)"\s*><\/mycite>\s*)+/gi;
normalized = normalized.replace(citeGroupRe, (groupMatch) => {
const ids = [];
const innerRe = /<mycite\s+data-id="([^"]*)"\s*><\/mycite>/gi;
let m;
while ((m = innerRe.exec(groupMatch)) !== null) {
m[1].split(',').forEach((part) => {
const id = part.trim();
if (id) ids.push(id);
});
}
const sortedAll = sortAutociteIdsByCiteNumber(ids, citeMap);
const validIds = sortedAll.filter((id) => refMap[id]);
const sortedIds = validIds.length ? sortAutociteIdsByCiteNumber(validIds, citeMap) : [];
const map = citeMap || {};
const parts = sortedIds.map((id) => {
const ref = refMap[id];
const no = ref ? map[id] : null;
const num = no != null && no !== '' ? String(no) : null;
return { id, ref, num };
});
const numsForLabel = parts
.map((p) => p.num)
.filter((n) => n != null && n !== '')
.map(Number);
const label = numsForLabel.length > 0 ? formatCiteNumbers(numsForLabel) : '';
if (!label) {
return '';
}
const dataIdAttr = escAttr(sortedIds.join(','));
return `<mycite data-id="${dataIdAttr}">[${label}]</mycite>`;
});
return normalized.replace(/<mycite[^>]*data-id=""[^>]*>[\s\S]*?<\/mycite>/gi, '');
}
export function applyCiteLabelsToTableRows(rows, refs, citeMap) {
if (!Array.isArray(rows) || !rows.length) return rows;
if (!Array.isArray(refs) || refs.length === 0) return rows;
return rows.map((row) => {
if (!Array.isArray(row)) return row;
const nextRow = row.map((cell) => {
if (!cell || typeof cell !== 'object') return cell;
const t = cell.text;
const lower = typeof t === 'string' ? t.toLowerCase() : '';
if (!lower || (!lower.includes('mycite') && !lower.includes('autocite'))) return cell;
const next = renderCiteLabelsInHtml(t, refs, citeMap);
if (next === t) return cell;
return { ...cell, text: next };
});
// TableUtils.addRowIdToData 会给数组行对象挂 rowId渲染 oddColor 依赖它,不能在 map 后丢失
if (row.rowId != null) {
nextRow.rowId = row.rowId;
}
return nextRow;
});
}

View File

@@ -71,7 +71,51 @@ function findExtentElement(blipElement) {
export default {
async searchTitleByDOI(doi) {
if (!doi) {
this.$message.warning('Please enter a DOI');
return null;
}
// 开启全局 Loading防止编辑重复点击
try {
// 1. 数据清洗
const cleanDoi = doi.trim()
.replace(/^doi:/i, '')
.replace(/https?:\/\/doi\.org\//i, '');
// 2. 请求 Crossref 接口
const response = await fetch(`https://api.crossref.org/works/${encodeURIComponent(cleanDoi)}`, {
method: 'GET',
headers: { 'Accept': 'application/json' }
});
if (!response.ok) throw new Error('DOI not found');
const data = await response.json();
// 3. 提取标题并跳转
const title = data.message?data.message.title?data.message.title[0]:'':'';
if (title) {
const searchUrl = `https://www.google.com/search?q=${encodeURIComponent(title)}`;
window.open(searchUrl, '_blank');
return title;
} else {
this.$message.error('Title not found in metadata.');
}
} catch (error) {
console.error("DOI Retrieval Error:", error);
this.$message.error('Failed to fetch title. Please check the DOI.');
} finally {
}
return null;
},
getJournalTypeName(value) {
var list = JSON.parse(localStorage.getItem('journalTypeDataAll'));
@@ -226,8 +270,7 @@ export default {
str = this.transformHtmlString(processedContent, 'table',{ keepBr: true })
console.log("🚀 ~ extractContentWithoutOuterSpan888888 ~ str:", str);
// 创建一个临时的 DOM 元素来解析 HTML
const div = document.createElement('div');
@@ -917,9 +960,9 @@ str = str.replace(regex, function (match, content, offset, fullString) {
});
// 2. 删除所有不需要的标签 (除 `strong`, `em`, `sub`, `sup`, `b`, `i` 外的所有标签)
if (type == 'table') {
inputHtml = inputHtml.replace(/<(?!\/?(strong|em|sub|sup|b|i|blue|wmath|img|myfigure|mytable|myh3))[^>]+>/g, ''); // 删除不需要的标签
inputHtml = inputHtml.replace(/<(?!\/?(strong|em|sub|sup|b|i|blue|wmath|img|myfigure|mytable|myh3|mycite))[^>]+>/g, ''); // 删除不需要的标签
} else {
inputHtml = inputHtml.replace(/<(?!\/?(strong|em|sub|sup|b|i|blue|wmath|myfigure|mytable|myh3))[^>]+>/g, ''); // 删除不需要的标签
inputHtml = inputHtml.replace(/<(?!\/?(strong|em|sub|sup|b|i|blue|wmath|myfigure|mytable|myh3|mycite))[^>]+>/g, ''); // 删除不需要的标签
}
@@ -992,8 +1035,7 @@ str = str.replace(regex, function (match, content, offset, fullString) {
const cells = row.querySelectorAll('th, td'); // 获取每个行中的单元格(包括 <th> 和 <td>
return await Promise.all(
Array.from(cells).map(async (cell) => {
console.log("🚀 ~ parseTableToArray777 ~ cell:", cell);
const text = await this.extractMathJaxLatex(cell);
return {
text,
@@ -1246,35 +1288,28 @@ str = str.replace(regex, function (match, content, offset, fullString) {
getCleanTextForCount(html) {
if (!html) return "";
// 创建临时容器解析 HTML
const tempDiv = document.createElement('div');
tempDiv.innerHTML = html;
// A. 特殊处理 wmath只拿它里面的公式文本扔掉里面生成的 mjx-container 等标签
// 1. 处理公式 (保留公式文本内容)
const wmaths = tempDiv.querySelectorAll('wmath');
wmaths.forEach(wm => {
// textContent 会拿到最原始的公式字符,忽略内部所有标签
const textNode = document.createTextNode(wm.textContent);
const textNode = document.createTextNode(" " + wm.textContent + " ");
wm.parentNode.replaceChild(textNode, wm);
});
// B. 获取现在的 HTML 内容
let result = tempDiv.innerHTML;
// 2. 移除所有引用标签 [1], [2] (防止用户靠狂刷引用来凑字数)
const refs = tempDiv.querySelectorAll('span.reference-link, a.ref'); // 根据你系统的 class 名调整
refs.forEach(r => r.remove());
// C. 去掉特定排版标签的“壳”(保留里面的文字)
// 包含 b, strong, br, em, i, sup, sub 等
result = result.replace(/<(p|div|b|strong|br|em|i|sup|sub)[^>]*>/gi, "");
result = result.replace(/<\/(p|div|b|strong|br|em|i|sup|sub)>/gi, "");
// 3. 获取纯文本 (textContent 是浏览器原生方法,能处理所有标签及其属性)
let text = tempDiv.textContent || tempDiv.innerText || "";
// E. 彻底“脱水”:去掉 HTML 实体、换行符、所有空格
result = result.replace(/&nbsp;/ig, "");
result = result.replace(/[\r\n\t]/g, "");
result = result.replace(/\s+/g, "");
return result;
// 4. 标准化空格:将 HTML 实体、换行、多个空格统一转为一个空格
return text.replace(/&nbsp;/ig, " ")
.replace(/[\r\n\t]+/g, " ")
.replace(/\s+/g, " ")
.trim();
},

View File

@@ -176,6 +176,7 @@ export default {
localStorage.removeItem('U_role');
localStorage.removeItem('U_id');
localStorage.removeItem('U_name');
localStorage.removeItem('U_email');
localStorage.removeItem('U_status');
localStorage.removeItem('ms_journal_alias');
localStorage.removeItem('journalTypeData');

View File

@@ -174,6 +174,7 @@ export default {
localStorage.removeItem('U_role');
localStorage.removeItem('U_id');
localStorage.removeItem('U_name');
localStorage.removeItem('U_email');
localStorage.removeItem('U_status');
localStorage.removeItem('ms_journal_alias');
localStorage.removeItem('journalTypeData');

View File

@@ -20,8 +20,15 @@
<template v-for="subItem in item.subs">
<el-submenu v-if="subItem.subs" :index="subItem.index" :key="subItem.index + '-submenu'">
<template slot="title">
{{ subItem.title }}
<!-- <el-badge is-dot :hidden="false">{{ subItem.title }}</el-badge> -->
<el-badge
v-if="subItem.index === '45'"
is-dot
:hidden="applyBadgeYouth <= 0"
class="sidebar-submenu-apply-badge"
>
<span>{{ subItem.title }}</span>
</el-badge>
<template v-else>{{ subItem.title }}</template>
</template>
<template v-for="(threeItem, i) in subItem.subs">
@@ -35,8 +42,16 @@
{{ fourItem.title }}
</el-menu-item>
</el-submenu>
<el-menu-item v-else :index="threeItem.index" :key="threeItem.index + '-item'"
>{{ threeItem.title }}
<el-menu-item v-else :index="threeItem.index" :key="threeItem.index + '-item'">
<el-badge
v-if="threeItem.index === 'youthApplyList'"
is-dot
:hidden="applyBadgeYouth <= 0"
class="sidebar-menu-youth-apply-badge"
>
<span class="sidebar-menu-youth-apply-badge__text">{{ threeItem.title }}</span>
</el-badge>
<template v-else>{{ threeItem.title }}</template>
</el-menu-item>
</template>
</el-submenu>
@@ -64,8 +79,8 @@
</el-submenu>
</template>
<!-- 编委 -->
<template v-if="this.user_cap.includes(',board')||this.user_cap.includes('board_editor')">
<template v-if="this.user_cap.includes(',board') || this.user_cap.includes('board_editor')">
<el-submenu index="7">
<template slot="title"> <i class="el-icon-notebook-1"></i> {{ $t('sidebar.edit_oria') }} </template>
<!-- <el-menu-item index="editorial">
@@ -74,7 +89,7 @@
<!-- <el-menu-item index="edithistory">
{{ $t('sidebar.edit_oria2') }}
</el-menu-item> -->
<el-menu-item index="editPeerewer">
<el-menu-item index="editPeerewer">
{{ $t('sidebar.edit_ewer1') }}
</el-menu-item>
<el-menu-item index="editPerhistory">
@@ -83,9 +98,10 @@
</el-submenu>
</template>
<!-- 主编 -->
<template v-if="this.user_cap.includes('chief')||this.user_cap.includes('chief_editor')||this.user_cap.includes('deputy_editor')">
<template
v-if="this.user_cap.includes('chief') || this.user_cap.includes('chief_editor') || this.user_cap.includes('deputy_editor')"
>
<el-submenu index="6">
<template slot="title"> <i class="el-icon-document-copy"></i> {{ $t('sidebar.man_ing') }} </template>
<el-menu-item index="managing">
@@ -168,6 +184,7 @@
<el-menu-item index="mailboxConfig">
{{ $t('sidebar.mailboxManagement') }}
</el-menu-item>
<el-submenu index="expertDatabaseSub">
<template slot="title">
{{ $t('sidebar.expertDatabase') }}
@@ -175,19 +192,16 @@
<el-menu-item index="expertDatabase">
{{ $t('sidebar.expertList') }}
</el-menu-item>
<el-menu-item index="crawlTaskMonitor">
{{ $t('sidebar.crawlTasks') }}
</el-menu-item>
</el-submenu>
<el-menu-item index="countryManagement">
{{ $t('sidebar.countryManagement') }}
</el-menu-item>
</el-submenu>
<el-submenu index="tools">
<template slot="title"> <i class="el-icon-paperclip"></i> {{ $t('sidebar.tools') }} </template>
<el-menu-item index="RejectedArticles">
@@ -221,6 +235,8 @@ export default {
user_cap: localStorage.getItem('U_role'),
menuList: [],
/** 青年编委申请红点Young Scientist 父级 + Apply 子项,数据来自 getYboardApplys */
applyBadgeYouth: 0,
items: [],
// 作者
author_items: [
@@ -234,7 +250,6 @@ export default {
index: '1',
title: this.$t('sidebar.author'),
subs: [
{
index: 'articleList',
title: this.$t('sidebar.author1')
@@ -246,10 +261,11 @@ export default {
{
index: 'articleAdd',
title: this.$t('sidebar.author2')
} , {
},
{
index: 'orderListAuthor',
title: this.$t('sidebar.author4')
},
}
]
}
// ,{
@@ -312,7 +328,6 @@ export default {
index: 'Promotionsystem',
title: this.$t('menu.Promotionsystem'),
subs: [
{
index: 'disseMRecord',
title: this.$t('menu.userManSys6')
@@ -363,7 +378,7 @@ export default {
index: '4',
title: this.$t('sidebar.userManSys'),
subs: [
{
{
//论文编辑系统
icon: 'el-icon-lx-copy',
index: 'Userdatabase',
@@ -679,74 +694,64 @@ export default {
}
},
mounted() {
// if(this.user_cap.includes(',board')||this.user_cap.includes('board_editor')||this.user_cap.includes('chief')||this.user_cap.includes('chief_editor')||this.user_cap.includes('deputy_editor')){
// Promise.all([
// this.$api
// .post('api/Finalreview/lists', {
// 'reviewer_id': localStorage.getItem('U_id'),state:5,
// 'page': 1,
// 'size': 999999,
// })
// ]).then(([res1]) => {
// console.log('res1 at line 770:', res1)
// const totalCheck = res1.data.total || 0; // 待审核
// if (totalCheck > 0 ) {
// const h = this.$createElement;
// const messageNodes = [];
// if (totalCheck > 0) {
// messageNodes.push(
// h(
// 'p',
// {
// style: {
// color: '#006699',
// marginTop: '10px',
// marginBottom: '4px',
// display: 'block', width: '280px' // 设置宽度
// }
// },
// `You have received 【${totalCheck}】 invitations .`
// )
// );
// // 第二行
// messageNodes.push(
// h(
// 'p',
// {
// style: {
// color: '#888',
// display: 'block', width: '280px' // 设置宽度
// }
// },
// 'Please process them promptly in the final review history.'
// )
// );
// }
// this.$notify({
// title: 'Final Review',
// message: h('div', {
// style: 'width: 200px;'
// }, messageNodes)
// });
// }
// });
// }
if (String(this.userrole) === '1') {
this.fetchApplyBadgeSummary();
}
// if(this.user_cap.includes(',board')||this.user_cap.includes('board_editor')||this.user_cap.includes('chief')||this.user_cap.includes('chief_editor')||this.user_cap.includes('deputy_editor')){
// Promise.all([
// this.$api
// .post('api/Finalreview/lists', {
// 'reviewer_id': localStorage.getItem('U_id'),state:5,
// 'page': 1,
// 'size': 999999,
// })
// ]).then(([res1]) => {
// console.log('res1 at line 770:', res1)
// const totalCheck = res1.data.total || 0; // 待审核
// if (totalCheck > 0 ) {
// const h = this.$createElement;
// const messageNodes = [];
// if (totalCheck > 0) {
// messageNodes.push(
// h(
// 'p',
// {
// style: {
// color: '#006699',
// marginTop: '10px',
// marginBottom: '4px',
// display: 'block', width: '280px' // 设置宽度
// }
// },
// `You have received 【${totalCheck}】 invitations .`
// )
// );
// // 第二行
// messageNodes.push(
// h(
// 'p',
// {
// style: {
// color: '#888',
// display: 'block', width: '280px' // 设置宽度
// }
// },
// 'Please process them promptly in the final review history.'
// )
// );
// }
// this.$notify({
// title: 'Final Review',
// message: h('div', {
// style: 'width: 200px;'
// }, messageNodes)
// });
// }
// });
// }
},
created() {
localStorage.setItem('collapse', this.collapse);
if (this.userrole == 2) {
//其余的身份(显示作者)
@@ -788,7 +793,7 @@ export default {
index: 'JournalManagementAll',
title: this.$t('sidebar.journalList')
},
{
index: 'GroupClassification',
title: this.$t('sidebar.GroupClassification')
@@ -860,10 +865,33 @@ export default {
localStorage.setItem('collapse', this.collapse);
bus.$emit('collapse-content', msg);
});
bus.$on('apply-badge-refresh', () => {
this.fetchApplyBadgeSummary();
});
},
beforeDestroy() {
bus.$off('apply-badge-refresh');
},
methods: {
// 获取数据
getDate() {}
getDate() {},
fetchApplyBadgeSummary() {
if (String(this.userrole) !== '1') return;
const editorId = localStorage.getItem('U_id');
if (!editorId) return;
this.$api
.post('api/User/getYboardApplys', { editor_id: editorId })
.then((res) => {
if (res && res.code === 0 && res.data && Array.isArray(res.data.applys)) {
this.applyBadgeYouth = res.data.applys.length > 0 ? 1 : 0;
} else {
this.applyBadgeYouth = 0;
}
})
.catch(() => {
this.applyBadgeYouth = 0;
});
}
}
};
</script>
@@ -937,4 +965,38 @@ export default {
.linkBar:hover {
background: #00527a;
}
/* Young Scientist 父级标题红点 */
.sidebar-submenu-apply-badge {
display: inline-block;
vertical-align: middle;
}
.sidebar-submenu-apply-badge ::v-deep .el-badge__content.is-dot {
top: 28%;
margin-top: 6px;
right: -4px;
border: 0;
display: none !important;
}
/* Apply 子菜单行上的红点,与菜单行高对齐 */
.sidebar-menu-youth-apply-badge {
display: inline-block;
vertical-align: middle;
line-height: 50px;
}
.sidebar-menu-youth-apply-badge ::v-deep .el-badge__content.is-dot {
top: 28%;
margin-top: 6px;
right: -4px;
border: 0;
display: none !important;
}
.sidebar-menu-youth-apply-badge__text {
color: inherit;
vertical-align: middle;
}
</style>

View File

@@ -20,6 +20,13 @@ const en = {
info: {
realname: 'English names can only contain uppercase and lowercase letters, "-", and spaces'
},
articleAdd: {
qqEmailAlertLine1: 'The publisher does not currently accept submissions from QQ Mail.',
qqEmailAlertLine2Before: 'Please go to',
qqEmailDashboardLink: 'Personal Center (Dashboard)',
qqEmailAlertLine2After: ' to change your registered email.',
qqEmailSubmitBlockedMsg: 'QQ Mail is not supported for submission. Please go to Personal Center (Dashboard) and change your email.'
},
total: {
author: 'author',
editor: 'editor',
@@ -281,6 +288,7 @@ const en = {
keywordManagement: 'Keyword Management',
crawlTasks: 'Crawl Tasks',
expertList: 'Expert List',
countryManagement: 'Country Management',
autoPromotion: 'Auto Promotion',
ReArticles: 'Rejected Manuscripts', // 被拒稿件
editorialBoard: 'Boss System',
@@ -307,16 +315,109 @@ const en = {
},
columns: {
baseInfo: 'Base Information',
country: 'Country',
affiliation: 'Affiliation',
researchAreas: 'Research areas'
researchAreas: 'Research areas',
unsubscribeStatus: 'Subscription status'
},
emptyMark: '-',
fields: {
nameLabel: 'Name:',
emailLabel: 'Email:',
acquisitionTimeLabel: 'Acquisition Time:'
},
viewAllInfo: 'View all details',
detailDialogTitle: 'Research areas & Article',
detailColField: 'Research areas',
detailColPaper: 'Article title',
detailColJournal: 'Journal',
detailClose: 'Close',
detailCellEmpty: 'N/A',
noFieldDetail: 'No publication details for these fields',
exportWarn: 'Please select a research area, enter a keyword, or enter a field before exporting.',
exportFailed: 'Export failed'
exportFailed: 'Export failed',
unsubscribeNormal: 'Subscribed',
unsubscribeUnsubscribed: 'Unsubscribed',
unsubscribeSwitchOn: 'Unsub',
unsubscribeSwitchOff: 'Subscribed',
unsubscribeMissingId: 'Missing expert ID, unable to switch unsubscribe status',
unsubscribeUpdateSuccess: 'Unsubscribe status updated',
unsubscribeUpdateFailed: 'Failed to update unsubscribe status'
},
countryManagement: {
title: 'Country Management',
keywordPlaceholder: 'Chinese / English / Code',
partitionLabel: 'Partition',
partitionAll: 'All partitions',
partition1: 'Partition 1',
partition2: 'Partition 2',
partition3: 'Partition 3',
searchBtn: 'Search',
resetBtn: 'Reset',
table: {
no: 'No.',
zhName: 'Chinese name',
enName: 'English name',
code: 'Code',
partition: 'Partition',
actions: 'Actions'
},
edit: 'Edit',
delete: 'Delete',
editTitle: 'Edit country',
form: {
zhName: 'Chinese name',
enName: 'English name',
code: 'Code',
partition: 'Partition'
},
cancel: 'Cancel',
save: 'Save',
confirm: 'OK',
deleteTitle: 'Confirm delete',
deleteConfirm: 'Delete this country record? This cannot be undone.',
saveSuccess: 'Saved',
deleteSuccess: 'Deleted',
opFailed: 'Operation failed',
loadFailed: 'Failed to load list',
missingId: 'Missing country id',
ruleZhName: 'Enter Chinese name',
ruleEnName: 'Enter English name',
ruleCode: 'Enter code',
rulePartition: 'Select a partition',
batchPartitionBtn: 'Batch update partition',
batchPartitionTitle: 'Batch update partition',
batchPartitionTargetLabel: 'Target partition',
batchPartitionTargetRequired: 'Please select target partition first',
batchPartitionHelp:
'One record per line: ISO code (3 letters) OR English OR Chinese name. Lines starting with # are comments. Example:\nDNK\nDenmark',
batchPartitionPlaceholder: 'Paste data, e.g.:\nDNK\nISR',
batchPartitionPreview: 'Preview match',
batchPartitionApply: 'Apply partition updates',
batchPartitionEmpty: 'Enter valid data (one country key per line)',
batchPartitionLoadListFailed: 'Failed to load full country list',
batchPartitionPreviewEmpty: 'Nothing to match',
batchPartitionColKey: 'Key from input',
batchPartitionColCurrentPartition: 'Current partition',
batchPartitionColPartition: 'Target partition',
batchPartitionColMatch: 'Match',
batchPartitionColId: 'country_id',
batchPartitionColName: 'English name',
batchPartitionMatched: 'Matched',
batchPartitionMismatch: 'Partition mismatch',
batchPartitionMissing: 'Not found',
batchPartitionSkipSame: 'Same partition',
batchPartitionApplyConfirm: 'Update partition only for {n} row(s). Continue?',
batchPartitionFilterPlaceholder: 'Filter by key / English / code / Chinese (use ; or , for multiple)',
batchPartitionSelectAllFiltered: 'Select all (filtered)',
batchPartitionClearSelection: 'Clear selection',
batchPartitionFilterCount: 'Showing {show} of {total}',
batchPartitionSelectionHint:
'Filter the table below, then tick rows to update. "Select all" only selects filtered rows that need a partition change. If nothing is ticked, all rows that need an update are submitted.',
batchPartitionNoSelection: 'Selection mode is on but no rows are ticked. Tick at least one row, or click Clear selection to submit all.',
batchPartitionDone: 'Done: {input} line(s) in batch; {ok} updated, {fail} failed, {miss} not found.',
batchPartitionSummaryLine:
'Summary: {input} line(s) parsed; {matched} matched; {miss} not found; {same} unchanged (same partition); {will} will be updated.'
},
mailboxConfig: {
mailSystem: 'Mailbox system',
@@ -1016,6 +1117,8 @@ colTitle: 'Template title',
autoSolicit: 'Auto Solicitation',
editConfig: 'Edit Configuration',
running: 'Running',
stopped: 'Stopped',
configure: 'Configure',
emailTemplate: 'Email Template',
emailStyle: 'Email Style',
notStarted: 'Auto solicitation plan is not enabled',
@@ -1045,21 +1148,102 @@ colTitle: 'Template title',
changeTemplate: 'Change Template',
selectPromotionFields: 'Select Promotion Fields',
choosePromotionFields: 'Choose Fields',
selectPromotionCountry: 'Select Country',
choosePromotionCountry: 'Choose Countries',
selectedCount: 'Selected {count}',
selectAll: 'Select All',
clearAll: 'Clear All',
selectPromotionFieldsTip: 'Multiple selection supported; leave empty for no field restriction.',
selectPromotionCountryTip: 'Multiple selection supported; leave empty for no country restriction. Uses the same API as fields until a dedicated country list is available.',
fieldSearchPlaceholder: 'Search promotion fields',
countrySearchPlaceholder: 'Search countries',
countryQuickZone1: 'Partition 1',
countryQuickZone2: 'Partition 2',
countryQuickZone3: 'Partition 3',
countryQuickChina: 'China',
countryQuickIndia: 'India',
noFieldMatch: 'No matching fields',
noCountryMatch: 'No matching countries',
confirm: 'Confirm',
fieldsSaved: 'Promotion fields saved',
countriesSaved: 'Promotion countries saved',
confirmAndEnable: 'Confirm and Enable',
onlySaveConfig: 'Save configuration only',
enableNowNextDay: 'Enable auto promotion now (starts next day)'
enableNowNextDay: 'Enable auto promotion now (starts next day)',
factoryCreateBtn: 'Create automated promotion task',
factoryDialogTitle: 'Create task',
factoryJournal: 'Journal',
factoryJournalPlaceholder: 'Select a journal',
factorySendSettings: 'Sending & scenario',
factoryEmails: 'Sender accounts',
factoryEmailsPlaceholder: 'Select one or more sender accounts',
factorySendCount: 'Send count',
factoryType: 'Scenario',
factoryTypeEditor: 'Editor',
factoryTypeArticle: 'Promote article',
factoryExpertType: 'Expert type',
factoryExpertTypePlaceholder: 'Optional; follow backend rules',
factorySubmit: 'Submit task',
factorySubmitSuccess: 'Factory task created',
factorySubmitFailed: 'Create failed, please try again later',
factoryNeedJournal: 'Please select a journal first',
factoryNeedTemplate: 'Please select email template and style',
factoryNeedEmails: 'Please select at least one sender account',
factoryNeedExpertType: 'Please select target person type',
factoryEmailsPickJournal: 'Select a journal to load sender accounts',
factoryNoAccounts: 'No mailbox accounts for this journal',
factoryAccountRemaining: 'Remaining today',
factorySendMaxFromApi: 'limit: up to {max} per day',
factorySendMaxFallback: 'using mailbox quota sum ~{max} (or default cap)',
factoryStepNav1Title: 'Journal',
factoryStepNav1Desc: 'Select a journal first.',
factoryStepNav2Title: 'Email template and style',
factoryStepNav2Desc: 'Choose template and style.',
factoryStepNav3Title: 'Sending and scenario',
factoryStepNav3Desc: 'Choose accounts, send count, and target type.',
factoryStepNav4Title: 'Promotion fields',
factoryStepNav4Desc: 'Select at least one promotion field.',
factoryStepNav5Title: 'Country',
factoryStepNav5Desc: 'Select at least one country or partition.',
factoryStepNav6Title: 'Confirm and enable',
factoryStepNav6Desc: 'Choose save only or enable next day.',
factoryPromotionFieldsBlockTip: 'Open “Choose fields” and tick at least one item; do not submit with none selected.',
factoryPromotionCountryBlockTip: 'Tick at least one partition or country; do not submit with none selected.',
factoryNeedPromotionFields: 'Select at least one promotion field before submitting.',
factoryNeedPromotionCountry: 'Select at least one partition or country before submitting.',
factoryQuotaLabel: 'Quota',
factoryClickSelectTemplate: 'Click to select email template',
factoryClickConfigureFields: 'Click to configure subject fields',
factoryBtnModify: 'Edit',
factoryBtnReset: 'Reset',
factoryBtnCancel: 'Cancel',
factoryBtnSubmit: 'Submit task',
factoryFillRequired: 'Please complete journal, template, and at least one sender account',
factoryExpertChief: 'Editor-in-Chief',
factoryExpertBoard: 'Editorial board',
factoryExpertYoungBoard: 'Young editorial board',
factoryExpertAuthor: 'Author',
factoryExpertDb: 'Expert database',
factoryExpertJump: 'View',
factoryOfficialEmailTip: 'For this type, the system uses the official sender email by default. No account selection is required.',
factoryScenario: 'Scenario',
factoryScenarioPlaceholder: 'Select scenario',
factoryScenarioSolicit: 'Invite Submission',
factoryScenarioPromoteCitation: 'Promote Citation',
factoryScenarioGeneralThanks: 'General Thanks',
createdAt: 'Created at',
noFactoryTask: 'No tasks',
factoryCreateNow: 'Create now',
emailClientCreateTaskBtn: 'Create task',
emailClientCreateTaskNeedFactory: 'Please select a promotion factory task in the dropdown first',
emailClientCreateTaskSuccess: 'Task created',
emailClientCreateTaskFailed: 'Failed to create task',
emailClientCreateTaskPreparingHint: 'Task created. Generating the mailing list may take a few minutes, please wait...'
}
,
autoPromotionLogs: {
detail: 'Auto Promotion Details',
factoryTaskSelectPlaceholder: 'Select promotion task',
configured: 'Configured',
editConfig: 'Edit auto promotion configuration',
startConfig: 'Start auto promotion configuration',
@@ -1100,6 +1284,8 @@ colTitle: 'Template title',
enable: 'Enable',
pause: 'Pause',
previewEditTitle: 'Preview and edit promotion email',
logDetailEditTitle: 'Edit promotion send log',
logDetailPreviewTitle: 'Preview promotion send log',
receiver: 'Receiver:',
receiverImmutablePlaceholder: 'Receiver email cannot be changed',
subject: 'Subject:',
@@ -1150,6 +1336,9 @@ colTitle: 'Template title',
deleteLogSuccess: 'Deleted',
deleteLogFailed: 'Delete failed',
noFailureReason: 'No failure reason',
logDetailEditTitle: 'Edit delivery log',
logDetailPreviewTitle: 'Preview delivery log',
logLoadFailed: 'Failed to load logs',
deletedSuccess: 'Deleted',
mockPromotionSubject: 'Promotion for {journal}',
mockPromotionContent: '<p>Dear {name},</p><p>Check out our latest journal updates...</p>'
@@ -1161,6 +1350,32 @@ colTitle: 'Template title',
previewWithVariablesHint: 'The expert data is an example, used for variable spelling check only.',
close: 'Close',
placeholder: 'Please enter email content'
},
wordCite: {
noRefs: 'Reference list is not loaded yet. Please wait or refresh the page.',
missingBoundRef: 'The bound reference no longer exists. Please cite again.',
notFoundById: 'No reference found for citation ID {id}',
selectRef: 'Select Reference',
originalOrder: 'Original order',
reference: 'Reference',
uncited: 'Uncited',
cancel: 'Cancel',
confirm: 'Confirm',
remove: 'Remove',
selected: 'Selected',
modifyRef: 'Edit citation',
removeRefTag: 'Remove citation',
citeUpdateFail: 'Could not update the citation in the text. Try again or use Edit.',
matchBracketRefs: 'Auto-link References',
matchBracketRefsDone: 'Converted {n} bracket citation(s) to autocite.',
matchBracketRefsNone: "No active citation links were detected in the text. To enable automatic numbering, please use the 'Reference' tool to link your sources.",
removeRefNeedClickCite: 'Click a citation in the text first, then choose Reference remove.',
quickPickPlaceholder: 'Enter e.g. [5, 6, 10-15] to auto-select',
quickPickApply: 'Link References',
quickPickClear: 'Clear selection',
currentCiteNo: 'Current',
locateInBody: 'Click to scroll to citation in text',
locateInRefHint: 'Highlight this entry in the list below'
}

View File

@@ -19,6 +19,13 @@ const zh = {
}, info: {
realname: '英文名字只能包含大小写英文字母、"-" 、和 空格'
},
articleAdd: {
qqEmailAlertLine1: '出版社暂不支持qq邮箱投稿。',
qqEmailAlertLine2Before: '请前往',
qqEmailDashboardLink: '个人中心Dashboard',
qqEmailAlertLine2After: '更换邮箱账号。',
qqEmailSubmitBlockedMsg: '出版社暂不支持qq邮箱投稿请去个人中心更换邮箱账号'
},
total: {
author: '作者',
editor: '编辑',
@@ -269,6 +276,7 @@ const zh = {
keywordManagement: '关键词管理',
crawlTasks: '抓取任务',
expertList: '专家列表',
countryManagement: '国家信息',
autoPromotion: '自动推广',
ReArticles: '被拒稿件', // 被拒稿件
editorialBoard: '编委管理',
@@ -296,16 +304,109 @@ const zh = {
},
columns: {
baseInfo: '基础信息',
country: '国家',
affiliation: '单位',
researchAreas: '研究领域'
researchAreas: '研究领域',
unsubscribeStatus: '订阅状态'
},
emptyMark: '-',
fields: {
nameLabel: '姓名:',
emailLabel: '邮箱:',
acquisitionTimeLabel: '采集时间:'
},
viewAllInfo: '查看全部信息',
detailDialogTitle: '领域与文章',
detailColField: '研究领域',
detailColPaper: '文章标题',
detailColJournal: '所属期刊',
detailClose: '关闭',
detailCellEmpty: '暂无',
noFieldDetail: '暂无领域对应的文献信息',
exportWarn: '请选择研究领域或输入关键词或领域 field 后再导出。',
exportFailed: '导出失败'
exportFailed: '导出失败',
unsubscribeNormal: '已订阅',
unsubscribeUnsubscribed: '已退订',
unsubscribeSwitchOn: '退订',
unsubscribeSwitchOff: '已订阅',
unsubscribeMissingId: '缺少专家 ID无法切换退订状态',
unsubscribeUpdateSuccess: '退订状态更新成功',
unsubscribeUpdateFailed: '退订状态更新失败'
},
countryManagement: {
title: '国家信息维护',
keywordPlaceholder: '中文名 / 英文名 / 代码',
partitionLabel: '分区',
partitionAll: '全部分区',
partition1: '分区 1',
partition2: '分区 2',
partition3: '分区 3',
searchBtn: '搜索',
resetBtn: '重置',
table: {
no: '序号',
zhName: '中文名称',
enName: '英文名称',
code: '代码',
partition: '分区',
actions: '操作'
},
edit: '修改',
delete: '删除',
editTitle: '编辑国家信息',
form: {
zhName: '中文名称',
enName: '英文名称',
code: '代码',
partition: '分区'
},
cancel: '取消',
save: '保存',
confirm: '确定',
deleteTitle: '删除确认',
deleteConfirm: '确定删除该国家信息?删除后不可恢复。',
saveSuccess: '保存成功',
deleteSuccess: '删除成功',
opFailed: '操作失败',
loadFailed: '加载列表失败',
missingId: '缺少国家编号,无法删除',
ruleZhName: '请输入中文名称',
ruleEnName: '请输入英文名称',
ruleCode: '请输入代码',
rulePartition: '请选择分区',
batchPartitionBtn: '批量修改分区',
batchPartitionTitle: '批量修改分区',
batchPartitionTargetLabel: '目标分区',
batchPartitionTargetRequired: '请先选择目标分区',
batchPartitionHelp:
'每行一条:国家代码(3位) 或 英文名 或 中文名。# 开头为注释。示例:\nDNK\nDenmark\n丹麦',
batchPartitionPlaceholder: '粘贴数据,例如:\nDNK\nISR',
batchPartitionPreview: '预览匹配',
batchPartitionApply: '确认写入分区',
batchPartitionEmpty: '请先填写有效数据(每行一个国家标识)',
batchPartitionLoadListFailed: '拉取全量国家列表失败',
batchPartitionPreviewEmpty: '没有可匹配的行',
batchPartitionColKey: '输入标识',
batchPartitionColCurrentPartition: '当前分区',
batchPartitionColPartition: '目标分区',
batchPartitionColMatch: '匹配结果',
batchPartitionColId: 'country_id',
batchPartitionColName: '英文名',
batchPartitionMatched: '已匹配',
batchPartitionMismatch: '分区不一致',
batchPartitionMissing: '未匹配',
batchPartitionSkipSame: '分区相同',
batchPartitionApplyConfirm: '将按当前规则仅更新分区字段,共 {n} 条。是否继续?',
batchPartitionFilterPlaceholder: '筛选:输入标识 / 英文名 / 代码 / 中文名(可用分号、逗号分隔多个关键词)',
batchPartitionSelectAllFiltered: '全选当前筛选',
batchPartitionClearSelection: '取消全选',
batchPartitionFilterCount: '当前显示 {show} / 共 {total} 条',
batchPartitionSelectionHint:
'说明:可先在下方筛选,再勾选要提交的行。「全选」只勾选当前筛选结果中、且分区有变化的行。未勾选任何行时,将提交全部「将提交更新」的行。',
batchPartitionNoSelection: '当前为「仅勾选」模式,请至少勾选一行,或点「取消全选」恢复为提交全部。',
batchPartitionDone: '批量完成:本次录入 {input} 条;更新成功 {ok} 条,失败 {fail} 条;未匹配 {miss} 条。',
batchPartitionSummaryLine:
'统计:录入 {input} 条;已匹配 {matched} 条;未匹配 {miss} 条;分区相同跳过 {same} 条;将提交更新 {will} 条。'
},
mailboxConfig: {
mailSystem: '邮件系统',
@@ -1001,6 +1102,8 @@ const zh = {
autoSolicit: '自动约稿',
editConfig: '修改配置',
running: '运行中',
stopped: '已停止',
configure: '配置',
emailTemplate: '邮件模板',
emailStyle: '邮件风格',
notStarted: '未开启自动约稿计划',
@@ -1030,21 +1133,102 @@ const zh = {
changeTemplate: '更换模版',
selectPromotionFields: '选择推广领域',
choosePromotionFields: '选择领域',
selectPromotionCountry: '选择国家',
choosePromotionCountry: '选择国家',
selectedCount: '已选 {count} 项',
selectAll: '全选',
clearAll: '取消全选',
selectPromotionFieldsTip: '可多选;未选择则不限制推广领域。',
selectPromotionCountryTip: '可多选;未选择则不限制国家。与领域接口一致,后续可对接独立国家数据。',
fieldSearchPlaceholder: '搜索推广领域',
countrySearchPlaceholder: '搜索国家',
countryQuickZone1: '1区',
countryQuickZone2: '2区',
countryQuickZone3: '3区',
countryQuickChina: 'China',
countryQuickIndia: 'India',
noFieldMatch: '没有匹配的领域',
noCountryMatch: '没有匹配的国家',
confirm: '确定',
fieldsSaved: '推广领域已保存',
countriesSaved: '推广国家已保存',
confirmAndEnable: '确认并开启',
onlySaveConfig: '仅保存配置',
enableNowNextDay: '立即激活自动推广(次日开始自动推广)'
enableNowNextDay: '立即激活自动推广(次日开始自动推广)',
factoryCreateBtn: '创建自动化推广任务',
factoryDialogTitle: '创建任务',
factoryJournal: '期刊',
factoryJournalPlaceholder: '请选择期刊',
factorySendSettings: '发送与场景',
factoryEmails: '发送邮箱',
factoryEmailsPlaceholder: '请选择发送账号(可多选)',
factorySendCount: '发送数量',
factoryType: '场景类型',
factoryTypeEditor: '编辑',
factoryTypeArticle: '推广文章',
factoryExpertType: '专家类型',
factoryExpertTypePlaceholder: '可选,按后端要求填写',
factorySubmit: '提交任务',
factorySubmitSuccess: '工厂任务已创建',
factorySubmitFailed: '创建失败,请稍后重试',
factoryNeedJournal: '请先选择期刊',
factoryNeedTemplate: '请先选择邮件模板与样式',
factoryNeedEmails: '请至少选择一个发送邮箱',
factoryNeedExpertType: '请选择目标人类型',
factoryEmailsPickJournal: '请先选择期刊以加载邮箱列表',
factoryNoAccounts: '该期刊下暂无可用邮箱账号',
factoryAccountRemaining: '今日剩余',
factorySendMaxFromApi: '接口限制:单日最多 {max} 封',
factorySendMaxFallback: '未返回接口上限,当前按邮箱额度合计约 {max} 封(或默认上限)',
factoryStepNav1Title: '期刊',
factoryStepNav1Desc: '先选期刊,未选不能提交。',
factoryStepNav2Title: '邮件模版与样式',
factoryStepNav2Desc: '选好邮件模板和样式。',
factoryStepNav3Title: '发送与场景',
factoryStepNav3Desc: '选账号,填发送数量和目标人类型。',
factoryStepNav4Title: '推广领域',
factoryStepNav4Desc: '至少选择一个推广领域。',
factoryStepNav5Title: '国家',
factoryStepNav5Desc: '至少选择一个国家或分区。',
factoryStepNav6Title: '确认并开启',
factoryStepNav6Desc: '选择仅保存或次日自动开启。',
factoryPromotionFieldsBlockTip: '请打开「选择领域」,在列表中至少勾选一项;不得留空提交。',
factoryPromotionCountryBlockTip: '请至少勾选一项分区或国家;不得留空提交。',
factoryNeedPromotionFields: '请至少选择一项推广领域后再提交。',
factoryNeedPromotionCountry: '请至少选择一项分区或国家后再提交。',
factoryQuotaLabel: '额度',
factoryClickSelectTemplate: '点击选择邮件模板',
factoryClickConfigureFields: '点击配置学科字段',
factoryBtnModify: '修改',
factoryBtnReset: '重置',
factoryBtnCancel: '取消',
factoryBtnSubmit: '立即提交任务',
factoryFillRequired: '请完善必填信息(期刊、模板、账号)',
factoryExpertChief: '主编',
factoryExpertBoard: '编委',
factoryExpertYoungBoard: '青年编委',
factoryExpertAuthor: '作者',
factoryExpertDb: 'expert库',
factoryExpertJump: '查看',
factoryOfficialEmailTip: '此类型默认使用系统官方邮箱发送,无需选择邮箱账号。',
factoryScenario: '场景',
factoryScenarioPlaceholder: '请选择场景',
factoryScenarioSolicit: '约稿',
factoryScenarioPromoteCitation: '推广引用',
factoryScenarioGeneralThanks: '常规感谢',
createdAt: '创建时间',
noFactoryTask: '没有任务',
factoryCreateNow: '立即创建',
emailClientCreateTaskBtn: '创建任务',
emailClientCreateTaskNeedFactory: '请先在下拉框中选择推广工厂任务',
emailClientCreateTaskSuccess: '创建任务成功',
emailClientCreateTaskFailed: '创建任务失败',
emailClientCreateTaskPreparingHint: '创建任务成功,生成发送邮件列表需要几分钟,请耐心等候...'
}
,
autoPromotionLogs: {
detail: '自动推广详情',
factoryTaskSelectPlaceholder: '选择推广任务',
configured: '已配置',
editConfig: '修改期刊自动推广配置',
startConfig: '立即开始期刊自动推广配置',
@@ -1085,6 +1269,8 @@ const zh = {
enable: '开启',
pause: '暂停',
previewEditTitle: '预览并修改推广邮件',
logDetailEditTitle: '编辑推广发送记录',
logDetailPreviewTitle: '预览推广发送记录',
receiver: '收件人:',
receiverImmutablePlaceholder: '收件人邮箱不可更改',
subject: '主题:',
@@ -1135,6 +1321,9 @@ const zh = {
deleteLogSuccess: '删除成功',
deleteLogFailed: '删除失败',
noFailureReason: '暂无失败原因',
logDetailEditTitle: '编辑发送记录',
logDetailPreviewTitle: '预览发送记录',
logLoadFailed: '加载日志失败',
deletedSuccess: '已删除',
mockPromotionSubject: '自动推广:{journal}',
mockPromotionContent: '<p>亲爱的 {name}</p><p>请查看我们最新的期刊更新...</p>'
@@ -1146,6 +1335,32 @@ const zh = {
previewWithVariablesHint: '专家数据仅为示例,仅用于变量拼写检查。',
close: '关闭',
placeholder: '请输入邮件内容'
},
wordCite: {
noRefs: '参考文献列表尚未加载,请稍候再试或刷新页面',
missingBoundRef: '当前绑定的参考文献不存在,请重新引用',
notFoundById: '未查询到编号{id}相关参考文献',
selectRef: '选择参考文献',
originalOrder: '原排序',
reference: '参考文献',
uncited: '未引用',
cancel: '取消',
confirm: '确认',
remove: '移除',
selected: '已选择',
modifyRef: '修改引用',
removeRefTag: '移除引用',
citeUpdateFail: '未能更新正文中的引用标签,请重试或进入编辑修改',
matchBracketRefs: '自动链接参考文献',
matchBracketRefsDone: '已转换 {n} 处 [n] 为可点击角标',
matchBracketRefsNone: '正文中未检测到可转换的纯文本引用 [n]。若要自动编号并关联参考文献请使用工具栏中的「Reference」插入引用。',
removeRefNeedClickCite: '请先在正文中点击要删除的引用角标,再点「移除参考文献」。',
quickPickPlaceholder: '输入如 [5, 6, 10-15] 自动勾选对应参考文献',
quickPickApply: '链接参考文献',
quickPickClear: '清空勾选',
currentCiteNo: '当前序号',
locateInBody: '点击定位正文角标',
locateInRefHint: '在下方列表中高亮该条'
}

View File

@@ -136,16 +136,7 @@
<!-- <div v-else style="padding: 20px; box-sizing: border-box"></div> -->
</div>
</div>
<div class="content_box mt20 stepbox">
<!-- 文章引用 -->
<div class="con">
<h4 class="con-title">{{ this.$t('PreAccept.step2') }}</h4>
<p style="color: #505050; font-size: 14px; padding: 20px; box-sizing: border-box">
<el-button @click="goGenerateCharts(thisArtcleId)" icon="el-icon-edit" type="text">Edit</el-button>
</p>
<!-- <div v-else style="padding: 20px; box-sizing: border-box"></div> -->
</div>
</div>
<div class="content_box mt20 stepbox">
<!-- 文章引用 -->
<div class="con">
@@ -170,7 +161,16 @@
<!-- <div v-else style="padding: 20px; box-sizing: border-box"></div> -->
</div>
</div>
<div class="content_box mt20 stepbox">
<!-- 文章引用 -->
<div class="con">
<h4 class="con-title">{{ this.$t('PreAccept.step2') }}</h4>
<p style="color: #505050; font-size: 14px; padding: 20px; box-sizing: border-box">
<el-button @click="goGenerateCharts(thisArtcleId)" icon="el-icon-edit" type="text">Edit</el-button>
</p>
<!-- <div v-else style="padding: 20px; box-sizing: border-box"></div> -->
</div>
</div>
<!-- 答疑 -->
<div class="mt20 helpcontent">
<div class="flexbox">

View File

@@ -859,8 +859,8 @@
<el-form-item label="Account :" prop="account">
<span>{{ coreForm.account }}</span>
</el-form-item>
<el-form-item label="Email :">
<span>{{ coreForm.email }}</span>
<el-form-item label="Email :" prop="email">
<el-input type="text" placeholder="Please enter email..." v-model="coreForm.email" style="width: 320px" clearable />
</el-form-item>
<el-form-item label="Real name :" prop="realname">
@@ -1610,6 +1610,14 @@ this.applyCvitaTable = data;
.then((res) => {
if (res.code == 0) {
this.coreTable = res.data.baseInfo;
try {
if (this.coreTable && this.coreTable.email != null && this.coreTable.email !== undefined) {
localStorage.setItem('U_email', String(this.coreTable.email));
}
if (this.coreTable && this.coreTable.realname != null && this.coreTable.realname !== undefined) {
localStorage.setItem('U_relname', String(this.coreTable.realname));
}
} catch (e) {}
this.majorsList=res.data.baseInfo.majors;
this.cvitaForm.user_id = res.data.baseInfo.user_id;
this.reviewForm.user_id = res.data.baseInfo.user_id;
@@ -1901,6 +1909,14 @@ this.applyCvitaTable = data;
.then((res) => {
if (res.code == 0) {
this.$message.success('Personal information modified successfully!');
try {
if (this.coreForm.email != null && this.coreForm.email !== undefined) {
localStorage.setItem('U_email', String(this.coreForm.email));
}
if (this.coreForm.realname != null && this.coreForm.realname !== undefined) {
localStorage.setItem('U_relname', String(this.coreForm.realname));
}
} catch (e) {}
this.coreVisible = false;
this.tipVisible = false;
this.getPersonData();

File diff suppressed because it is too large Load Diff

View File

@@ -263,7 +263,39 @@
<i v-else class="el-icon-plus avatar-uploader-icon" style="line-height: 120px"></i>
</el-upload>
</div>
</el-form-item>
<el-form-item label="Contact Editor WeChat QR Code :" prop="wechat_yboard_qrcode">
<div class="wechat-name-split__right">
<div class="yboard-qrcode-side__label"></div>
<div class="portrait WeChatCode">
<el-upload
class="avatar-uploader"
ref="upIconIMgYboard"
:action="baseUrl + 'api/Journal/uploadYboardQrcode'"
:show-file-list="false"
name="qrcode_url"
:on-success="handleAvatarSuccessYboard"
:on-error="handleAvatarErrorYboard"
:before-upload="beforeAvatarUpload2"
>
<img
v-if="detailForm.wechat_yboard_qrcode"
:src="
/^https?:\/\//.test(detailForm.wechat_yboard_qrcode)
? detailForm.wechat_yboard_qrcode
: mediaUrl + 'journalyboardqrcode/' + detailForm.wechat_yboard_qrcode
"
class="avatar"
accept=".png,.jpg"
/>
<i v-else class="el-icon-plus avatar-uploader-icon" style="line-height: 120px"></i>
</el-upload>
</div>
</div>
</el-form-item>
<el-form-item label="Journal Topic :" prop="ResearchAreas">
<el-button @click="addArea" size="mini" type="primary" plain style="position: absolute; right: 0; margin-left: 10px"
>+ Add</el-button
@@ -283,8 +315,13 @@
</div>
</div>
</el-form-item>
<el-form-item label="Wechat Name :" prop="wechat_name">
<el-input v-model="detailForm.wechat_name" placeholder="eg:公众号名称"></el-input>
<el-form-item label="Wechat Name :" prop="wechat_name" class="wechat-name-split">
<div class="wechat-name-split__inner">
<div class="wechat-name-split__left">
<el-input v-model="detailForm.wechat_name" placeholder="eg:公众号名称"></el-input>
</div>
</div>
</el-form-item>
<el-form-item label="Wechat APP ID :" prop="wechat_app_id">
<el-input v-model="detailForm.wechat_app_id" placeholder="eg:公众号app_id"></el-input>
@@ -657,6 +694,17 @@ export default {
this.$message.error(res.msg);
}
},
async handleAvatarSuccessYboard(res, file) {
if (res.code == 0) {
this.detailForm.wechat_yboard_qrcode = res.upurl;
this.$forceUpdate();
} else {
this.$message.error(res.msg);
}
},
handleAvatarErrorYboard(res, file) {
// no-op
},
handleAvatarError2(res, file) {
// this.$message.error(res);
},
@@ -883,7 +931,9 @@ export default {
epassword: data.epassword,
kfen: data.kfen,
fee: data.fee,
databases: data.databases || data.database_inclusion || '',
editor_qrcode: data.editor_qrcode,
wechat_yboard_qrcode: data.wechat_yboard_qrcode || data.yboard_qrcode,
scope: data.scope,
abstract_chinese: data.abstract_chinese,
publish_author: data.publish_author,
@@ -1369,6 +1419,29 @@ export default {
border-radius: 110px;
}
/* Wechat Name + Apply Youth Board QR两列对齐到右侧 */
.wechat-name-split__inner {
display: flex;
align-items: flex-start;
gap: 16px;
}
.wechat-name-split__left {
flex: 1;
min-width: 200px;
}
.wechat-name-split__right {
width: 160px;
}
.yboard-qrcode-side__label {
font-size: 12px;
color: #666;
text-align: center;
margin-bottom: 8px;
}
.portrait .ptmark {
position: absolute;
top: 0;

View File

@@ -215,6 +215,8 @@
localStorage.setItem('U_role', 'superadmin');
localStorage.setItem('U_name', res.userinfo.account);
localStorage.setItem('U_id', res.userinfo.user_id);
localStorage.setItem('U_email', '');
this.$router.push('/');
} else if (res.data.roles.includes('editor')) {
@@ -222,6 +224,7 @@
localStorage.setItem('U_role', res.data.roles);
localStorage.setItem('U_name', res.data.userinfo.account);
localStorage.setItem('U_id', res.data.userinfo.user_id);
localStorage.setItem('U_email', res.data.userinfo.email);
this.$router.push('/');
} else {
localStorage.setItem('U_status', '2'); //其余的身份
@@ -229,6 +232,7 @@
localStorage.setItem('U_name', res.data.userinfo.account);
localStorage.setItem('U_id', res.data.userinfo.user_id);
localStorage.setItem('U_relname', res.data.userinfo.realname);
localStorage.setItem('U_email', res.data.userinfo.email);
this.$router.push('/');
// this.roleVisible = true;
// this.user_cap = res.data.roles;

View File

@@ -332,11 +332,11 @@ export default {
// refName: 'setFiveRef',
// rongCont: 'Modify the article body.'
// },
{
name: 'Text Proofread',
refName: 'setThreeRef',
rongCont: 'HTML layout.'
}
// {
// name: 'Text Proofread',
// refName: 'setThreeRef',
// rongCont: 'HTML layout.'
// }
// {
// name: 'Create Build',
// refName: 'setSevenRef',
@@ -1337,7 +1337,7 @@ export default {
// 5----重新获取加载参考文献
changeRefer(val) {
console.log('重新获取参考文献');
this.$api
.post('api/Production/getReferList', {
p_article_id: this.p_article_id
@@ -1348,7 +1348,7 @@ export default {
for (var i = 0; i < this.chanFerForm.length; i++) {
this.chanFerForm[i].edit_mark = 1;
}
console.log(this.chanFerForm);
})
.catch((err) => {
console.log(err);

View File

@@ -1433,7 +1433,7 @@ export default {
// 5----重新获取加载参考文献
changeRefer(val) {
console.log('重新获取参考文献');
this.$api
.post('api/Production/getReferList', {
p_article_id: this.p_article_id
@@ -1444,7 +1444,7 @@ export default {
for (var i = 0; i < this.chanFerForm.length; i++) {
this.chanFerForm[i].edit_mark = 1;
}
console.log(this.chanFerForm);
})
.catch((err) => {
console.log(err);

View File

@@ -0,0 +1,238 @@
<template>
<div class="submission-page">
<div class="container">
<div class="success-icon"></div>
<h2 class="success-title">Application submitted successfully!</h2>
<p class="success-desc" v-if="isFromChina">
We have a WeChat group for academic discussions. Please feel free to scan the QR code below to join.
</p>
<p class="success-desc" v-else>
Your application is currently under review. We appreciate your patience, and our team will notify you of the final decision via email as soon as possible.
</p>
<div v-if="isFromChina" class="qr-section">
<div v-if="qrLoading" class="qr-loading">Loading...</div>
<div v-else class="qr-code-box" v-if="qrCodeUrl">
<img :src="qrCodeUrl" alt="WeChat Group QR" />
</div>
<!-- <p class="remark-tip">Please use the following format for group remark:</p>
<div class="remark-box">Name - Research Field - Affiliation</div> -->
</div>
<router-link to="/login" replace class="back-btn"> Login to the Submission System Now </router-link>
</div>
</div>
</template>
<script>
export default {
name: 'YouthBoardSubmitSuccess',
data() {
return {
qrCodeUrl: '',
qrLoading: false
};
},
computed: {
isFromChina() {
const s = String(this.$route.query.country || '').trim();
if (!s) return false;
// 兼容1 / China / 中国 / CN / CHN
if (s === '1') return true;
if (s === 'China' || s === 'CN' || s === 'CHN') return true;
if (s === '中国') return true;
if (s === 'US' || s === 'United States' || s === '美国') return false;
return s === 'China';
}
},
mounted() {
if (this.isFromChina) this.loadApplyBaseInfo();
},
methods: {
normalizeCountry(v) {
const s = String(v || '').trim();
if (!s) return '';
if (s === '中国' || s === 'CN' || s === 'CHN') return 'China';
if (s === '美国' || s === 'USA' || s === 'US') return 'United States';
if (s === '英国' || s === 'UK' || s === 'GBR') return 'United Kingdom';
return s;
},
buildMediaUrl(raw) {
if (!raw) return '';
if (/^https?:\/\//i.test(raw)) return raw;
const mediaBase = (this.Common && this.Common.mediaUrl ? this.Common.mediaUrl : '').replace(/\/+$/, '');
if (!mediaBase) return raw;
const cleanPath = String(raw).replace(/^\/+/, '');
// 与后台上传目录保持一致JournalManagement/common.vue
return `${mediaBase}/journalyboardqrcode/${cleanPath}`;
},
loadApplyBaseInfo() {
const journal_id = this.$route.query.journal_id || this.$route.query.journalId;
const expert_id = this.$route.query.expert_id || this.$route.query.expertId;
if (!journal_id || !expert_id) {
return;
}
this.qrLoading = true;
this.$api
.post('api/Ucenter/getApplyYboardForExpertBaseInfo', {
journal_id,
expert_id
})
.then((res) => {
const data = (res && res.data) || {};
const journal = data.journal || data.journal_info || data.journalInfo || null;
const raw =
(journal && (journal.wechat_yboard_qrcode || journal.yboard_qrcode || journal.qrcode_url)) || '';
this.qrCodeUrl = this.buildMediaUrl(raw);
})
.catch(() => {
this.qrCodeUrl = '';
})
.finally(() => {
this.qrLoading = false;
});
}
}
};
</script>
<style scoped>
.submission-page {
--primary-blue: #3a91d9;
--text-main: #2c3e50;
--bg-light: #f7f9fc;
--success-green: #48bb78;
--danger: #e53e3e;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background-color: var(--bg-light);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
margin: 0;
box-sizing: border-box;
}
.container {
background: #ffffff;
width: 100%;
max-width: 520px;
height: fit-content;
padding: 60px 40px;
border-radius: 24px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
text-align: center;
}
.success-icon {
font-size: 60px;
color: var(--success-green);
margin-bottom: 20px;
}
.success-title {
font-size: 24px;
color: var(--text-main);
font-weight: 700;
margin-bottom: 15px;
}
.success-desc {
font-size: 16px;
color: #718096;
margin-bottom: 40px;
line-height: 1.6;
}
.qr-section {
background-color: #f0f7ff;
border: 1px solid #c3dafe;
border-radius: 16px;
padding: 30px;
margin-top: 20px;
}
.qr-header {
color: #2b6cb0;
font-weight: bold;
font-size: 16px;
}
.qr-code-box {
width: 200px;
height: 200px;
background: #fff;
margin: 15px auto;
border: 1px solid #eee;
padding: 8px;
display: flex;
align-items: center;
justify-content: center;
}
.qr-code-box img {
width: 100%;
height: 100%;
object-fit: contain;
}
.remark-tip {
font-size: 14px;
color: #4a5568;
margin-top: 10px;
}
.remark-box {
background: #fff;
border: 1px solid #feb2b2;
color: var(--danger);
font-weight: bold;
padding: 10px 15px;
border-radius: 8px;
display: inline-block;
margin-top: 5px;
font-size: 14px;
}
.back-btn {
display: inline-block;
margin-top: 40px;
color: #006699;
text-decoration: none;
font-size: 14px;
transition: color 0.2s;
}
.back-btn:hover {
color: var(--primary-blue);
}
.loading-container {
display: flex;
align-items: center;
justify-content: center;
min-height: 220px;
}
.loading-text {
color: #718096;
font-size: 14px;
}
.qr-loading {
width: 200px;
height: 200px;
background: #fff;
margin: 15px auto;
border: 1px solid #eee;
border-radius: 2px;
display: flex;
align-items: center;
justify-content: center;
color: #718096;
font-size: 14px;
}
</style>

View File

@@ -0,0 +1,612 @@
<template>
<div class="registration-container">
<div class="card">
<h1>Youth Editorial Board Registration</h1>
<div v-if="journalInfoLoaded" class="journal-hero">
<div class="journal-cover-wrap" v-if="journalCoverUrl">
<img :src="journalCoverUrl" :alt="journalTitle || 'Journal Cover'" class="journal-cover" />
</div>
<div class="journal-title">{{ journalTitle || 'Journal Information' }}</div>
</div>
<!-- <p v-if="journalId && expertId" class="link-meta">
Journal ID: <strong>{{ journalId }}</strong> · Expert ID: <strong>{{ expertId }}</strong>
</p> -->
<!-- <p v-else class="link-meta link-meta--warn">
Missing <code>journal_id</code> and/or <code>expert_id</code> in the URL. Please use the full invitation link.
</p> -->
<div v-if="submitSuccess" class="success-panel">
<h2>Thank you</h2>
<p>Your registration has been submitted. We will contact you by email.</p>
</div>
<form v-else @submit.prevent="handleSubmit" autocomplete="off">
<div class="form-group">
<label><span class="required-star">*</span> English Name</label>
<input
type="text"
v-model="formData.engName"
placeholder=""
autocomplete="off"
/>
</div>
<div class="form-group">
<label><span class="required-star">*</span> Email (QQ mail is not allowed)</label>
<input type="email" v-model="formData.email" placeholder="" autocomplete="off" />
</div>
<div class="form-group">
<label><span class="required-star">*</span> Password</label>
<input
type="text"
v-model="formData.password"
placeholder=""
autocomplete="off"
/>
</div>
<div class="form-group">
<label><span class="required-star">*</span> Upload CV</label>
<div v-if="!selectedFile" class="upload-trigger" @click="$refs.fileInput.click()">
<div class="icon">📤</div>
<div class="hint">Click to upload PDF CV</div>
<input type="file" ref="fileInput" hidden accept=".pdf" @change="onFileChange" />
</div>
<div v-else class="file-display-box">
<span class="file-icon">📄</span>
<span class="file-name">{{ selectedFile.name }}</span>
<span class="remove-btn" @click.prevent="removeFile">×</span>
</div>
</div>
<!-- <transition name="fade">
<div v-if="formData.country === 'China'" class="qr-area">
<div class="qr-title">Mandatory for Youth Scientists in China</div>
<div v-if="wechatQrUrl" class="qr-box">
<img :src="wechatQrUrl" alt="Group QR Code" @error="onQrImgError" />
</div>
<p v-else class="qr-fallback">Please add image file <code>public/youth-board-wechat-qr.png</code> for the group QR code.</p>
<p class="qr-hint">Please use the following format for the group remark:</p>
<div class="format-tag">Name - Research Field - Affiliation</div>
</div>
</transition> -->
<button type="submit" class="submit-btn" :disabled="submitting">
{{ submitting ? 'Submitting...' : 'Register Now' }}
</button>
</form>
</div>
</div>
</template>
<script>
import axios from 'axios';
/** 公开邀请注册:后端实现 multipart 接口后填写此路径(与 Dashboard 青年编委申请字段对齐可再改) */
const SUBMIT_URL = '/api/User/youthBoardInviteRegister';
export default {
name: 'YouthEditorialBoardRegistration',
data() {
return {
baseUrl: this.Common.baseUrl,
formData: {
engName: '',
email: '',
country: '',
password: ''
},
countryList: [],
selectedFile: null,
submitting: false,
submitSuccess: false,
wechatQrUrl: '',
journalInfoLoaded: false,
journalDetail: null,
uploadedCvPath: ''
};
},
computed: {
journalId() {
const q = this.$route.query || {};
return String(q.journal_id || q.journalId || '').trim();
},
expertId() {
const q = this.$route.query || {};
return String(q.expert_id || q.expertId || '').trim();
},
journalTitle() {
const j = this.journalDetail || {};
return j.full_name || j.journal_name || j.title || j.abbr || '';
},
journalCoverUrl() {
const j = this.journalDetail || {};
const raw =
j.journal_icon ||
j.cover ||
j.img ||
j.image ||
j.icon ||
j.logo ||
j.thumb ||
j.picture ||
j.photo ||
j.journal_cover ||
j.journal_img ||
'';
if (!raw) return '';
if (/^https?:\/\//i.test(raw)) return raw;
const mediaBase = (this.Common.mediaUrl || '').replace(/\/+$/, '');
const cleanPath = String(raw).replace(/^\/+/, '');
if (!mediaBase) return `/${cleanPath}`;
if (/^journal\//i.test(cleanPath) || /^reviewer\//i.test(cleanPath)) {
return `${mediaBase}/${cleanPath}`;
}
return `${mediaBase}/journal/${cleanPath}`;
}
},
mounted() {
const base = process.env.BASE_URL || '/';
const prefix = base.endsWith('/') ? base : `${base}/`;
this.wechatQrUrl = `${prefix}youth-board-wechat-qr.png`;
this.fetchCountries();
this.fetchApplyBaseInfo();
},
methods: {
countryOptionKey(item) {
return item.name || item.id || item.country || JSON.stringify(item);
},
countryOptionValue(item) {
return item.name != null ? item.name : item.country || item.title || '';
},
countryOptionLabel(item) {
return item.name != null ? item.name : item.country || item.title || '';
},
fetchCountries() {
// this.$api
// .post('api/Reviewer/getCountrys')
// .then((res) => {
// const list = res.countrys || res.data || [];
// this.countryList = Array.isArray(list) ? list : [];
// })
// .catch(() => {
// this.countryList = [{ name: 'China' }, { name: 'United States' }, { name: 'United Kingdom' }];
// });
},
fetchApplyBaseInfo() {
if (!this.journalId || !this.expertId) return;
this.$api
.post('api/Ucenter/getApplyYboardForExpertBaseInfo', {
journal_id: this.journalId,
expert_id: this.expertId
})
.then((res) => {
const data = (res && res.data) || {};
const expertCandidate =
data.expert_info ||{}
const journal =
data.journal ||
data.journal_info ||
data.journalInfo ||
data.journal_detail ||
data.journalDetail ||
null;
// 为了兼容后端返回字段名,这里做多字段兜底取值
const pickFirst = (obj, keys) => {
for (let i = 0; i < keys.length; i++) {
const k = keys[i];
if (obj && obj[k] !== undefined && obj[k] !== null && String(obj[k]).trim() !== '') {
return obj[k];
}
}
return '';
};
const pickFromCandidateOrData = (keys) => {
const v1 = pickFirst(expertCandidate, keys);
if (v1) return v1;
return pickFirst(data, keys);
};
const normalizeCountry = (v) => {
const s = String(v || '').trim();
if (!s) return '';
// 常见中文/英文归一化(确保和下拉 options.value 匹配)
if (s === '中国' || s === 'CN' || s === 'CHN') return 'China';
if (s === '美国' || s === 'USA' || s === 'US') return 'United States';
if (s === '英国' || s === 'UK' || s === 'GBR') return 'United Kingdom';
return s;
};
this.formData.engName = pickFromCandidateOrData([
'eng_name',
'english_name',
'u_eng_name',
'U_eng_name',
'U_engName',
'U_name_en',
'realname',
'u_relname',
'U_relname',
'name',
'U_name'
]);
this.formData.email = pickFromCandidateOrData([
'email',
'u_email',
'U_email',
'U_email_address',
'user_email',
'username',
'U_username'
]);
this.formData.country = normalizeCountry(
pickFromCandidateOrData([
'country',
'country_name',
'u_country',
'U_country',
'countryName',
'U_country_name'
])
);
if (journal) {
this.journalDetail = journal;
this.journalInfoLoaded = true;
}
if (!journal) {
this.journalDetail = null;
this.journalInfoLoaded = true;
}
})
.catch(() => {
this.journalDetail = null;
this.journalInfoLoaded = true;
});
},
async onFileChange(e) {
const file = e.target.files && e.target.files[0];
if (file && file.type === 'application/pdf') {
this.selectedFile = file;
const fd = new FormData();
fd.append('reviewerCV', file);
try {
const resp = await axios.post(`${this.baseUrl}api/Ucenter/up_cv_file`, fd, {
headers: { 'Content-Type': 'multipart/form-data' }
});
const body = resp && resp.data ? resp.data : {};
if (Number(body.code) === 0 && body.upurl) {
this.uploadedCvPath = body.upurl;
} else {
this.selectedFile = null;
this.uploadedCvPath = '';
this.alertError((body && body.msg) || 'CV upload failed.');
}
} catch (err) {
this.selectedFile = null;
this.uploadedCvPath = '';
this.alertError('CV upload failed. Please try again.');
}
} else if (file) {
this.alertError('Please upload a valid PDF file.');
}
},
removeFile() {
this.selectedFile = null;
this.uploadedCvPath = '';
if (this.$refs.fileInput) this.$refs.fileInput.value = '';
},
onQrImgError() {
this.wechatQrUrl = '';
},
alertError(msg) {
this.$message.error(msg);
},
async handleSubmit() {
if (!this.journalId || !this.expertId) {
this.alertError('Invalid link: journal_id and expert_id are required in the URL.');
return;
}
const engName = (this.formData.engName || '').trim();
if (!engName) {
this.alertError('Please enter your English name.');
return;
}
const emailRaw = (this.formData.email || '').trim();
if (!emailRaw) {
this.alertError('Please enter your email address.');
return;
}
const email = emailRaw.toLowerCase();
if (!/^[-._A-Za-z0-9]+@[A-Za-z0-9_-]+(\.[A-Za-z0-9_-]+)+$/.test(email)) {
this.alertError('Please enter a valid email address.');
return;
}
if (email.endsWith('@qq.com')) {
this.alertError('Registration failed: QQ email addresses are not accepted.');
return;
}
if (!this.formData.password) {
this.alertError('Please enter your password.');
return;
}
if (!this.selectedFile) {
this.alertError('Please upload your CV.');
return;
}
if (!this.uploadedCvPath) {
this.alertError('CV upload is not complete. Please upload again.');
return;
}
this.submitting = true;
this.$api
.post('api/Ucenter/submitApplyYboardForExpert', {
journal_id: this.journalId,
expert_id: this.expertId,
name: engName,
email: emailRaw,
cv: this.uploadedCvPath,
password: this.formData.password
})
.then((res) => {
if (res && res.code == 0) {
this.$router.replace({
path: '/youthBoardSubmitSuccess',
query: {
country: this.formData.country == 'China' ? '1' : '0',
journal_id: this.journalId,
expert_id: this.expertId
}
});
} else {
this.alertError((res && res.msg) || 'Submission failed.');
}
})
.catch((err) => {
this.alertError((err && err.msg) || 'Submission failed.');
})
.finally(() => {
this.submitting = false;
});
}
}
};
</script>
<style scoped>
.registration-container {
--primary: #3a91d9;
--text: #2c3e50;
--border: #e2e8f0;
--danger: #e53e3e;
--bg: #f7f9fc;
min-height: 100vh;
background-color: var(--bg);
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
font-family: sans-serif;
}
.card {
background: #ffffff;
width: 100%;
max-width: 520px;
padding: 40px;
border-radius: 24px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
}
.journal-hero {
text-align: center;
margin: 6px 0 18px;
}
.journal-cover-wrap {
display: inline-flex;
align-items: center;
justify-content: center;
width: 112px;
height: 150px;
border-radius: 6px;
overflow: hidden;
background: transparent;
}
.journal-cover {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 4px;
}
.journal-title {
margin-top: 10px;
color: #1d4f8c;
font-size: 16px;
line-height: 1.4;
font-weight: 700;
word-break: break-word;
}
h1 {
text-align: center;
color: var(--text);
font-size: 24px;
margin-bottom: 16px;
}
.link-meta {
font-size: 13px;
color: #4a5568;
text-align: center;
margin-bottom: 24px;
line-height: 1.5;
}
.link-meta--warn {
color: #c05621;
}
.success-panel {
text-align: center;
padding: 24px 0;
color: var(--text);
}
.success-panel h2 {
font-size: 20px;
margin-bottom: 12px;
}
.form-group {
margin-bottom: 20px;
}
label {
display: block;
font-size: 14px;
font-weight: 600;
color: #4a5568;
margin-bottom: 8px;
}
.required-star {
color: #e53e3e;
}
input,
select {
width: 100%;
padding: 12px 16px;
border: 1px solid var(--border);
border-radius: 12px;
font-size: 14px;
box-sizing: border-box;
}
.upload-trigger {
border: 1px dashed #cbd5e0;
border-radius: 12px;
padding: 30px;
text-align: center;
cursor: pointer;
background: #fff;
}
.upload-trigger:hover {
background: #f8fafc;
}
.upload-trigger .icon {
font-size: 28px;
}
.upload-trigger .hint {
font-size: 14px;
color: #718096;
margin-top: 5px;
}
.file-display-box {
display: flex;
align-items: center;
padding: 12px 16px;
border: 1px solid var(--border);
border-radius: 12px;
}
.file-name {
flex: 1;
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.remove-btn {
color: var(--danger);
cursor: pointer;
font-size: 20px;
margin-left: 10px;
}
.qr-area {
background-color: #f0f7ff;
border: 1px solid #dbeafe;
border-radius: 16px;
padding: 25px;
margin: 20px 0;
text-align: center;
}
.qr-title {
color: #2b6cb0;
font-weight: bold;
font-size: 15px;
margin-bottom: 15px;
}
.qr-box {
width: 180px;
height: 180px;
background: #fff;
margin: 0 auto 15px;
padding: 8px;
border-radius: 8px;
}
.qr-box img {
width: 100%;
height: 100%;
object-fit: contain;
}
.qr-fallback {
font-size: 13px;
color: #718096;
margin-bottom: 12px;
}
.qr-hint {
font-size: 13px;
color: #4a5568;
margin-bottom: 10px;
}
.format-tag {
display: inline-block;
padding: 8px 16px;
border: 1px solid #feb2b2;
border-radius: 8px;
color: var(--danger);
font-weight: bold;
background: #fff;
}
.submit-btn {
width: 100%;
padding: 16px;
background: linear-gradient(135deg, #4da1e6 0%, #3588d1 100%);
color: white;
border: none;
border-radius: 12px;
font-size: 16px;
font-weight: bold;
cursor: pointer;
}
.submit-btn:disabled {
opacity: 0.7;
cursor: not-allowed;
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
</style>

View File

@@ -810,9 +810,37 @@
>
</div>
<el-alert
v-if="articleAddQqEmailSubmitBlocked"
type="warning"
:closable="false"
show-icon
style="max-width: 720px; margin: 24px auto 0"
>
<template slot="title">
<div class="qq-email-alert-body">
<div class="qq-email-alert-line1">{{ $t('articleAdd.qqEmailAlertLine1') }}</div>
<div class="qq-email-alert-line2">
<span>{{ $t('articleAdd.qqEmailAlertLine2Before') }}</span>
<router-link to="/dashboard" class="qq-email-dashboard-link">
<i class="el-icon-user-solid"></i>
{{ $t('articleAdd.qqEmailDashboardLink') }}
</router-link>
<span>{{ $t('articleAdd.qqEmailAlertLine2After') }}</span>
</div>
</div>
</template>
</el-alert>
<div style="text-align: center; margin: 40px 0 0 0">
<el-button type="warning" @click="onStagingSave(4)" class="pro_stage">Save as draft </el-button>
<el-button type="primary" @click="onSubmit(1)" class="pro_ceed">Confirm Submit </el-button>
<el-button
type="primary"
@click="onSubmit(1)"
class="pro_ceed"
:disabled="articleAddQqEmailSubmitBlocked"
>
Confirm Submit
</el-button>
</div>
</div>
</div>
@@ -1612,6 +1640,17 @@ export default {
},
upload_qualifications: function () {
return this.baseUrl + 'api/Admin/up_file';
},
/** 投稿页第四步:登录邮箱为 QQ 邮箱时不允许正式提交 */
articleAddQqEmailSubmitBlocked() {
try {
const raw = localStorage.getItem('U_email') || '';
const email = String(raw).trim().toLowerCase();
if (!email || !email.includes('@')) return false;
return /@qq\.com$/i.test(email) || /@vip\.qq\.com$/i.test(email);
} catch (e) {
return false;
}
}
},
methods: {
@@ -1907,6 +1946,10 @@ export default {
}
},
async onSubmit() {
if (this.articleAddQqEmailSubmitBlocked) {
this.$message.warning(this.$t('articleAdd.qqEmailSubmitBlockedMsg'));
return false;
}
// 1. 校验协议勾选
if (!this.agreechecked) {
this.$message.error(
@@ -4063,6 +4106,28 @@ export default {
</script>
<style scoped>
.qq-email-alert-body {
line-height: 1.55;
}
.qq-email-alert-line1 {
display: block;
margin-bottom: 6px;
}
.qq-email-alert-line2 {
display: block;
}
.qq-email-dashboard-link {
display: inline-flex;
align-items: center;
gap: 4px;
margin: 0 4px;
font-weight: 600;
color: #cf9236;
text-decoration: underline;
}
.qq-email-dashboard-link:hover {
color: #b8822f;
}
/deep/.apc_content a{
color: rgb(81, 127, 213) !important; cursor: pointer !important; text-decoration: underline !important;
}

File diff suppressed because it is too large Load Diff

View File

@@ -16,20 +16,59 @@
<div class="left">
<span class="label">{{ $t('autoPromotion.journal') }} : </span>
{{ currentJournalName }}
<el-select
v-if="config.initialized && selectedJournalId"
v-model="headerPromotionFactoryId"
class="header-factory-task-select"
size="small"
filterable
:loading="factoryTasksHeaderLoading"
:placeholder="$t('autoPromotionLogs.factoryTaskSelectPlaceholder')"
@change="onHeaderFactoryTaskChange"
>
<el-option
v-for="opt in factoryTaskOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-select>
<el-tag
v-if="config.initialized && selectedJournalId && headerFactoryTaskRunning !== null"
:type="headerFactoryTaskRunning ? 'success' : 'info'"
size="small"
effect="plain"
class="header-factory-status-tag"
>
<i v-if="headerFactoryTaskRunning" class="el-icon-circle-check"></i>
<span v-else class="header-factory-status-dot"></span>
{{ headerFactoryTaskRunning ? $t('autoPromotion.running') : $t('autoPromotion.stopped') }}
</el-tag>
<template v-if="config.initialized">
<el-tag type="success" size="small" effect="plain" style="margin-left: 10px">
<!-- <template v-if="config.initialized"> -->
<!-- <el-tag type="success" size="small" effect="plain" style="margin-left: 10px">
<i class="el-icon-circle-check"></i> {{ $t('autoPromotionLogs.configured') }}
</el-tag>
<el-button type="text" size="small" style="margin-left: 10px" @click="openWizardDialog">
</el-tag> -->
<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') }}
</el-button>
</template>
<!-- </template> -->
<el-tag v-else type="info" size="small" effect="plain" style="margin-left: 10px">
<!-- <el-tag v-else type="info" size="small" effect="plain" style="margin-left: 10px">
<i class="el-icon-info"></i> {{ $t('autoPromotionLogs.notConfigured') }}
</el-tag>
</el-tag> -->
</div>
<div v-if="config.initialized && selectedJournalId && headerPromotionFactoryId" class="right">
<el-button
type="primary"
size="small"
icon="el-icon-plus"
:loading="createTaskLoading"
@click="handleCreateEmailClientTask"
>
{{ $t('autoPromotion.emailClientCreateTaskBtn') }}
</el-button>
</div>
</div>
</el-card>
@@ -41,7 +80,9 @@
:config="config"
:wizardStartDate.sync="wizardStartDate"
:selectedFieldIds.sync="selectedFieldIds"
:selectedCountryIds.sync="selectedCountryIds"
:availableFields="availableFields"
:availableCountries="availableCountries"
:fieldsLoading="fieldsLoading"
:fieldsSaving="fieldsSaving"
:currentJournalName="currentJournalName"
@@ -52,6 +93,7 @@
:title="$t('autoPromotion.title')"
@open-template-selector="showTemplateDialog = true"
@confirm-fields="savePromotionFieldsNow"
@confirm-countries="savePromotionCountriesNow"
@confirm="completeInitialization"
/>
</el-card>
@@ -61,22 +103,24 @@
<div class="filter-header-row">
<div class="tmr-capsule-group">
<el-tabs v-model="query.state" type="card" @tab-click="handleTabClick">
<el-tab-pane :label="$t('autoPromotionLogs.statusAll')" name="all"></el-tab-pane>
<el-tab-pane :label="$t('autoPromotionLogs.state0')" name="0"></el-tab-pane>
<el-tab-pane :label="$t('autoPromotionLogs.state5')" name="5"></el-tab-pane>
<el-tab-pane :label="$t('autoPromotionLogs.state1')" name="1"></el-tab-pane>
<el-tab-pane :label="$t('autoPromotionLogs.state3')" name="3"></el-tab-pane>
<el-tab-pane :label="$t('autoPromotionLogs.state2')" name="2"></el-tab-pane>
<el-tab-pane :label="$t('autoPromotionLogs.state4')" name="4"></el-tab-pane>
</el-tabs>
</div>
<div class="tmr-capsule-group">
<el-tabs v-model="query.state" type="card" @tab-click="handleTabClick">
<el-tab-pane :label="$t('autoPromotionLogs.statusAll')" name="all"></el-tab-pane>
<el-tab-pane :label="$t('autoPromotionLogs.state0')" name="0"></el-tab-pane>
<el-tab-pane :label="$t('autoPromotionLogs.state5')" name="5"></el-tab-pane>
<el-tab-pane :label="$t('autoPromotionLogs.state1')" name="1"></el-tab-pane>
<el-tab-pane :label="$t('autoPromotionLogs.state3')" name="3"></el-tab-pane>
<el-tab-pane :label="$t('autoPromotionLogs.state2')" name="2"></el-tab-pane>
<el-tab-pane :label="$t('autoPromotionLogs.state4')" name="4"></el-tab-pane>
</el-tabs>
</div>
<!-- <div class="filter-actions">
<el-button type="primary" icon="el-icon-search" @click="handleSearch">{{ $t('autoPromotionLogs.searchBtn') }}</el-button>
</div> -->
</div>
<div class="filter-actions">
<el-button type="primary" plain icon="el-icon-refresh" :loading="loading" @click="handleSearch">
{{ $t('autoPromotionLogs.logRefresh') }}
</el-button>
</div>
</div>
<el-table :data="list" border stripe size="small" class="custom-table exquisite-log-table">
<el-table-column
@@ -210,7 +254,9 @@
:config="config"
:wizardStartDate.sync="wizardStartDate"
:selectedFieldIds.sync="selectedFieldIds"
:selectedCountryIds.sync="selectedCountryIds"
:availableFields="availableFields"
:availableCountries="availableCountries"
:fieldsLoading="fieldsLoading"
:fieldsSaving="fieldsSaving"
:currentJournalName="currentJournalName"
@@ -221,6 +267,7 @@
:title="$t('autoPromotion.title')"
@open-template-selector="showTemplateDialog = true"
@confirm-fields="savePromotionFieldsNow"
@confirm-countries="savePromotionCountriesNow"
@cancel="showWizardDialog = false"
@confirm="completeInitialization"
/>
@@ -236,6 +283,16 @@
@confirm="handleTemplateApply"
@close-all-dialogs="closeAllDialogs"
/>
<promotion-factory-task-dialog
:visible.sync="showFactoryTaskDialog"
:initial-journal-id="factoryDialogInitialJournalId"
:initial-task="factoryDialogInitialTask"
@success="
fetchFactoryTasksForHeader();
fetchList();
fetchJournalDetail();
"
/>
<el-dialog :title="$t('autoPromotionLogs.previewEditTitle')" :visible.sync="showPreviewDialog" width="1200px" top="5vh">
<div class="mail-edit-wrapper" v-if="previewForm">
<el-form label-width="120px" size="small">
@@ -281,6 +338,7 @@
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 地址
const API = {
@@ -294,7 +352,7 @@ const API = {
export default {
name: 'autoPromotion',
components: { TemplateSelectorDialog, AutoPromotionWizard, CkeditorMail, PromotionDetailDrawer },
components: { TemplateSelectorDialog, AutoPromotionWizard, PromotionFactoryTaskDialog, CkeditorMail, PromotionDetailDrawer },
data() {
return {
handleRefreshList: [],
@@ -323,7 +381,7 @@ export default {
selectedStyleName: '',
// 列表数据
query: { keyword: '', state: 'all', pageIndex: 1, pageSize: 15 },
query: { keyword: '', state: 'all', pageIndex: 1, pageSize: 10 },
list: [],
total: 0,
@@ -339,9 +397,19 @@ export default {
templateDialogInitialTemplateId: '',
togglingTaskId: '',
selectedFieldIds: [],
selectedCountryIds: [],
availableFields: [],
availableCountries: [],
fieldsLoading: false,
fieldsSaving: false,
showFactoryTaskDialog: false,
factoryDialogInitialJournalId: '',
factoryDialogInitialTask: null,
routePromotionFactoryId: '',
headerPromotionFactoryId: '',
factoryTaskOptions: [],
factoryTasksHeaderLoading: false,
createTaskLoading: false,
previewForm: {
id: '',
email: '',
@@ -351,7 +419,28 @@ export default {
}
};
},
computed: {},
computed: {
/** 当前选中工厂任务是否运行中(与下拉 options 中 running 一致) */
headerFactoryTaskRunning() {
const id = String(this.headerPromotionFactoryId || '').trim();
if (!id || !this.factoryTaskOptions || !this.factoryTaskOptions.length) return null;
const opt = this.factoryTaskOptions.find((o) => String(o.value) === id);
if (opt && typeof opt.running === 'boolean') return opt.running;
return null;
}
},
watch: {
'$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) {
this.query.pageIndex = 1;
this.fetchList();
}
}
},
created() {
this.initPage();
},
@@ -370,6 +459,7 @@ export default {
closeAllDialogs() {
// 点击“去新增模板”后:关闭当前页面所有可能的弹窗
this.showWizardDialog = false;
this.showFactoryTaskDialog = false;
this.showTemplateDialog = false;
this.showPreviewDialog = false;
this.currentRow = null;
@@ -463,6 +553,12 @@ export default {
async initPage() {
this.hidePage = false;
var journal_id = (this.$route.query && this.$route.query.journal_id) || '';
var pfid =
(this.$route.query && this.$route.query.promotion_factory_id) ||
(this.$route.query && this.$route.query.taskId) ||
'';
this.routePromotionFactoryId = String(pfid || '');
this.headerPromotionFactoryId = this.routePromotionFactoryId;
this.selectedJournalId = String(journal_id);
this.loading = true;
try {
@@ -472,6 +568,7 @@ export default {
}
if (this.config.initialized) {
await this.fetchTemplates();
await this.fetchFactoryTasksForHeader();
await this.fetchList();
}
} finally {
@@ -540,6 +637,150 @@ export default {
}
},
/** 下拉项:场景类型文案(优先 scene否则按 type 映射) */
getFactoryHeaderTaskTypeLabel(task) {
if (!task || typeof task !== 'object') return '';
const scene = String(task.scene || task.scene_name || '').trim();
if (scene) return scene;
const type = String(task.type != null ? task.type : '').trim();
if (type === '1') return this.$t('autoPromotion.factoryScenarioSolicit');
if (type === '2') return this.$t('autoPromotion.factoryScenarioPromoteCitation');
if (type === '3') return this.$t('autoPromotion.factoryScenarioGeneralThanks');
if (type === '4') return this.$t('autoPromotion.autoSolicit');
return String(task.task_name || task.name || '').trim();
},
formatFactoryHeaderTaskCreateTime(task) {
if (!task || typeof task !== 'object') return '';
const raw = task.ctime || task.create_time || task.created_at || task.time || '';
if (raw == null || String(raw).trim() === '') return '';
const n = Number(raw);
let dt = null;
if (!isNaN(n) && n > 0) {
dt = new Date(n > 1e12 ? n : n * 1000);
} else {
dt = new Date(String(raw));
}
if (!dt || isNaN(dt.getTime())) return String(raw).trim();
const pad = (v) => String(v).padStart(2, '0');
return `${dt.getFullYear()}-${pad(dt.getMonth() + 1)}-${pad(dt.getDate())} ${pad(dt.getHours())}:${pad(dt.getMinutes())}:${pad(dt.getSeconds())}`;
},
isFactoryHeaderTaskRunning(task) {
if (!task || typeof task !== 'object') return false;
if (task.start_promotion != null && String(task.start_promotion).trim() !== '') {
return String(task.start_promotion) === '1';
}
if (task.state != null && String(task.state).trim() !== '') {
return String(task.state) === '1';
}
return false;
},
/** 下拉仅展示「类型 - 创建日期」,运行状态单独用 el-tag */
buildFactoryHeaderOptionMainLabel(task, pidFallback) {
const typePart = this.getFactoryHeaderTaskTypeLabel(task) || String(pidFallback || '').trim() || '—';
const datePart = this.formatFactoryHeaderTaskCreateTime(task);
return datePart ? `${typePart} - ${datePart}` : typePart;
},
replacePromotionFactoryIdInUrl(promotionFactoryId) {
try {
const url = new URL(window.location.href);
url.searchParams.set('promotion_factory_id', String(promotionFactoryId));
window.history.replaceState({}, document.title, url.toString());
} catch (e) {
console.error(e);
}
},
async fetchFactoryTasksForHeader() {
if (!this.selectedJournalId || !this.config.initialized) {
this.factoryTaskOptions = [];
return;
}
this.factoryTasksHeaderLoading = true;
try {
const userId = localStorage.getItem('U_id') || '';
const res = await this.$api.post('api/promotion_factory/getList', {
journal_id: String(this.selectedJournalId),
user_id: String(userId),
state: '-1'
});
const payload = (res && res.data) || {};
const list = this.findArray(payload) || this.findArray(res) || [];
let opts = (Array.isArray(list) ? list : []).map((task, idx) => {
const pid =
task && task.promotion_factory_id != null
? String(task.promotion_factory_id)
: task && task.id != null
? String(task.id)
: '';
if (!pid) return null;
const label = this.buildFactoryHeaderOptionMainLabel(task, pid);
const running = this.isFactoryHeaderTaskRunning(task);
return { value: pid, label, running };
}).filter(Boolean);
let cur = String(this.routePromotionFactoryId || this.headerPromotionFactoryId || '').trim();
const ids = new Set(opts.map((o) => o.value));
if (cur && !ids.has(cur)) {
opts = [{ value: cur, label: cur, running: false }].concat(opts);
}
this.factoryTaskOptions = opts;
if (!cur && opts.length) {
cur = opts[0].value;
}
if (cur) {
this.headerPromotionFactoryId = cur;
this.routePromotionFactoryId = cur;
const routePid = String((this.$route.query && this.$route.query.promotion_factory_id) || '').trim();
if (cur !== routePid) {
this.replacePromotionFactoryIdInUrl(cur);
}
} else {
this.headerPromotionFactoryId = '';
}
} catch (e) {
this.factoryTaskOptions = [];
} finally {
this.factoryTasksHeaderLoading = false;
}
},
onHeaderFactoryTaskChange(id) {
const next = String(id != null ? id : '').trim();
if (!next) return;
this.routePromotionFactoryId = next;
this.headerPromotionFactoryId = next;
this.query.pageIndex = 1;
this.replacePromotionFactoryIdInUrl(next);
this.fetchList();
},
async handleCreateEmailClientTask() {
const pid = String(this.headerPromotionFactoryId || this.routePromotionFactoryId || '').trim();
if (!pid) {
this.$message.warning(this.$t('autoPromotion.emailClientCreateTaskNeedFactory'));
return;
}
this.createTaskLoading = true;
try {
const res = await this.$api.post('api/email_client/createTask', { promotion_factory_id: pid });
if (res && Number(res.code) === 0) {
const taskId = String(res.task_id || (res.data && res.data.task_id) || '').trim();
if (taskId) {
// Fire-and-forget: prepare recipient list in background.
this.$api.post('api/email_client/prepareTask', { task_id: taskId }).catch(() => {});
}
this.$message.success(this.$t('autoPromotion.emailClientCreateTaskPreparingHint'));
this.query.pageIndex = 1;
this.fetchList();
} else {
this.$message.error((res && res.msg) || this.$t('autoPromotion.emailClientCreateTaskFailed'));
}
} catch (e) {
this.$message.error(this.$t('autoPromotion.emailClientCreateTaskFailed'));
} finally {
this.createTaskLoading = false;
}
},
// 打开向导弹窗:用于“修改期刊自动推广配置”
findArray(obj) {
if (Array.isArray(obj)) return obj;
@@ -552,10 +793,32 @@ export default {
if (values.length && Array.isArray(values[0])) return values[0];
return null;
},
parseCountryIdsFromPromotionPayload(selectedPayload) {
if (!selectedPayload || typeof selectedPayload !== 'object') return [];
const raw =
selectedPayload.country_fetch_ids != null
? selectedPayload.country_fetch_ids
: selectedPayload.country_ids != null
? selectedPayload.country_ids
: '';
if (typeof raw === 'string' && raw.trim()) {
return raw.split(',').map((s) => s.trim()).filter(Boolean).map(String);
}
return [];
},
journalPromotionFieldsPayload(journalId) {
return {
journal_id: String(journalId),
fetch_ids: (this.selectedFieldIds || []).join(','),
country_fetch_ids: (this.selectedCountryIds || []).join(',')
};
},
async loadPromotionFields(journalId) {
this.fieldsLoading = true;
this.availableFields = [];
this.availableCountries = [];
this.selectedFieldIds = [];
this.selectedCountryIds = [];
try {
const availableRes = await this.$api.post('api/email_client/getAvailableFields', { journal_id: String(journalId) });
const availablePayload = (availableRes && availableRes.data) || availableRes || {};
@@ -566,33 +829,22 @@ export default {
const label = item.field || item.title || item.name || item.label || String(id);
return { id: String(id), label };
});
this.availableCountries = this.availableFields.map((x) => ({ id: String(x.id), label: x.label }));
} catch (e) {
this.availableFields = [];
this.availableCountries = [];
}
try {
const selectedRes = await this.$api.post('api/email_client/getJournalPromotionFields', { journal_id: String(journalId) });
const selectedPayload = (selectedRes && selectedRes.data) || selectedRes || {};
let selectedArr = this.findArray(selectedPayload);
if (selectedArr) {
this.selectedFieldIds = selectedArr.map((it) => String(it.expert_fetch_id || it.fetch_id || it.id || it.field_id || it));
} else if (typeof selectedPayload === 'string') {
this.selectedFieldIds = selectedPayload.split(',').map((s) => s.trim()).filter(Boolean);
} else if (typeof selectedPayload.fetch_ids === 'string') {
this.selectedFieldIds = selectedPayload.fetch_ids.split(',').map((s) => s.trim()).filter(Boolean);
}
} catch (e) {
this.selectedFieldIds = [];
}
// 日志页不请求 getJournalPromotionFields该接口在此场景不可用已选字段/国家由向导内操作或他处回显
this.fieldsLoading = false;
},
async savePromotionFieldsNow() {
if (!this.selectedJournalId) return;
this.fieldsSaving = true;
try {
await this.$api.post('api/email_client/setJournalPromotionFields', {
journal_id: String(this.selectedJournalId),
fetch_ids: (this.selectedFieldIds || []).join(',')
});
await this.$api.post(
'api/email_client/setJournalPromotionFields',
this.journalPromotionFieldsPayload(this.selectedJournalId)
);
this.$message.success(this.$t('autoPromotion.fieldsSaved'));
} catch (e) {
this.$message.error(this.$t('autoPromotion.saveFailed'));
@@ -600,6 +852,21 @@ export default {
this.fieldsSaving = false;
}
},
async savePromotionCountriesNow() {
if (!this.selectedJournalId) return;
this.fieldsSaving = true;
try {
await this.$api.post(
'api/email_client/setJournalPromotionFields',
this.journalPromotionFieldsPayload(this.selectedJournalId)
);
this.$message.success(this.$t('autoPromotion.countriesSaved'));
} catch (e) {
this.$message.error(this.$t('autoPromotion.saveFailed'));
} finally {
this.fieldsSaving = false;
}
},
async openWizardDialog() {
this.wizardStep = 0;
if (this.config && this.config.start_date) {
@@ -610,6 +877,41 @@ export default {
}
this.showWizardDialog = true;
},
openFactoryTaskDialogFromLogs() {
this.factoryDialogInitialJournalId = this.selectedJournalId ? String(this.selectedJournalId) : '';
const routePid = String(this.routePromotionFactoryId || '').trim();
const first = this.list && this.list.length ? this.list[0] : null;
const matched = routePid
? (this.list || []).find((row) => {
const pid = row && row.promotion_factory_id != null ? String(row.promotion_factory_id) : '';
const rid = row && row.id != null ? String(row.id) : '';
const tid = row && row.task_id != null ? String(row.task_id) : '';
return pid === routePid || rid === routePid || tid === routePid;
}) || first
: first;
let task = null;
if (matched) {
task = { ...matched };
if (!routePid) {
task.promotion_factory_id =
matched.promotion_factory_id != null
? String(matched.promotion_factory_id)
: matched.id != null
? String(matched.id)
: matched.task_id != null
? String(matched.task_id)
: '';
}
}
// promotion_factory/getDetail 必须使用地址栏 promotion_factory_id避免列表首行 id 与路由不一致
if (routePid) {
task = { ...(task || {}), promotion_factory_id: routePid };
}
this.factoryDialogInitialTask = task && Object.keys(task).length ? task : null;
this.showFactoryTaskDialog = true;
},
// 切换期刊逻辑
async handleJournalChange() {
@@ -702,13 +1004,14 @@ export default {
};
this.config.initialized = true;
this.showWizardDialog = false;
this.fetchList();
await this.$api.post(API.saveConfig, payload);
await this.$api.post('api/email_client/setJournalPromotionFields', {
journal_id: String(this.selectedJournalId || ''),
fetch_ids: (this.selectedFieldIds || []).join(',')
});
await this.$api.post(
'api/email_client/setJournalPromotionFields',
this.journalPromotionFieldsPayload(this.selectedJournalId || '')
);
this.$message.success(this.$t('autoPromotionLogs.configUpdated'));
await this.fetchFactoryTasksForHeader();
await this.fetchList();
} finally {
this.saving = false;
}
@@ -730,8 +1033,9 @@ export default {
try {
const params = {
journal_id: String(this.selectedJournalId || ''),
factory_id: String(this.routePromotionFactoryId || ''),
page: Number(this.query.pageIndex || 1),
per_page: Number(this.query.pageSize || 15)
per_page: Number(this.query.pageSize || 10)
};
if (this.query.state !== 'all' && this.query.state !== '' && this.query.state != null) {
params.state = String(this.query.state);
@@ -743,8 +1047,15 @@ export default {
this.list = rawList.map((item, idx) => {
const runAt = item.run_at || item.run_time || item.plan_time || item.execute_time || item.send_date || '';
const state = String(item.state != null ? item.state : '');
const promotionFactoryId =
item.promotion_factory_id != null
? item.promotion_factory_id
: item.id != null
? item.id
: item.task_id;
return {
id: item.id || item.task_id || `task_${idx + 1}`,
promotion_factory_id: promotionFactoryId != null ? String(promotionFactoryId) : '',
task_id: String(item.task_id != null ? item.task_id : item.id || ''),
task_name: item.task_name || item.name || '',
scene: item.scene || '',
@@ -922,6 +1233,36 @@ export default {
justify-content: space-between;
align-items: center;
}
.config-bar .left {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 4px 10px;
}
.config-bar .right {
flex-shrink: 0;
margin-left: 12px;
}
.header-factory-task-select {
width: min(380px, 46vw);
min-width: 200px;
}
.header-factory-status-tag {
margin-left: 8px;
vertical-align: middle;
}
.header-factory-status-tag .el-icon-circle-check {
margin-right: 4px;
}
.header-factory-status-dot {
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
background: #909399;
margin-right: 6px;
vertical-align: middle;
}
/* 向导样式 */
.wizard-card {
@@ -1504,6 +1845,10 @@ export default {
border-radius: 6px;
transition: all 0.2s;
}
.filter-actions {
margin-left: auto;
}
/* 基础 Badge 样式 */
.status-badge {
display: inline-flex;

View File

@@ -198,8 +198,8 @@
<el-form-item label="Account :" prop="account">
<span>{{coreForm.account}}</span>
</el-form-item>
<el-form-item label="Email :">
<span>{{coreForm.email}}</span>
<el-form-item label="Email :" prop="email">
<el-input type="text" placeholder="Please enter email..." v-model="coreForm.email" clearable></el-input>
</el-form-item>
<el-form-item label="head portrait :">
<el-upload class="avatar-uploader" :action="baseUrl+'master/Journal/up_topic_file'"

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,17 @@
<template>
<div class="tinymce-container editor-container">
<textarea class="tinymce-textarea" :id="tinymceId"></textarea>
<div class="tinymce-editor-surface">
<textarea class="tinymce-textarea" :id="tinymceId"></textarea>
</div>
<div
v-if="showRefButton && hasReferencesForAutoLink"
ref="autoLinkFooterWrap"
class="tinymce-autolink-footer"
>
<span @click="handleAutoLinkRefsClick" style="cursor: pointer;color: #409eff;font: 12px;font-weight: 700;">
<i class="el-icon-link"></i> {{ $t('wordCite.matchBracketRefs') }}
</span>
</div>
</div>
</template>
<script>
@@ -63,6 +74,107 @@ export default {
},
articleId: {
default: ''
},
chanFerForm: {
type: Array,
default: () => []
},
/** 由父级根据全文(稿面 + Edit Content 草稿合并)扫描得到,与 word.vue citeMap 一致 */
bodyCiteIdOrder: {
type: Array,
default: () => []
},
/** mytable(data-id) -> 该表内已出现引用的最大全局序号(由父组件计算) */
tableLinkCiteMaxMap: {
type: Object,
default: () => ({})
},
/** 为 false 时不显示 Ref 工具栏按钮,也不自动在 LateX 后注入 insertRef用于图表标题等 */
showRefButton: {
type: Boolean,
default: true
},
/**
* true仅「表格单元格编辑」场景角标/自动匹配 [n] 按 old_index+1或 order_index
* false与稿面一致始终用 bodyCiteIdOrder 的 citeMapEdit Content 等虽 type=table 放宽标签,也必须 false
*/
useTableLocalCitationIndex: {
type: Boolean,
default: false
}
},
computed: {
/** 是否启用表格局部序号(与全文 citeMap 互斥) */
tableLocalCiteActive() {
if (this.type !== 'table' || !this.useTableLocalCitationIndex) return false;
return Object.keys(this.tableBracketNumToRefIdMap || {}).length > 0;
},
citeMap() {
const refs = Array.isArray(this.chanFerForm) ? this.chanFerForm : [];
const refIdSet = new Set(
refs.map((r) => (r && r.p_refer_id != null ? String(r.p_refer_id) : '')).filter(Boolean)
);
if (!Array.isArray(this.bodyCiteIdOrder) || this.bodyCiteIdOrder.length === 0) {
const map = {};
refs.forEach((row, idx) => {
const key = row && row.p_refer_id != null ? String(row.p_refer_id) : '';
if (key) map[key] = idx + 1;
});
return map;
}
const orderedIds = this.bodyCiteIdOrder.map(String);
const filtered = [];
orderedIds.forEach((id) => {
if (refIdSet.has(id) && !filtered.includes(id)) filtered.push(id);
});
const map = {};
filtered.forEach((id, idx) => {
map[id] = idx + 1;
});
let next = filtered.length + 1;
refs.forEach((r) => {
const key = r && r.p_refer_id != null ? String(r.p_refer_id) : '';
if (!key || map[key] != null) return;
map[key] = next++;
});
return map;
},
/** 有参考文献列表时才显示「自动链接」:与 insertRef 一致,依赖 chanFerForm 中有效 p_refer_id */
hasReferencesForAutoLink() {
const refs = Array.isArray(this.chanFerForm) ? this.chanFerForm : [];
return refs.some((r) => r && r.p_refer_id != null && String(r.p_refer_id).trim() !== '');
},
/**
* 表格编辑器专用:单元格 [n] 中的 n → p_refer_id。
* - 有 old_index0 起n = old_index + 1
* - 仅有 order_index 时:按接口约定已为与 [n] 一致的序号n = order_index不再 +1
*/
tableBracketNumToRefIdMap() {
const refs = Array.isArray(this.chanFerForm) ? this.chanFerForm : [];
const map = {};
refs.forEach((r) => {
if (!r || r.p_refer_id == null) return;
const n = this._getTableBracketNoForRow(r);
if (n == null) return;
map[n] = String(r.p_refer_id);
});
return map;
},
/** p_refer_id → 表格角标数字 n与 [n] 一致) */
tableRefIdToBracketNum() {
const refs = Array.isArray(this.chanFerForm) ? this.chanFerForm : [];
const m = {};
refs.forEach((r) => {
if (!r || r.p_refer_id == null) return;
const n = this._getTableBracketNoForRow(r);
if (n == null) return;
m[String(r.p_refer_id)] = n;
});
return m;
}
},
data() {
@@ -124,22 +236,52 @@ export default {
hasChange: false,
hasInit: false,
editorInstance: null,
tinymceId: this.id || 'vue-tinymce-' + +new Date()
tinymceId: this.id || 'vue-tinymce-' + +new Date(),
/** 将底部栏移入 TinyMCE 容器前,记录原 DOM 位置以便销毁时移回 */
_autoLinkFooterRestore: null
};
},
watch: {
value: {
handler(val) {
if (!this.hasChange && this.hasInit) {
if (!this.hasChange && this.hasInit) {
this.$nextTick(() => {
this.handleSetContent(val);
});
}
},
immediate: true
},
chanFerForm: {
handler() {
this.$nextTick(() => {
window.tinymce.get(this.tinymceId).setContent(val);
if (this.editorInstance) {
this.renderAutociteInEditor(this.editorInstance);
}
});
},
deep: true
},
bodyCiteIdOrder: {
handler() {
this.$nextTick(() => {
if (this.editorInstance) {
this.renderAutociteInEditor(this.editorInstance);
}
});
},
deep: true
},
hasReferencesForAutoLink(val) {
if (!val) {
this.restoreAutoLinkFooterDom();
return;
}
if (this.showRefButton && this.editorInstance) {
this.$nextTick(() => {
this.mountAutoLinkFooterInsideEditor(this.editorInstance);
});
}
},
immediate: true
}
},
mounted() {
@@ -163,10 +305,526 @@ export default {
this.destroyTinymce();
},
methods: {
parseAutociteDataIds(attr) {
if (!attr || typeof attr !== 'string') return [];
return attr
.split(',')
.map((s) => s.trim())
.filter(Boolean);
},
/**
* 与正文 [n] 一致的角标数字 n。old_index 为 0 起 → n=old_index+1无 old_index 时用 order_index已为 n.
*/
_getTableBracketNoForRow(r) {
if (!r) return null;
const pick = (v) => {
if (v == null || v === '') return null;
const x = Number(v);
return Number.isNaN(x) ? null : x;
};
const oi =
r.old_index != null && r.old_index !== ''
? pick(r.old_index)
: pick(r.oldIndex);
if (oi != null) return oi + 1;
const ord =
r.order_index != null && r.order_index !== ''
? pick(r.order_index)
: pick(r.orderIndex);
return ord;
},
/** 与 word.vue renderCiteLabels合并角标 id 按 citeMap 序号排序 */
sortAutociteIdsByCiteNumber(ids) {
const uniq = [...new Set(ids.map(String))];
const map = this.citeMap || {};
return uniq.sort((a, b) => {
const na = map[a];
const nb = map[b];
const ha = na != null && na !== '';
const hb = nb != null && nb !== '';
if (ha && hb) return Number(na) - Number(nb);
if (ha) return -1;
if (hb) return 1;
return String(a).localeCompare(String(b));
});
},
/** 同 word.vue多 id 均在列表中时对全局序号做 13 区间合并 */
formatCiteNumbers(nums) {
if (!nums || !nums.length) return '';
const sorted = [...new Set(nums)].sort((a, b) => a - b);
const result = [];
let i = 0;
while (i < sorted.length) {
let j = i;
while (j < sorted.length - 1 && sorted[j + 1] === sorted[j] + 1) j++;
if (j - i >= 2) {
result.push(`${sorted[i]}${sorted[j]}`);
} else {
for (let k = i; k <= j; k++) result.push(sorted[k]);
}
i = j + 1;
}
return result.join(', ');
},
/** 全局角标序号 n → p_refer_id用于将正文中的 [n] 转为 mycite */
buildNumToRefIdMap() {
const citeMap = this.citeMap || {};
const map = {};
Object.keys(citeMap).forEach((id) => {
const n = citeMap[id];
if (n != null && n !== '' && !Number.isNaN(Number(n))) {
map[Number(n)] = String(id);
}
});
return map;
},
/** 自动匹配 [n]:表格内用 old_index+1 或 order_index(=n)mytable 之后段落仍用全局 citeMap */
_getBracketNumToIdMaps() {
const globalMap = this.buildNumToRefIdMap();
if (this.type !== 'table' || !this.useTableLocalCitationIndex) {
return { primary: globalMap, afterTable: globalMap };
}
const tm = this.tableBracketNumToRefIdMap || {};
const has = Object.keys(tm).length > 0;
return {
primary: has ? tm : globalMap,
afterTable: globalMap
};
},
sortAutociteIdsByTableBracketNumber(ids) {
const uniq = [...new Set(ids.map(String))];
const numById = this.tableRefIdToBracketNum || {};
return uniq.sort((a, b) => {
const na = numById[a];
const nb = numById[b];
const ha = na != null && na !== '' && !Number.isNaN(Number(na));
const hb = nb != null && nb !== '' && !Number.isNaN(Number(nb));
if (ha && hb) return Number(na) - Number(nb);
if (ha) return -1;
if (hb) return 1;
return String(a).localeCompare(String(b));
});
},
_sortAutociteIdsForDisplay(ids) {
if (this.tableLocalCiteActive) {
return this.sortAutociteIdsByTableBracketNumber(ids);
}
return this.sortAutociteIdsByCiteNumber(ids);
},
_sortIdsAfterBracketMatch(ids, tableOffset) {
if (this.tableLocalCiteActive && tableOffset === 0) {
return this.sortAutociteIdsByTableBracketNumber(ids);
}
return this.sortAutociteIdsByCiteNumber(ids);
},
/** 解析 [1]、[1,2]、[14]、[1, 23, 4] 等括号内数字列表(不含方括号) */
parseBracketInnerToNumbers(inner) {
if (!inner || typeof inner !== 'string') return [];
const t = inner.trim().replace(//g, ',');
// 先按逗号拆段,再对每段解析单号或区间;避免 parseInt('41-42') 只得到 41
if (/[,]/.test(t)) {
const parts = t.split(/[,]/).map((s) => String(s).trim()).filter(Boolean);
const out = [];
parts.forEach((part) => {
out.push(...this.parseBracketInnerToNumbers(part));
});
return out;
}
const range = t.match(/^(\d+)\s*[-–—]\s*(\d+)$/);
if (range) {
const a = Number(range[1]);
const b = Number(range[2]);
if (Number.isNaN(a) || Number.isNaN(b)) return [];
const lo = Math.min(a, b);
const hi = Math.max(a, b);
const out = [];
for (let i = lo; i <= hi; i++) out.push(i);
return out;
}
const n = parseInt(t, 10);
return Number.isNaN(n) ? [] : [n];
},
/**
* 将编辑器内纯文本形式的 [1]、[13]、[1, 2] 按当前 citeMap 转为 <mycite>(跳过已有 mycite/wmath 内文字)
* @returns {{ replaced: number }}
*/
convertPlainBracketCitesToAutocite() {
const ed = this.editorInstance;
if (!ed) return { replaced: 0 };
const refs = Array.isArray(this.chanFerForm) ? this.chanFerForm : [];
if (!refs.length) {
this.$message.warning(this.$t('wordCite.noRefs'));
return { replaced: 0 };
}
const maps = this._getBracketNumToIdMaps();
if (Object.keys(maps.primary).length === 0) {
this.$message.warning(this.$t('wordCite.noRefs'));
return { replaced: 0 };
}
const doc = ed.getDoc();
const body = ed.getBody();
if (!body) return { replaced: 0 };
let replaced = 0;
ed.undoManager.transact(() => {
// 先把被拆成多个 span 的 [13, 16, 2123] 规整成单段文本,再做自动匹配
this.normalizeSplitBracketCitesInTableCells(body);
replaced = this._replaceBracketCitesInDocOrder(body, doc, maps, { tableOffset: 0 });
});
this.renderAutociteInEditor(ed);
ed.fire('change');
return { replaced };
},
/**
* TinyMCE/粘贴可能把单元格里的 [1, 23] 拆成多个内联节点span/text 混排),
* 导致按文本节点匹配的自动链接无法命中。这里在匹配前把该类节点规整回纯文本。
*/
normalizeSplitBracketCitesInTableCells(root) {
if (!root || !root.querySelectorAll) return;
const cells = root.querySelectorAll('td, th');
cells.forEach((cell) => {
if (!cell || !cell.querySelectorAll) return;
if (cell.querySelector('mycite, autocite, wmath')) return;
if (!cell.querySelector('span')) return;
const raw = (cell.textContent || '').replace(/\u200b/g, '');
const compact = raw.replace(/\s+/g, ' ').trim();
if (!/^\[[\d\s,\-–—]+\]$/.test(compact)) return;
cell.textContent = compact;
});
},
/** 底部「自动链接参考文献」按钮,与原先工具栏 autoLinkRefs 行为一致 */
handleAutoLinkRefsClick() {
const r = this.convertPlainBracketCitesToAutocite();
if (!r) return;
if (r.replaced > 0) {
this.$message.success(this.$t('wordCite.matchBracketRefsDone', { n: r.replaced }));
return;
}
const refs = Array.isArray(this.chanFerForm) ? this.chanFerForm : [];
const maps = this._getBracketNumToIdMaps();
if (refs.length && Object.keys(maps.primary).length) {
this.$message.info(this.$t('wordCite.matchBracketRefsNone'));
}
},
/** 把「自动链接」栏挂到 TinyMCE 外壳 .tox-tinymce 内部底部,与工具栏/编辑区同一外框 */
mountAutoLinkFooterInsideEditor(ed) {
if (!this.showRefButton || !this.hasReferencesForAutoLink) return;
this.$nextTick(() => {
const el = this.$refs.autoLinkFooterWrap;
if (!el || !ed) return;
const container = ed.getContainer && ed.getContainer();
if (!container) return;
if (el.parentNode === container) return;
this._autoLinkFooterRestore = {
parent: el.parentNode,
next: el.nextSibling
};
container.appendChild(el);
});
},
/** 销毁编辑器前必须移回,否则节点会随 .tox-tinymce 一起被移除 */
restoreAutoLinkFooterDom() {
const el = this.$refs.autoLinkFooterWrap;
const r = this._autoLinkFooterRestore;
this._autoLinkFooterRestore = null;
if (!el || !r || !r.parent) return;
try {
if (r.next && r.next.parentNode === r.parent) {
r.parent.insertBefore(el, r.next);
} else {
r.parent.appendChild(el);
}
} catch (e) {
/* ignore */
}
},
/**
* 按文档顺序遍历,使「表格链接」后任意后续段落里的 [n] 都能用上该表的最大全局序号偏移。
* 旧实现只在同一父节点下、MYTABLE 与后续文本为兄弟时才生效MYTABLE 在上一段、角标在下一段时会失效。
*/
_replaceBracketCitesInDocOrder(node, doc, maps, state) {
if (node.nodeType === 3) {
return this._processTextNodeForBracketCites(node, doc, maps, state.tableOffset);
}
if (node.nodeType !== 1) return 0;
const name = node.nodeName;
if (name === 'AUTOCITE' || name === 'MYCITE' || name === 'WMATH' || name === 'SCRIPT' || name === 'STYLE') {
return 0;
}
const isMytable = name === 'MYTABLE' || (node.tagName && String(node.tagName).toLowerCase() === 'mytable');
if (isMytable) {
let total = 0;
Array.from(node.childNodes).forEach((c) => {
total += this._replaceBracketCitesInDocOrder(c, doc, maps, state);
});
const tid = (node.getAttribute && node.getAttribute('data-id')) || '';
const map = this.tableLinkCiteMaxMap || {};
const tableMax = Number(map[String(tid)]);
if (!Number.isNaN(tableMax) && tableMax > 0) {
state.tableOffset = tableMax;
}
return total;
}
let total = 0;
Array.from(node.childNodes).forEach((c) => {
total += this._replaceBracketCitesInDocOrder(c, doc, maps, state);
});
return total;
},
_processTextNodeForBracketCites(textNode, doc, maps, tableOffset = 0) {
const numToId = tableOffset > 0 ? maps.afterTable : maps.primary;
const text = textNode.textContent;
const re = /\[([\d\s,\-–—]+)\]/g;
let m;
let lastIndex = 0;
const pieces = [];
let replaced = 0;
let skippedSpecial = 0;
while ((m = re.exec(text)) !== null) {
const rawNums = this.parseBracketInnerToNumbers(m[1]);
// 仅 [0]、[-1]、[0, -1] 等「全是 0/-1」不转换与正常号混写时去掉 0/-1 再匹配
const onlyZeroOrNegOne =
rawNums.length > 0 && rawNums.every((n) => n === 0 || n === -1);
if (onlyZeroOrNegOne) {
pieces.push({ type: 'text', s: text.slice(lastIndex, m.index) });
pieces.push({ type: 'text', s: m[0] });
lastIndex = m.index + m[0].length;
skippedSpecial++;
continue;
}
const nums = rawNums.filter((n) => n !== 0 && n !== -1);
const mapNo = (n) => (n > 0 && tableOffset > 0 ? n + tableOffset - 1 : n);
if (!nums.length) {
pieces.push({ type: 'text', s: text.slice(lastIndex, m.index) });
pieces.push({ type: 'text', s: m[0] });
lastIndex = m.index + m[0].length;
continue;
}
const validNums = nums.filter((n) => numToId[mapNo(n)]);
const invalidNums = nums.filter((n) => !numToId[mapNo(n)]);
if (validNums.length === 0) {
pieces.push({ type: 'text', s: text.slice(lastIndex, m.index) });
pieces.push({ type: 'text', s: m[0] });
lastIndex = m.index + m[0].length;
continue;
}
const ids = [];
const seen = new Set();
validNums.forEach((n) => {
const mappedNo = mapNo(n);
const id = numToId[mappedNo];
if (id && !seen.has(id)) {
seen.add(id);
ids.push(id);
}
});
pieces.push({ type: 'text', s: text.slice(lastIndex, m.index) });
if (ids.length > 0) {
const sorted = this._sortIdsAfterBracketMatch(ids, tableOffset);
pieces.push({ type: 'cite', ids: sorted });
if (invalidNums.length) {
const invSorted = [...new Set(invalidNums)].sort((a, b) => a - b);
const invLabel = this.formatCiteNumbers(invSorted);
if (invLabel) {
pieces.push({ type: 'text', s: ', [' + invLabel + ']' });
}
}
replaced++;
} else {
pieces.push({ type: 'text', s: m[0] });
}
lastIndex = m.index + m[0].length;
}
if (replaced === 0) return 0;
pieces.push({ type: 'text', s: text.slice(lastIndex) });
const parent = textNode.parentNode;
if (!parent) return 0;
const frag = doc.createDocumentFragment();
pieces.forEach((p) => {
if (p.type === 'text') {
frag.appendChild(doc.createTextNode(p.s));
} else {
const ac = doc.createElement('mycite');
ac.setAttribute('data-id', p.ids.join(','));
ac.setAttribute('contenteditable', 'false');
ac.appendChild(doc.createTextNode('\u200b'));
frag.appendChild(ac);
}
});
parent.replaceChild(frag, textNode);
if (skippedSpecial > 0) {
// 提示:仅提示一次即可;这里在节点级别提示可能重复,放到宏任务末尾合并展示
clearTimeout(this._autoLinkSkipToastTimer);
this._autoLinkSkipToastTimer = setTimeout(() => {
this.$message.info(`Skipped ${skippedSpecial} bracket cite(s) containing only 0 or -1.`);
}, 0);
}
return replaced;
},
renderAutociteInEditor(ed) {
const body = ed.getBody();
if (!body) return;
const allAutocites = Array.from(
ed.dom && typeof ed.dom.select === 'function'
? ed.dom.select('mycite,autocite', body)
: body.querySelectorAll('mycite, autocite')
);
if (!allAutocites.length) return;
const refs = Array.isArray(this.chanFerForm) ? this.chanFerForm : [];
const refMap = {};
refs.forEach((item) => {
const key = item && item.p_refer_id != null ? String(item.p_refer_id) : '';
if (key) refMap[key] = item;
});
const citeMap = this.citeMap || {};
const tableNums = this.tableRefIdToBracketNum || {};
const useTableBracketNums = this.tableLocalCiteActive;
allAutocites.forEach((el) => {
ed.dom.setAttrib(el, 'contenteditable', 'false');
el.style.display = '';
const sortedAll = this._sortAutociteIdsForDisplay(this.parseAutociteDataIds(el.getAttribute('data-id')));
const validIds = sortedAll.filter((id) => refMap[String(id)]);
if (validIds.length < sortedAll.length) {
ed.dom.setAttrib(el, 'data-id', validIds.length ? validIds.join(',') : '');
}
const sortedIds = validIds.length ? this._sortAutociteIdsForDisplay(validIds) : [];
const parts = sortedIds.map((id) => {
const ref = refMap[String(id)];
const noCite = ref ? citeMap[String(id)] : null;
const noTable =
useTableBracketNums && tableNums[String(id)] != null ? tableNums[String(id)] : null;
// 单元格内 [n] 按 Original ordertable 序号)匹配;角标展示与正文一致,优先用 citeMap 对应序号
const num =
noCite != null && noCite !== '' && !Number.isNaN(Number(noCite))
? String(noCite)
: noTable != null && noTable !== '' && !Number.isNaN(Number(noTable))
? String(noTable)
: null;
return { id, ref, num };
});
const numsForLabel = parts
.map((p) => p.num)
.filter((n) => n != null && n !== '')
.map(Number);
const label = numsForLabel.length > 0 ? this.formatCiteNumbers(numsForLabel) : '';
if (!label) {
ed.dom.remove(el);
return;
}
el.textContent = `[${label}]`;
el.style.display = '';
if (el.removeAttribute) el.removeAttribute('title');
ed.dom.setAttrib(el, 'data-cite-missing', null);
if (String(el.tagName || '').toLowerCase() === 'autocite') {
const doc = ed.getDoc();
const nu = doc.createElement('mycite');
nu.setAttribute('data-id', el.getAttribute('data-id') || '');
nu.setAttribute('contenteditable', 'false');
const st = el.getAttribute('style');
if (st) nu.setAttribute('style', st);
nu.textContent = el.textContent;
el.parentNode.replaceChild(nu, el);
}
});
this.padAutociteCaretPlaceholder(ed);
},
/** 段尾不可编辑节点后浏览器/TinyMCE 容易把后续输入新开 <p>,在引用后补零宽空格让光标留在同一段 */
padAutociteCaretPlaceholder(ed) {
const doc = ed.getDoc();
const body = doc.body;
if (!body) return;
body.querySelectorAll('mycite, autocite').forEach((el) => {
const next = el.nextSibling;
if (next === null) {
el.parentNode.appendChild(doc.createTextNode('\u200b'));
return;
}
if (next.nodeType === 3) {
if (next.textContent === '\u200b') return;
if (next.textContent === '') {
next.textContent = '\u200b';
}
}
});
},
insertAutocite(refIds) {
const ed = this.editorInstance;
if (!ed) return;
const ids = (Array.isArray(refIds) ? refIds : [refIds]).map(String);
const dataId = ids.join(',');
const escaped = dataId.replace(/"/g, '&quot;');
if (this._editingAutocite) {
this._editingAutocite.setAttribute('data-id', dataId);
this._editingAutocite = null;
ed.fire('change');
} else {
if (this._refBookmark) {
ed.selection.moveToBookmark(this._refBookmark);
}
ed.insertContent(`<mycite data-id="${escaped}" contenteditable="false"></mycite>&#8203;`);
}
this.renderAutociteInEditor(ed);
},
removeAutocite() {
const ed = this.editorInstance;
if (!ed || !this._editingAutocite) return;
ed.dom.remove(this._editingAutocite);
this._editingAutocite = null;
ed.fire('change');
},
/**
* 从当前编辑的 mycite 中去掉指定 p_refer_id去掉后无 id 则删除整段标签。
* ids 为空:删除整段(与 removeAutocite 一致)。
*/
stripAutociteIds(idsToRemove) {
const ed = this.editorInstance;
if (!ed || !this._editingAutocite) return;
const remove = new Set((idsToRemove || []).map((id) => String(id)));
const el = this._editingAutocite;
this._editingAutocite = null;
if (remove.size === 0) {
ed.dom.remove(el);
ed.fire('change');
return;
}
const parts = this.parseAutociteDataIds(el.getAttribute('data-id') || '');
const remaining = parts.filter((id) => !remove.has(String(id)));
if (remaining.length === 0) {
ed.dom.remove(el);
} else {
const sorted = this.sortAutociteIdsByCiteNumber(remaining);
el.setAttribute('data-id', sorted.join(','));
this.renderAutociteInEditor(ed);
}
ed.fire('change');
},
/** TinyMCE 会剔除「空」的行内标签;空 mycite 必须在入编辑器前占位,否则合并引用 [13] 等整段消失 */
normalizeAutociteHtmlForEditor(html) {
if (!html || typeof html !== 'string') return html;
// 历史库/表格里可能为 <autocite>,与 mycite 统一,否则 renderAutociteInEditor 扫不到、无效 id 会残留
let out = html.replace(/<\/autocite>/gi, '</mycite>').replace(/<autocite\b/gi, '<mycite');
/** 角标显示一律由 renderAutociteInEditor 根据 data-id 生成,禁止保留库内遗留的 [1-4]、[14] 等旧文案 */
out = out.replace(/<mycite([^>]*)>[\s\S]*?<\/mycite>/gi, '<mycite$1>&#8203;</mycite>');
// 外侧:连续空格 / &nbsp; 合并为单个 &nbsp;,避免「普通空格 + &nbsp;」叠成大缝
out = out.replace(/(?:\s|&nbsp;|&#160;)+(?=<mycite\b)/gi, '&nbsp;');
out = out.replace(/(?<=<\/mycite>)(?:\s|&nbsp;|&#160;)+/gi, '&nbsp;');
return out;
},
handleSetContent(val) {
if (!this.editorInstance) return;
let finalContent = val || '';
let finalContent = this.normalizeAutociteHtmlForEditor(val || '');
// 你的业务逻辑:自动包裹 <p> 标签
if (!finalContent.includes('wordTableHtml') && !finalContent.startsWith('<p>')) {
finalContent = '<p>' + finalContent + '</p>';
@@ -174,8 +832,11 @@ export default {
this.editorInstance.setContent(finalContent);
// 渲染数学公式
// SetContent 回调里会 renderAutociteInEditor再补一次 nextTick避免时序下仍显示库内旧 [1-4]
this.$nextTick(() => {
if (this.editorInstance) {
this.renderAutociteInEditor(this.editorInstance);
}
if (window.renderMathJax) {
window.renderMathJax(this.tinymceId);
}
@@ -320,7 +981,10 @@ export default {
},
getDetail(val) {
if (this.hasInit == true) {
this.$nextTick(() => window.tinymce.get(this.tinymceId).setContent(val));
this.$nextTick(() => {
const ed = window.tinymce.get(this.tinymceId);
if (ed) ed.setContent(this.normalizeAutociteHtmlForEditor(val || ''));
});
}
},
//将字符串添加到富文本编辑器中
@@ -431,7 +1095,7 @@ export default {
return new Blob([u8arr], { type: mime });
},
formatHtml(val) {
const rawValue = val || ''; // 处理 null
const rawValue = this.normalizeAutociteHtmlForEditor(val || ''); // 须先于 cleanEmptyTags否则空 mycite 被删
const cleanEmptyTags = /<([a-zA-Z1-6]+)\b[^>]*><\/\1>/g;
const replaceSpaces = /\s+(?=<)|(?<=>)\s+/g;
const removeBr = /<br\s*\/?>/gi; // 移除所有 br 标签
@@ -456,7 +1120,7 @@ export default {
}
},
getSafeContent(val) {
const rawValue = val || '';
const rawValue = this.normalizeAutociteHtmlForEditor(val || '');
const cleanEmptyTags = /<([a-zA-Z1-6]+)\b[^>]*><\/\1>/g;
const replaceSpaces = /\s+(?=<)|(?<=>)\s+/g;
@@ -497,9 +1161,10 @@ export default {
window.tinymce.init({
..._this.tinymceOtherInit,
trim_span_elements: false, // 禁止修剪内联标签周围的空格
extended_valid_elements: 'blue[*]',
custom_elements: 'blue',
valid_children: '+blue[#text|i|em|b|strong|span],+body[blue],+p[blue]',
extended_valid_elements: 'blue[*],mycite[*]',
/* ~ 前缀:按行内(类似 span处理否则默认当块级会拆段导致引用后强制换行 */
custom_elements: 'blue,~mycite',
valid_children: '+blue[#text|i|em|b|strong|span],+body[blue|mycite],+p[blue|mycite]',
inline: false, // 使用 iframe 模式
selector: `#${this.tinymceId}`,
@@ -509,7 +1174,7 @@ export default {
valid_elements:
this.type == 'table'
? '*[*]'
: `img[src|alt|width|height],strong,em,sub,sup,blue,table,b,i,myfigure,mytable,wmath${this.valid_elements}`, // 允许的标签和属性
: `img[src|alt|width|height],strong,em,sub,sup,blue,table,b,i,myfigure,mytable,wmath,mycite[data-id|contenteditable|data-cite-missing|style]${this.valid_elements}`, // 允许的标签和属性mycite 不使用 title 悬停)
// valid_elements: '*[*]', // 允许所有 HTML 标签
noneditable_editable_class: 'MathJax',
height: this.height,
@@ -541,6 +1206,34 @@ export default {
font-weight: bold !important;
}
/* inline 与 blue 引用一致,避免 inline-block 在行尾产生多余换行感 */
mycite {
display: inline;
vertical-align: baseline;
color: rgb(0, 130, 170);
// font-weight: bold;
cursor: pointer;
padding: 0 2px;
border-radius: 3px;
background-color: rgba(0, 130, 170, 0.08);
user-select: all;
font-size: 12px;
white-space: nowrap;
}
mycite:hover {
background-color: rgba(0, 130, 170, 0.2);
text-shadow: 0 0 3px rgba(0, 130, 170, 0.3);
}
mycite[data-cite-missing] {
background-color: rgba(0, 130, 170, 0.08) !important;
color: rgb(0, 130, 170) !important;
text-shadow: 0 0 3px rgba(0, 130, 170, 0.3);
box-shadow: none !important;
}
mycite[data-cite-missing]:hover {
background-color: rgba(0, 130, 170, 0.2) !important;
}
@keyframes blueGlow {
0%,
100% {
@@ -559,7 +1252,37 @@ export default {
},
body_class: 'panel-body ',
object_resizing: false,
toolbar: this.toolbar.length > 0 ? this.toolbar : toolbar,
toolbar: (function () {
const tb = _this.toolbar;
const hasCustom =
(Array.isArray(tb) && tb.length > 0) ||
(typeof tb === 'string' && tb.length > 0);
const refInsert = _this.showRefButton ? ' insertRef' : '';
/* 自动匹配 [n] 为角标:底部蓝色按钮,见模板 tinymce-autolink-footer */
/* 与 content.vue 默认一致;含 insertRef 由 showRefButton 控制 */
const defaultToolbar = [
`bold italic |customBlue removeBlue|LateX${refInsert}| myuppercase myuppercasea Line MoreSymbols|subscript superscript|clearButton|searchreplace`
];
if (!hasCustom) return defaultToolbar;
const rows = Array.isArray(tb) ? tb : [tb];
return rows.map((row) => {
if (typeof row !== 'string') return row;
let out = row;
if (!_this.showRefButton) {
out = out
.replace(/\binsertRef\b/g, '')
.replace(/\bautoLinkRefs\b/g, '')
.replace(/\|\s*\|/g, '|')
.replace(/\|\s*$/g, '')
.replace(/^\s*\|/g, '');
} else if (out.indexOf('insertRef') === -1) {
out = out
.replace(/\|LateX\|/g, '|LateX insertRef|')
.replace(/\|\s*LateX\s*\|/g, '| LateX insertRef |');
}
return out;
});
})(),
menubar: false, // 启用菜单栏并保持必要的项目
statusbar: false, // 关闭底部状态栏
custom_colors: false,
@@ -626,7 +1349,27 @@ export default {
let currentPasteImages = [];
_this.$commonJS.initEditorButton(_this, ed);
var currentWmathElement = null;
ed.ui.registry.addButton('insertRef', {
text: 'Reference',
tooltip: 'Insert Reference',
onAction: function () {
_this._refBookmark = ed.selection.getBookmark(2);
_this._editingAutocite = null;
_this.$emit('openRefSelector', { currentRefIds: [] });
}
});
ed.on('click', function (e) {
const autociteEl = e.target.closest('mycite') || e.target.closest('autocite');
if (autociteEl) {
const dataIds = _this.parseAutociteDataIds(autociteEl.getAttribute('data-id'));
_this._refBookmark = ed.selection.getBookmark(2);
_this._editingAutocite = autociteEl;
_this.$emit('openRefSelector', { currentRefIds: dataIds });
return;
}
const wmathElement = e.target.closest('wmath');
if (wmathElement) {
currentWmathElement = wmathElement; // 保存当前点击的元素
@@ -757,6 +1500,8 @@ export default {
subtree: true,
characterData: true
});
_this.mountAutoLinkFooterInsideEditor(ed);
});
// 定义自定义按钮
@@ -791,14 +1536,20 @@ export default {
const editorBody = ed.getBody();
ed.dom.select('wmath', editorBody).forEach(function (wmathElement) {
ed.dom.setAttrib(wmathElement, 'contenteditable', 'false');
// ed.dom.addClass(wmathElement, 'non-editable-wmath');
});
_this.renderAutociteInEditor(ed);
e.content = e.content.replace(/<strong>/g, '<b>').replace(/<\/strong>/g, '</b>');
e.content = e.content.replace(/<em>/g, '<i>').replace(/<\/em>/g, '</i>');
});
ed.on('GetContent', function (e) {
e.content = e.content.replace(/<b>/g, '<strong>').replace(/<\/b>/g, '</strong>');
e.content = e.content.replace(/<i>/g, '<em>').replace(/<\/i>/g, '</em>');
e.content = e.content.replace(/<i>/g, '<em>').replace(/<\/em>/g, '</em>');
e.content = e.content.replace(/<\/mycite>\s*&#8203;/gi, '</mycite>');
e.content = e.content.replace(/<\/mycite>\s*\u200b/g, '</mycite>');
e.content = e.content.replace(/<mycite([^>]*)>[^<]*<\/mycite>/gi, function (match, attrs) {
var clean = attrs.replace(/\s*style="[^"]*"/gi, '').replace(/\s*title="[^"]*"/gi, '').replace(/\s*contenteditable="[^"]*"/gi, '');
return '<mycite' + clean + '></mycite>';
});
});
},
paste_preprocess: function (plugin, args) {
@@ -958,13 +1709,15 @@ export default {
//销毁富文本
destroyTinymce() {
this.onClear();
this.restoreAutoLinkFooterDom();
if (window.tinymce.get(this.tinymceId)) {
window.tinymce.get(this.tinymceId).destroy();
}
},
//设置内容
setContent(value) {
window.tinymce.get(this.tinymceId).setContent(value);
const ed = window.tinymce.get(this.tinymceId);
if (ed) ed.setContent(this.normalizeAutociteHtmlForEditor(value || ''));
},
//获取内容
async getContent(type) {
@@ -973,7 +1726,8 @@ export default {
content = content.replace(/<span[^>]*>/g, '').replace(/<\/span>/g, ''); // 去除span标签
content = content.replace(/<strong>/g, '<b>').replace(/<\/strong>/g, '</b>');
content = content.replace(/<em>/g, '<i>').replace(/<\/em>/g, '</i>');
content = content.replace(/&nbsp;/g, ' '); // 将所有 &nbsp; 替换为空格
content = content.replace(/&nbsp;/g, ' '); // 先统一为空格
content = this.normalizeAutociteHtmlForEditor(content); // mycite 两侧水平空白以 &nbsp; 存库(与入编辑器一致)
this.$emit('getContent', type, content);
},
@@ -1058,6 +1812,26 @@ export default {
};
</script>
<style scoped>
.tinymce-editor-surface {
width: 100%;
}
.tinymce-autolink-footer {
display: flex;
justify-content: flex-end;
align-items: center;
padding-top: 8px;
margin-top: 4px;
border-top: 1px solid #ebeef5;
}
/* 移入 .tox-tinymce 内部后:贴编辑区下沿、与编辑器同宽同框 */
::v-deep .tox-tinymce > .tinymce-autolink-footer {
margin-top: 0;
padding: 0px 10px;
box-sizing: border-box;
border-top: 1px solid #dcdfe6;
background: #fafafa;
flex-shrink: 0;
}
::v-deep .tox-tinymce-aux {
z-index: 9999 !important;
}

View File

@@ -17,11 +17,14 @@
:selectedTemplateName="selectedTemplateName"
:selectedStyleName="selectedStyleName"
:availableFields="availableFields"
:availableCountries="availableCountries"
:fieldsLoading="fieldsLoading"
:fieldsSaving="fieldsSaving"
:selectedFieldIds.sync="selectedFieldIdsProxy"
:selectedCountryIds.sync="selectedCountryIdsProxy"
@open-template-selector="emitOpenTemplateSelector"
@confirm-fields="emitConfirmFields"
@confirm-countries="emitConfirmCountries"
@update:wizardStartDate="onWizardStartDateUpdate"
/>
@@ -49,11 +52,14 @@
:selectedTemplateName="selectedTemplateName"
:selectedStyleName="selectedStyleName"
:availableFields="availableFields"
:availableCountries="availableCountries"
:fieldsLoading="fieldsLoading"
:fieldsSaving="fieldsSaving"
:selectedFieldIds.sync="selectedFieldIdsProxy"
:selectedCountryIds.sync="selectedCountryIdsProxy"
@open-template-selector="emitOpenTemplateSelector"
@confirm-fields="emitConfirmFields"
@confirm-countries="emitConfirmCountries"
@update:wizardStartDate="onWizardStartDateUpdate"
/>
<div class="dialog-footer">
@@ -89,9 +95,11 @@ export default {
selectedStyleName: { type: String, default: '' },
saving: { type: Boolean, default: false },
availableFields: { type: Array, default: () => [] },
availableCountries: { type: Array, default: () => [] },
fieldsLoading: { type: Boolean, default: false },
fieldsSaving: { type: Boolean, default: false },
selectedFieldIds: { type: Array, default: () => [] }
selectedFieldIds: { type: Array, default: () => [] },
selectedCountryIds: { type: Array, default: () => [] }
},
computed: {
dialogVisible: {
@@ -118,6 +126,14 @@ export default {
this.$emit('update:selectedFieldIds', val);
}
},
selectedCountryIdsProxy: {
get() {
return this.selectedCountryIds;
},
set(val) {
this.$emit('update:selectedCountryIds', val);
}
},
canConfirm() {
const id = this.config && this.config.defaultTemplateId != null ? String(this.config.defaultTemplateId) : '';
return id !== '' && id !== '0';
@@ -130,6 +146,9 @@ export default {
emitConfirmFields() {
this.$emit('confirm-fields');
},
emitConfirmCountries() {
this.$emit('confirm-countries');
},
onWizardStartDateUpdate(val) {
// 由内容组件回传日期,继续走父组件的 .sync 链路
this.wizardStartDateProxy = val;

View File

@@ -103,7 +103,44 @@
<section class="form-section">
<h4 class="section-title">
<i class="el-icon-finished"></i> 3. {{ $t('autoPromotion.confirmAndEnable') }}
<i class="el-icon-location-outline"></i> 3. {{ $t('autoPromotion.selectPromotionCountry') }}
<!-- <span class="selected-count">
{{ $t('autoPromotion.selectedCount', { count: selectedCountryIdsProxy.length }) }}
</span> -->
<!-- <el-button
size="small"
type="primary"
plain
icon="el-icon-edit-outline"
class="section-action-btn"
@click="countryDialogVisible = true"
>
{{ $t('autoPromotion.choosePromotionCountry') }}
</el-button> -->
</h4>
<div class="status-confirm-box">
<div class="country-quick-checks">
<div class="field-tip" style="margin-bottom: 10px;">{{ $t('autoPromotion.selectPromotionCountryTip') }}</div>
<el-checkbox-group v-model="selectedCountryIdsProxy" size="small">
<el-checkbox label="Partition1">{{ $t('autoPromotion.countryQuickZone1') }}</el-checkbox>
<el-checkbox label="Partition2">{{ $t('autoPromotion.countryQuickZone2') }}</el-checkbox>
<el-checkbox label="Partition3">{{ $t('autoPromotion.countryQuickZone3') }}</el-checkbox>
<el-checkbox label="country_china" value="239">{{ $t('autoPromotion.countryQuickChina') }}</el-checkbox>
<el-checkbox label="country_india" value="228">{{ $t('autoPromotion.countryQuickIndia') }}</el-checkbox>
</el-checkbox-group>
</div>
<!-- <div v-if="selectedCountryTagRows.length" class="selected-tags">
<el-tag v-for="row in selectedCountryTagRows" :key="'c-' + row.id" size="mini" type="info" effect="plain">{{ row.text }}</el-tag>
</div> -->
</div>
</section>
<el-divider></el-divider>
<section class="form-section">
<h4 class="section-title">
<i class="el-icon-finished"></i> 4. {{ $t('autoPromotion.confirmAndEnable') }}
</h4>
<div class="status-confirm-box">
@@ -150,6 +187,41 @@
<el-button size="small" type="primary" :loading="fieldsSaving" @click="emitConfirmFields">{{ $t('autoPromotion.confirm') }}</el-button>
</span>
</el-dialog>
<el-dialog
:title="$t('autoPromotion.selectPromotionCountry')"
:visible.sync="countryDialogVisible"
width="1200px"
append-to-body
:close-on-click-modal="false"
>
<div class="field-dialog-toolbar">
<el-input
v-model="countrySearchText"
size="small"
clearable
class="field-search-input"
prefix-icon="el-icon-search"
:placeholder="$t('autoPromotion.countrySearchPlaceholder')"
/>
<el-button size="mini" @click="selectAllCountries">{{ $t('autoPromotion.selectAll') }}</el-button>
<el-button size="mini" @click="clearAllCountries">{{ $t('autoPromotion.clearAll') }}</el-button>
</div>
<div class="field-dialog-body" v-loading="fieldsLoading">
<el-checkbox-group v-model="selectedCountryIdsProxy" class="field-check-group">
<el-checkbox v-for="c in sortedFilteredCountries" :key="'country-' + String(c.id)" :label="String(c.id)">
{{ c.label }}
</el-checkbox>
</el-checkbox-group>
<div v-if="!fieldsLoading && sortedFilteredCountries.length === 0" class="field-empty-tip">
{{ $t('autoPromotion.noCountryMatch') }}
</div>
</div>
<span slot="footer">
<el-button size="small" @click="countryDialogVisible = false">{{ $t('autoPromotion.cancel') }}</el-button>
<el-button size="small" type="primary" :loading="fieldsSaving" @click="emitConfirmCountries">{{ $t('autoPromotion.confirm') }}</el-button>
</span>
</el-dialog>
</div>
</template>
@@ -159,7 +231,9 @@ export default {
data() {
return {
fieldSearchText: '',
fieldDialogVisible: false
fieldDialogVisible: false,
countrySearchText: '',
countryDialogVisible: false
};
},
props: {
@@ -170,9 +244,11 @@ export default {
selectedTemplateName: { type: String, default: '' },
selectedStyleName: { type: String, default: '' },
availableFields: { type: Array, default: () => [] },
availableCountries: { type: Array, default: () => [] },
fieldsLoading: { type: Boolean, default: false },
fieldsSaving: { type: Boolean, default: false },
selectedFieldIds: { type: Array, default: () => [] }
selectedFieldIds: { type: Array, default: () => [] },
selectedCountryIds: { type: Array, default: () => [] }
},
computed: {
hasSelectedTemplate() {
@@ -190,11 +266,52 @@ export default {
this.$emit('update:selectedFieldIds', val);
}
},
selectedCountryIdsProxy: {
get() {
return this.selectedCountryIds;
},
set(val) {
this.$emit('update:selectedCountryIds', val);
}
},
sortedFilteredFields() {
const kw = (this.fieldSearchText || '').trim().toLowerCase();
const list = (this.availableFields || []).filter((item) => {
if (!kw) return true;
return String(item.label || '').toLowerCase().includes(kw);
const kwRaw = String(this.fieldSearchText || '');
const normalize = (s) =>
String(s || '')
.trim()
.replace(/\s+/g, ' ')
.toLowerCase();
const tokens = kwRaw
? kwRaw
.split(/[\r\n,;]+/g)
.map((s) => normalize(s))
.filter(Boolean)
: [];
const list = (this.availableFields || []).filter((item) => {
if (!tokens.length) return true;
const label = normalize(item.label || '');
// 严格匹配:必须与字段名完全一致(忽略大小写与空白差异)
return tokens.some((t) => t === label);
});
return list.slice().sort((a, b) => String(a.label || '').localeCompare(String(b.label || '')));
},
sortedFilteredCountries() {
const kwRaw = String(this.countrySearchText || '');
const normalize = (s) =>
String(s || '')
.trim()
.replace(/\s+/g, ' ')
.toLowerCase();
const tokens = kwRaw
? kwRaw
.split(/[\r\n,;]+/g)
.map((s) => normalize(s))
.filter(Boolean)
: [];
const list = (this.availableCountries || []).filter((item) => {
if (!tokens.length) return true;
const label = normalize(item.label || '');
return tokens.some((t) => t === label);
});
return list.slice().sort((a, b) => String(a.label || '').localeCompare(String(b.label || '')));
},
@@ -204,6 +321,30 @@ export default {
return (this.selectedFieldIdsProxy || [])
.map((id) => map[String(id)])
.filter(Boolean);
},
selectedCountryTagRows() {
const map = {};
(this.availableCountries || []).forEach((i) => {
map[String(i.id)] = i.label;
});
const quick = {
zone_1: this.$t('autoPromotion.countryQuickZone1'),
zone_2: this.$t('autoPromotion.countryQuickZone2'),
zone_3: this.$t('autoPromotion.countryQuickZone3'),
country_china: this.$t('autoPromotion.countryQuickChina'),
country_india: this.$t('autoPromotion.countryQuickIndia')
};
return (this.selectedCountryIdsProxy || []).map((id) => {
const sid = String(id);
const fromList = map[sid];
const text =
fromList != null && fromList !== ''
? fromList
: quick[sid] != null
? quick[sid]
: sid;
return { id: sid, text };
});
}
},
methods: {
@@ -219,6 +360,16 @@ export default {
emitConfirmFields() {
this.$emit('confirm-fields');
this.fieldDialogVisible = false;
},
selectAllCountries() {
this.selectedCountryIdsProxy = (this.availableCountries || []).map((c) => String(c.id));
},
clearAllCountries() {
this.selectedCountryIdsProxy = [];
},
emitConfirmCountries() {
this.$emit('confirm-countries');
this.countryDialogVisible = false;
}
}
};
@@ -567,5 +718,17 @@ export default {
font-size: 12px;
color: #909399;
}
.country-quick-checks {
margin-bottom: 12px;
}
.country-quick-checks >>> .el-checkbox-group {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 12px 20px;
}
.country-quick-checks >>> .el-checkbox {
margin-right: 0;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -5,6 +5,7 @@
:close-on-click-modal="false"
width="90%"
top="5vh"
append-to-body
destroy-on-close
:before-close="handleClose"
custom-class="template-modal"

View File

@@ -5,22 +5,22 @@
<slot name="title"></slot>
</div>
<div class="header-actions">
<button type="button" @click="openPreview(false)" class="preview-trigger-btn">
<!-- <button type="button" @click="openPreview(false)" class="preview-trigger-btn">
<i class="icon-eye"></i> {{ $t('tmrEmailEditor.preview') }}
</button>
</button> -->
<button type="button" @click="openPreview(true)" class="preview-trigger-btn preview-with-vars-btn">
<i class="icon-eye"></i> {{ $t('tmrEmailEditor.previewWithVariables') }}
</button>
</div>
</div>
<textarea
<!-- <textarea
ref="editorRef"
class="tmr-textarea"
:value="plainText"
@input="handleInput"
:placeholder="resolvedPlaceholder"
></textarea>
></textarea> -->
<transition name="fade">
<div v-if="showModal" class="tmr-modal-mask" @click.self="closePreviewModal">
@@ -62,6 +62,10 @@ export default {
default: ''
},
language: {
type: String,
default: 'en'
},
placeholder: {
type: String,
default: ''
@@ -87,13 +91,29 @@ export default {
expert_name: "John Doe", // 专家姓名
expert_field: "Biomedical Engineering", // 专家研究领域
representative_work_title: "Advanced Applications of AI in Medical Imaging", // 专家代表作标题
// ai_content_analysis: "", // AI 约稿理由分析
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
}
}
},
computed: {
isZhLanguage() {
return String(this.language || '').toLowerCase() === 'zh';
},
localizedAiMockData() {
if (this.isZhLanguage) {
return {
ai_content_analysis: '【AI分析这篇文章一句话总结】。【我们希望也关注个领域】',
ai_advised_topics: '我们尤其关注如【方向/题目建议1】、【方向/题目建议2】以及【方向/题目建议3】等相关议题的研究进展。'
};
}
return {
ai_content_analysis: '【AI分析文章一句话总结】',
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.'
};
},
resolvedPlaceholder() {
return this.placeholder || (this.$t && this.$t('tmrEmailEditor.placeholder')) || '请输入邮件内容...';
},
@@ -141,6 +161,7 @@ const deadlineStr = oneMonthLater.toISOString().split('T')[0];
const map = {
...this.variableMockData,
...this.localizedAiMockData,
journal_abbr: journal_info.jabbr, // 期刊缩写
journal_name: journal_info.title,// 期刊全称
journal_url: journal_info.website, // 期刊官网链接

View File

@@ -58,9 +58,25 @@
<script>
import { TableUtils } from '@/common/js/TableUtils';
import { mediaUrl } from '@/common/js/commonJS.js';
import {
buildCiteMapFromRefs,
applyCiteLabelsToTableRows
} from '@/common/js/citeTablePreview.js';
export default {
name: 'TablePreviewer',
props: {
/** 与稿面 chanFerForm 一致,用于把单元格内 <mycite> 显示为 [n] */
referenceList: {
type: Array,
default: () => []
},
/** 正文引用首次出现顺序p_refer_id与 GenerateCharts articleCiteIdOrder 一致 */
bodyCiteIdOrder: {
type: Array,
default: () => []
}
},
data() {
return {
visible: false,
@@ -70,23 +86,32 @@ export default {
mediaUrl,
};
},
computed: {
previewCiteMap() {
return buildCiteMapFromRefs(this.referenceList, this.bodyCiteIdOrder);
}
},
methods: {
async open(type, item,isNoBg) {
async open(type, item, isNoBg) {
this.visible = true;
this.type = type;
const hideOddRowBg = isNoBg === true || isNoBg === 'true' || isNoBg === 1 || isNoBg === '1';
if (type === 'table') {
this.loading = true;
setTimeout(() => {
try {
const processed = this.processTableData(item.table);
const processed = this.processTableData(item.table, {
refs: this.referenceList,
citeMap: this.previewCiteMap
});
this.processedItem = Object.freeze({
...item,
table: {
...item.table,
tableHeader: processed.tableHeader,
tableContent: processed.tableContent,
oddRowIds: isNoBg ? [] : processed.oddRowIds
oddRowIds: hideOddRowBg ? [] : processed.oddRowIds
}
});
} catch (err) {
@@ -97,6 +122,7 @@ export default {
}, 50);
} else {
this.processedItem = item;
}
// 数学公式渲染
@@ -105,12 +131,20 @@ export default {
}, 500);
},
processTableData(rawContent) {
processTableData(rawContent, citeCtx) {
try {
const tableList = typeof rawContent === 'string' ? JSON.parse(rawContent) : rawContent;
const { header, content } = TableUtils.splitTable(tableList);
const { rowData, rowIds } = TableUtils.addRowIdToData(content);
return { tableHeader: header, tableContent: rowData, oddRowIds: rowIds };
const refs = citeCtx && citeCtx.refs;
const citeMap = citeCtx && citeCtx.citeMap;
let tableHeader = header;
let tableContent = rowData;
if (Array.isArray(refs) && refs.length > 0 && citeMap && typeof citeMap === 'object') {
tableHeader = applyCiteLabelsToTableRows(header, refs, citeMap);
tableContent = applyCiteLabelsToTableRows(rowData, refs, citeMap);
}
return { tableHeader, tableContent, oddRowIds: rowIds };
} catch (e) {
return { tableHeader: [], tableContent: [], oddRowIds: [] };
}
@@ -238,6 +272,16 @@ export default {
background: rgb(250, 231, 232) !important;
}
/* 与稿面 mycite 引用样式一致,弹窗内可见 [n] */
.table_Box ::v-deep mycite {
display: inline;
vertical-align: baseline;
color: rgb(0, 130, 170) !important;
cursor: inherit;
text-decoration: none;
background-color: rgba(0, 130, 170, 0.08);
}
.table-fade-enter-active, .table-fade-leave-active { transition: opacity 0.3s ease; }
.table-fade-enter, .table-fade-leave-to { opacity: 0; }
</style>

View File

@@ -10,13 +10,19 @@
ref="tinymceChild1"
:wordStyle="wordStyle"
:isAutomaticUpdate="isAutomaticUpdate"
:showRefButton="showRefButton"
@getContent="getContent"
@openLatexEditor="openLatexEditor"
@openRefSelector="openRefSelector"
@updateChange="updateChange"
@input="onTinymceInput"
:value="value"
:chanFerForm="chanFerForm"
:bodyCiteIdOrder="bodyCiteIdOrder"
:tableLinkCiteMaxMap="tableLinkCiteMaxMap"
:typesettingType="typesettingType"
class="paste-area text-container"
:toolbar="!isAutomaticUpdate?['bold italic |customBlue removeBlue|LateX| myuppercase myuppercasea Line MoreSymbols|subscript superscript|clearButton|searchreplace']:['bold italic |customBlue removeBlue| myuppercase myuppercasea Line MoreSymbols|subscript superscript|clearButton|searchreplace']"
:toolbar="toolbarConfig"
style="
/* white-space: pre-line; */
line-height: 12px;
@@ -36,10 +42,40 @@
<script>
import Tinymce from '@/components/page/components/Tinymce';
export default {
props: ['value','isAutomaticUpdate','height','id'],
props: {
value: {},
isAutomaticUpdate: {},
height: {},
id: {},
chanFerForm: {},
/** 全文 mycite 顺序,与稿面 word.vue 的 bodyCiteIdOrder 一致,用于弹窗内 [1][2] 与参考文献重排 */
bodyCiteIdOrder: {
type: Array,
default: () => []
},
/** mytable(data-id) 对应表格内已出现引用的最大全局序号,用于正文中 “See Table X. And see [2,3]” 的偏移映射 */
tableLinkCiteMaxMap: {
type: Object,
default: () => ({})
},
/** false标题等场景不显示 Ref */
showRefButton: {
type: Boolean,
default: true
}
},
components: {
Tinymce
},
computed: {
toolbarConfig() {
const refBtn = this.showRefButton ? ' insertRef' : '';
if (!this.isAutomaticUpdate) {
return [`bold italic |customBlue removeBlue|LateX${refBtn}| myuppercase myuppercasea Line MoreSymbols|subscript superscript|clearButton|searchreplace`];
}
return [`bold italic |customBlue removeBlue${refBtn}| myuppercase myuppercasea Line MoreSymbols|subscript superscript|clearButton|searchreplace`];
}
},
watch: {
lineStyle() {}
},
@@ -85,8 +121,40 @@ export default {
this.$refs.tinymceChild1.getContent(type);
},
getContent(type, content) {
this.$emit('getContent', type, content);
},
openRefSelector(data) {
this.$emit('openRefSelector', data);
},
onTinymceInput(html) {
this.$emit('editorInput', html);
},
insertAutocite(refId) {
this.$refs.tinymceChild1.insertAutocite(refId);
},
removeAutocite() {
this.$refs.tinymceChild1.removeAutocite();
},
/** 从当前 mycite 的 data-id 中移除指定 id无剩余则删标签未选 id 时删整段 */
stripAutociteIds(ids) {
if (this.$refs.tinymceChild1 && typeof this.$refs.tinymceChild1.stripAutociteIds === 'function') {
this.$refs.tinymceChild1.stripAutociteIds(ids);
}
},
/** 参考文献异步到达后刷新编辑器内 mycite 数字(供父组件在打开弹窗 / fetch 完成后调用) */
refreshAutociteDisplay() {
const t = this.$refs.tinymceChild1;
if (t && typeof t.renderAutociteInEditor === 'function' && t.editorInstance) {
t.renderAutociteInEditor(t.editorInstance);
}
},
/** 将正文中的 [1]、[13] 等按全局序号匹配为 <mycite> */
convertBracketRefsToAutocite() {
const t = this.$refs.tinymceChild1;
if (t && typeof t.convertPlainBracketCitesToAutocite === 'function') {
return t.convertPlainBracketCitesToAutocite();
}
return { replaced: 0 };
}
}
};

View File

@@ -2,11 +2,17 @@
<div>
<tinymce
type="table"
:use-table-local-citation-index="true"
:articleId="articleId"
ref="tinymceChild1"
:wordStyle="wordStyle"
:show-ref-button="showRefButton"
:chanFerForm="chanFerForm"
:bodyCiteIdOrder="bodyCiteIdOrder"
@getContent="getContent"
@openLatexEditor="openLatexEditor"
@openRefSelector="$emit('openRefSelector', $event)"
@input="onTableEditorInput"
:height="calcDynamicWidth()"
:value="updatedHtml"
:typesettingType="typesettingType"
@@ -22,7 +28,24 @@
<script>
import Tinymce from '@/components/page/components/Tinymce';
export default {
props: ['lineStyle', 'articleId'],
props: {
lineStyle: {},
articleId: {},
/** 与稿面/段落编辑一致,供 Ref 插入;未传时 TinyMCE 内为空会提示「参考文献尚未加载」 */
chanFerForm: {
type: Array,
default: () => []
},
bodyCiteIdOrder: {
type: Array,
default: () => []
},
/** 与 content.vue 一致:为 true 时显示 Reference、Auto-link References稿面表格编辑需文献角标时保持 true */
showRefButton: {
type: Boolean,
default: true
}
},
components: {
Tinymce
},
@@ -91,6 +114,9 @@ export default {
}
},
methods: {
onTableEditorInput(html) {
this.$emit('editorInput', html);
},
openLatexEditor(data) {
this.$emit('openLatexEditor', data);
},
@@ -121,6 +147,22 @@ export default {
} else {
this.$emit('getContent', type, { html_data: '', table: [] });
}
},
insertAutocite(refIds) {
if (this.$refs.tinymceChild1 && typeof this.$refs.tinymceChild1.insertAutocite === 'function') {
this.$refs.tinymceChild1.insertAutocite(refIds);
}
},
stripAutociteIds(ids) {
if (this.$refs.tinymceChild1 && typeof this.$refs.tinymceChild1.stripAutociteIds === 'function') {
this.$refs.tinymceChild1.stripAutociteIds(ids);
}
},
refreshAutociteDisplay() {
const t = this.$refs.tinymceChild1;
if (t && typeof t.renderAutociteInEditor === 'function' && t.editorInstance) {
t.renderAutociteInEditor(t.editorInstance);
}
}
}
};

File diff suppressed because it is too large Load Diff

View File

@@ -252,10 +252,11 @@
</ul>
</div>
<DynamicTable
ref="myTableModal"
/>
<DynamicTable
ref="myTableModal"
:reference-list="chanFerForm || []"
:body-cite-id-order="bodyCiteIdOrder || []"
/>
</div>
</template>
@@ -264,7 +265,18 @@
import { mediaUrl } from '@/common/js/commonJS.js'; // 引入通用逻辑
import DynamicTable from './DynamicTable.vue';
export default {
props: ['articleId', 'imgWidth', 'imgHeight', 'scale', 'isEdit', 'isShowEdit', 'urlList', 'content'],
props: [
'articleId',
'imgWidth',
'imgHeight',
'scale',
'isEdit',
'isShowEdit',
'urlList',
'content',
'chanFerForm',
'bodyCiteIdOrder'
],
data() {
return {
identity: localStorage.getItem('U_role'),

View File

@@ -464,10 +464,11 @@
</li>
</ul>
</div>
<DynamicTable
ref="myTableModal"
/>
<DynamicTable
ref="myTableModal"
:reference-list="chanFerForm || []"
:body-cite-id-order="bodyCiteIdOrder || []"
/>
</div>
</template>
@@ -476,7 +477,20 @@ import DynamicTable from './DynamicTable.vue';
import { mediaUrl } from '@/common/js/commonJS.js'; // 引入通用逻辑
export default {
props: ['articleId', 'imgWidth', 'imgHeight', 'scale', 'isEdit', 'isShowEdit', 'urlList', 'content'],
props: [
'articleId',
'imgWidth',
'imgHeight',
'scale',
'isEdit',
'isShowEdit',
'urlList',
'content',
/** 参考文献列表,供表格预览把 mycite 显示为 [n] */
'chanFerForm',
/** 正文引用顺序,与稿面 articleCiteIdOrder 一致 */
'bodyCiteIdOrder'
],
data() {
return {
isShowComment: false,

View File

@@ -0,0 +1,932 @@
<template>
<div class="country-manage">
<div class="crumbs">
<el-breadcrumb separator="/">
<el-breadcrumb-item> <i class="el-icon-place"></i> {{ $t('countryManagement.title') }}</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="toolbar">
<el-form :inline="true" :model="query" size="small">
<el-form-item>
<el-input
v-model="query.keyword"
clearable
:placeholder="$t('countryManagement.keywordPlaceholder')"
style="width: 260px"
/>
</el-form-item>
<el-form-item>
<el-select
v-model="query.partition"
clearable
:placeholder="$t('countryManagement.partitionAll')"
style="width: 140px"
@change="onPartitionChange"
>
<el-option :label="$t('countryManagement.partitionAll')" value="" />
<el-option :label="$t('countryManagement.partition1')" value="1" />
<el-option :label="$t('countryManagement.partition2')" value="2" />
<el-option :label="$t('countryManagement.partition3')" value="3" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" :loading="loading" @click="handleSearch">
{{ $t('countryManagement.searchBtn') }}
</el-button>
<el-button @click="handleReset">{{ $t('countryManagement.resetBtn') }}</el-button>
<!-- 批量修改分区按钮 -->
<!-- <el-button type="warning" plain icon="el-icon-upload2" @click="openBatchPartitionDialog">
{{ $t('countryManagement.batchPartitionBtn') }}
</el-button> -->
</el-form-item>
</el-form>
</div>
<el-card shadow="never" class="table-card">
<el-table :data="list" border stripe v-loading="loading" header-row-class-name="dark-table-header">
<el-table-column type="index" :label="$t('countryManagement.table.no')" width="70" align="center" />
<el-table-column prop="zh_name" :label="$t('countryManagement.table.zhName')" min-width="140" show-overflow-tooltip />
<el-table-column prop="en_name" :label="$t('countryManagement.table.enName')" min-width="160" show-overflow-tooltip />
<el-table-column prop="code" :label="$t('countryManagement.table.code')" width="100" align="center" />
<el-table-column prop="partition" :label="$t('countryManagement.table.partition')" width="100" align="center" />
<el-table-column :label="$t('countryManagement.table.actions')" width="220" align="center" fixed="right">
<template slot-scope="scope">
<div class="table-row-actions">
<el-button
type="primary"
plain
size="mini"
icon="el-icon-edit"
class="action-btn action-btn--edit"
@click="openEdit(scope.row)"
>
{{ $t('countryManagement.edit') }}
</el-button>
<el-button
type="danger"
plain
size="mini"
icon="el-icon-delete"
class="action-btn action-btn--delete"
@click="handleDelete(scope.row)"
>
{{ $t('countryManagement.delete') }}
</el-button>
</div>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination
background
layout="total, sizes, prev, pager, next, jumper"
:current-page="query.page"
:page-size="query.per_page"
:page-sizes="[20, 50, 100]"
:total="total"
@size-change="handleSizeChange"
@current-change="handlePageChange"
/>
</div>
</el-card>
<el-dialog
:title="$t('countryManagement.editTitle')"
:visible.sync="editVisible"
width="580px"
append-to-body
destroy-on-close
@closed="resetForm"
>
<el-form ref="editForm" :model="form" :rules="rules" label-width="150px" size="small" class="country-edit-form">
<el-form-item :label="$t('countryManagement.form.zhName')" prop="zh_name">
<el-input v-model="form.zh_name" />
</el-form-item>
<el-form-item :label="$t('countryManagement.form.enName')" prop="en_name">
<el-input v-model="form.en_name" />
</el-form-item>
<el-form-item :label="$t('countryManagement.form.code')" prop="code">
<el-input v-model="form.code" />
</el-form-item>
<el-form-item :label="$t('countryManagement.form.partition')" prop="partition">
<el-select v-model="form.partition" style="width: 100%">
<el-option :label="$t('countryManagement.partition1')" value="1" />
<el-option :label="$t('countryManagement.partition2')" value="2" />
<el-option :label="$t('countryManagement.partition3')" value="3" />
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="editVisible = false">{{ $t('countryManagement.cancel') }}</el-button>
<el-button type="primary" :loading="saveLoading" @click="submitEdit">{{ $t('countryManagement.save') }}</el-button>
</span>
</el-dialog>
<el-dialog
:title="$t('countryManagement.batchPartitionTitle')"
:visible.sync="batchPartitionVisible"
width="80vw"
append-to-body
destroy-on-close
@closed="resetBatchPartitionDialog"
>
<div style="display: flex; align-items: center; justify-content: space-between">
<div class="batch-partition-content" style="width: 100%">
<el-form label-width="120px" size="small" class="batch-partition-target-form">
<el-form-item :label="$t('countryManagement.batchPartitionTargetLabel')">
<el-select
v-model="batchPartitionTargetPartition"
style="width: 220px"
@change="handleBatchPartitionDraftChange"
>
<el-option :label="$t('countryManagement.partition1')" value="1" />
<el-option :label="$t('countryManagement.partition2')" value="2" />
<el-option :label="$t('countryManagement.partition3')" value="3" />
</el-select>
</el-form-item>
</el-form>
<p class="batch-partition-help">{{ $t('countryManagement.batchPartitionHelp') }}</p>
<el-input
v-model="batchPartitionInput"
type="textarea"
:rows="20"
:placeholder="$t('countryManagement.batchPartitionPlaceholder')"
@input="handleBatchPartitionDraftChange"
/>
<div class="batch-partition-actions">
<el-button type="primary" plain :loading="batchPartitionPreviewLoading" @click="previewBatchPartition">
{{ $t('countryManagement.batchPartitionPreview') }}
</el-button>
<el-button
v-if="batchPartitionToApplyBaseRows.length > 0"
type="success"
:loading="batchPartitionApplyLoading"
:disabled="!batchPartitionPreviewRows.length"
@click="applyBatchPartition"
>
{{ $t('countryManagement.batchPartitionApply') }}
</el-button>
</div>
</div>
<div v-if="batchPartitionStats.input > 0" class="batch-partition-summary-container" style="margin-left: 20px">
<div v-if="batchPartitionStats.input > 0" class="batch-partition-summary">
{{
$t('countryManagement.batchPartitionSummaryLine', {
input: String(batchPartitionStats.input),
matched: String(batchPartitionStats.matched),
miss: String(batchPartitionStats.miss),
same: String(batchPartitionStats.skipSame),
will: String(batchPartitionStats.willUpdate)
})
}}
</div>
<p v-if="batchPartitionPreviewRows.length" class="batch-partition-selection-hint">
{{ $t('countryManagement.batchPartitionSelectionHint') }}
</p>
<el-table
v-if="batchPartitionPreviewRows.length"
:data="batchPartitionFilteredPreviewRows"
border
stripe
size="small"
max-height="400"
class="batch-partition-table"
:row-class-name="batchPartitionRowClassName"
>
<el-table-column type="index" :label="$t('countryManagement.table.no')" width="64" align="center" />
<el-table-column
prop="key"
:label="$t('countryManagement.batchPartitionColKey')"
min-width="120"
show-overflow-tooltip
/>
<el-table-column prop="country_id" :label="$t('countryManagement.batchPartitionColId')" width="90" align="center" />
<el-table-column
prop="en_name"
:label="$t('countryManagement.batchPartitionColName')"
min-width="140"
show-overflow-tooltip
/>
<el-table-column :label="$t('countryManagement.batchPartitionColCurrentPartition')" width="140" align="center">
<template slot-scope="scope">
<span :class="['partition-chip', scope.row.status === 'diff' ? 'partition-chip--warn' : '']">
{{ scope.row.currentPartition || '—' }}
</span>
</template>
</el-table-column>
<el-table-column :label="$t('countryManagement.batchPartitionColMatch')" width="150" align="center">
<template slot-scope="scope">
<span
:class="[
'match-chip',
scope.row.status === 'not_found'
? 'match-chip--danger'
: scope.row.status === 'diff'
? 'match-chip--warn'
: 'match-chip--ok'
]"
>
{{ scope.row.matchLabel }}
</span>
</template>
</el-table-column>
</el-table>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'countryManagement',
data() {
return {
query: {
keyword: '',
partition: '',
page: 1,
per_page: 20
},
list: [],
total: 0,
loading: false,
editVisible: false,
saveLoading: false,
form: {
country_id: '',
zh_name: '',
en_name: '',
code: '',
partition: '1'
},
rules: {},
batchPartitionVisible: false,
batchPartitionTargetPartition: '1',
batchPartitionInput: '',
batchPartitionPreviewRows: [],
batchPartitionPreviewLoading: false,
batchPartitionApplyLoading: false,
batchPartitionAllRows: [],
/** 预览后的统计:录入、匹配、将更新等 */
batchPartitionStats: {
input: 0,
matched: 0,
miss: 0,
skipSame: 0,
willUpdate: 0
},
/** 预览表筛选关键词(分号、逗号、换行分隔多词) */
batchPartitionTableFilter: '',
/** none未勾选视为提交全部可更新行explicit仅提交已勾选 */
batchPartitionSelectionMode: 'none',
batchPartitionSelectedIds: []
};
},
computed: {
batchPartitionFilteredPreviewRows() {
const rows = this.batchPartitionPreviewRows || [];
const tokens = this.batchPartitionFilterTokens(this.batchPartitionTableFilter);
if (!tokens.length) return rows;
return rows.filter((r) => this.batchPartitionRowMatchesTokens(r, tokens));
},
batchPartitionToApplyBaseRows() {
return (this.batchPartitionPreviewRows || []).filter(
(r) => r._row && String(r._row.partition != null ? r._row.partition : '') !== String(r.partition)
);
},
batchPartitionEffectiveToApplyRows() {
const base = this.batchPartitionToApplyBaseRows;
if (this.batchPartitionSelectionMode === 'none') return base;
const ids = new Set((this.batchPartitionSelectedIds || []).map(String));
return base.filter((r) => ids.has(this.countryRowId(r._row)));
}
},
created() {
this.rules = {
zh_name: [{ required: true, message: this.$t('countryManagement.ruleZhName'), trigger: 'blur' }],
en_name: [{ required: true, message: this.$t('countryManagement.ruleEnName'), trigger: 'blur' }],
code: [{ required: true, message: this.$t('countryManagement.ruleCode'), trigger: 'blur' }],
partition: [{ required: true, message: this.$t('countryManagement.rulePartition'), trigger: 'change' }]
};
this.fetchList();
},
methods: {
countryRowId(row) {
if (!row) return '';
return row.country_id != null ? String(row.country_id) : row.id != null ? String(row.id) : '';
},
normalizeListResponse(res) {
const d = res && res.data;
if (!d) return { list: [], total: 0 };
const list = d.list || d.data || d.rows || [];
const total = Number(d.total != null ? d.total : d.count != null ? d.count : list.length) || 0;
return { list: Array.isArray(list) ? list : [], total };
},
async fetchList() {
this.loading = true;
try {
const params = {
keyword: this.query.keyword || '',
partition: this.query.partition === '' || this.query.partition == null ? '' : String(this.query.partition),
page: this.query.page,
per_page: this.query.per_page
};
const res = await this.$api.post('api/Country/getList', params);
if (res && res.code === 0) {
const { list, total } = this.normalizeListResponse(res);
this.list = list;
this.total = total;
} else {
this.list = [];
this.total = 0;
if (res && res.msg) this.$message.warning(res.msg);
}
} catch (e) {
this.list = [];
this.total = 0;
this.$message.error(this.$t('countryManagement.loadFailed'));
} finally {
this.loading = false;
}
},
handleSearch() {
this.query.page = 1;
this.fetchList();
},
/** 切换分区即请求列表,无需再点搜索 */
onPartitionChange() {
this.query.page = 1;
this.fetchList();
},
handleReset() {
this.query = {
keyword: '',
partition: '',
page: 1,
per_page: 20
};
this.fetchList();
},
handleSizeChange(size) {
this.query.per_page = size;
this.query.page = 1;
this.fetchList();
},
handlePageChange(page) {
this.query.page = page;
this.fetchList();
},
openEdit(row) {
const id = this.countryRowId(row);
this.form = {
country_id: id,
zh_name: (row && row.zh_name) || '',
en_name: (row && row.en_name) || '',
code: (row && row.code) || '',
partition: row && row.partition != null && row.partition !== '' ? String(row.partition) : '1'
};
this.editVisible = true;
this.$nextTick(() => {
if (this.$refs.editForm) this.$refs.editForm.clearValidate();
});
},
resetForm() {
this.form = {
country_id: '',
zh_name: '',
en_name: '',
code: '',
partition: '1'
};
},
submitEdit() {
this.$refs.editForm.validate(async (valid) => {
if (!valid) return;
this.saveLoading = true;
try {
const params = {
country_id: String(this.form.country_id),
zh_name: this.form.zh_name,
en_name: this.form.en_name,
code: this.form.code,
partition: String(this.form.partition)
};
const res = await this.$api.post('api/Country/edit', params);
if (res && res.code === 0) {
this.$message.success(this.$t('countryManagement.saveSuccess'));
this.editVisible = false;
this.fetchList();
} else {
this.$message.error((res && res.msg) || this.$t('countryManagement.opFailed'));
}
} catch (e) {
this.$message.error(this.$t('countryManagement.opFailed'));
} finally {
this.saveLoading = false;
}
});
},
handleDelete(row) {
const id = this.countryRowId(row);
if (!id) {
this.$message.warning(this.$t('countryManagement.missingId'));
return;
}
this.$confirm(this.$t('countryManagement.deleteConfirm'), this.$t('countryManagement.deleteTitle'), {
type: 'warning',
confirmButtonText: this.$t('countryManagement.confirm'),
cancelButtonText: this.$t('countryManagement.cancel')
})
.then(async () => {
try {
const res = await this.$api.post('api/Country/delete', { country_id: String(id) });
if (res && res.code === 0) {
this.$message.success(this.$t('countryManagement.deleteSuccess'));
this.fetchList();
} else {
this.$message.error((res && res.msg) || this.$t('countryManagement.opFailed'));
}
} catch (e) {
this.$message.error(this.$t('countryManagement.opFailed'));
}
})
.catch(() => {});
},
openBatchPartitionDialog() {
this.batchPartitionVisible = true;
},
resetBatchPartitionDialog() {
this.batchPartitionTargetPartition = '1';
this.batchPartitionInput = '';
this.batchPartitionPreviewRows = [];
this.batchPartitionAllRows = [];
this.resetBatchPartitionStats();
this.batchPartitionTableFilter = '';
this.batchPartitionSelectionMode = 'none';
this.batchPartitionSelectedIds = [];
},
handleBatchPartitionDraftChange() {
if (!this.batchPartitionPreviewRows.length && !(this.batchPartitionStats && this.batchPartitionStats.input > 0)) return;
this.batchPartitionPreviewRows = [];
this.batchPartitionAllRows = [];
this.resetBatchPartitionStats();
this.batchPartitionTableFilter = '';
this.batchPartitionSelectionMode = 'none';
this.batchPartitionSelectedIds = [];
},
batchPartitionFilterTokens(text) {
return String(text || '')
.toLowerCase()
.split(/[;\n,]+/g)
.map((s) => s.trim())
.filter(Boolean);
},
batchPartitionRowMatchesTokens(pr, tokens) {
if (!tokens || !tokens.length) return true;
const parts = [
pr.key,
pr.en_name,
pr.country_id,
pr.matchLabel,
pr._row && pr._row.code,
pr._row && pr._row.zh_name,
pr._row && pr._row.en_name
]
.filter((x) => x != null && String(x).trim() !== '')
.map((x) => String(x).toLowerCase());
const hay = parts.join(' ');
return tokens.some((t) => hay.indexOf(t) !== -1);
},
isBatchPartitionRowUpdatable(pr) {
if (!pr || !pr._row) return false;
return String(pr._row.partition != null ? pr._row.partition : '') !== String(pr.partition);
},
isBatchPartitionRowSelected(pr) {
if (!pr._row || this.batchPartitionSelectionMode === 'none') return false;
const id = this.countryRowId(pr._row);
return (this.batchPartitionSelectedIds || []).map(String).includes(String(id));
},
onBatchPartitionNativeCheckboxChange(pr, ev) {
const checked = !!(ev && ev.target && ev.target.checked);
const id = pr._row ? this.countryRowId(pr._row) : '';
if (!id || !this.isBatchPartitionRowUpdatable(pr)) return;
let ids = (this.batchPartitionSelectedIds || []).map(String);
if (this.batchPartitionSelectionMode === 'none') {
if (checked) {
this.batchPartitionSelectionMode = 'explicit';
ids = [String(id)];
}
} else {
if (checked) {
if (!ids.includes(String(id))) ids.push(String(id));
} else {
ids = ids.filter((x) => x !== String(id));
}
}
if (this.batchPartitionSelectionMode === 'explicit' && ids.length === 0) {
this.batchPartitionSelectionMode = 'none';
}
this.batchPartitionSelectedIds = ids;
},
selectAllFilteredBatchPartitionRows() {
const ids = [];
(this.batchPartitionFilteredPreviewRows || []).forEach((r) => {
if (!this.isBatchPartitionRowUpdatable(r)) return;
const id = this.countryRowId(r._row);
if (id) ids.push(String(id));
});
if (!ids.length) {
this.$message.info(this.$t('countryManagement.batchPartitionSkipSame'));
return;
}
this.batchPartitionSelectionMode = 'explicit';
this.batchPartitionSelectedIds = [...new Set(ids)];
},
clearBatchPartitionRowSelection() {
this.batchPartitionSelectionMode = 'none';
this.batchPartitionSelectedIds = [];
},
batchPartitionRowClassName({ row }) {
if (!row) return '';
if (row.status === 'not_found') return 'batch-row-not-found';
if (row.status === 'diff') return 'batch-row-mismatch';
return '';
},
resetBatchPartitionStats() {
this.batchPartitionStats = {
input: 0,
matched: 0,
miss: 0,
skipSame: 0,
willUpdate: 0
};
},
recomputeBatchPartitionStats() {
const rows = this.batchPartitionPreviewRows || [];
let matched = 0;
let miss = 0;
let skipSame = 0;
let willUpdate = 0;
rows.forEach((r) => {
if (!r._row) {
miss += 1;
return;
}
matched += 1;
const cur = String(r._row.partition != null ? r._row.partition : '');
if (cur === String(r.partition)) {
skipSame += 1;
} else {
willUpdate += 1;
}
});
this.batchPartitionStats = {
input: rows.length,
matched,
miss,
skipSame,
willUpdate
};
},
parseBatchPartitionLines(text) {
const lines = String(text || '')
.split(/\r?\n/)
.map((l) => l.trim())
.filter((l) => l && !l.startsWith('#'));
return lines.map((key) => ({ key }));
},
findCountryRowForBatch(rows, keyRaw) {
const key = String(keyRaw || '').trim();
if (!key || !rows || !rows.length) return null;
const upper = key.toUpperCase();
if (upper.length === 3) {
const byCode = rows.find((r) => String(r.code || '').toUpperCase() === upper);
if (byCode) return byCode;
}
const lower = key.toLowerCase();
return (
rows.find(
(r) =>
String(r.en_name || '')
.trim()
.toLowerCase() === lower
) ||
rows.find((r) => String(r.zh_name || '').trim() === key) ||
null
);
},
async fetchAllCountryRowsForBatch() {
const all = [];
let page = 1;
const per_page = 300;
while (true) {
const res = await this.$api.post('api/Country/getList', {
keyword: '',
partition: '',
page,
per_page
});
if (!res || res.code !== 0) {
throw new Error('getList');
}
const { list, total } = this.normalizeListResponse(res);
if (!Array.isArray(list) || list.length === 0) break;
all.push(...list);
if (all.length >= total) break;
page += 1;
if (page > 500) break;
}
return all;
},
async previewBatchPartition() {
const targetPartition = String(this.batchPartitionTargetPartition || '').trim();
if (!['1', '2', '3'].includes(targetPartition)) {
this.$message.warning(this.$t('countryManagement.batchPartitionTargetRequired'));
return;
}
const parsed = this.parseBatchPartitionLines(this.batchPartitionInput);
if (!parsed.length) {
this.$message.warning(this.$t('countryManagement.batchPartitionEmpty'));
this.batchPartitionPreviewRows = [];
this.resetBatchPartitionStats();
return;
}
this.batchPartitionPreviewLoading = true;
this.batchPartitionPreviewRows = [];
this.resetBatchPartitionStats();
try {
this.batchPartitionAllRows = await this.fetchAllCountryRowsForBatch();
} catch (e) {
this.batchPartitionAllRows = [];
this.batchPartitionPreviewRows = [];
this.resetBatchPartitionStats();
this.$message.error(this.$t('countryManagement.batchPartitionLoadListFailed'));
this.batchPartitionPreviewLoading = false;
return;
}
const rows = this.batchPartitionAllRows;
this.batchPartitionPreviewRows = parsed.map((item) => {
const row = this.findCountryRowForBatch(rows, item.key);
const id = row ? this.countryRowId(row) : '';
const curPart = row && row.partition != null && row.partition !== '' ? String(row.partition) : '';
let matchLabel = this.$t('countryManagement.batchPartitionMissing');
let status = 'not_found';
if (row) {
if (curPart === targetPartition) {
matchLabel = this.$t('countryManagement.batchPartitionSkipSame');
status = 'same';
} else {
matchLabel = this.$t('countryManagement.batchPartitionMismatch');
status = 'diff';
}
}
return {
key: item.key,
partition: targetPartition,
currentPartition: curPart || '—',
matchLabel,
status,
country_id: id || '—',
en_name: (row && row.en_name) || '—',
_row: row
};
});
if (!this.batchPartitionPreviewRows.length) {
this.$message.warning(this.$t('countryManagement.batchPartitionPreviewEmpty'));
}
this.recomputeBatchPartitionStats();
this.batchPartitionTableFilter = '';
this.batchPartitionSelectionMode = 'none';
this.batchPartitionSelectedIds = [];
this.batchPartitionPreviewLoading = false;
},
async applyBatchPartition() {
if (!this.batchPartitionPreviewRows.length) {
this.$message.warning(this.$t('countryManagement.batchPartitionPreviewEmpty'));
return;
}
const toApply = this.batchPartitionEffectiveToApplyRows.slice();
if (this.batchPartitionSelectionMode === 'explicit' && toApply.length === 0) {
this.$message.warning(this.$t('countryManagement.batchPartitionNoSelection'));
return;
}
if (!toApply.length) {
this.$message.info(this.$t('countryManagement.batchPartitionSkipSame'));
return;
}
try {
await this.$confirm(
this.$t('countryManagement.batchPartitionApplyConfirm', { n: String(toApply.length) }),
this.$t('countryManagement.batchPartitionTitle'),
{
type: 'warning',
confirmButtonText: this.$t('countryManagement.confirm'),
cancelButtonText: this.$t('countryManagement.cancel')
}
);
} catch (e) {
return;
}
this.batchPartitionApplyLoading = true;
let ok = 0;
let fail = 0;
for (let i = 0; i < toApply.length; i++) {
const pr = toApply[i];
const row = pr._row;
const params = {
country_id: String(this.countryRowId(row)),
zh_name: (row && row.zh_name) || '',
en_name: (row && row.en_name) || '',
code: (row && row.code) || '',
partition: String(pr.partition)
};
try {
const res = await this.$api.post('api/Country/edit', params);
if (res && res.code === 0) ok += 1;
else fail += 1;
} catch (e) {
fail += 1;
}
}
const miss = this.batchPartitionPreviewRows.filter((r) => !r._row).length;
const inputN = String(this.batchPartitionStats.input || this.batchPartitionPreviewRows.length);
this.$message.success(
this.$t('countryManagement.batchPartitionDone', {
ok: String(ok),
fail: String(fail),
miss: String(miss),
input: inputN
})
);
this.batchPartitionApplyLoading = false;
this.batchPartitionVisible = false;
this.fetchList();
}
}
};
</script>
<style scoped>
.country-manage {
padding: 0 10px;
}
.crumbs {
margin-bottom: 10px;
}
.toolbar {
/* margin-bottom: 15px; */
margin-top: 20px;
}
.table-card {
margin-top: 0;
}
.pagination {
margin-top: 15px;
text-align: right;
}
::v-deep .dark-table-header th {
background-color: #f5f7fa;
font-weight: 600;
}
.table-row-actions {
display: inline-flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
gap: 8px;
}
.table-row-actions .action-btn {
margin: 0;
padding: 7px 12px;
border-radius: 4px;
font-weight: 500;
}
.table-row-actions .action-btn--edit {
background-color: #ecf5ff;
border-color: #b3d8ff;
color: #409eff;
}
.table-row-actions .action-btn--edit:hover {
background-color: #d9ecff;
border-color: #409eff;
color: #409eff;
}
.table-row-actions .action-btn--delete {
background-color: #fef0f0;
border-color: #fbc4c4;
color: #f56c6c;
}
.table-row-actions .action-btn--delete:hover {
background-color: #fde2e2;
border-color: #f56c6c;
color: #f56c6c;
}
.batch-partition-help {
font-size: 12px;
color: #606266;
line-height: 1.6;
white-space: pre-line;
margin: 0 0 10px;
}
.batch-partition-target-form {
margin-bottom: 4px;
}
.batch-partition-actions {
margin: 12px 0;
display: flex;
justify-content: flex-end;
gap: 10px;
flex-wrap: wrap;
}
.batch-partition-summary {
font-size: 13px;
color: #303133;
line-height: 1.55;
margin: 0 0 10px;
padding: 10px 12px;
background: #f4f6f9;
border-radius: 4px;
border: 1px solid #ebeef5;
}
.batch-partition-selection-hint {
font-size: 12px;
color: #606266;
line-height: 1.55;
margin: 0 0 8px;
}
.batch-partition-table-toolbar {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px 10px;
margin-bottom: 8px;
}
.batch-partition-filter-input {
width: min(320px, 100%);
flex: 1;
min-width: 200px;
}
.batch-partition-filter-count {
font-size: 12px;
color: #909399;
margin-left: 4px;
}
.batch-partition-checkbox-placeholder {
color: #dcdfe6;
font-size: 12px;
}
.batch-partition-native-checkbox {
width: 14px;
height: 14px;
cursor: pointer;
vertical-align: middle;
accent-color: #409eff;
}
.batch-partition-table {
margin-top: 8px;
}
.partition-chip,
.match-chip {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 62px;
padding: 2px 8px;
border-radius: 12px;
line-height: 18px;
font-size: 12px;
}
.partition-chip--warn,
.match-chip--warn {
color: #8a5700;
background: #fff7e6;
border: 1px solid #ffd591;
}
.match-chip--danger {
color: #a8071a;
background: #fff1f0;
border: 1px solid #ffa39e;
}
.match-chip--ok {
color: #237804;
background: #f6ffed;
border: 1px solid #b7eb8f;
}
::v-deep .batch-row-not-found td {
background: #fff5f5 !important;
}
::v-deep .batch-row-mismatch td {
background: #fffdf0 !important;
}
</style>

View File

@@ -239,18 +239,47 @@ export default {
openAddDialog() { this.addDialogVisible = true; },
resetAddForm() { this.addForm = { field: '', runNow: false }; this.addLoading = false; },
async submitAddKeyword() {
if (!this.addForm.field.trim()) return this.$message.warning(this.$t('crawlTask.enterKeyword'));
const raw = String(this.addForm.field || '').trim();
if (!raw) return this.$message.warning(this.$t('crawlTask.enterKeyword'));
// 支持一次录入多个:按换行/逗号/分号拆分,去重
const fields = raw
.split(/[\r\n,;]+/g)
.map((s) => s.trim())
.filter(Boolean);
const uniqFields = Array.from(new Set(fields));
if (uniqFields.length === 0) return this.$message.warning(this.$t('crawlTask.enterKeyword'));
this.addLoading = true;
try {
const res = await this.$api.post('api/expert_manage/addFetchField', { field: this.addForm.field });
if (res.code === 0) {
this.$message.success(this.$t('crawlTask.addKeywordSuccess'));
if (this.addForm.runNow) {
await this.$api.post('api/expert_finder/fetchOneField', { field: this.addForm.field });
const ok = [];
const fail = [];
for (const field of uniqFields) {
try {
const res = await this.$api.post('api/expert_manage/addFetchField', { field });
if (res && res.code === 0) {
ok.push(field);
if (this.addForm.runNow) {
// 不阻塞整体添加run once 失败也记录,不影响已添加成功
try {
await this.$api.post('api/expert_finder/fetchOneField', { field });
} catch (e) {
/* ignore */
}
}
} else {
fail.push({ field, msg: (res && res.msg) || this.$t('crawlTask.operationFail') });
}
} catch (e) {
fail.push({ field, msg: this.$t('crawlTask.operationFail') });
}
this.addDialogVisible = false;
this.fetchList();
}
if (ok.length > 0) {
this.$message.success(`${this.$t('crawlTask.addKeywordSuccess')} (${ok.length}/${uniqFields.length})`);
}
if (fail.length > 0) {
this.$message.warning(`Failed: ${fail.map((x) => x.field).join(', ')}`);
}
this.addDialogVisible = false;
this.fetchList();
} finally { this.addLoading = false; }
}
}

View File

@@ -71,6 +71,7 @@
Special note: If the number of authors is 6 or fewer, all authors should be listed.
</div>
<el-button
v-if="canDelete"
@click="StepBNext(1)"
type="primary"
plain
@@ -110,7 +111,7 @@
<span @click="handleContainerClick" style="margin-left: 5px" v-html="getRepeatRefHtml()"> </span>
</div>
<div class="topBtnBox btns" v-if="chanFerForm.length > 0 && role == 'editor'">
<div class="topBtnBox btns" v-if="chanFerForm.length > 0 && role == 'editor' && canDelete">
<el-button type="primary" plain @click="selectAllRef">Select all</el-button>
<el-button type="success" plain @click="toggleSelection">Select none</el-button>
<el-button type="danger" plain @click="deleteSomeRefs" :disabled="multipleSelection.length > 0 ? false : true"
@@ -154,11 +155,10 @@
class="status ok"
:class="scope.row.refer_type == 'journal' ? getJournalDateno(scope.row.dateno, 'status') : ''"
v-if="
(
(scope.row.refer_type == 'journal' && scope.row.doilink != '' && scope.row.cs == 1) ||
(scope.row.refer_type == 'book' && scope.row.isbn != '' && scope.row.cs == 1)
) && scope.row.retract == 0
"
((scope.row.refer_type == 'journal' && scope.row.doilink != '' && scope.row.cs == 1) ||
(scope.row.refer_type == 'book' && scope.row.isbn != '' && scope.row.cs == 1)) &&
scope.row.retract == 0
"
>
<i class="el-icon-circle-check"></i>
</span>
@@ -173,7 +173,9 @@
<!-- journal 形式 -->
<div style="text-align: left" v-if="scope.row.refer_type == 'journal'" class="reference-item">
<p>
{{ scope.row.author }}&nbsp;<span v-html="formatTitle(scope.row.title)"></span>. &nbsp;<em>{{ scope.row.joura }}</em
{{ scope.row.author }}&nbsp;<span v-html="formatTitle(scope.row.title)"></span>. &nbsp;<em>{{
scope.row.joura
}}</em
>.&nbsp;<span :class="getJournalDateno(scope.row.dateno, 'title')">{{ scope.row.dateno }}</span
>.<br />
</p>
@@ -181,13 +183,16 @@
</div>
<!-- book 形式 -->
<div style="text-align: left" v-if="scope.row.refer_type == 'book'" class="reference-item">
<p>{{ scope.row.author }}&nbsp;<span v-html="formatTitle(scope.row.title)"></span>.&nbsp;{{ scope.row.dateno }}.&nbsp;<br /></p>
<p>
{{ scope.row.author }}&nbsp;<span v-html="formatTitle(scope.row.title)"></span>.&nbsp;{{
scope.row.dateno
}}.&nbsp;<br />
</p>
<a class="doiLink" :href="scope.row.isbn" target="_blank">{{ scope.row.isbn }}</a>
</div>
<!-- other 形式 -->
<p class="wrongLine reference-item" style="text-align: left" v-if="scope.row.refer_type == 'other'">
<span v-html="formatTitle(scope.row.refer_frag)"></span>
</p>
</template>
</el-table-column>
@@ -242,7 +247,7 @@
</div>
</el-table-column>
</el-table>
<div class="bottomBtnBox btns" v-if="chanFerForm.length > 0 && role == 'editor'">
<div class="bottomBtnBox btns" v-if="chanFerForm.length > 0 && role == 'editor'&& canDelete">
<el-button type="primary" plain @click="selectAllRef">Select all</el-button>
<el-button type="success" plain @click="toggleSelection">Select none</el-button>
<el-button type="danger" plain @click="deleteSomeRefs" :disabled="multipleSelection.length > 0 ? false : true"
@@ -546,6 +551,7 @@ export default {
},
addLoading: false,
editboxVisible: false,
canDelete: true,
multipleSelection: [] // 多选
};
},
@@ -572,18 +578,19 @@ export default {
}
},
methods: {
formatTitle(title) {
if (!title) return '';
// 使用正则匹配,'gi' 表示全局匹配且不区分大小写
// \b 确保是完整单词匹配,防止误伤含有这些字母的其他单词
const reg = /\b(Retracted|Retraction)\b/gi;
return title.replace(reg, (match) => {
return `<span style="color: red; font-weight: bold;">${match}</span>`;
});
}
,
getCurrentRoute() {
this.canDelete = !['/articleListEditor_B1'].includes(this.$route.path);
},
formatTitle(title) {
if (!title) return '';
// 使用正则匹配,'gi' 表示全局匹配且不区分大小写
// \b 确保是完整单词匹配,防止误伤含有这些字母的其他单词
const reg = /\b(Retracted|Retraction)\b/gi;
return title.replace(reg, (match) => {
return `<span style="color: red; font-weight: bold;">${match}</span>`;
});
},
getJournalDateno(dateno, type) {
if (dateno && typeof dateno === 'string') {
const hasInvalidColon = !dateno.includes(':') || (dateno.includes(':') && dateno.split(':').pop().trim() === '');
@@ -682,7 +689,7 @@ export default {
.then((res) => {
if (res.status == 1) {
return res.data;
}
}
throw res.msg;
})
.catch((err) => {
@@ -697,6 +704,7 @@ export default {
return {};
},
init(e) {
this.getCurrentRoute();
this.chanFerForm = e;
this.bijiao();
////console.log('更新更新')

File diff suppressed because it is too large Load Diff

View File

@@ -771,6 +771,7 @@
</template>
<script>
import bus from '../common/bus'
export default {
data() {
return {
@@ -1188,6 +1189,43 @@ export default {
this.getjour();
},
methods: {
readPromotionFactoryJumpJournalId() {
try {
const raw = sessionStorage.getItem('promotionFactoryJump');
if (!raw) return '';
const obj = JSON.parse(raw || '{}');
if (!obj || obj.from !== 'promotionFactory') return '';
if (obj.targetPath && String(obj.targetPath) !== String(this.$route.path)) return '';
const id = obj.journal_id != null ? String(obj.journal_id) : '';
sessionStorage.removeItem('promotionFactoryJump');
return id;
} catch (e) {
try {
sessionStorage.removeItem('promotionFactoryJump');
} catch (e2) {}
return '';
}
},
forceClearJumpQuery() {
const q = (this.$route && this.$route.query) || {};
const has = q && (q._ap_from || q.journal_id || q.journalId || q.journalIdd);
if (!has) return;
const oldFullPath = this.$route && this.$route.fullPath ? this.$route.fullPath : '';
const nextQuery = Object.assign({}, q);
delete nextQuery._ap_from;
delete nextQuery.journal_id;
delete nextQuery.journalId;
delete nextQuery.journalIdd;
// 关闭“中间态 fullPath”对应的标签页避免残留在顶部 Tags
if (oldFullPath) {
bus.$emit('close_tag_by_path', { path: oldFullPath, silent: true });
}
this.$router.replace({ path: this.$route.path, query: nextQuery }).catch(() => {});
try {
const cleanUrl = window.location.origin + this.$route.path;
window.history.replaceState({}, '', cleanUrl);
} catch (e) {}
},
unplIcon() {
this.$refs['upIconIMg'].$refs['upload-inner'].handleClick();
},
@@ -1314,9 +1352,28 @@ export default {
if (res.code == 0) {
this.df_jour = res.data.journals;
this.add_jour = res.data.journals;
this.query.journal_id = this.df_jour[0].journal_id;
this.query.journal_title = this.df_jour[0].title;
const fromQueryId = this.$route && this.$route.query ? this.$route.query.journal_id : '';
const fromSessionId = this.readPromotionFactoryJumpJournalId();
const pickedId = fromQueryId || fromSessionId;
const matched = pickedId ? this.df_jour.find((j) => String(j.journal_id) === String(pickedId)) : null;
const first = this.df_jour[0];
const picked = matched || first;
this.query.journal_id = picked ? picked.journal_id : 0;
this.query.journal_title = picked ? picked.title : '';
this.getgroup();
// 仅首次接收参数:应用后立刻清掉 URL避免刷新仍然固定某一本期刊
if (fromQueryId) {
const nextQuery = Object.assign({}, (this.$route && this.$route.query) || {});
delete nextQuery.journal_id;
delete nextQuery.journalId;
delete nextQuery._ap_from;
this.$router.replace({ path: this.$route.path, query: nextQuery }).catch(() => {});
// 双保险:路由稳定后再强制清参一次,避免地址栏残留“中间态”
setTimeout(() => {
this.forceClearJumpQuery();
}, 0);
}
} else {
this.$message.error(res.msg);
}

View File

@@ -68,16 +68,42 @@
</p>
<p class="info-row" style="margin-top: 10px; font-size: 12px">
<span class="label">{{ $t('expertDatabase.fields.acquisitionTimeLabel') }}</span>
<span class="value time">{{ scope.row.ctime_text ? scope.row.ctime_text : '-' }}</span>
<span class="value time">{{ scope.row.ctime_text ? scope.row.ctime_text : $t('expertDatabase.emptyMark') }}</span>
</p>
<span class="custom-tag">{{ scope.row.state_text }}</span>
</div>
</template>
</el-table-column>
<el-table-column prop="affiliation" :label="$t('expertDatabase.columns.affiliation')" min-width="260" />
<el-table-column prop="fieldDisplay" :label="$t('expertDatabase.columns.researchAreas')" min-width="200">
<el-table-column prop="country" :label="$t('expertDatabase.columns.country')" min-width="100" />
<el-table-column prop="affiliation" :label="$t('expertDatabase.columns.affiliation')" min-width="460" />
<el-table-column :label="$t('expertDatabase.columns.unsubscribeStatus')" width="180" align="center">
<template slot-scope="scope">
<div class="unsubscribe-cell">
<el-tag
size="mini"
:type="getUnsubscribeValue(scope.row) === 1 ? 'warning' : 'success'"
effect="plain"
class="unsubscribe-tag"
>
{{
getUnsubscribeValue(scope.row) === 1
? $t('expertDatabase.unsubscribeUnsubscribed')
: $t('expertDatabase.unsubscribeNormal')
}}
</el-tag>
<el-switch
class="unsubscribe-switch"
:value="getUnsubscribeValue(scope.row) === 0"
active-color="#13ce66"
inactive-color="#dcdfe6"
:disabled="switchingExpertId === getExpertId(scope.row)"
@change="(val) => handleUnsubscribeSwitch(scope.row, val)"
/>
</div>
</template>
</el-table-column>
<el-table-column prop="fieldDisplay" :label="$t('expertDatabase.columns.researchAreas')" min-width="260">
<template slot-scope="scope">
<div v-for="(field, index) in scope.row.fields" :key="index">
<span>
@@ -85,10 +111,43 @@
{{ field.field }}
</span>
</div>
<el-button
v-if="scope.row.fields && scope.row.fields.length"
type="text"
size="small"
class="view-all-btn"
@click.stop="openFieldDetail(scope.row)"
>
{{ $t('expertDatabase.viewAllInfo') }}
</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog
:title="$t('expertDatabase.detailDialogTitle')"
:visible.sync="fieldDetailVisible"
width="1200px"
append-to-body
destroy-on-close
class="field-detail-dialog"
>
<p v-if="fieldDetailExpert" class="field-detail-name">
<span class="label">{{ $t('expertDatabase.fields.nameLabel') }}</span>
<span class="value bold">{{ fieldDetailExpert.name }}</span>
</p>
<el-table v-if="fieldDetailRows.length" :data="fieldDetailRows" border stripe size="small" max-height="420">
<el-table-column type="index" :label="$t('expertDatabase.table.no')" width="56" align="center" />
<el-table-column prop="field" :label="$t('expertDatabase.detailColField')" min-width="140" />
<el-table-column prop="paper_title" :label="$t('expertDatabase.detailColPaper')" min-width="220" />
<el-table-column prop="paper_journal" :label="$t('expertDatabase.detailColJournal')" min-width="140" />
</el-table>
<p v-else class="field-detail-empty">{{ $t('expertDatabase.noFieldDetail') }}</p>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="fieldDetailVisible = false">{{ $t('expertDatabase.detailClose') }}</el-button>
</span>
</el-dialog>
<div class="pagination">
<el-pagination
background
@@ -124,7 +183,11 @@ export default {
list: [],
total: 0,
loading: false,
exportLoading: false
exportLoading: false,
switchingExpertId: '',
fieldDetailVisible: false,
fieldDetailExpert: null,
fieldDetailRows: []
};
},
created() {
@@ -187,8 +250,12 @@ export default {
this.list = rawList.map((item) => {
const fieldArray = item.fields || [];
const fieldNames = fieldArray.map((f) => f.field).join(', ');
const unsubscribed = this.normalizeUnsubscribeValue(item);
return {
...item,
// 以 unsubscribed 作为页面主判断字段
unsubscribed,
unsubscribe: unsubscribed,
fieldDisplay: fieldNames
};
});
@@ -204,6 +271,57 @@ export default {
this.loading = false;
}
},
getExpertId(row) {
if (!row) return '';
return String(row.expert_id || row.id || row.user_id || row.uid || '').trim();
},
normalizeUnsubscribeValue(row) {
const raw =
row && row.unsubscribed != null
? row.unsubscribed
: row && row.unsubscribe != null
? row.unsubscribe
: row && row.is_unsubscribe != null
? row.is_unsubscribe
: 0;
return Number(raw) === 1 ? 1 : 0;
},
getUnsubscribeValue(row) {
return this.normalizeUnsubscribeValue(row);
},
async handleUnsubscribeSwitch(row, checked) {
const expertId = this.getExpertId(row);
if (!expertId) {
this.$message.warning(this.$t('expertDatabase.unsubscribeMissingId'));
return;
}
const oldValue = this.getUnsubscribeValue(row);
// switch: ON(checked)=正常(0), OFF=退订(1)
const nextValue = checked ? 0 : 1;
if (oldValue === nextValue) return;
row.unsubscribed = nextValue;
row.unsubscribe = nextValue;
this.switchingExpertId = expertId;
try {
const apiUrl = nextValue === 1 ? 'api/expert_manage/unsubscribe' : 'api/expert_manage/resubscribe';
const res = await this.$api.post(apiUrl, {
expert_ids: String(expertId)
});
if (res && Number(res.code) === 0) {
this.$message.success(this.$t('expertDatabase.unsubscribeUpdateSuccess'));
} else {
row.unsubscribed = oldValue;
row.unsubscribe = oldValue;
this.$message.error((res && res.msg) || this.$t('expertDatabase.unsubscribeUpdateFailed'));
}
} catch (e) {
row.unsubscribed = oldValue;
row.unsubscribe = oldValue;
this.$message.error(this.$t('expertDatabase.unsubscribeUpdateFailed'));
} finally {
this.switchingExpertId = '';
}
},
handleSearch() {
this.query.pageIndex = 1;
this.fetchList();
@@ -228,6 +346,17 @@ export default {
this.query.pageIndex = page;
this.fetchList();
},
openFieldDetail(row) {
const empty = this.$t('expertDatabase.detailCellEmpty');
this.fieldDetailExpert = row || null;
const fields = (row && row.fields) || [];
this.fieldDetailRows = fields.map((f) => ({
field: (f && f.field) || empty,
paper_title: (f && (f.paper_title || f.title)) || empty,
paper_journal: (f && (f.paper_journal || f.journal)) || empty
}));
this.fieldDetailVisible = true;
},
async handleExport() {
if (!this.query.major_id && !this.query.keyword && !this.query.field) {
this.$message.warning(this.$t('expertDatabase.exportWarn'));
@@ -330,5 +459,37 @@ export default {
.value.time {
color: #888;
}
.view-all-btn {
margin-top: 8px;
padding: 0;
}
.field-detail-name {
margin: 0 0 12px;
font-size: 14px;
}
.field-detail-empty {
margin: 16px 0;
color: #909399;
font-size: 13px;
}
.unsubscribe-cell {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
padding: 0 4px;
}
.unsubscribe-tag {
min-width: 56px;
height: 22px;
line-height: 20px;
text-align: center;
border-radius: 12px;
font-size: 12px;
}
.unsubscribe-switch {
flex-shrink: 0;
}
</style>

View File

@@ -171,6 +171,7 @@ import MailDetail from '../../components/page/components/email/MailDetail.vue';
export default {
data() {
return {
baseUrl: this.Common.baseUrl,
currentFolder: 'inbox',
searchKeyword: '',
syncLoading: false,
@@ -645,7 +646,7 @@ fetchLatestSingleMail(jEmailId, journalId) {
},
buildSseUrl(jEmailId) {
// 与现有 axios baseURL=/api + 相对路径 规则一致GET + query 传参
const base = `/api/${API.inboxSse}`;
const base = `${this.baseUrl}${API.inboxSse}`;
const q = new URLSearchParams({ j_email_id: String(jEmailId) }).toString();
return `${base}?${q}`;
},

View File

@@ -279,11 +279,14 @@
journal_id: this.query.journal_id || (this.journalList[0] ? this.journalList[0].journal_id : null),
account: '',
password: '',
// password: '123456qwe..%%%',
smtp_from_name: '',
smtp_host: 'mail.tmrjournals.co.nz',
// smtp_host: 'smtp.mxhichina.com',
smtp_port: '465',
smtp_encryption: 'ssl',
imap_host: 'mail.tmrjournals.co.nz',
// imap_host: 'imap.qiye.aliyun.com',
imap_port: '993',
};
this.dialogVisible = true;

View File

@@ -147,6 +147,12 @@ const API = {
deleteTemplate: 'api/mail_template/deleteTemplate',
deleteStyle: 'api/mail_template/deleteStyle'
};
// 仅在当前 SPA 会话内记忆筛选(刷新页面即重置)
const mailboxMouldSessionMemory = {
journalId: '',
scene: '',
language: ''
};
export default {
data() {
@@ -203,8 +209,15 @@ export default {
}));
this.journalList = mapped;
if (mapped.length > 0) {
this.tplFilters.journalId = String(mapped[0].journal_id);
const rememberedJournalId = String(mailboxMouldSessionMemory.journalId || '').trim();
const hasRemembered = rememberedJournalId && mapped.some(j => String(j.journal_id) === rememberedJournalId);
this.tplFilters.journalId = hasRemembered
? rememberedJournalId
: String(mapped[0].journal_id);
}
this.tplFilters.scene = String(mailboxMouldSessionMemory.scene || '');
this.tplFilters.language = String(mailboxMouldSessionMemory.language || '');
this.syncTplFilterMemory();
if (this.activeTab === 'styles') {
this.fetchStyles();
} else {
@@ -226,6 +239,11 @@ export default {
},
// ========== Templates ==========
syncTplFilterMemory() {
mailboxMouldSessionMemory.journalId = String((this.tplFilters && this.tplFilters.journalId) || '');
mailboxMouldSessionMemory.scene = String((this.tplFilters && this.tplFilters.scene) || '');
mailboxMouldSessionMemory.language = String((this.tplFilters && this.tplFilters.language) || '');
},
fetchTemplates() {
this.tplLoading = true;
const params = {
@@ -233,6 +251,7 @@ export default {
scene: this.tplFilters.scene || '',
language: this.tplFilters.language || ''
};
this.syncTplFilterMemory();
this.$api
.post(API.listTemplates, params)
.then(res => {
@@ -257,11 +276,13 @@ export default {
});
},
handleCreateTemplate() {
this.syncTplFilterMemory();
// 传入当前模板列表选中的期刊,详情页用于默认回填
const journalId = this.tplFilters && this.tplFilters.journalId ? String(this.tplFilters.journalId) : '';
this.$router.push({ path: '/mailboxMouldDetail', query: journalId ? { journal_id: journalId } : {} });
},
handleEditTemplate(row) {
this.syncTplFilterMemory();
const templateId = row && (row.template_id || row.id);
const journalId = this.tplFilters && this.tplFilters.journalId ? String(this.tplFilters.journalId) : '';
const query = templateId ? { template_id: String(templateId) } : {};
@@ -274,6 +295,7 @@ export default {
this.previewVisible = true;
},
handleDeleteTemplate(row) {
this.syncTplFilterMemory();
const templateId = row && (row.template_id || row.id);
if (!templateId) return;
this.$confirm(this.$t('mailboxMould.deleteConfirm'), this.$t('mailboxMould.colActions'), {

View File

@@ -96,13 +96,14 @@
<div class="body-editor-container">
<div class="subject-label" style="margin-bottom: 10px;">{{ $t('mailboxMouldDetail.emailBody') }}:</div>
<TmrEmailEditor
<!-- <TmrEmailEditor
v-model="form.body"
:journalList="journalList"
:journalId="form.journalId"
:language="form.lang"
placeholder=""
/>
<!-- <CkeditorMail v-model="form.body" /> -->
/> -->
<CkeditorMail v-model="form.body" />
</div>
</el-card>
</section>

View File

@@ -424,6 +424,7 @@
</template>
<script>
import bus from '../common/bus'
export default {
data() {
return {
@@ -435,8 +436,7 @@ export default {
baseUrl: this.Common.baseUrl,
mediaUrl: this.Common.mediaUrl,
query: {
// journal_id: '',
// year: 0,
journal_id: 0,
keywords: '',
page: 1,
limit: 15
@@ -472,6 +472,23 @@ export default {
this.initMajor();
},
methods: {
readPromotionFactoryJumpJournalId() {
try {
const raw = sessionStorage.getItem('promotionFactoryJump');
if (!raw) return '';
const obj = JSON.parse(raw || '{}');
if (!obj || obj.from !== 'promotionFactory') return '';
if (obj.targetPath && String(obj.targetPath) !== String(this.$route.path)) return '';
const id = obj.journal_id != null ? String(obj.journal_id) : '';
sessionStorage.removeItem('promotionFactoryJump');
return id;
} catch (e) {
try {
sessionStorage.removeItem('promotionFactoryJump');
} catch (e2) {}
return '';
}
},
goDetail(row) {
console.log('row at line 460:', row);
this.$router.push({
@@ -518,8 +535,31 @@ export default {
.then((res) => {
if (res.code == 0) {
this.jourList = res.data.journals;
this.query.journal_id = this.jourList[0].journal_id;
const fromQueryId = this.$route && this.$route.query ? this.$route.query.journal_id : '';
const fromSessionId = this.readPromotionFactoryJumpJournalId();
const pickedId = fromQueryId || fromSessionId;
const matched = pickedId ? this.jourList.find((j) => String(j.journal_id) === String(pickedId)) : null;
this.query.journal_id = matched ? matched.journal_id : this.jourList[0].journal_id;
this.getData();
// 仅首次接收参数:应用后立刻清掉 URL避免刷新仍然固定某一本期刊
if (fromQueryId) {
const oldFullPath = this.$route && this.$route.fullPath ? this.$route.fullPath : '';
const nextQuery = Object.assign({}, (this.$route && this.$route.query) || {});
delete nextQuery.journal_id;
delete nextQuery.journalId;
delete nextQuery._ap_from;
if (oldFullPath) {
bus.$emit('close_tag_by_path', { path: oldFullPath, silent: true });
}
this.$router.replace({ query: nextQuery }).catch(() => {});
// 兜底:某些场景 router.replace 不更新地址栏,这里强制清掉 query
try {
const u = new URL(window.location.href);
['_ap_from', 'journal_id', 'journalId', 'journalIdd'].forEach((k) => u.searchParams.delete(k));
window.history.replaceState({}, '', u.toString());
} catch (e) {}
}
} else {
this.$message.error(res.msg);
}

View File

@@ -124,7 +124,7 @@ export default {
},
// 5----重新获取加载参考文献
changeRefer(val) {
console.log('重新获取参考文献')
this.$api
.post('api/Production/getReferList', {
'p_article_id': this.p_article_id

View File

@@ -478,6 +478,7 @@ const currentYear = new Date().getFullYear();
var ReviewTime = `(${currentYear - 2}${currentYear})`;
import commonReviewer from '../page/components/reviewerList/add.vue';
import commonMajorTableList from '../page/components/major/tableList.vue';
import bus from '../common/bus'
export default {
components: {
commonReviewer,
@@ -657,11 +658,27 @@ export default {
},
created() {
this.getDate();
this.getContent();
this.loadFields();
// this.initMajor()
},
methods: {
readPromotionFactoryJumpJournalId() {
try {
const raw = sessionStorage.getItem('promotionFactoryJump');
if (!raw) return '';
const obj = JSON.parse(raw || '{}');
if (!obj || obj.from !== 'promotionFactory') return '';
if (obj.targetPath && String(obj.targetPath) !== String(this.$route.path)) return '';
const id = obj.journal_id != null ? String(obj.journal_id) : '';
sessionStorage.removeItem('promotionFactoryJump');
return id;
} catch (e) {
try {
sessionStorage.removeItem('promotionFactoryJump');
} catch (e2) {}
return '';
}
},
getProps() {
return {
value: 'value',
@@ -716,6 +733,32 @@ export default {
.then((res) => {
if (res.code == 0) {
this.df_jour = res.data.journals;
const fromQueryId = (this.$route && this.$route.query && (this.$route.query.journalId || this.$route.query.journal_id)) || '';
const fromSessionId = this.readPromotionFactoryJumpJournalId();
const pickedId = fromQueryId || fromSessionId;
if (pickedId) {
this.query.journalId = Number(pickedId) || 0;
}
this.getContent();
// 仅首次接收参数:应用后立刻清掉 URL避免刷新仍然固定某一本期刊
if (fromQueryId) {
const oldFullPath = this.$route && this.$route.fullPath ? this.$route.fullPath : '';
const nextQuery = Object.assign({}, (this.$route && this.$route.query) || {});
delete nextQuery.journal_id;
delete nextQuery.journalId;
delete nextQuery._ap_from;
if (oldFullPath) {
bus.$emit('close_tag_by_path', { path: oldFullPath, silent: true });
}
this.$router.replace({ query: nextQuery }).catch(() => {});
// 兜底:某些场景 router.replace 不更新地址栏,这里强制清掉 query
try {
const u = new URL(window.location.href);
['_ap_from', 'journal_id', 'journalId', 'journalIdd'].forEach((k) => u.searchParams.delete(k));
window.history.replaceState({}, '', u.toString());
} catch (e) {}
}
} else {
this.$message.error(res.msg);
}

View File

@@ -187,6 +187,7 @@
<script>
import commonCv from '../common/cv.vue';
import bus from '../common/bus';
export default {
components: {
commonCv
@@ -362,6 +363,7 @@ export default {
for (var i = 0; i < this.tableData.length; i++) {
this.getScoreData(i, this.tableData[i].score);
}
bus.$emit('apply-badge-refresh');
} else {
this.$message.error(res.msg);
}

View File

@@ -248,6 +248,7 @@
</template>
<script>
import bus from '../common/bus'
export default {
name: 'youthList',
data() {
@@ -326,6 +327,21 @@
this.yearData()
},
methods: {
readPromotionFactoryJumpJournalId() {
try {
const raw = sessionStorage.getItem('promotionFactoryJump')
if (!raw) return ''
const obj = JSON.parse(raw || '{}')
if (!obj || obj.from !== 'promotionFactory') return ''
if (obj.targetPath && String(obj.targetPath) !== String(this.$route.path)) return ''
const id = obj.journal_id != null ? String(obj.journal_id) : ''
sessionStorage.removeItem('promotionFactoryJump')
return id
} catch (e) {
try { sessionStorage.removeItem('promotionFactoryJump') } catch (e2) {}
return ''
}
},
// 获取当年时间
yearData() {
this.YearThis = new Date().getFullYear()
@@ -347,8 +363,33 @@
.then(res => {
if (res.code == 0) {
this.df_jour = res.data.journals;
this.query.journal_id = this.df_jour[0].journal_id
const fromQueryId =
(this.$route && this.$route.query && (this.$route.query.journal_id || this.$route.query.journalId)) || ''
const fromSessionId = this.readPromotionFactoryJumpJournalId()
const pickedId = fromQueryId || fromSessionId
const matched = pickedId ? this.df_jour.find(j => String(j.journal_id) === String(pickedId)) : null
this.query.journal_id = matched ? matched.journal_id : this.df_jour[0].journal_id
this.getDate();
// 仅首次接收参数:应用后立刻清掉 URL避免刷新仍然固定某一本期刊
if (fromQueryId) {
const oldFullPath = this.$route && this.$route.fullPath ? this.$route.fullPath : ''
const nextQuery = Object.assign({}, (this.$route && this.$route.query) || {})
delete nextQuery.journal_id
delete nextQuery.journalId
delete nextQuery.journalIdd
delete nextQuery._ap_from
if (oldFullPath) {
bus.$emit('close_tag_by_path', { path: oldFullPath, silent: true })
}
this.$router.replace({ path: this.$route.path, query: nextQuery }).catch(() => {})
// 兜底:某些场景 router.replace 不更新地址栏,这里强制清掉 query
try {
const u = new URL(window.location.href)
;['_ap_from', 'journal_id', 'journalId', 'journalIdd'].forEach(k => u.searchParams.delete(k))
window.history.replaceState({}, '', u.toString())
} catch (e) {}
}
} else {
this.$message.error(res.msg);
}

View File

@@ -222,7 +222,7 @@ const i18n = new VueI18n({
router.beforeEach(async (to, from, next) => {
const currentRoute = to; // 获取当前路由路径,例如 "/home"
if (currentRoute.meta.hideJournal) {
if (currentRoute.meta.hideJournal || currentRoute.meta.public) {
} else {
try {
@@ -239,11 +239,11 @@ router.beforeEach(async (to, from, next) => {
// 无论接口成功/失败,都执行原有跳转逻辑
document.title = `${to.meta.title} | Traditional Medicine Research`;
document.title = `${to.meta.title || 'TMR'} | Traditional Medicine Research`;
const role = localStorage.getItem('U_name');
const userrole = localStorage.getItem('U_status');
if (!role && to.path != '/register' && to.path !== '/submission' && to.path !== '/verification' && to.path !== '/orcidLink' && to.path !== '/img' && to.path !== '/reviewer' && to.path !== '/thanks' && to.path !== '/login' && to.path !== '/refuse' && to.path !== '/managing' && to.path.search(/retrieve/i) < 0) {
if (!role && to.meta.public !== true && to.path != '/register' && to.path !== '/submission' && to.path !== '/verification' && to.path !== '/orcidLink' && to.path !== '/img' && to.path !== '/reviewer' && to.path !== '/thanks' && to.path !== '/login' && to.path !== '/refuse' && to.path !== '/managing' && to.path.search(/retrieve/i) < 0) {
next('/login');
} else {
if (navigator.userAgent.indexOf('MSIE') > -1 && to.path === '/editor') {

View File

@@ -1115,7 +1115,16 @@ export default new Router({
path: '/expertDatabase', //专家库
component: () => import('../components/page/expertDatabase'),
meta: {
title: 'Expert Database'
title: 'Expert Database',
titleKey: 'sidebar.expertList'
}
},
{
path: '/countryManagement', // 专家库-国家信息维护
component: () => import('../components/page/countryManagement'),
meta: {
title: 'Country Management',
titleKey: 'sidebar.countryManagement'
}
},
{
@@ -1468,6 +1477,24 @@ export default new Router({
title: 'img'
}
},
{
path: '/youthBoardRegister',
component: () => import( /* webpackChunkName: "youthBoardRegister" */ '../components/page/YouthEditorialBoardRegistration.vue'),
meta: {
title: 'Youth Editorial Board Registration',
public: true,
hideJournal: true
}
},
{
path: '/youthBoardSubmitSuccess',
component: () => import( /* webpackChunkName: "youthBoardSubmitSuccess" */ '../components/page/YouthBoardSubmitSuccess.vue'),
meta: {
title: 'Submission Success',
public: true,
hideJournal: true
}
},
{
path: '*',
redirect: '/404'

22
src/utils/autociteHtml.js Normal file
View File

@@ -0,0 +1,22 @@
/**
* 从 HTML 字符串中按出现顺序收集引用标签的 data-idmycite / autocite 与稿面、TinyMCE、历史库一致
* 支持逗号多 id、属性任意顺序、单/双引号
*/
export function extractAutociteIdsFromHtmlString(raw) {
if (!raw || typeof raw !== 'string') return [];
const ids = [];
const tagRe = /<(mycite|autocite)\b[^>]*>/gi;
let m;
while ((m = tagRe.exec(raw)) !== null) {
const tag = m[0];
const dbl = tag.match(/\bdata-id\s*=\s*"([^"]*)"/i);
const sgl = tag.match(/\bdata-id\s*=\s*'([^']*)'/i);
const val = dbl ? dbl[1] : sgl ? sgl[1] : '';
if (!val) continue;
val.split(',').forEach((part) => {
const id = part.trim();
if (id && !ids.includes(id)) ids.push(id);
});
}
return ids;
}

View File

@@ -0,0 +1,161 @@
/**
* Main_List 全文首次出现顺序(与 Edit Content / 稿面 / 底部参考文献列表共用)。
* 正文中 <mytable> 占位处需先插入对应表格段在 Main_List 中的表题/表体/表注引用,再计其后的 mycite。
*/
import { extractAutociteIdsFromHtmlString } from '@/utils/autociteHtml.js';
export function collectCiteStringsDeep(source, out, depth = 0) {
if (!source || depth > 6) return;
if (typeof source === 'string') {
const s = source.trim();
if (!s) return;
const maybeCite = /<(?:mycite|autocite)\b/i.test(s) || /\[[\d\s,\-–—]+\]/.test(s);
if (maybeCite) out.push(s);
return;
}
if (Array.isArray(source)) {
source.forEach((item) => collectCiteStringsDeep(item, out, depth + 1));
return;
}
if (typeof source === 'object') {
Object.keys(source).forEach((k) => {
const v = source[k];
collectCiteStringsDeep(v, out, depth + 1);
});
}
}
export function collectCiteHtmlSourcesForMainListItem(p, draftAmId, draftHtml) {
if (draftAmId != null && p && p.am_id == draftAmId && draftHtml != null) {
return [draftHtml];
}
const out = [];
const typ = p != null && p.type != null ? Number(p.type) : NaN;
if (typ === 2 && p.table) {
const t = p.table;
if (typeof t.title === 'string' && t.title.trim()) out.push(t.title);
if (typeof t.html_data === 'string' && t.html_data.trim()) {
out.push(t.html_data);
} else {
const pushRows = (rows) => {
if (!Array.isArray(rows)) return;
rows.forEach((row) => {
if (!Array.isArray(row)) return;
row.forEach((cell) => {
if (cell && typeof cell.text === 'string' && cell.text) out.push(cell.text);
});
});
};
pushRows(t.tableHeader);
pushRows(t.tableContent);
}
if (typeof t.note === 'string' && t.note.trim()) out.push(t.note);
collectCiteStringsDeep(t, out);
return out;
}
if (typ === 1 && p.image) {
const img = p.image;
if (typeof img.title === 'string' && img.title.trim()) out.push(img.title);
if (typeof img.note === 'string' && img.note.trim()) out.push(img.note);
if (out.length === 0) {
if (p && typeof p.content === 'string' && p.content.trim()) out.push(p.content);
if (p && typeof p.text === 'string' && p.text.trim()) out.push(p.text);
}
return out;
}
if (p && typeof p.text === 'string' && p.text.trim()) out.push(p.text);
if (p && typeof p.content === 'string' && p.content.trim()) out.push(p.content);
return out;
}
export function findMainListTableByLinkId(mainList, rawId) {
if (rawId == null || String(rawId).trim() === '') return null;
const sid = String(rawId).trim();
const list = Array.isArray(mainList) ? mainList : [];
return (
list.find((p) => {
if (!p || Number(p.type) !== 2) return false;
if (String(p.amt_id) === sid) return true;
if (String(p.am_id) === sid) return true;
if (p.p_main_table_id != null && String(p.p_main_table_id) === sid) return true;
if (p.table && p.table.amt_id != null && String(p.table.amt_id) === sid) return true;
if (p.table && p.table.am_id != null && String(p.table.am_id) === sid) return true;
if (p.table && p.table.p_main_table_id != null && String(p.table.p_main_table_id) === sid)
return true;
if (p.table && p.table.table_id != null && String(p.table.table_id) === sid) return true;
return false;
}) || null
);
}
/**
* @param {object} [options]
* @param {number|string|null} [options.tableDraftAmId] 正在编辑的表格段 am_idEdit Table 抽屉)
* @param {string|null} [options.tableDraftHtml] 与该表对应的 Title+表体+Note 合并稿;正文里 mytable 展开到该表时用此稿替代 Main_List 已存内容,使「全文 mytable 之前」的序号与抽屉内一致
*/
export function extractAutociteOrderFromDraftHtmlWithInlineTables(html, mainList, options = {}) {
const order = [];
const pushUnique = (id) => {
if (id && !order.includes(id)) order.push(id);
};
const pushFromRaw = (raw) => {
extractAutociteIdsFromHtmlString(raw).forEach((id) => pushUnique(id));
};
if (!html || typeof html !== 'string') return order;
const re = /<mytable\b[^>]*>[\s\S]*?<\/mytable>/gi;
let last = 0;
let m;
while ((m = re.exec(html)) !== null) {
const before = html.slice(last, m.index);
if (before) pushFromRaw(before);
const openEnd = html.indexOf('>', m.index) + 1;
const openTag = html.slice(m.index, openEnd);
const dm = openTag.match(/\bdata-id\s*=\s*["']([^"']*)["']/i);
const tid = dm ? String(dm[1]).trim() : '';
const tableP = findMainListTableByLinkId(mainList, tid);
if (tableP) {
const useDraft =
options.tableDraftAmId != null &&
options.tableDraftHtml != null &&
String(tableP.am_id) === String(options.tableDraftAmId);
const sources = useDraft
? [options.tableDraftHtml]
: collectCiteHtmlSourcesForMainListItem(tableP, null, null);
sources.forEach((raw) => pushFromRaw(raw));
}
last = m.index + m[0].length;
}
const after = html.slice(last);
if (after) pushFromRaw(after);
return order;
}
export function extractAutociteOrderFromMainList(mainList, draftAmId, draftHtml, options = {}) {
const list = Array.isArray(mainList) ? mainList : [];
const order = [];
list.forEach((p) => {
if (draftAmId != null && p && p.am_id == draftAmId && draftHtml != null) {
extractAutociteOrderFromDraftHtmlWithInlineTables(draftHtml, list, options).forEach((id) => {
if (!order.includes(id)) order.push(id);
});
return;
}
const candidates = collectCiteHtmlSourcesForMainListItem(p, draftAmId, draftHtml);
candidates.forEach((raw) => {
if (typeof raw === 'string' && /<mytable\b/i.test(raw)) {
extractAutociteOrderFromDraftHtmlWithInlineTables(raw, list, options).forEach((id) => {
if (!order.includes(id)) order.push(id);
});
} else {
extractAutociteIdsFromHtmlString(raw).forEach((id) => {
if (!order.includes(id)) order.push(id);
});
}
});
});
return order;
}