Compare commits
8 Commits
3c27591fc7
...
Editorial-
| Author | SHA1 | Date | |
|---|---|---|---|
| f44b3910a4 | |||
| 4f0b95d7bb | |||
| 577a30aeb6 | |||
| 94d45dfddf | |||
| d66225dc5d | |||
| 34677e1e83 | |||
| 1074e9c82f | |||
| 213ca978b7 |
19719
package-lock.json
generated
19719
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -8,11 +8,15 @@
|
||||
"build": "vue-cli-service build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ckeditor/ckeditor5-build-classic": "^34.2.0",
|
||||
"@ckeditor/ckeditor5-source-editing": "^34.2.0",
|
||||
"@ckeditor/ckeditor5-vue2": "^3.0.1",
|
||||
"@stripe/stripe-js": "^5.5.0",
|
||||
"@tinymce/tinymce-vue": "^3.0.1",
|
||||
"@vue/reactivity": "^3.5.13",
|
||||
"axios": "^0.18.0",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"ckeditor5-custom-project": "file:ckeditor5-builder-47.6.0",
|
||||
"clipboard": "^2.0.11",
|
||||
"cnpm": "^9.4.0",
|
||||
"docx": "^9.1.0",
|
||||
@@ -25,6 +29,7 @@
|
||||
"html2canvas": "^1.4.1",
|
||||
"install": "^0.13.0",
|
||||
"jszip": "^3.10.1",
|
||||
"juice": "^11.1.1",
|
||||
"katex": "^0.16.21",
|
||||
"mammoth": "^1.5.1",
|
||||
"mathlive": "^0.104.0",
|
||||
|
||||
@@ -18,6 +18,6 @@
|
||||
<script async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||
<script src="/js/global-math.js"></script>
|
||||
<script src="https://www.paypal.com/sdk/js?client-id=ATqBigrhcNdqR8J83aDjTOoJHsAVz0U45JRY4H0stcEcv0mQrMDHQmyrydQInYd1w4lJ1ee3Wsblm2WP"></script>
|
||||
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
@@ -1,402 +1,524 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="crumbs">
|
||||
<el-breadcrumb separator="/">
|
||||
<el-breadcrumb-item>{{ $t('sidebar.tools') }}</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>{{ $t('sidebar.scholarCrawlers') }}</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
<div class="container">
|
||||
<el-card class="box-card">
|
||||
<el-form
|
||||
ref="searchForm"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="80px"
|
||||
:inline="false"
|
||||
class="search-form"
|
||||
@submit.native.prevent
|
||||
>
|
||||
<div class="search-bar">
|
||||
<el-form-item label="Keyword" prop="keyword" class="search-input-item">
|
||||
<el-input
|
||||
v-model="form.keyword"
|
||||
placeholder="Please input keyword"
|
||||
clearable
|
||||
@keyup.enter.native="handleSearch"
|
||||
/>
|
||||
<div class="scholar-container">
|
||||
<div class="sidebar">
|
||||
<el-card class="params-card" shadow="never">
|
||||
<div slot="header" class="card-header" style="font-weight: bold;"><i class="el-icon-search"></i> Scholar Search</div>
|
||||
|
||||
<el-form :model="form" ref="searchForm" :rules="rules" label-position="top">
|
||||
<el-form-item label="Keyword" prop="keyword">
|
||||
<el-input v-model="form.keyword" placeholder="e.g. cancer" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<div class="form-row">
|
||||
<el-form-item label="Per Page (Articles)" class="half-width">
|
||||
<el-input-number v-model="per_page" :controls="false" :min="1" :max="100"></el-input-number>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="Page Number" class="half-width">
|
||||
<el-input-number v-model="page" :controls="false" :min="1" :max="maxPages"></el-input-number>
|
||||
</el-form-item>
|
||||
<div class="search-actions">
|
||||
<el-button type="primary" icon="el-icon-search" :loading="loading" @click="handleSearch">
|
||||
Search
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
icon="el-icon-download"
|
||||
:loading="exportLoading"
|
||||
:disabled="!form.keyword"
|
||||
@click="handleExport"
|
||||
>
|
||||
Export Excel
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex; gap: 10px; margin-top: 15px;">
|
||||
<el-button type="primary" class="fetch-btn" style="flex: 3;" :loading="loading" @click="handleExecute">
|
||||
<i v-if="!loading" class="el-icon-coin"></i>
|
||||
{{ loading ? 'Fetching...' : 'Execute Fetch' }}
|
||||
</el-button>
|
||||
|
||||
<el-button @click="resetForm" class="custom-reset-btn">
|
||||
<i class="el-icon-refresh-left"></i> Reset
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card
|
||||
v-if="hasSearched"
|
||||
class="box-card"
|
||||
style="margin-top: 20px"
|
||||
>
|
||||
<div class="total-bar">
|
||||
Total: <span class="total-number">{{ total }}</span>
|
||||
<div class="info-box">
|
||||
<h4>INFORMATION</h4>
|
||||
|
||||
<p>
|
||||
"This tool allows for systematic extraction of scholar data from academic publications. Note that per_page refers to the
|
||||
number of articles scanned, which may yield multiple scholar records."
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-content" :style="{border:hasSearched && !loading ? 'none' : '2px solid #e2e2e2'}">
|
||||
<div v-if="!hasSearched && !loading" class="main-content-center">
|
||||
<div class="empty-state">
|
||||
<div class="state-icon"><i class="el-icon-user"></i></div>
|
||||
|
||||
<h3>Scholar Search</h3>
|
||||
|
||||
<p>
|
||||
Enter a research keyword and specify the search depth to retrieve expert profiles from professional academic
|
||||
databases.
|
||||
</p>
|
||||
</div>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="tableData"
|
||||
border
|
||||
stripe
|
||||
style="width: 100%;"
|
||||
class="table"
|
||||
header-cell-class-name="table-header"
|
||||
empty-text="No data, please search first"
|
||||
>
|
||||
<el-table-column type="index" label="No." width="60" align="center" :index="tableIndex" />
|
||||
<el-table-column
|
||||
v-for="col in columns"
|
||||
:key="col"
|
||||
:prop="col"
|
||||
:label="formatColumnLabel(col)"
|
||||
:min-width="getColumnWidth(col)"
|
||||
:width="getColumnFixedWidth(col)"
|
||||
/>
|
||||
<el-table-column label="Paper Count" width="140" align="center">
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="main-content-center">
|
||||
<div class="processing-state">
|
||||
<div class="spinner-box"><i class="el-icon-loading"></i></div>
|
||||
|
||||
<h3>PROCESSING REQUEST</h3>
|
||||
|
||||
<p>Connecting to api.tmrjournals.com...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="hasSearched && !loading" class="results-container">
|
||||
<div class="results-header">
|
||||
<div class="results-stats">
|
||||
<i class="el-icon-user"></i> RESULTS FOUND: <strong>{{ total }}</strong>
|
||||
<span class="divider">|</span>
|
||||
<span class="page-info">PAGE {{ page }} OF APPROX. {{ maxPages }}</span>
|
||||
<template v-if="Source">
|
||||
<span class="divider">|</span>
|
||||
<span class="page-info">Source {{ Source }}</span>
|
||||
</template>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="results-nav">
|
||||
<el-button
|
||||
class="nav-btn"
|
||||
size="mini"
|
||||
icon="el-icon-arrow-left"
|
||||
:disabled="page <= 1"
|
||||
@click="changePage(-1)"
|
||||
></el-button>
|
||||
|
||||
<el-button
|
||||
class="nav-btn"
|
||||
size="mini"
|
||||
icon="el-icon-arrow-right"
|
||||
:disabled="page >= maxPages"
|
||||
@click="changePage(1)"
|
||||
></el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-table :data="exportFiles" class="custom-table" border stripe header-row-class-name="dark-table-header">
|
||||
<el-table-column prop="name" label="File name" min-width="200"></el-table-column>
|
||||
<el-table-column prop="url" label="File url" min-width="250">
|
||||
<template slot-scope="scope">
|
||||
<div class="paper-count-cell">
|
||||
<span class="paper-count-number">{{ scope.row.paperCount }}</span>
|
||||
<el-button
|
||||
v-if="scope.row.paperCount"
|
||||
type="primary"
|
||||
size="mini"
|
||||
plain
|
||||
@click="showPapers(scope.row)"
|
||||
>
|
||||
Detail
|
||||
</el-button>
|
||||
</div>
|
||||
<el-link class="file-link" :href="mediaUrl+scope.row.url" target="_blank">
|
||||
{{ scope.row.url }}
|
||||
<i class="el-icon-download download-icon"></i>
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="count" label="Count" width="120" align="center"></el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination">
|
||||
<el-pagination
|
||||
background
|
||||
layout="total, sizes, prev, pager, next"
|
||||
:total="total"
|
||||
:current-page="page"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="per_page"
|
||||
@current-change="handlePageChange"
|
||||
@size-change="handleSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-dialog title="Papers" :visible.sync="papersDialogVisible" width="70vw">
|
||||
<div class="paper-expert-info">
|
||||
<div><strong>Name:</strong> {{ currentExpert.name || currentExpert.realname }}</div>
|
||||
<div><strong>Email:</strong> {{ currentExpert.email }}</div>
|
||||
<div><strong>Affiliation:</strong> {{ currentExpert.affiliation }}</div>
|
||||
</div>
|
||||
<el-table :data="currentPapers" border stripe style="width: 100%">
|
||||
<el-table-column type="index" label="No." width="60" align="center" />
|
||||
<el-table-column prop="article_id" label="Article ID" width="180" />
|
||||
<el-table-column prop="journal" label="Journal" width="340" />
|
||||
<el-table-column prop="title" label="Title" />
|
||||
</el-table>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="papersDialogVisible = false">Close</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Common from '@/components/common/common'
|
||||
export default {
|
||||
name: 'scholarCrawlers',
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
keyword: '',
|
||||
},
|
||||
mediaUrl: Common.mediaUrl,
|
||||
form: { keyword: '' },
|
||||
rules: {
|
||||
keyword: [
|
||||
{
|
||||
required: true,
|
||||
message: 'Please input keyword',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
keyword: [{ required: true, message: 'Required', trigger: 'blur' }]
|
||||
},
|
||||
tableData: [],
|
||||
columns: [],
|
||||
loading: false,
|
||||
exportLoading: false,
|
||||
papersDialogVisible: false,
|
||||
currentPapers: [],
|
||||
currentExpert: {},
|
||||
total: 0,
|
||||
hasSearched: false,
|
||||
page: 1,
|
||||
per_page: 20,
|
||||
hasSearched: false,
|
||||
maxPages: 100, // 初始上限
|
||||
total: 0,
|
||||
Source: '',
|
||||
exportFiles: [] // 模拟图二的文件列表数据
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
tableIndex(index) {
|
||||
return (this.page - 1) * this.per_page + index + 1;
|
||||
},
|
||||
handlePageChange(val) {
|
||||
this.page = val;
|
||||
this.doSearch();
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.per_page = val;
|
||||
resetForm() {
|
||||
this.form = { keyword: '' };
|
||||
this.page = 1;
|
||||
this.doSearch();
|
||||
this.per_page=20;
|
||||
this.$refs.searchForm.resetFields();
|
||||
},
|
||||
doSearch() {
|
||||
this.loading = true;
|
||||
this.hasSearched = true;
|
||||
this.$api
|
||||
.post('/api/expert_finder/search', {
|
||||
keyword: this.form.keyword,
|
||||
page: this.page,
|
||||
per_page: this.per_page,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res && res.code === 0 && res.data) {
|
||||
const list =
|
||||
Array.isArray(res.data.experts) && res.data.experts.length
|
||||
? res.data.experts
|
||||
: [];
|
||||
const listWithCount = list.map((item) => ({
|
||||
...item,
|
||||
paperCount: Array.isArray(item.papers)
|
||||
? item.papers.length
|
||||
: item.paper_count || item.paperCount || 0,
|
||||
}));
|
||||
this.tableData = listWithCount;
|
||||
this.total = res.data.total != null ? Number(res.data.total) : listWithCount.length;
|
||||
this.columns = listWithCount.length
|
||||
? Object.keys(listWithCount[0]).filter(
|
||||
(key) =>
|
||||
key !== 'papers' &&
|
||||
key !== 'paperCount' &&
|
||||
key !== 'paper_count'
|
||||
)
|
||||
: [];
|
||||
} else {
|
||||
this.tableData = [];
|
||||
this.columns = [];
|
||||
this.total = 0;
|
||||
if (res && res.msg) {
|
||||
this.$message.error(res.msg);
|
||||
} else {
|
||||
this.$message.error('No expert found, please try again');
|
||||
async handleExecute() {
|
||||
this.$refs.searchForm.validate(async (valid) => {
|
||||
if (!valid) return;
|
||||
this.loading = true;
|
||||
this.hasSearched = false;
|
||||
|
||||
try {
|
||||
// 1. 调用 Search 接口获取页数上限
|
||||
const searchRes = await this.$api.post('/api/expert_finder/search', {
|
||||
keyword: this.form.keyword,
|
||||
page: this.page,
|
||||
per_page: this.per_page
|
||||
});
|
||||
|
||||
if (searchRes && searchRes.code === 0) {
|
||||
this.total = searchRes.data.total || 0;
|
||||
this.maxPages = searchRes.data.total_pages || 1; // 2. 模拟处理延迟(配合图一动画)
|
||||
this.Source = searchRes.data.source || '';
|
||||
await new Promise((resolve) => setTimeout(resolve, 1500)); // 3. 调用 Export 接口生成文件
|
||||
|
||||
const exportRes = await this.$api.post('/api/expert_finder/export', {
|
||||
keyword: this.form.keyword,
|
||||
page: this.page,
|
||||
per_page: this.per_page
|
||||
});
|
||||
|
||||
if (exportRes && (exportRes.code === 0 || exportRes.status === 1)) {
|
||||
// 构造图二展示的数据格式
|
||||
const fileUrl = exportRes.data ? exportRes.data.file_url || exportRes.file_url : '';
|
||||
const fileName = fileUrl ? fileUrl.split('/').pop() : `experts_${this.form.keyword}_p${this.page}.xlsx`;
|
||||
this.exportFiles = [
|
||||
{
|
||||
url: fileUrl,
|
||||
name: fileName,
|
||||
count: searchRes.data.experts ? searchRes.data.experts.length : 0
|
||||
}
|
||||
];
|
||||
this.hasSearched = true;
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.tableData = [];
|
||||
this.columns = [];
|
||||
this.total = 0;
|
||||
this.$message.error('Request error, please try again');
|
||||
})
|
||||
.finally(() => {
|
||||
} catch (error) {
|
||||
this.$message.error('Execution failed');
|
||||
console.error(error);
|
||||
} finally {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
handleSearch() {
|
||||
this.$refs.searchForm.validate((valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
this.page = 1;
|
||||
this.doSearch();
|
||||
});
|
||||
},
|
||||
async handleExport() {
|
||||
if (!this.form.keyword) {
|
||||
this.$message.warning('Please input keyword first');
|
||||
return;
|
||||
}
|
||||
this.exportLoading = true;
|
||||
try {
|
||||
const res = await this.$api.post('/api/expert_finder/export', {
|
||||
keyword: this.form.keyword,
|
||||
page: this.page,
|
||||
per_page: this.per_page,
|
||||
});
|
||||
|
||||
if (res && (res.code === 0 || res.status === 1)) {
|
||||
const url =
|
||||
(res.data && (res.data.url || res.data.link)) ||
|
||||
res.url ||
|
||||
(typeof res.data === 'string' ? res.data : '');
|
||||
|
||||
if (!url) {
|
||||
this.$message.error('No download url returned from server');
|
||||
} else {
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
const parts = url.split('/');
|
||||
link.download = parts[parts.length - 1] || `scholar_${this.form.keyword}.xlsx`;
|
||||
link.target = '_blank';
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
this.$message.success('Export success');
|
||||
}
|
||||
} else {
|
||||
this.$message.error((res && res.msg) || 'Export failed, please try again');
|
||||
}
|
||||
} catch (e) {
|
||||
this.$message.error('Request error, please try again');
|
||||
} finally {
|
||||
this.exportLoading = false;
|
||||
}
|
||||
},
|
||||
formatColumnLabel(key) {
|
||||
if (!key) return '';
|
||||
return key
|
||||
.split('_')
|
||||
.map((word) => (word ? word.charAt(0).toUpperCase() + word.slice(1) : ''))
|
||||
.join(' ');
|
||||
},
|
||||
getColumnWidth(key) {
|
||||
if (!key) return 140;
|
||||
const lower = key.toLowerCase();
|
||||
if (lower === 'name' || lower === 'realname') {
|
||||
return 180;
|
||||
}
|
||||
if (lower === 'affiliation' || lower === 'organization' || lower === 'institution') {
|
||||
return 420;
|
||||
}
|
||||
if (lower === 'email') {
|
||||
return 300;
|
||||
}
|
||||
return 140;
|
||||
},
|
||||
getColumnFixedWidth(key) {
|
||||
if (!key) return null;
|
||||
const lower = key.toLowerCase();
|
||||
if (lower === 'name' || lower === 'realname') {
|
||||
return 180;
|
||||
}
|
||||
if (lower === 'email') {
|
||||
return 300;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
showPapers(row) {
|
||||
const papers = Array.isArray(row.papers) ? row.papers : [];
|
||||
if (!papers.length) {
|
||||
this.$message.info('No papers found');
|
||||
return;
|
||||
}
|
||||
this.currentExpert = row;
|
||||
this.currentPapers = papers;
|
||||
this.papersDialogVisible = true;
|
||||
},
|
||||
},
|
||||
changePage(step) {
|
||||
this.page += step;
|
||||
this.handleExecute();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
padding: 20px;
|
||||
/* 全局基础:背景色与字体 */
|
||||
.scholar-container {
|
||||
display: flex;
|
||||
/* background-color: #E6E6E6; */
|
||||
|
||||
padding: 20px 0;
|
||||
box-sizing: border-box;
|
||||
/* font-family: "Georgia", "Times New Roman", serif; */
|
||||
color: #1a1a1a;
|
||||
}
|
||||
|
||||
.box-card {
|
||||
margin-bottom: 10px;
|
||||
/* --- 左侧边栏 --- */
|
||||
.sidebar {
|
||||
width: 420px;
|
||||
margin-right: 30px;
|
||||
}
|
||||
|
||||
.search-form {
|
||||
width: 100%;
|
||||
/* 参数卡片:去掉 Element 默认圆角和阴影 */
|
||||
.params-card {
|
||||
border: 2px solid #000 !important;
|
||||
border-radius: 0 !important;
|
||||
background: #fff;
|
||||
/* 核心:右下角的硬阴影效果 */
|
||||
box-shadow: 6px 6px 0px 0px rgba(0, 0, 0, 0.8) !important;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
.search-bar {
|
||||
/* 卡片头部标题 */
|
||||
.card-header {
|
||||
font-size: 1.2rem;
|
||||
font-style: italic;
|
||||
font-weight: 500;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
.search-input-item {
|
||||
flex: 1;
|
||||
margin-bottom: 0;
|
||||
.card-header i {
|
||||
margin-right: 8px;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.search-input-item .el-form-item__content {
|
||||
width: 100%;
|
||||
/* 表单元素重置 */
|
||||
/deep/ .el-form-item__label {
|
||||
font-family: 'Arial', sans-serif; /* 标签用无衬线体形成对比 */
|
||||
font-size: 12px;
|
||||
font-weight: 800;
|
||||
color: #333;
|
||||
padding: 0 !important;
|
||||
line-height: 20px !important;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.search-input-item .el-input {
|
||||
width: 100%;
|
||||
/deep/ .el-input__inner {
|
||||
border-radius: 0 !important;
|
||||
border: 1.5px solid #000 !important;
|
||||
height: 40px;
|
||||
font-family: 'Georgia', serif;
|
||||
background-color: #fcfcfc;
|
||||
/* 内部微阴影感 */
|
||||
box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.search-actions {
|
||||
.form-row {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 10px;
|
||||
margin-left: 16px;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.paper-count-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
/deep/ .el-input-number {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.paper-count-number {
|
||||
font-weight: 700;
|
||||
/* 黑色大按钮 */
|
||||
.fetch-btn {
|
||||
width: 100%;
|
||||
height: 55px;
|
||||
background-color: #000 !important;
|
||||
border: none !important;
|
||||
border-radius: 0 !important;
|
||||
color: #fff !important;
|
||||
font-weight: 900;
|
||||
font-size: 16px;
|
||||
color: #006699;
|
||||
letter-spacing: 1.5px;
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.table .cell {
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
.fetch-btn:hover {
|
||||
background-color: #333 !important;
|
||||
transform: translate(-1px, -1px);
|
||||
box-shadow: 2px 2px 0 #888;
|
||||
}
|
||||
|
||||
.paper-expert-info {
|
||||
margin-bottom: 15px;
|
||||
padding: 10px 12px;
|
||||
background-color: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
font-size: 13px;
|
||||
.fetch-btn i {
|
||||
font-size: 20px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
/* 信息框:黑底白字 */
|
||||
.info-box {
|
||||
background-color: #151515;
|
||||
color: #d0d0d0;
|
||||
padding: 25px;
|
||||
border-radius: 0;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.paper-expert-info > div + div {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.total-bar {
|
||||
margin-bottom: 10px;
|
||||
.info-box h4 {
|
||||
color: #fff;
|
||||
font-family: 'Arial', sans-serif;
|
||||
font-size: 13px;
|
||||
color: #666;
|
||||
text-align: right;
|
||||
letter-spacing: 2px;
|
||||
margin: 0 0 15px 0;
|
||||
border-bottom: 1px solid #444;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.total-number {
|
||||
font-weight: 600;
|
||||
color: #006699;
|
||||
.info-box p {
|
||||
font-style: italic;
|
||||
font-size: 13px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.pagination {
|
||||
margin-top: 16px;
|
||||
text-align: right;
|
||||
.main-content-center {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
max-width: 450px;
|
||||
}
|
||||
|
||||
/* 数据库图标 */
|
||||
.state-icon {
|
||||
font-size: 80px;
|
||||
color: #bcbcbc;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.empty-state h3 {
|
||||
font-size: 24px;
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
color: #444;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.empty-state p {
|
||||
font-size: 14px;
|
||||
color: #888;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* 加载动画状态 */
|
||||
.processing-state {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.spinner-box {
|
||||
font-size: 50px;
|
||||
margin-bottom: 20px;
|
||||
animation: rotating 2s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes rotating {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.processing-state h3 {
|
||||
letter-spacing: 4px;
|
||||
font-weight: 900;
|
||||
color: #000;
|
||||
}
|
||||
/* 右侧容器改为顶部对齐 */
|
||||
.main-content {
|
||||
flex: 1;
|
||||
border: 2px dashed #bbb;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
justify-content: center;
|
||||
align-items: flex-start; /* 确保列表从顶部开始 */
|
||||
/* padding: 20px; */
|
||||
background-color: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.results-container {
|
||||
width: 100%;
|
||||
/* 模拟图二的实体阴影 */
|
||||
box-shadow: 8px 8px 0px 0px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 统计栏样式 */
|
||||
.results-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 15px 20px;
|
||||
background: #fff;
|
||||
border: 2px solid #000;
|
||||
border-bottom: none; /* 与下方表格衔接 */
|
||||
}
|
||||
|
||||
.results-stats {
|
||||
font-family: 'Arial', sans-serif;
|
||||
font-weight: 800;
|
||||
font-size: 14px;
|
||||
letter-spacing: 0.5px;
|
||||
/* text-transform: uppercase; */
|
||||
}
|
||||
|
||||
.results-stats strong {
|
||||
font-size: 18px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.divider {
|
||||
margin: 0 15px;
|
||||
color: #ccc;
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
.page-info {
|
||||
color: #999;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
/* 导航按钮 */
|
||||
.nav-btn {
|
||||
border: 1.5px solid #000 !important;
|
||||
border-radius: 0 !important;
|
||||
background: #fff !important;
|
||||
color: #000 !important;
|
||||
padding: 5px 10px !important;
|
||||
}
|
||||
|
||||
.nav-btn:hover {
|
||||
background: #000 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
/* 表格主体还原 */
|
||||
/deep/ .custom-table {
|
||||
border: 2px solid #000 !important;
|
||||
}
|
||||
|
||||
/deep/ .dark-table-header th {
|
||||
background-color: #000 !important;
|
||||
color: #fff !important;
|
||||
/* font-family: "Arial", sans-serif; */
|
||||
font-weight: 900;
|
||||
letter-spacing: 1px;
|
||||
padding: 12px 0 !important;
|
||||
}
|
||||
|
||||
/deep/ .el-table__row td {
|
||||
padding: 15px 0 !important;
|
||||
color: #333;
|
||||
/* font-family: "Georgia", serif; */
|
||||
}
|
||||
|
||||
/* 链接样式 */
|
||||
.file-link {
|
||||
font-size: 13px;
|
||||
text-decoration: none !important;
|
||||
color: #0066cc;
|
||||
}
|
||||
|
||||
.file-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.download-icon {
|
||||
margin-left: 6px;
|
||||
vertical-align: middle;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.custom-reset-btn {
|
||||
flex: 1;
|
||||
background-color: #fff;
|
||||
border: 2px solid #000;
|
||||
color: #000;
|
||||
font-weight: 800;
|
||||
font-family: 'Arial', sans-serif;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.1s;
|
||||
outline: none;
|
||||
margin-top: 10px
|
||||
}
|
||||
|
||||
.custom-reset-btn i {
|
||||
margin-right: 4px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
/* 悬浮和点击效果:增加黑白对比度 */
|
||||
.custom-reset-btn:hover {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
.custom-reset-btn:active {
|
||||
transform: translate(1px, 1px);
|
||||
box-shadow: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -2301,7 +2301,8 @@ str = str.replace(regex, function (match, content, offset, fullString) {
|
||||
{ selector: '.tox-tbtn[data-mce-name="edit"]', className: 'tinymce-custom-button-edit' },
|
||||
{ selector: '.tox-tbtn[data-mce-name="save"]', className: 'tinymce-custom-button-save' },
|
||||
{ selector: '.tox-tbtn[data-mce-name="customblue"]', className: 'tinymce-custom-button-blue' },
|
||||
{ selector: '.tox-tbtn[data-mce-name="removeblue"]', className: 'tinymce-custom-button-removeblue' }
|
||||
{ selector: '.tox-tbtn[data-mce-name="removeblue"]', className: 'tinymce-custom-button-removeblue' },
|
||||
{ selector: '.tox-tbtn[data-mce-name="selecttemplate"]', className: 'tinymce-custom-button-selecttemplate' }
|
||||
];
|
||||
|
||||
// 遍历每个按钮并为每个按钮添加类
|
||||
|
||||
@@ -155,17 +155,23 @@
|
||||
<!-- 编辑 -->
|
||||
<template v-if="this.userrole == 1">
|
||||
<el-submenu index="mailboxManagement">
|
||||
<template slot="title"> <i class="el-icon-message"></i> {{ $t('sidebar.mailboxManagement') }} </template>
|
||||
<el-menu-item index="mailboxManagement">
|
||||
{{ $t('sidebar.mailboxManagement') }}
|
||||
<template slot="title"> <i class="el-icon-message"></i> {{ $t('sidebar.promotionManagement') }} </template>
|
||||
|
||||
<el-menu-item index="expertDatabase">
|
||||
{{ $t('sidebar.expertDatabase') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item index="mailboxConfig">
|
||||
{{ $t('sidebar.mailboxConfig') }}
|
||||
{{ $t('sidebar.mailboxManagement') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item index="mailboxCollect">
|
||||
{{ $t('sidebar.mailboxCollect') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item index="mailboxMould">
|
||||
{{ $t('sidebar.emailTemplates') }}
|
||||
</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">
|
||||
|
||||
@@ -268,11 +268,12 @@ const en = {
|
||||
mailbox1: 'Mailbox send',
|
||||
mailbox2: 'Mailbox list',
|
||||
mailbox3: 'Mailbox template',
|
||||
emailTemplates: 'Email Templates',
|
||||
emailStyles: 'Email Styles',
|
||||
tools: 'Assistant tools',
|
||||
mailboxManagement: 'Mailbox Management',
|
||||
mailboxConfig: 'Mailbox config',
|
||||
mailboxCollect: 'Mailbox list',
|
||||
scholarCrawlers: 'Scholar Crawlers',
|
||||
expertDatabase: 'Expert Database',
|
||||
ReArticles: 'Rejected Manuscripts', // 被拒稿件
|
||||
editorialBoard: 'Boss System',
|
||||
editorialBoard1: 'Board Management',
|
||||
@@ -283,6 +284,8 @@ const en = {
|
||||
managingDirector: 'Managing Director',
|
||||
GroupClassification: 'Group List',
|
||||
JournalInstallment: 'Journal Installment',
|
||||
mailboxCollect: 'Email List',
|
||||
promotionManagement: 'Promotion Management',
|
||||
},
|
||||
mailboxConfig: {
|
||||
mailSystem: 'Mailbox system',
|
||||
@@ -350,6 +353,109 @@ const en = {
|
||||
rulesImapPort: 'Please enter IMAP port',
|
||||
rulesIsPrimary: 'Please set primary or not',
|
||||
},
|
||||
mailboxMould: {
|
||||
title: 'Email Templates',
|
||||
subtitle: 'Manage and customize your journal email templates.',
|
||||
searchPlaceholder: 'Search by title or scene...',
|
||||
journalPlaceholder: 'Journal',
|
||||
scenePlaceholder: 'Scene',
|
||||
all: 'All',
|
||||
inviteSubmission: 'Invite Submission',
|
||||
promoteCitation: 'Promote Citation',
|
||||
generalThanks: 'General Thanks',
|
||||
languagePlaceholder: 'Language',
|
||||
searchBtn: 'Search',
|
||||
createTemplate: 'Create Template',
|
||||
colTitle: 'Subject',
|
||||
colSubject: 'Mail title',
|
||||
colScene: 'Scene',
|
||||
colLanguage: 'Language',
|
||||
colVersion: 'Version',
|
||||
colStatus: 'Status',
|
||||
colActions: 'Actions',
|
||||
active: 'Active',
|
||||
inactive: 'Inactive',
|
||||
confirm: 'Confirm',
|
||||
cancel: 'Cancel',
|
||||
deleteConfirm: 'Delete this template?',
|
||||
deleteSuccess: 'Deleted successfully',
|
||||
deleteFail: 'Delete failed',
|
||||
previewTitle: 'Template preview',
|
||||
previewClose: 'Close',
|
||||
},
|
||||
mailboxStyle: {
|
||||
title: 'Email Styles',
|
||||
subtitle: 'Manage email header and footer styles.',
|
||||
searchPlaceholder: 'Search by name or description...',
|
||||
journalPlaceholder: 'Journal',
|
||||
scenePlaceholder: 'Scene',
|
||||
languagePlaceholder: 'Language',
|
||||
searchBtn: 'Refresh',
|
||||
createStyle: 'Create Style',
|
||||
colName: 'Style name',
|
||||
colDescription: 'Style description',
|
||||
},
|
||||
mailboxStyleDetail: {
|
||||
back: 'Back',
|
||||
createStyle: 'Create style',
|
||||
editStyle: 'Edit style',
|
||||
cancel: 'Cancel',
|
||||
save: 'Save',
|
||||
loading: 'Loading',
|
||||
name: 'Style name',
|
||||
namePlaceholder: 'Enter style name',
|
||||
description: 'Style description',
|
||||
descriptionPlaceholder: 'Enter style description',
|
||||
headerHtml: 'Header HTML',
|
||||
footerHtml: 'Footer HTML',
|
||||
rulesName: 'Please enter style name',
|
||||
rulesDescription: 'Please enter style description',
|
||||
rulesHeaderHtml: 'Please enter header HTML',
|
||||
rulesFooterHtml: 'Please enter footer HTML',
|
||||
saveSuccess: 'Saved successfully',
|
||||
saveFail: 'Save failed',
|
||||
},
|
||||
mailboxMouldDetail: {
|
||||
back: 'Back',
|
||||
createTemplate: 'Create template',
|
||||
editTemplate: 'Edit template',
|
||||
cancel: 'Cancel',
|
||||
save: 'Save',
|
||||
loading: 'Loading',
|
||||
rulesJournal: 'Please select journal',
|
||||
rulesScene: 'Please select template type',
|
||||
rulesLanguage: 'Please select language',
|
||||
rulesTitle: 'Please enter template title',
|
||||
rulesSubject: 'Please enter email subject',
|
||||
rulesBody: 'Please enter email body',
|
||||
rulesVersion: 'Please enter version',
|
||||
basicInfo: 'Basic info',
|
||||
templateTitle: 'Template title',
|
||||
templateTitlePlaceholder: 'Enter title',
|
||||
emailSubject: 'Email subject',
|
||||
emailSubjectPlaceholder: 'Email subject',
|
||||
emailBody: 'Email body',
|
||||
journal: 'Journal',
|
||||
templateType: 'Template type',
|
||||
sceneInviteSubmission: 'Invite submission',
|
||||
scenePromoteCitation: 'Promote citation',
|
||||
sceneGeneralThanks: 'General thanks',
|
||||
languageConfig: 'Language',
|
||||
version: 'Version',
|
||||
versionControl: 'Version',
|
||||
versionPlaceholder: '1.0.0',
|
||||
bodyEdit: 'Body editor',
|
||||
activeStatus: 'Active',
|
||||
variablesJson: 'Variables (JSON)',
|
||||
variablesPlaceholder: '{"name": "string"}',
|
||||
previewTab: 'Preview',
|
||||
subjectLabel: 'Subject:',
|
||||
receiverLabel: 'Receiver:',
|
||||
previewRendering: 'Live preview',
|
||||
saveSuccess: 'Saved successfully',
|
||||
saveFail: 'Save failed',
|
||||
saveSuccessMock: 'Template saved (mock)',
|
||||
},
|
||||
mailboxCollect: {
|
||||
inboxTab: 'Mail received',
|
||||
outboxTab: 'Mail sent',
|
||||
@@ -360,6 +466,7 @@ const en = {
|
||||
searchBtn: 'Search',
|
||||
syncBtn: 'Sync remote mail',
|
||||
writeBtn: 'Write letter',
|
||||
receiveBtn: 'Sync inbox',
|
||||
email: 'Email',
|
||||
account: 'Account',
|
||||
time: 'Time',
|
||||
@@ -386,6 +493,9 @@ const en = {
|
||||
syncSuccess: 'Sync succeeded',
|
||||
syncFail: 'Sync failed',
|
||||
operation: 'Operation',
|
||||
loadingMore: 'Loading more...',
|
||||
noMore: 'No more',
|
||||
selectAccountTip: 'Please select an email account first.'
|
||||
},
|
||||
mailboxSend: {
|
||||
title: 'Write mail',
|
||||
@@ -413,6 +523,10 @@ const en = {
|
||||
cancel: 'Cancel',
|
||||
save: 'Save',
|
||||
saveDraft: 'Save draft',
|
||||
sourceMode: 'Source code',
|
||||
richTextMode: 'Rich text',
|
||||
exitSourceMode: 'Exit source mode',
|
||||
sourcePlaceholder: 'Paste or edit full HTML here (DOCTYPE, html, head, body supported)',
|
||||
editorPlaceholder: 'Please enter...',
|
||||
validateTo: 'Please add at least one addressee',
|
||||
validateSubject: 'Please enter mail subject',
|
||||
@@ -705,7 +819,10 @@ const en = {
|
||||
"tooLarge": "Too Large (>1MB)",
|
||||
"error": "Error: {msg}",
|
||||
"imgLabel": "Img"
|
||||
}
|
||||
},
|
||||
mailTemplate: {
|
||||
noTemplateTip: 'No templates are available for the current journal. Please select another journal or contact the administrator to configure templates.'
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -253,11 +253,15 @@ const zh = {
|
||||
mailbox1: '发邮件',
|
||||
mailbox2: '邮件列表',
|
||||
mailbox3: '模板管理',
|
||||
emailTemplates: '邮件模板',
|
||||
emailStyles: '邮件风格',
|
||||
tools: '辅助工具',
|
||||
mailboxManagement: '邮箱管理',
|
||||
mailboxConfig: '邮箱配置管理',
|
||||
mailboxCollect: '邮箱列表',
|
||||
scholarCrawlers: '学者抓取',
|
||||
|
||||
|
||||
scholarCrawlers: '学者数据库',
|
||||
expertDatabase: '专家库',
|
||||
ReArticles: '被拒稿件', // 被拒稿件
|
||||
editorialBoard: '编委管理',
|
||||
editorialBoard1: '编委列表',
|
||||
@@ -268,6 +272,8 @@ const zh = {
|
||||
managingDirector: '总经理',
|
||||
GroupClassification: '集团列表',
|
||||
JournalInstallment: '分期列表',
|
||||
mailboxCollect: '邮件列表',
|
||||
promotionManagement: '推广管理',
|
||||
|
||||
},
|
||||
mailboxConfig: {
|
||||
@@ -336,6 +342,109 @@ const zh = {
|
||||
rulesImapPort: '请输入 IMAP 端口',
|
||||
rulesIsPrimary: '请选择是否主邮箱',
|
||||
},
|
||||
mailboxMould: {
|
||||
title: '邮件模板',
|
||||
subtitle: '管理并自定义期刊邮件模板。',
|
||||
searchPlaceholder: '按标题或场景搜索...',
|
||||
journalPlaceholder: '期刊',
|
||||
scenePlaceholder: '场景',
|
||||
all: '全部',
|
||||
inviteSubmission: '邀请投稿',
|
||||
promoteCitation: '论文推送',
|
||||
generalThanks: '通用感谢',
|
||||
languagePlaceholder: '语言',
|
||||
searchBtn: '搜索',
|
||||
createTemplate: '新建模板',
|
||||
colTitle: '主题',
|
||||
colSubject: '邮件标题',
|
||||
colScene: '场景',
|
||||
colLanguage: '语言',
|
||||
colVersion: '版本',
|
||||
colStatus: '状态',
|
||||
colActions: '操作',
|
||||
active: '启用',
|
||||
inactive: '停用',
|
||||
confirm: '确定',
|
||||
cancel: '取消',
|
||||
deleteConfirm: '确定删除该模板?',
|
||||
deleteSuccess: '删除成功',
|
||||
deleteFail: '删除失败',
|
||||
previewTitle: '模板预览',
|
||||
previewClose: '关闭',
|
||||
},
|
||||
mailboxStyle: {
|
||||
title: '邮件风格',
|
||||
subtitle: '管理邮件头部和尾部样式。',
|
||||
searchPlaceholder: '按名称或描述搜索...',
|
||||
journalPlaceholder: '期刊',
|
||||
scenePlaceholder: '场景',
|
||||
languagePlaceholder: '语言',
|
||||
searchBtn: '刷新',
|
||||
createStyle: '新建风格',
|
||||
colName: '风格名称',
|
||||
colDescription: '风格描述',
|
||||
},
|
||||
mailboxStyleDetail: {
|
||||
back: '返回',
|
||||
createStyle: '新建风格',
|
||||
editStyle: '编辑风格',
|
||||
cancel: '取消',
|
||||
save: '保存',
|
||||
loading: '加载中',
|
||||
name: '风格名称',
|
||||
namePlaceholder: '请输入风格名称',
|
||||
description: '风格描述',
|
||||
descriptionPlaceholder: '请输入风格描述',
|
||||
headerHtml: 'Header HTML',
|
||||
footerHtml: 'Footer HTML',
|
||||
rulesName: '请输入风格名称',
|
||||
rulesDescription: '请输入风格描述',
|
||||
rulesHeaderHtml: '请输入 Header HTML',
|
||||
rulesFooterHtml: '请输入 Footer HTML',
|
||||
saveSuccess: '保存成功',
|
||||
saveFail: '保存失败',
|
||||
},
|
||||
mailboxMouldDetail: {
|
||||
back: '返回',
|
||||
createTemplate: '新建模板',
|
||||
editTemplate: '编辑模板',
|
||||
cancel: '取消',
|
||||
save: '保存',
|
||||
loading: '加载中',
|
||||
rulesJournal: '请选择所属期刊',
|
||||
rulesScene: '请选择模版类型',
|
||||
rulesLanguage: '请选择语言',
|
||||
rulesTitle: '请输入模板标题',
|
||||
rulesSubject: '请输入邮件主题',
|
||||
rulesBody: '请输入邮件正文',
|
||||
rulesVersion: '请输入版本号',
|
||||
basicInfo: '基本信息',
|
||||
templateTitle: '模板标题',
|
||||
templateTitlePlaceholder: '输入标题',
|
||||
emailSubject: '邮件主题',
|
||||
emailSubjectPlaceholder: '邮件主题',
|
||||
emailBody: '邮件正文',
|
||||
journal: '所属期刊',
|
||||
templateType: '模版类型',
|
||||
sceneInviteSubmission: '邀请投稿',
|
||||
scenePromoteCitation: '论文推送',
|
||||
sceneGeneralThanks: '通用感谢',
|
||||
languageConfig: '语言配置',
|
||||
version: '版本',
|
||||
versionControl: '版本控制',
|
||||
versionPlaceholder: '1.0.0',
|
||||
bodyEdit: '正文编辑',
|
||||
activeStatus: '激活状态',
|
||||
variablesJson: '动态变量 (JSON)',
|
||||
variablesPlaceholder: '{"name": "string"}',
|
||||
previewTab: '预览窗口',
|
||||
subjectLabel: 'Subject:',
|
||||
receiverLabel: 'Receiver:',
|
||||
previewRendering: '实时预览渲染中',
|
||||
saveSuccess: '保存成功',
|
||||
saveFail: '保存失败',
|
||||
saveSuccessMock: '模板已保存(模拟)',
|
||||
},
|
||||
mailboxCollect: {
|
||||
inboxTab: '收件箱',
|
||||
outboxTab: '发件箱',
|
||||
@@ -346,6 +455,7 @@ const zh = {
|
||||
searchBtn: '搜索',
|
||||
syncBtn: '同步远程邮箱',
|
||||
writeBtn: '写邮件',
|
||||
receiveBtn: '收信',
|
||||
email: '邮箱',
|
||||
account: '账户',
|
||||
time: '时间',
|
||||
@@ -372,6 +482,9 @@ const zh = {
|
||||
syncSuccess: '同步成功',
|
||||
syncFail: '同步失败',
|
||||
operation: '操作',
|
||||
loadingMore: '加载更多...',
|
||||
noMore: '没有更多了',
|
||||
selectAccountTip: '请先选择一个邮箱账号.',
|
||||
},
|
||||
mailboxSend: {
|
||||
title: '写邮件',
|
||||
@@ -399,6 +512,10 @@ const zh = {
|
||||
cancel: '取消',
|
||||
save: '保存',
|
||||
saveDraft: '保存草稿',
|
||||
sourceMode: '源代码编辑',
|
||||
richTextMode: '富文本编辑',
|
||||
exitSourceMode: '退出源码编辑',
|
||||
sourcePlaceholder: '在此粘贴或编辑完整 HTML,支持 <!DOCTYPE>、<html>、<head>、<body> 等',
|
||||
editorPlaceholder: '请输入邮件内容...',
|
||||
validateTo: '请至少添加一个收件人',
|
||||
validateSubject: '请输入邮件主题',
|
||||
@@ -686,6 +803,10 @@ const zh = {
|
||||
"tooLarge": "过大跳过(>1MB)",
|
||||
"error": "失败: {msg}",
|
||||
"imgLabel": "图"
|
||||
},
|
||||
mailTemplate: {
|
||||
// 如果已经有 mailTemplate,就只加这一行
|
||||
noTemplateTip: '当前期刊暂无可用模板,请重新选择期刊或联系管理员配置模板。'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
<template>
|
||||
<div class="tinymce-container">
|
||||
|
||||
|
||||
<i
|
||||
class="el-icon-copy-document"
|
||||
v-if="displayValue && readonly && isArticleDetailEditor"
|
||||
@click="handleCopy"
|
||||
style="margin-top: -30px; float: right; margin-bottom: 10px; cursor: pointer;"
|
||||
></i>
|
||||
<div style="clear: both;"></div>
|
||||
<div v-if="readonly" v-html="displayValue" class="readonly-content">
|
||||
|
||||
</div>
|
||||
@@ -55,6 +61,13 @@
|
||||
oldValue: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 只在 articleDetailEditor 路由下显示复制图标
|
||||
isArticleDetailEditor() {
|
||||
console.log(this.$route);
|
||||
return this.$route && this.$route.path === '/articleDetailEditor';
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
handler(newVal) {
|
||||
@@ -96,6 +109,41 @@ beforeDestroy() {
|
||||
|
||||
|
||||
methods: {
|
||||
handleCopy() {
|
||||
|
||||
|
||||
if (this.displayValue) {
|
||||
// 1. 使用正则匹配 <wmath ... data-latex="内容" ...>...</wmath>
|
||||
// 这里的正则会精准提取 data-latex 属性中的值
|
||||
const cleanValue = this.displayValue.replace(/<wmath[^>]*data-latex="([^"]*)"[^>]*>[\s\S]*?<\/wmath>/g, '$1');
|
||||
|
||||
// 2. 如果你还想顺便把 <br> 转换成换行符,可以加上这一行:
|
||||
const finalValue = cleanValue.replace(/<br\s*\/?>/gi, '\n');
|
||||
|
||||
|
||||
|
||||
// 3. 执行复制到剪贴板的操作
|
||||
this.copyToClipboard(finalValue);
|
||||
}
|
||||
},
|
||||
|
||||
copyToClipboard(text) {
|
||||
// 兼容性较好的复制方法
|
||||
const textArea = document.createElement("textarea");
|
||||
textArea.value = text;
|
||||
document.body.appendChild(textArea);
|
||||
textArea.select();
|
||||
try {
|
||||
document.execCommand('copy');
|
||||
this.$message({
|
||||
message: 'Successfully copied to clipboard!',
|
||||
type: 'success'
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('无法复制', err);
|
||||
}
|
||||
document.body.removeChild(textArea);
|
||||
},
|
||||
destroyTinymce() {
|
||||
this.displayValue=null
|
||||
// 通过 window.tinymce 获取全局对象,根据 id 找到并销毁
|
||||
|
||||
190
src/components/page/components/email/CkeditorMail.vue
Normal file
190
src/components/page/components/email/CkeditorMail.vue
Normal file
@@ -0,0 +1,190 @@
|
||||
<template>
|
||||
<div class="tinymce-container editor-container">
|
||||
<textarea class="tinymce-textarea" :id="tinymceId"></textarea>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CommonJS from '@/common/js/commonJS'
|
||||
|
||||
export default {
|
||||
name: 'TinyEditor',
|
||||
props: {
|
||||
value: { type: String, default: '' },
|
||||
id: { type: String, default: () => 'tiny-' + +new Date() },
|
||||
showSelectTemplateButton: { type: Boolean, default: false }
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tinymceId: this.id,
|
||||
editor: null
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
if (!this.editor) return;
|
||||
const next = val || '';
|
||||
const current = this.editor.getContent() || '';
|
||||
if (next !== current) {
|
||||
this.editor.setContent(next);
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initTiny();
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 自动化行内样式转换工具 (高兼容性版)
|
||||
* @param {String} htmlContent 原始 HTML 字符串
|
||||
* @returns {String} 转换后的 HTML 字符串
|
||||
*/
|
||||
autoInlineStyles(htmlContent) {
|
||||
if (!htmlContent) return "";
|
||||
|
||||
const parser = new DOMParser();
|
||||
// 使用 text/html 解析,会自动补全 html/body 结构
|
||||
const doc = parser.parseFromString(htmlContent, "text/html");
|
||||
const styleTags = doc.querySelectorAll("style");
|
||||
|
||||
styleTags.forEach((tag) => {
|
||||
let rules = [];
|
||||
try {
|
||||
// 1. 尝试从浏览器引擎直接获取解析好的 CSS 规则
|
||||
if (tag.sheet && tag.sheet.cssRules && tag.sheet.cssRules.length > 0) {
|
||||
rules = Array.from(tag.sheet.cssRules);
|
||||
} else {
|
||||
// 2. 兜底:如果 sheet 为空(通常因为手动插入 DOM 还没渲染),则进行手动正则解析
|
||||
const cssText = tag.textContent.replace(/\/\*[\s\S]*?\*\//g, ""); // 移除注释
|
||||
const ruleRegex = /([^{]+)\s*\{\s*([^}]+)\s*\}/g;
|
||||
let match;
|
||||
while ((match = ruleRegex.exec(cssText)) !== null) {
|
||||
rules.push({
|
||||
selectorText: match[1].trim(),
|
||||
styleText: match[2].trim(),
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("CSS 解析失败,跳过该 Style 标签", e);
|
||||
}
|
||||
|
||||
// 遍历每一条 CSS 规则
|
||||
rules.forEach((rule) => {
|
||||
try {
|
||||
const selector = rule.selectorText;
|
||||
|
||||
// 过滤邮件不支持的复杂规则(伪类 :hover, @media 等)
|
||||
if (selector.includes(":") || selector.includes("@")) return;
|
||||
|
||||
// 使用 querySelectorAll 找到所有匹配的元素
|
||||
const elements = doc.querySelectorAll(selector);
|
||||
|
||||
elements.forEach((el) => {
|
||||
// 获取当前规则的样式文本
|
||||
const newStyleText = rule.style ? rule.style.cssText : rule.styleText;
|
||||
|
||||
// 获取元素已有的行内样式
|
||||
const existingStyle = el.getAttribute("style") || "";
|
||||
|
||||
// 合并样式:
|
||||
// 注意:CSS 的顺序决定优先级,后面定义的会覆盖前面的
|
||||
// 为了简单起见,我们直接追加在后面,浏览器会自动应用最后一个声明
|
||||
const mergedStyle = existingStyle +
|
||||
(existingStyle && !existingStyle.endsWith(";") ? "; " : " ") +
|
||||
newStyleText;
|
||||
|
||||
el.setAttribute("style", mergedStyle.trim());
|
||||
});
|
||||
} catch (err) {
|
||||
// 忽略无法解析的选择器 (例如某些 AI 写的非法选择器)
|
||||
}
|
||||
});
|
||||
|
||||
// 转换完成后移除 style 标签,避免干扰邮件客户端
|
||||
tag.remove();
|
||||
});
|
||||
|
||||
// 针对邮件模板的特殊处理:确保 meta 编码正确
|
||||
const meta = doc.querySelector('meta[charset]');
|
||||
if (!meta) {
|
||||
const charsetMeta = doc.createElement('meta');
|
||||
charsetMeta.setAttribute('charset', 'UTF-8');
|
||||
doc.head.insertBefore(charsetMeta, doc.head.firstChild);
|
||||
}
|
||||
|
||||
// 返回包含声明的完整内容
|
||||
return "<!DOCTYPE html>\n" + doc.documentElement.outerHTML;
|
||||
},
|
||||
initTiny() {
|
||||
const vueInstance = this;
|
||||
const hasTemplateBtn = this.showSelectTemplateButton;
|
||||
window.tinymce.init({
|
||||
selector: `#${this.tinymceId}`,
|
||||
language: 'zh_CN', // 记得下载语言包,没有就删掉这行
|
||||
height: 500,
|
||||
// 核心配置:允许所有 HTML 标签和样式,这对比邮件模板至关重要
|
||||
valid_children: '+body[tr],+body[thead],+body[tbody],+body[table],+body[style],+p[style],+div[style]',
|
||||
extended_valid_elements: 'style,meta,title',
|
||||
custom_elements: 'style,meta,title',
|
||||
verify_html: false, // 关闭 HTML 校验,防止自动删掉你的邮件结构
|
||||
forced_root_block: '', // 停止自动包裹 <p> 标签
|
||||
|
||||
// 插件需要包含这些,否则工具栏按钮不会显示
|
||||
plugins: 'code link table lists fullscreen directionality codesample preview charmap autolink nonbreaking',
|
||||
|
||||
// 按照图片布局精准排序:
|
||||
toolbar: hasTemplateBtn
|
||||
? 'undo redo | selectTemplate | code preview | fontselect fontsizeselect | formatselect | bold italic underline strikethrough | forecolor backcolor | bullist numlist | lineheight outdent indent | alignleft aligncenter alignright alignjustify | table link | fullscreen'
|
||||
: 'undo redo | code preview | fontselect fontsizeselect | formatselect | bold italic underline strikethrough | forecolor backcolor | bullist numlist | lineheight outdent indent | alignleft aligncenter alignright alignjustify | table link | fullscreen',
|
||||
|
||||
// 补充:让字体和字号选择器更有序
|
||||
fontsize_formats: '12px 14px 16px 18px 24px 36px 48px',
|
||||
font_formats: '系统默认=System Default; 微软雅黑=Microsoft YaHei; 宋体=SimSun; 黑体=SimHei; Arial=arial,helvetica,sans-serif; Times New Roman=times new roman,times;',
|
||||
branding: false,
|
||||
promotion: false,
|
||||
// 邮件编辑优化:允许在源码中看到完整的 html 结构
|
||||
fullpage_enabled: true,
|
||||
setup(editor) {
|
||||
// 自定义 Select Template 按钮(触发 Vue 事件给父组件,按需显示)
|
||||
if (hasTemplateBtn) {
|
||||
editor.ui.registry.addButton('selectTemplate', {
|
||||
text: 'Select Template ▾',
|
||||
onAction() {
|
||||
vueInstance.$emit('onSelectTemplate');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 统一给自定义按钮加样式(无按钮时不会产生影响)
|
||||
CommonJS.inTinymceButtonClass();
|
||||
},
|
||||
init_instance_callback: (editor) => {
|
||||
this.editor = editor;
|
||||
if (this.value) {
|
||||
editor.setContent(this.value);
|
||||
}
|
||||
|
||||
// 监听内容变化
|
||||
editor.on('NodeChange Change KeyUp SetContent', () => {
|
||||
vueInstance.$emit('input', editor.getContent());
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 获取经过行内样式转换后的内容
|
||||
getInlinedContent() {
|
||||
if (!this.editor) return '';
|
||||
const rawHtml = this.editor.getContent();
|
||||
// 调用我们之前的 autoInlineStyles 方法
|
||||
return this.autoInlineStyles(rawHtml);
|
||||
},
|
||||
},
|
||||
beforeDestroy() {
|
||||
// 销毁编辑器防止内存泄漏
|
||||
if (window.tinymce.get(this.tinymceId)) {
|
||||
window.tinymce.get(this.tinymceId).destroy();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -2,9 +2,10 @@
|
||||
<div class="mail-detail-container">
|
||||
<div class="detail-toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-tooltip content="回复" placement="bottom"><i class="el-icon-chat-line-square action-icon"></i></el-tooltip>
|
||||
<!-- <el-tooltip content="回复" placement="bottom"><i class="el-icon-chat-line-square action-icon"></i></el-tooltip>
|
||||
<el-tooltip content="转发" placement="bottom"><i class="el-icon-position action-icon"></i></el-tooltip>
|
||||
<el-tooltip content="删除" placement="bottom"><i class="el-icon-delete action-icon" style="color: #fb2c36;"></i></el-tooltip>
|
||||
-->
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<!-- <i class="el-icon-star-off action-icon"></i> -->
|
||||
|
||||
274
src/components/page/components/email/TemplateSelectorDialog.vue
Normal file
274
src/components/page/components/email/TemplateSelectorDialog.vue
Normal file
@@ -0,0 +1,274 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="Template Selection"
|
||||
:visible.sync="visible"
|
||||
:close-on-click-modal="false"
|
||||
width="90%"
|
||||
top="5vh"
|
||||
destroy-on-close
|
||||
:before-close="handleClose"
|
||||
custom-class="template-modal"
|
||||
>
|
||||
<div class="template-wrapper">
|
||||
<div class="selection-panel">
|
||||
|
||||
<el-tabs v-model="activeStep">
|
||||
<el-tab-pane label="1.Choose Style" name="style">
|
||||
<div class="card-grid">
|
||||
<div
|
||||
v-for="(item,index) in headerStyles" :key="item.id"
|
||||
:class="['card-item', { active: selectedHeaderId === item.id }]"
|
||||
@click="selectedHeaderId = item.id"
|
||||
>
|
||||
<div class="card-img" @click.stop="selectedHeaderId = item.id">
|
||||
<div v-html="item.htmlHeader+item.htmlFooter" style="zoom: 0.15;pointer-events: none; user-select: none;"></div>
|
||||
</div>
|
||||
|
||||
<p class="card-title"><span>{{ index+1 }}. </span>{{ item.name }}</p>
|
||||
<p
|
||||
class="card-desc"
|
||||
:class="{ expanded: expandedHeaderId === item.id }"
|
||||
@click.stop="toggleDesc(item.id)"
|
||||
>
|
||||
{{ item.description }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="2.Choose Template" name="content">
|
||||
<div style="margin-bottom: 15px; padding: 0 5px;">
|
||||
<p style="font-size: 12px; color: #999; margin-bottom: 5px;">Journal:</p>
|
||||
<el-select
|
||||
v-model="selectedJournalId"
|
||||
placeholder="All Journals"
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
@change="handleJournalChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in journalOptions"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<div
|
||||
class="card-grid"
|
||||
v-loading="contentLoading"
|
||||
>
|
||||
<div
|
||||
v-for="(item,index) in contentTemplates" :key="item.id"
|
||||
:class="['card-item', { active: selectedContentId === item.id }]"
|
||||
@click="selectedContentId = item.id"
|
||||
>
|
||||
|
||||
<p class="card-title" style="text-align: left;margin-top: 0;"><span>{{ index+1 }}. </span>{{ item.name }}<br><span style="color:#888 ;">{{ item.subject }}</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
||||
<div class="preview-panel">
|
||||
<div class="preview-label">LIVE PREVIEW</div>
|
||||
<div class="preview-container">
|
||||
<div class="mail-render-box" v-html="combinedHtml"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<div class="footer-info">
|
||||
Selected: <strong>{{ currentSelectionText }}</strong>
|
||||
</div>
|
||||
<div>
|
||||
<el-button @click="handleClose" style="">Cancel</el-button>
|
||||
<el-button type="primary" icon="el-icon-check" @click="submit">Apply Template</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
visible: Boolean
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeStep: 'style',
|
||||
// 期刊过滤
|
||||
journalOptions: [],
|
||||
selectedJournalId: null,
|
||||
selectedHeaderId: null,
|
||||
selectedContentId: null,
|
||||
expandedHeaderId: null,
|
||||
// 头部样式列表(通过接口获取)
|
||||
headerStyles: [],
|
||||
contentTemplates: [],
|
||||
contentLoading: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.fetchJournals();
|
||||
this.fetchHeaderStyles();
|
||||
|
||||
},
|
||||
computed: {
|
||||
// 【关键】拼接 HTML
|
||||
combinedHtml() {
|
||||
const header = this.headerStyles.find(h => h.id === this.selectedHeaderId);
|
||||
const content = this.contentTemplates.find(c => c.id === this.selectedContentId);
|
||||
|
||||
// 没有可用模板时,右侧显示提示文案(走国际化)
|
||||
if (!header || !content) {
|
||||
const msg = this.$t('mailTemplate.noTemplateTip');
|
||||
return `<div style="padding: 40px; text-align: center; color: #999; font-size: 14px;">
|
||||
${msg}
|
||||
</div>`;
|
||||
}
|
||||
|
||||
// 返回完整的拼接代码,使用内联样式以兼容邮件
|
||||
return `${header.htmlHeader}${content.bodyHtml}${header.htmlFooter}`;
|
||||
},
|
||||
currentSelectionText() {
|
||||
const h = this.headerStyles.find(h => h.id === this.selectedHeaderId);
|
||||
const c = this.contentTemplates.find(c => c.id === this.selectedContentId);
|
||||
return `${h ? h.name : ''} + ${c ? c.name : ''}`;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取期刊列表用于过滤模板
|
||||
async fetchJournals() {
|
||||
try {
|
||||
const res = await this.$api.post('api/Journal/getAllJournal', {});
|
||||
if (!res || res.code !== 0) {
|
||||
return;
|
||||
}
|
||||
this.journalOptions = res.data.journals.map(j => ({
|
||||
id: j.journal_id,
|
||||
label:j.title,
|
||||
}));
|
||||
if (this.journalOptions.length && !this.selectedJournalId) {
|
||||
this.selectedJournalId = this.journalOptions[0].id;
|
||||
|
||||
this.fetchContentTemplates();
|
||||
}
|
||||
} catch (e) {
|
||||
// 静默失败
|
||||
}
|
||||
},
|
||||
toggleDesc(id) {
|
||||
this.expandedHeaderId = this.expandedHeaderId === id ? null : id;
|
||||
},
|
||||
async handleJournalChange() {
|
||||
// 切换期刊时重新拉取样式和模板(按需可改为带 journal_id 过滤)
|
||||
this.contentTemplates=[]
|
||||
await this.fetchContentTemplates();
|
||||
if (this.contentTemplates.length) {
|
||||
this.selectedContentId = this.contentTemplates[0].id;
|
||||
}
|
||||
},
|
||||
// 调用接口获取头部样式列表
|
||||
async fetchHeaderStyles() {
|
||||
try {
|
||||
const res = await this.$api.post('api/mail_template/listStyles', {
|
||||
journal_id: this.selectedJournalId
|
||||
});
|
||||
if (!res || res.code !== 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 后端返回字段:style_id, name, header_html, footer_html
|
||||
|
||||
this.headerStyles = res.data.list.map(item => ({
|
||||
id: item.style_id,
|
||||
name: item.name,
|
||||
description:item.description || '',
|
||||
htmlHeader: item.header_html || '',
|
||||
htmlFooter: item.footer_html || ''
|
||||
}));
|
||||
console.log("🚀 ~ headerStyles:", this.headerStyles);
|
||||
// 默认选中第一条
|
||||
if (this.headerStyles.length && !this.selectedHeaderId) {
|
||||
this.selectedHeaderId = this.headerStyles[0].id;
|
||||
}
|
||||
} catch (e) {
|
||||
// 静默失败,避免打断用户流程
|
||||
}
|
||||
},
|
||||
// 调用接口获取内容模板列表
|
||||
async fetchContentTemplates() {
|
||||
try {
|
||||
this.contentLoading = true;
|
||||
const res = await this.$api.post('api/mail_template/listTemplates', {
|
||||
journal_id: this.selectedJournalId
|
||||
});
|
||||
if (!res || res.code !== 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 后端返回字段:template_id, title, body_html 等
|
||||
this.contentTemplates = res.data.list.map(item => ({
|
||||
id: item.template_id,
|
||||
name: item.title,
|
||||
subject: item.subject,
|
||||
bodyHtml: item.body_html || ''
|
||||
}));
|
||||
|
||||
// 默认选中第一条
|
||||
if (this.contentTemplates.length && !this.selectedContentId) {
|
||||
this.selectedContentId = this.contentTemplates[0].id;
|
||||
}
|
||||
} catch (e) {
|
||||
// 静默失败
|
||||
} finally {
|
||||
this.contentLoading = false;
|
||||
}
|
||||
},
|
||||
handleClose() {
|
||||
this.$emit('update:visible', false);
|
||||
},
|
||||
submit() {
|
||||
// 将拼接好的 HTML 抛给父组件
|
||||
this.$emit('confirm', this.combinedHtml);
|
||||
this.handleClose();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.template-wrapper { display: flex; height: 70vh; gap: 20px; }
|
||||
.selection-panel { width: 260px; border-right: 1px solid #eee; padding-right: 10px; overflow-y: auto; }
|
||||
.journal-filter-form { padding-right: 8px; }
|
||||
.preview-panel { flex: 1; background: #f4f6f8; padding: 20px; display: flex; flex-direction: column; }
|
||||
.preview-label { font-weight: bold; color: #999; font-size: 12px; margin-bottom: 10px; }
|
||||
.preview-container { background: #fff; flex: 1; border-radius: 4px; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
|
||||
|
||||
.card-grid { display: flex; flex-direction: column; gap: 12px; margin-top: 15px; }
|
||||
.card-item { border: 1px solid #ddd; border-radius: 8px; padding: 8px; cursor: pointer; transition: 0.3s; }
|
||||
.card-item.active { border-color: #6366f1; background: #f5f7ff; outline: 1px solid #6366f1; }
|
||||
.card-img { width: 100%; height: auto; border-radius: 4px; }
|
||||
.card-title { font-size: 13px; margin: 8px 0 0; text-align: center; color: #666; }
|
||||
.card-desc {
|
||||
font-size: 12px;
|
||||
color: #888;
|
||||
margin-top: 4px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
cursor: pointer;
|
||||
}
|
||||
.card-desc.expanded {
|
||||
white-space: normal;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.dialog-footer { display: flex; justify-content: space-between; align-items: center; width: 100%; }
|
||||
.footer-info { color: #666; font-size: 14px; }
|
||||
</style>
|
||||
315
src/components/page/expertDatabase.vue
Normal file
315
src/components/page/expertDatabase.vue
Normal file
@@ -0,0 +1,315 @@
|
||||
<template>
|
||||
<div class="scholar-db-container">
|
||||
<div class="crumbs">
|
||||
<el-breadcrumb separator="/">
|
||||
<el-breadcrumb-item>
|
||||
<i class="el-icon-user"></i> Expert Database
|
||||
</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
<div class="toolbar">
|
||||
<div class="filters">
|
||||
<el-form :inline="true" :model="query" size="small">
|
||||
<el-form-item label="">
|
||||
<el-cascader
|
||||
ref="cascader"
|
||||
@change="handleChange"
|
||||
v-model="major_id"
|
||||
:placeholder="'Please select field'"
|
||||
:options="options"
|
||||
:props="getProps()"
|
||||
style="width: 260px"
|
||||
></el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item label="">
|
||||
<el-input
|
||||
v-model="query.keyword"
|
||||
placeholder="Name / Email / Affiliation"
|
||||
clearable
|
||||
style="width: 260px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" :loading="loading" @click="handleSearch">
|
||||
Search
|
||||
</el-button>
|
||||
<el-button @click="handleReset">Reset</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<el-button type="success" icon="el-icon-download" @click="handleExport" :loading="exportLoading">
|
||||
Download Excel
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-card class="table-card" shadow="never">
|
||||
<el-table :data="list" border stripe v-loading="loading" header-row-class-name="dark-table-header">
|
||||
<el-table-column prop="name" label="Base Information" min-width="220">
|
||||
<template slot-scope="scope">
|
||||
<div>
|
||||
<p class="info-row">
|
||||
<span class="label">Name: </span><span class="value bold">{{ scope.row.name }}</span>
|
||||
</p>
|
||||
<p class="info-row">
|
||||
<span class="label">Email: </span><span class="value link">{{ scope.row.email }}</span>
|
||||
</p>
|
||||
<p class="info-row" style="margin-top: 10px; font-size: 12px">
|
||||
<span class="label">Acquisition Time:</span>
|
||||
<span class="value time">{{ scope.row.ctime_text ? scope.row.ctime_text : '-' }}</span>
|
||||
</p>
|
||||
|
||||
<span class="custom-tag">{{ scope.row.state_text }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="affiliation" label="Affiliation" min-width="260" />
|
||||
<el-table-column prop="fieldDisplay" label="Research areas" min-width="200">
|
||||
<template slot-scope="scope">
|
||||
<div v-for="(field, index) in scope.row.fields" :key="index">
|
||||
<span>
|
||||
<span style="color: #006699">{{ index + 1 }}.</span>
|
||||
{{ field.field }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination">
|
||||
<el-pagination
|
||||
background
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:current-page="query.pageIndex"
|
||||
:page-size="query.pageSize"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
:total="total"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Common from '@/components/common/common';
|
||||
export default {
|
||||
name: 'expertDatabase',
|
||||
data() {
|
||||
return {
|
||||
mediaUrl: Common.mediaUrl,
|
||||
major_id: [],
|
||||
query: {
|
||||
major_id: null,
|
||||
keyword: '',
|
||||
pageIndex: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
options: [],
|
||||
list: [],
|
||||
total: 0,
|
||||
loading: false,
|
||||
exportLoading: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.loadFields();
|
||||
this.fetchList();
|
||||
},
|
||||
methods: {
|
||||
loadFields() {
|
||||
this.$api.post('api/Major/getMajorList', {}).then((res) => {
|
||||
const transformData = (data) => {
|
||||
return data.map((item) => {
|
||||
const transformedItem = {
|
||||
...item,
|
||||
value: item.major_id,
|
||||
label: `${item.major_title}`
|
||||
};
|
||||
if (item.children && item.children.length > 0) {
|
||||
transformedItem.children = transformData(item.children);
|
||||
}
|
||||
return transformedItem;
|
||||
});
|
||||
};
|
||||
const root = (res.data.majors || []).find((item) => item.major_id == 1);
|
||||
const data = root && root.children ? transformData(root.children) : [];
|
||||
this.options = [...data];
|
||||
});
|
||||
},
|
||||
handleChange() {
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.cascader && this.$refs.cascader.dropDownVisible !== undefined) {
|
||||
this.$refs.cascader.dropDownVisible = false;
|
||||
}
|
||||
this.query.major_id = this.major_id[this.major_id.length - 1] || null;
|
||||
this.query.pageIndex = 1;
|
||||
this.fetchList();
|
||||
});
|
||||
},
|
||||
getProps() {
|
||||
return {
|
||||
value: 'value',
|
||||
label: 'label',
|
||||
children: 'children',
|
||||
checkStrictly: true,
|
||||
expandTrigger: 'hover'
|
||||
};
|
||||
},
|
||||
async fetchList() {
|
||||
this.loading = true;
|
||||
try {
|
||||
const params = {
|
||||
major_id: this.query.major_id,
|
||||
keyword: this.query.keyword,
|
||||
pageIndex: this.query.pageIndex,
|
||||
pageSize: this.query.pageSize
|
||||
};
|
||||
const res = await this.$api.post('api/expert_manage/getList', params);
|
||||
if (res && res.code === 0 && res.data) {
|
||||
const rawList = res.data.list || [];
|
||||
this.list = rawList.map((item) => {
|
||||
const fieldArray = item.fields || [];
|
||||
const fieldNames = fieldArray.map((f) => f.field).join(', ');
|
||||
return {
|
||||
...item,
|
||||
fieldDisplay: fieldNames
|
||||
};
|
||||
});
|
||||
this.total = res.data.total || 0;
|
||||
} else {
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
}
|
||||
} catch (e) {
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
handleSearch() {
|
||||
this.query.pageIndex = 1;
|
||||
this.fetchList();
|
||||
},
|
||||
handleReset() {
|
||||
this.major_id = [];
|
||||
this.query = {
|
||||
major_id: null,
|
||||
keyword: '',
|
||||
pageIndex: 1,
|
||||
pageSize: 10
|
||||
};
|
||||
this.fetchList();
|
||||
},
|
||||
handleSizeChange(size) {
|
||||
this.query.pageSize = size;
|
||||
this.query.pageIndex = 1;
|
||||
this.fetchList();
|
||||
},
|
||||
handlePageChange(page) {
|
||||
this.query.pageIndex = page;
|
||||
this.fetchList();
|
||||
},
|
||||
async handleExport() {
|
||||
if (!this.query.major_id && !this.query.keyword) {
|
||||
this.$message.warning('Please select a research area or enter a keyword before exporting.');
|
||||
return;
|
||||
}
|
||||
this.exportLoading = true;
|
||||
try {
|
||||
const params = {
|
||||
major_id: this.query.major_id,
|
||||
keyword: this.query.keyword
|
||||
};
|
||||
const res = await this.$api.post('api/expert_manage/exportExcel', params);
|
||||
if (res && res.code === 0 && res.data && res.data.file_url) {
|
||||
window.open(this.mediaUrl + res.data.file_url, '_blank');
|
||||
} else {
|
||||
this.$message.error(res.msg || 'Export failed');
|
||||
}
|
||||
} catch (e) {
|
||||
this.$message.error(e.msg || 'Export failed');
|
||||
} finally {
|
||||
this.exportLoading = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.scholar-db-container {
|
||||
padding: 0 10px;
|
||||
}
|
||||
.toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 15px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
.filters {
|
||||
flex: 1;
|
||||
margin: 0 20px;
|
||||
margin-left: 0;
|
||||
}
|
||||
.actions {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.table-card {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.pagination {
|
||||
margin-top: 15px;
|
||||
text-align: right;
|
||||
}
|
||||
/deep/ .dark-table-header th {
|
||||
background-color: #f5f7fa;
|
||||
font-weight: 600;
|
||||
}
|
||||
/deep/ .el-form-item--mini.el-form-item,
|
||||
.el-form-item--small.el-form-item {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.custom-tag {
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
right: 6px;
|
||||
top: 0px;
|
||||
color: #ce4f15;
|
||||
font-size: 12px;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
}
|
||||
.info-row {
|
||||
margin-bottom: 4px;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
line-height: 1.2;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
.label {
|
||||
color: #999;
|
||||
margin-right: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.value {
|
||||
color: #333;
|
||||
}
|
||||
.value.bold {
|
||||
font-weight: bold;
|
||||
font-size: 15px;
|
||||
}
|
||||
.value.link {
|
||||
color: #0066a1;
|
||||
}
|
||||
.value.time {
|
||||
color: #888;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,21 +1,28 @@
|
||||
<template>
|
||||
<div class="mail-container">
|
||||
<div class="mail-sidebar">
|
||||
<div class="p-20">
|
||||
<el-button type="primary" icon="el-icon-plus" class="write-btn" @click="handleWrite">
|
||||
{{ $t('mailboxCollect.writeBtn') }}
|
||||
</el-button>
|
||||
<div class="p-10" style="padding-left: 0px;padding-right: 0px;">
|
||||
<div class="sidebar-top-actions">
|
||||
<el-button type="primary" icon="el-icon-plus" class="write-btn" @click="handleWrite">
|
||||
{{ $t('mailboxCollect.writeBtn') }}
|
||||
</el-button>
|
||||
<el-button type="success" icon="el-icon-refresh" class="receive-btn" :loading="syncLoading" @click="handleSyncInbox">
|
||||
{{ $t('mailboxCollect.receiveBtn') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="folder-list">
|
||||
<li :class="{ active: currentFolder === 'inbox' }" @click="switchFolder('inbox')">
|
||||
<i class="el-icon-message"></i> {{ $t('mailboxCollect.inboxTab') }}
|
||||
<span class="badge" v-if="queryIn.num > 0">{{ queryIn.num }}</span>
|
||||
</li>
|
||||
<li :class="{ active: currentFolder === 'sent' }" @click="switchFolder('sent')">
|
||||
<li :class="{ active: currentFolder === 'sent' }" @click="switchFolder('sent')">
|
||||
<i class="el-icon-position"></i><span style="font-size: 14px;">{{ $t('mailboxCollect.outboxTab')}}</span>
|
||||
</li>
|
||||
<li @click="notImplemented"><i class="el-icon-document"></i> <span style="font-size: 14px;">{{ $t('mailboxCollect.draftsTab')}}</span> </li>
|
||||
<!-- <li @click="notImplemented"><i class="el-icon-document"></i> <span style="font-size: 14px;">{{ $t('mailboxCollect.draftsTab')}}</span> </li>
|
||||
<li @click="notImplemented"><i class="el-icon-delete"></i> <span style="font-size: 14px;">{{ $t('mailboxCollect.deletedTab')}}</span> </li>
|
||||
-->
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="sidebar-footer">
|
||||
@@ -33,18 +40,18 @@
|
||||
</div>
|
||||
|
||||
<div class="mail-list-panel" :style="{ width: listWidth + 'px' }" v-if="selectedAccount">
|
||||
<div class="panel-header">
|
||||
<el-input
|
||||
<!-- <div class="panel-header">
|
||||
<el-input
|
||||
v-model="searchKeyword"
|
||||
prefix-icon="el-icon-search"
|
||||
:placeholder="$t('mailboxCollect.searchPlaceholder')"
|
||||
clearable
|
||||
@change="handleSearch"
|
||||
></el-input>
|
||||
<el-button icon="el-icon-refresh" circle :loading="syncLoading" @click="handleSyncInbox" style="margin-left: 10px;"></el-button>
|
||||
</div>
|
||||
<el-button icon="el-icon-refresh" circle :loading="syncLoading" @click="handleSyncInbox" style="margin-left: 10px;"></el-button>
|
||||
</div> -->
|
||||
|
||||
<div class="list-scroll-area">
|
||||
<div ref="listScrollArea" class="list-scroll-area" @scroll="onListScroll">
|
||||
<template v-if="displayList.length > 0">
|
||||
<div
|
||||
v-for="item in displayList"
|
||||
@@ -70,8 +77,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div v-else class="empty-list-container">
|
||||
<div v-if="inboxLoadingMore" class="load-more-tip">
|
||||
<i class="el-icon-loading"></i> {{ $t('mailboxCollect.loadingMore') || '加载更多...' }}
|
||||
</div>
|
||||
<div v-else-if="displayList.length > 0 && inboxPage >= inboxTotalPages" class="load-more-tip no-more">
|
||||
{{ $t('mailboxCollect.noMore') || '没有更多了' }}
|
||||
</div>
|
||||
<div v-else-if="displayList.length === 0" class="empty-list-container">
|
||||
<div class="empty-wrapper">
|
||||
<i class="el-icon-message"></i>
|
||||
<p>{{ $t('mailboxCollect.emptyText') }}</p>
|
||||
@@ -101,10 +113,23 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog :title="$t('mailboxCollect.selectAccountTitle')" :visible.sync="accountDialogVisible" width="600px" append-to-body>
|
||||
<el-dialog
|
||||
:title="$t('mailboxCollect.selectAccountTitle')"
|
||||
:visible.sync="accountDialogVisible"
|
||||
width="800px"
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
:show-close="true"
|
||||
:before-close="handleAccountDialogBeforeClose"
|
||||
>
|
||||
<el-form inline style="margin-bottom: 10px;">
|
||||
<el-form-item :label="$t('mailboxCollect.journal')">
|
||||
<el-select v-model="accountJournalId" style="width: 260px;" @change="loadAccountsForJournal">
|
||||
<el-select
|
||||
v-model="accountJournalId"
|
||||
style="width: 260px;"
|
||||
:loading="journalLoading"
|
||||
@change="loadAccountsForJournal"
|
||||
>
|
||||
<el-option v-for="item in journalList" :key="item.journal_id" :label="item.title" :value="item.journal_id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -128,7 +153,7 @@
|
||||
const API = {
|
||||
getInboxList: 'api/email_client/getInboxList',
|
||||
getEmailDetail: 'api/email_client/getEmailDetail',
|
||||
receiveMail: 'api/Mail/receiveMail',
|
||||
syncInbox: 'api/email_client/syncInbox',
|
||||
getAccounts: 'api/email_client/getAccounts',
|
||||
getOneEmail: 'api/email_client/getOneEmail',
|
||||
getAllJournal: 'api/Journal/getAllJournal',
|
||||
@@ -145,12 +170,18 @@ export default {
|
||||
tableData_out: [],
|
||||
detailMail: {},
|
||||
queryIn: { num: 0 },
|
||||
inboxPage: 1,
|
||||
inboxPerPage: 20,
|
||||
inboxTotalPages: 1,
|
||||
inboxTotal: 0,
|
||||
inboxLoadingMore: false,
|
||||
listWidth: 350,
|
||||
minWidth: 260,
|
||||
maxWidth: 600,
|
||||
selectedAccount: null,
|
||||
accountDialogVisible: false,
|
||||
journalList: [],
|
||||
journalLoading: false,
|
||||
accountJournalId: null,
|
||||
accountList: [],
|
||||
accountLoading: false,
|
||||
@@ -195,11 +226,60 @@ export default {
|
||||
},
|
||||
initAccountSelection() {
|
||||
const q = this.$route.query;
|
||||
const storedEmailId = localStorage.getItem('mailboxCollect_j_email_id');
|
||||
const storedJournalId = localStorage.getItem('mailboxCollect_journal_id');
|
||||
|
||||
// 1. 兼容老链接:如果地址栏里带有参数,优先用并写入本地
|
||||
if (q.j_email_id) {
|
||||
this.loadAccountById(q.j_email_id);
|
||||
} else {
|
||||
this.openAccountDialog();
|
||||
localStorage.setItem('mailboxCollect_j_email_id', q.j_email_id);
|
||||
if (q.journal_id) {
|
||||
localStorage.setItem('mailboxCollect_journal_id', q.journal_id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 否则尝试从本地缓存恢复上次选择
|
||||
if (storedEmailId) {
|
||||
this.loadAccountById(storedEmailId);
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. 都没有则弹出选择账号弹窗
|
||||
this.openAccountDialog();
|
||||
},
|
||||
loadDefaultAccount() {
|
||||
this.$api.post(API.getAllJournal, {}).then(res => {
|
||||
const journals = (res && res.data && res.data.journals) || res.data || [];
|
||||
const list = (Array.isArray(journals) ? journals : []).map(i => ({
|
||||
journal_id: i.journal_id || i.id,
|
||||
title: i.title || i.name || ''
|
||||
}));
|
||||
this.journalList = list;
|
||||
if (!list.length) {
|
||||
this.openAccountDialog();
|
||||
return;
|
||||
}
|
||||
const firstJournalId = list[0].journal_id;
|
||||
this.accountJournalId = firstJournalId;
|
||||
this.accountLoading = true;
|
||||
this.$api.post(API.getAccounts, { journal_id: firstJournalId }).then(accRes => {
|
||||
this.accountLoading = false;
|
||||
const accounts = accRes && accRes.data ? accRes.data : [];
|
||||
if (Array.isArray(accounts) && accounts.length > 0) {
|
||||
this.selectedAccount = accounts[0];
|
||||
this.fetchData();
|
||||
} else {
|
||||
this.accountList = accounts || [];
|
||||
this.openAccountDialog();
|
||||
}
|
||||
}).catch(() => {
|
||||
this.accountLoading = false;
|
||||
this.openAccountDialog();
|
||||
});
|
||||
}).catch(() => {
|
||||
this.openAccountDialog();
|
||||
});
|
||||
},
|
||||
loadAccountById(jEmailId) {
|
||||
this.$api.post(API.getOneEmail, { j_email_id: jEmailId }).then(res => {
|
||||
@@ -207,26 +287,34 @@ export default {
|
||||
if (res.code === 0 && email) {
|
||||
this.selectedAccount = email;
|
||||
this.fetchData();
|
||||
} else {
|
||||
this.openAccountDialog();
|
||||
}
|
||||
}).catch(() => this.openAccountDialog());
|
||||
}).catch(() => {});
|
||||
},
|
||||
openAccountDialog() {
|
||||
this.accountDialogVisible = true;
|
||||
this.loadJournals();
|
||||
if (this.selectedAccount.journal_id) {
|
||||
if (this.selectedAccount && this.selectedAccount.journal_id) {
|
||||
this.accountJournalId = this.selectedAccount.journal_id;
|
||||
this.loadAccountsForJournal(this.selectedAccount.journal_id);
|
||||
}
|
||||
},
|
||||
loadJournals() {
|
||||
this.$api.post(API.getAllJournal, {}).then(res => {
|
||||
this.journalList = (res.data.journals || res.data || []).map(i => ({
|
||||
journal_id: i.journal_id || i.id,
|
||||
title: i.title || i.name || ''
|
||||
}));
|
||||
});
|
||||
this.journalLoading = true;
|
||||
this.$api
|
||||
.post(API.getAllJournal, {})
|
||||
.then(res => {
|
||||
this.journalList = (res.data.journals || res.data || []).map(i => ({
|
||||
journal_id: i.journal_id || i.id,
|
||||
title: i.title || i.name || ''
|
||||
}));
|
||||
if (!this.accountJournalId && this.journalList.length > 0) {
|
||||
this.accountJournalId = this.journalList[0].journal_id;
|
||||
this.loadAccountsForJournal(this.accountJournalId);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.journalLoading = false;
|
||||
});
|
||||
},
|
||||
loadAccountsForJournal(id) {
|
||||
this.accountLoading = true;
|
||||
@@ -238,29 +326,72 @@ export default {
|
||||
chooseAccount(row) {
|
||||
this.selectedAccount = row;
|
||||
this.accountDialogVisible = false;
|
||||
this.closeDetail();
|
||||
this.closeDetail();
|
||||
|
||||
// 将所选邮箱配置持久化到本地,避免暴露在地址栏
|
||||
if (row && row.j_email_id) {
|
||||
localStorage.setItem('mailboxCollect_j_email_id', String(row.j_email_id));
|
||||
}
|
||||
if (row && row.journal_id) {
|
||||
localStorage.setItem('mailboxCollect_journal_id', String(row.journal_id));
|
||||
}
|
||||
|
||||
// 不再写入路由 query,直接拉取数据
|
||||
this.fetchData();
|
||||
},
|
||||
fetchData() {
|
||||
handleAccountDialogBeforeClose(done) {
|
||||
const hasAccount = this.selectedAccount || this.$route.query.j_email_id;
|
||||
if (hasAccount) {
|
||||
done();
|
||||
}else{
|
||||
this.$message.error(this.$t('mailboxCollect.selectAccountTip'));
|
||||
}
|
||||
// 没选账号时不允许关闭
|
||||
},
|
||||
// 拉取收件列表,支持分页:page=1 时替换列表,page>1 时追加;接口返回 total、page、per_page、total_pages
|
||||
fetchData(page) {
|
||||
if (!this.selectedAccount) return;
|
||||
const isFirstPage = page === 1 || page == null;
|
||||
if (isFirstPage) {
|
||||
this.inboxPage = 1;
|
||||
}
|
||||
const params = {
|
||||
j_email_id: this.selectedAccount.j_email_id,
|
||||
journal_id: this.selectedAccount.journal_id,
|
||||
keyword: this.searchKeyword || ''
|
||||
// keyword: this.searchKeyword || '',
|
||||
page: isFirstPage ? 1 : page,
|
||||
per_page: this.inboxPerPage
|
||||
};
|
||||
if (isFirstPage) {
|
||||
// 第一页不显示 loadingMore,仅翻页时显示
|
||||
} else {
|
||||
this.inboxLoadingMore = true;
|
||||
}
|
||||
this.$api.post(API.getInboxList, params).then(res => {
|
||||
const list = (res && res.data && (res.data.list || res.data)) || [];
|
||||
this.tableData_in = (Array.isArray(list) ? list : []).map(item => ({
|
||||
const data = res && res.data ? res.data : {};
|
||||
const list = Array.isArray(data.list) ? data.list : (Array.isArray(data) ? data : []);
|
||||
const rows = list.map(item => ({
|
||||
id: item.inbox_id || item.id,
|
||||
inbox_id: item.inbox_id || item.id,
|
||||
email: item.from_email,
|
||||
from_name: item.from_name,
|
||||
subject: item.subject,
|
||||
email_date: item.email_date,
|
||||
email_date: item.email_date,
|
||||
content: item.content_html || item.content_text || '',
|
||||
state: item.is_read === 1 ? 0 : 1
|
||||
}));
|
||||
this.queryIn.num = this.tableData_in.length;
|
||||
if (isFirstPage) {
|
||||
this.tableData_in = rows;
|
||||
} else {
|
||||
this.tableData_in = this.tableData_in.concat(rows);
|
||||
}
|
||||
this.inboxPage = data.page != null ? Number(data.page) : (isFirstPage ? 1 : this.inboxPage);
|
||||
this.inboxTotalPages = data.total_pages != null ? Number(data.total_pages) : 1;
|
||||
this.inboxTotal = data.total != null ? Number(data.total) : this.tableData_in.length;
|
||||
this.queryIn.num = this.inboxTotal;
|
||||
this.inboxLoadingMore = false;
|
||||
}).catch(() => {
|
||||
this.inboxLoadingMore = false;
|
||||
});
|
||||
},
|
||||
switchFolder(f) { this.currentFolder = f; this.activeMailId = null; },
|
||||
@@ -281,12 +412,26 @@ export default {
|
||||
this.detailLoading = false;
|
||||
});
|
||||
},
|
||||
// 同步收件箱:api/email_client/syncInbox 参数 j_email_id、journal_id(均为 String),完成后重新拉取 displayList
|
||||
handleSyncInbox() {
|
||||
if (!this.selectedAccount) return;
|
||||
this.syncLoading = true;
|
||||
this.$api.post(API.receiveMail, { j_email_id: this.selectedAccount.j_email_id }).then(() => {
|
||||
const params = {
|
||||
j_email_id: String(this.selectedAccount.j_email_id),
|
||||
journal_id: String(this.selectedAccount.journal_id),
|
||||
};
|
||||
this.$api.post(API.syncInbox, params).then((res) => {
|
||||
this.syncLoading = false;
|
||||
this.fetchData();
|
||||
}).catch(() => this.syncLoading = false);
|
||||
if (res && res.code === 0) {
|
||||
this.$message.success(this.$t('mailboxCollect.syncSuccess'));
|
||||
this.fetchData();
|
||||
} else {
|
||||
this.$message.error((res && res.msg) || this.$t('mailboxCollect.syncFail'));
|
||||
}
|
||||
}).catch(() => {
|
||||
this.syncLoading = false;
|
||||
this.$message.error(this.$t('mailboxCollect.syncFail'));
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 格式化邮件显示时间
|
||||
@@ -347,7 +492,16 @@ export default {
|
||||
this.selectedAccount.j_email_id
|
||||
);
|
||||
},
|
||||
handleSearch() { this.fetchData(); },
|
||||
handleSearch() { this.fetchData(1); },
|
||||
onListScroll(e) {
|
||||
const el = e.target;
|
||||
if (!el || this.currentFolder !== 'inbox' || this.inboxLoadingMore) return;
|
||||
if (this.inboxPage >= this.inboxTotalPages) return;
|
||||
const threshold = 80;
|
||||
if (el.scrollHeight - el.scrollTop - el.clientHeight <= threshold) {
|
||||
this.fetchData(this.inboxPage + 1);
|
||||
}
|
||||
},
|
||||
notImplemented() { this.$message.info('开发中...'); }
|
||||
}
|
||||
};
|
||||
@@ -370,8 +524,11 @@ export default {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.p-10 { padding: 10px; }
|
||||
.p-20 { padding: 20px; }
|
||||
.write-btn { width: 100%; border-radius: 8px; font-weight: bold; }
|
||||
.sidebar-top-actions { display: flex; gap: 10px; }
|
||||
.write-btn { flex: 1; width: auto; border-radius: 8px; font-weight: bold;padding-left: 0px;padding-right: 0px; }
|
||||
.receive-btn { flex: 1; width: auto; border-radius: 8px; font-weight: bold;margin-left: 0px;padding-left: 0px;padding-right: 0px; }
|
||||
.folder-list { list-style: none; padding: 0; margin: 0; flex: 1; }
|
||||
.folder-list li {
|
||||
padding: 12px 20px;
|
||||
@@ -384,7 +541,7 @@ export default {
|
||||
.folder-list li.active { background: #edeef0; color: #006699; font-weight: bold; border-right: 3px solid #006699; }
|
||||
.badge { margin-left: auto; background: #ddd; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
|
||||
|
||||
.sidebar-footer { padding: 15px 20px; border-top: 1px solid #eee; background: #f8f9fa; }
|
||||
.sidebar-footer { padding: 10px 0px; border-top: 1px solid #eee; background: #f8f9fa; }
|
||||
.user-card { display: flex; align-items: center; margin-bottom: 8px; overflow: hidden; }
|
||||
.user-avatar { flex-shrink: 0; background: #ffeded; color: #f56c6c; }
|
||||
.user-detail { margin-left: 10px; overflow: hidden; flex: 1; }
|
||||
@@ -413,7 +570,9 @@ export default {
|
||||
.send-time { font-size: 12px; color: #909399; flex-shrink: 0; }
|
||||
.row-two { margin-bottom: 4px; }
|
||||
.mail-subject { font-size: 13px; color: #6a7282; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.mail-excerpt { font-size: 12px; color: #606266; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
||||
.mail-excerpt { font-size: 12px; color: #606266; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
||||
.load-more-tip { text-align: center; padding: 12px; font-size: 12px; color: #909399; }
|
||||
.load-more-tip.no-more { color: #c0c4cc; }
|
||||
|
||||
/* 拖拽条 */
|
||||
.list-resizer { width: 4px; cursor: col-resize; border-left: 1px solid #eaeaea; transition: background 0.2s; }
|
||||
|
||||
@@ -24,17 +24,18 @@
|
||||
<!-- <el-table-column prop="journal_name" :label="$t('mailboxConfig.journal')" min-width="140"></el-table-column> -->
|
||||
<el-table-column prop="account" :label="$t('mailboxConfig.account')" min-width="160"></el-table-column>
|
||||
<el-table-column prop="smtp_from_name" :label="$t('mailboxConfig.smtpFromName')" min-width="120"></el-table-column>
|
||||
<el-table-column prop="smtp_host" :label="$t('mailboxConfig.smtpHost')" min-width="120"></el-table-column>
|
||||
<el-table-column prop="smtp_port" :label="$t('mailboxConfig.smtpPort')" width="100" align="center"></el-table-column>
|
||||
<el-table-column prop="imap_host" :label="$t('mailboxConfig.imapHost')" min-width="120"></el-table-column>
|
||||
<el-table-column prop="imap_port" :label="$t('mailboxConfig.imapPort')" width="100" align="center"></el-table-column>
|
||||
<!-- <el-table-column prop="smtp_host" :label="$t('mailboxConfig.smtpHost')" min-width="120"></el-table-column> -->
|
||||
<!-- <el-table-column prop="smtp_port" :label="$t('mailboxConfig.smtpPort')" width="100" align="center"></el-table-column> -->
|
||||
<!-- <el-table-column prop="imap_host" :label="$t('mailboxConfig.imapHost')" min-width="120"></el-table-column> -->
|
||||
<!-- <el-table-column prop="imap_port" :label="$t('mailboxConfig.imapPort')" width="100" align="center"></el-table-column> -->
|
||||
<el-table-column prop="today_sent" :label="$t('mailboxConfig.todaySent')" width="95" align="center"></el-table-column>
|
||||
<el-table-column prop="remaining_today" :label="$t('mailboxConfig.remainingToday')" width="130" align="center"></el-table-column>
|
||||
<!-- <el-table-column prop="state" :label="$t('mailboxConfig.state')" width="80" align="center"></el-table-column> -->
|
||||
<el-table-column :label="$t('mailboxConfig.operation')" width="220" align="center" fixed="right">
|
||||
<el-table-column label="" width="380" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="primary" plain icon="el-icon-edit" @click="handleEdit(scope.row)">{{ $t('mailboxConfig.edit') }}</el-button>
|
||||
<el-button size="mini" type="success" plain icon="el-icon-message" @click="handleMailManage(scope.row)">{{ $t('mailboxConfig.mailManage') }}</el-button>
|
||||
<el-button size="mini" type="danger" plain icon="el-icon-delete" @click="handleDelete(scope.row)">{{ $t('mailboxConfig.delete') }}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -89,7 +90,7 @@
|
||||
getAccounts: 'api/email_client/getAccounts',
|
||||
addAccount: 'api/email_client/addAccount',
|
||||
updateAccount: 'api/email_client/updateAccount',
|
||||
deleteEmailAccount: 'api/Mail/deleteEmailAccount',
|
||||
deleteAccount: 'api/email_client/deleteAccount',
|
||||
};
|
||||
|
||||
export default {
|
||||
@@ -305,14 +306,38 @@
|
||||
});
|
||||
},
|
||||
handleMailManage(row) {
|
||||
// 进入邮箱列表前,把当前选择的邮箱账号写入本地,供 mailboxCollect 使用
|
||||
if (row && row.j_email_id) {
|
||||
localStorage.setItem('mailboxCollect_j_email_id', String(row.j_email_id));
|
||||
}
|
||||
if (row && row.journal_id) {
|
||||
localStorage.setItem('mailboxCollect_journal_id', String(row.journal_id));
|
||||
}
|
||||
|
||||
this.$router.push({
|
||||
path: '/mailboxCollect',
|
||||
query: {
|
||||
journal_id: row.journal_id,
|
||||
j_email_id: row.j_email_id
|
||||
}
|
||||
});
|
||||
},
|
||||
// 删除邮箱配置:接口 api/email_client/deleteAccount,传参 j_email_id
|
||||
handleDelete(row) {
|
||||
const self = this;
|
||||
this.$confirm(self.$t('mailboxConfig.deleteConfirm'), self.$t('mailboxConfig.title'), {
|
||||
confirmButtonText: self.$t('mailboxConfig.confirm'),
|
||||
cancelButtonText: self.$t('mailboxConfig.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
self.$api.post(API.deleteAccount, { j_email_id: row.j_email_id }).then((res) => {
|
||||
if (res && res.code === 0) {
|
||||
self.$message.success(self.$t('mailboxConfig.deleteSuccess'));
|
||||
self.getList();
|
||||
} else {
|
||||
self.$message.error((res && res.msg) || self.$t('mailboxConfig.deleteFail'));
|
||||
}
|
||||
}).catch(() => {
|
||||
self.$message.error(self.$t('mailboxConfig.deleteFail'));
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,163 +1,367 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="crumbs">
|
||||
<el-breadcrumb separator="/">
|
||||
<el-breadcrumb-item>
|
||||
<i class="el-icon-message"></i> Mailbox template list
|
||||
</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div>
|
||||
<quill-editor ref="myTextEditor" v-model="tempForm.content" :options="editorOption"></quill-editor>
|
||||
<el-upload class="avatar-uploader" :action="baseUrl+'api/Suggest/upImg'" name="img" :show-file-list="false"
|
||||
:on-success="uploadSuccess">
|
||||
</el-upload>
|
||||
</div>
|
||||
</div>
|
||||
<div class="admin-container">
|
||||
|
||||
</div>
|
||||
|
||||
<el-tabs v-model="activeTab" @tab-click="handleTabChange">
|
||||
<!-- ========== Tab 1: Templates ========== -->
|
||||
<el-tab-pane :label="$t('mailboxMould.title') || 'Templates'" name="templates">
|
||||
<div class="toolbar">
|
||||
<el-select
|
||||
v-model="tplFilters.journalId"
|
||||
:placeholder="$t('mailboxMould.journalPlaceholder')"
|
||||
style="width: 300px; margin-right: 10px;"
|
||||
@change="fetchTemplates"
|
||||
>
|
||||
<el-option
|
||||
v-for="j in journalList"
|
||||
:key="j.journal_id"
|
||||
:label="j.title"
|
||||
:value="String(j.journal_id)"
|
||||
></el-option>
|
||||
</el-select>
|
||||
|
||||
<el-select
|
||||
v-model="tplFilters.scene"
|
||||
:placeholder="$t('mailboxMould.scenePlaceholder')"
|
||||
clearable
|
||||
style="width: 200px; margin-right: 10px;"
|
||||
@change="fetchTemplates"
|
||||
@clear="fetchTemplates"
|
||||
>
|
||||
<el-option :label="$t('mailboxMould.inviteSubmission')" value="invite_submission"></el-option>
|
||||
<el-option :label="$t('mailboxMould.promoteCitation')" value="promote_citation"></el-option>
|
||||
<el-option :label="$t('mailboxMould.generalThanks')" value="general_thanks"></el-option>
|
||||
</el-select>
|
||||
|
||||
<el-select
|
||||
v-model="tplFilters.language"
|
||||
:placeholder="$t('mailboxMould.languagePlaceholder')"
|
||||
clearable
|
||||
style="width: 120px; margin-right: 10px;"
|
||||
@change="fetchTemplates"
|
||||
@clear="fetchTemplates"
|
||||
>
|
||||
<el-option label="EN" value="en"></el-option>
|
||||
<el-option label="ZH" value="zh"></el-option>
|
||||
</el-select>
|
||||
|
||||
<el-button type="primary" icon="el-icon-search" @click="fetchTemplates" style="margin-right: 10px;">
|
||||
{{ $t('mailboxMould.searchBtn') }}
|
||||
</el-button>
|
||||
|
||||
<div class="right-actions">
|
||||
<el-button type="primary" plain icon="el-icon-plus" @click="handleCreateTemplate">{{ $t('mailboxMould.createTemplate') }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-table :data="tplTableData" border style="width: 100%; margin-top: 20px;" v-loading="tplLoading">
|
||||
<el-table-column prop="title" :label="$t('mailboxMould.colTitle')" min-width="220">
|
||||
<template slot-scope="scope">
|
||||
<div class="title-cell"><strong>{{ scope.row.title }}</strong></div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="subject" :label="$t('mailboxMould.colSubject')" min-width="220">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.subject || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="scene" :label="$t('mailboxMould.colScene')">
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" type="info">{{ scope.row.scene }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="language" :label="$t('mailboxMould.colLanguage')" width="100">
|
||||
<template slot-scope="scope">
|
||||
{{ String(scope.row.language || '').toUpperCase() }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="version" :label="$t('mailboxMould.colVersion')" width="100"></el-table-column>
|
||||
<el-table-column :label="$t('mailboxMould.colStatus')" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span :class="['status-dot', scope.row.status]"></span>
|
||||
{{ scope.row.status === 'active' ? $t('mailboxMould.active') : $t('mailboxMould.inactive') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="160">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" icon="el-icon-view" @click="handlePreviewTemplate(scope.row)"></el-button>
|
||||
<el-button type="text" icon="el-icon-edit" @click="handleEditTemplate(scope.row)"></el-button>
|
||||
<el-button type="text" icon="el-icon-delete" class="delete-btn" @click="handleDeleteTemplate(scope.row)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
|
||||
<!-- ========== Tab 2: Styles ========== -->
|
||||
<el-tab-pane :label="$t('mailboxStyle.title') || 'Styles'" name="styles">
|
||||
<div class="toolbar">
|
||||
<div class="right-actions">
|
||||
<el-button type="primary" icon="el-icon-refresh" @click="fetchStyles">{{ $t('mailboxStyle.searchBtn') }}</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-plus" @click="handleCreateStyle">{{ $t('mailboxStyle.createStyle') }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-table :data="styleTableData" border style="width: 100%; margin-top: 20px;" v-loading="styleLoading">
|
||||
<el-table-column prop="name" :label="$t('mailboxStyle.colName')" min-width="220">
|
||||
<template slot-scope="scope">
|
||||
<div class="title-cell"><strong>{{ scope.row.title }}</strong></div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="description" :label="$t('mailboxStyle.colDescription')" min-width="220">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.description || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="160">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" icon="el-icon-view" @click="handlePreviewStyle(scope.row)"></el-button>
|
||||
<el-button type="text" icon="el-icon-edit" @click="handleEditStyle(scope.row)"></el-button>
|
||||
<el-button type="text" icon="el-icon-delete" class="delete-btn" @click="handleDeleteStyle(scope.row)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<!-- 预览弹窗(两个 Tab 共用) -->
|
||||
<el-dialog
|
||||
:title="$t('mailboxMould.previewTitle')"
|
||||
:visible.sync="previewVisible"
|
||||
width="80%"
|
||||
>
|
||||
<div class="preview-body" v-html="previewContent"></div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="previewVisible = false">{{ $t('mailboxMould.previewClose') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 引入富文本quill-editor相关组件依赖
|
||||
import {
|
||||
quillEditor,
|
||||
Quill
|
||||
} from 'vue-quill-editor'
|
||||
// import {
|
||||
// container,
|
||||
// QuillWatch
|
||||
// } from 'quill-image-extend-module'
|
||||
// import ImageResize from 'quill-image-resize-module' // 引用,调整图片大小
|
||||
// Quill.register('modules/imageResize', ImageResize)
|
||||
const API = {
|
||||
listTemplates: 'api/mail_template/listTemplates',
|
||||
listStyles: 'api/mail_template/listStyles',
|
||||
getAllJournal: 'api/Journal/getAllJournal',
|
||||
deleteTemplate: 'api/mail_template/deleteTemplate',
|
||||
deleteStyle: 'api/mail_template/deleteStyle'
|
||||
};
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
baseUrl: this.Common.baseUrl,
|
||||
mediaUrl: this.Common.mediaUrl,
|
||||
tempForm: {
|
||||
content: ''
|
||||
},
|
||||
editorOption: {
|
||||
placeholder: 'Please enter...',
|
||||
modules: {
|
||||
toolbar: {
|
||||
container: [
|
||||
['bold', 'italic', 'underline', 'strike'],
|
||||
['blockquote', 'code-block'],
|
||||
[{
|
||||
'header': 1
|
||||
}, {
|
||||
'header': 2
|
||||
}],
|
||||
[{
|
||||
'list': 'ordered'
|
||||
}, {
|
||||
'list': 'bullet'
|
||||
}],
|
||||
[{
|
||||
'script': 'sub'
|
||||
}, {
|
||||
'script': 'super'
|
||||
}],
|
||||
[{
|
||||
'indent': '-1'
|
||||
}, {
|
||||
'indent': '+1'
|
||||
}],
|
||||
[{
|
||||
'direction': 'rtl'
|
||||
}],
|
||||
[{
|
||||
'size': ['small', false, 'large', 'huge']
|
||||
}],
|
||||
[{
|
||||
'header': [1, 2, 3, 4, 5, 6, false]
|
||||
}],
|
||||
[{
|
||||
'color': []
|
||||
}, {
|
||||
'background': []
|
||||
}],
|
||||
[{
|
||||
'font': []
|
||||
}],
|
||||
[{
|
||||
'align': []
|
||||
}],
|
||||
['link', 'image']
|
||||
],
|
||||
// 工具栏
|
||||
handlers: {
|
||||
image: function(value) {
|
||||
if (value) {
|
||||
// upload点击上传事件
|
||||
document.querySelector('.avatar-uploader input').click()
|
||||
} else {
|
||||
this.quill.format('image', false)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// 调整图片大小
|
||||
// imageResize: {
|
||||
// displayStyles: {
|
||||
// backgroundColor: 'black',
|
||||
// border: 'none',
|
||||
// color: 'white'
|
||||
// },
|
||||
// modules: ['Resize', 'DisplaySize', 'Toolbar']
|
||||
// }
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getDate();
|
||||
},
|
||||
// components: {
|
||||
// quillEditor
|
||||
// },
|
||||
methods: {
|
||||
// 获取编辑列表数据
|
||||
getDate() {
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
activeTab: 'templates',
|
||||
journalList: [],
|
||||
|
||||
},
|
||||
// --- Templates ---
|
||||
tplLoading: false,
|
||||
tplFilters: {
|
||||
journalId: '',
|
||||
scene: '',
|
||||
language: ''
|
||||
},
|
||||
tplTableData: [],
|
||||
|
||||
// 富文本编辑器
|
||||
onEditorChange({
|
||||
editor,
|
||||
html,
|
||||
text
|
||||
}) {
|
||||
this.content = html;
|
||||
},
|
||||
// --- Styles ---
|
||||
styleLoading: false,
|
||||
styleTableData: [],
|
||||
|
||||
// 上传成功
|
||||
uploadSuccess(res) {
|
||||
let quill = this.$refs.myTextEditor.quill;
|
||||
// --- 共用预览 ---
|
||||
previewVisible: false,
|
||||
previewContent: ''
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.loadJournals();
|
||||
},
|
||||
methods: {
|
||||
// ========== 公共 ==========
|
||||
loadJournals() {
|
||||
this.$api
|
||||
.post(API.getAllJournal, {})
|
||||
.then(res => {
|
||||
const list = (res && res.data && res.data.journals) || res.data || [];
|
||||
const mapped = (Array.isArray(list) ? list : []).map(j => ({
|
||||
journal_id: j.journal_id || j.id,
|
||||
title: j.title || j.name || ''
|
||||
}));
|
||||
this.journalList = mapped;
|
||||
if (mapped.length > 0) {
|
||||
this.tplFilters.journalId = String(mapped[0].journal_id);
|
||||
}
|
||||
this.fetchTemplates();
|
||||
})
|
||||
.catch(() => {
|
||||
this.journalList = [];
|
||||
});
|
||||
},
|
||||
handleTabChange(tab) {
|
||||
if (tab.name === 'templates' && this.tplTableData.length === 0) {
|
||||
this.fetchTemplates();
|
||||
} else if (tab.name === 'styles' && this.styleTableData.length === 0) {
|
||||
this.fetchStyles();
|
||||
}
|
||||
},
|
||||
|
||||
// 获取光标所在位置
|
||||
let length = quill.getSelection().index
|
||||
// 插入图片 res.upurl为服务器返回的图片地址
|
||||
quill.insertEmbed(length, 'image', this.baseUrl + res.data.icon)
|
||||
// 调整光标到最后
|
||||
quill.setSelection(length + 1)
|
||||
}
|
||||
// ========== Templates ==========
|
||||
fetchTemplates() {
|
||||
this.tplLoading = true;
|
||||
const params = {
|
||||
journal_id: this.tplFilters.journalId || '',
|
||||
scene: this.tplFilters.scene || '',
|
||||
language: this.tplFilters.language || ''
|
||||
};
|
||||
this.$api
|
||||
.post(API.listTemplates, params)
|
||||
.then(res => {
|
||||
this.tplLoading = false;
|
||||
const list = (res && res.data && res.data.list) || [];
|
||||
this.tplTableData = (Array.isArray(list) ? list : []).map(item => ({
|
||||
id: item.template_id || item.id,
|
||||
template_id: item.template_id || item.id,
|
||||
title: item.title,
|
||||
subject: item.subject,
|
||||
body_html: item.body_html,
|
||||
description: item.description || '',
|
||||
scene: item.scene,
|
||||
language: item.language,
|
||||
version: item.version,
|
||||
status: item.status || 'active'
|
||||
}));
|
||||
})
|
||||
.catch(() => {
|
||||
this.tplLoading = false;
|
||||
this.tplTableData = [];
|
||||
});
|
||||
},
|
||||
handleCreateTemplate() {
|
||||
this.$router.push({ path: '/mailboxMouldDetail' });
|
||||
},
|
||||
handleEditTemplate(row) {
|
||||
const templateId = row && (row.template_id || row.id);
|
||||
this.$router.push({ path: '/mailboxMouldDetail', query: templateId ? { template_id: String(templateId) } : {} });
|
||||
},
|
||||
handlePreviewTemplate(row) {
|
||||
this.previewContent = row && row.body_html ? row.body_html : '';
|
||||
this.previewVisible = true;
|
||||
},
|
||||
handleDeleteTemplate(row) {
|
||||
const templateId = row && (row.template_id || row.id);
|
||||
if (!templateId) return;
|
||||
this.$confirm(this.$t('mailboxMould.deleteConfirm'), this.$t('mailboxMould.colActions'), {
|
||||
confirmButtonText: this.$t('mailboxMould.confirm'),
|
||||
cancelButtonText: this.$t('mailboxMould.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$api.post(API.deleteTemplate, { template_id: String(templateId) }).then(res => {
|
||||
if (res && res.code === 0) {
|
||||
this.$message.success(this.$t('mailboxMould.deleteSuccess'));
|
||||
this.fetchTemplates();
|
||||
} else {
|
||||
this.$message.error((res && res.msg) || this.$t('mailboxMould.deleteFail'));
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.error(this.$t('mailboxMould.deleteFail'));
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
// ========== Styles ==========
|
||||
fetchStyles() {
|
||||
this.styleLoading = true;
|
||||
this.$api
|
||||
.post(API.listStyles, {})
|
||||
.then(res => {
|
||||
this.styleLoading = false;
|
||||
const list = (res && res.data && res.data.list) || [];
|
||||
this.styleTableData = (Array.isArray(list) ? list : []).map(item => ({
|
||||
id: item.style_id || item.id,
|
||||
style_id: item.style_id || item.id,
|
||||
title: item.name,
|
||||
header_html: item.header_html,
|
||||
footer_html: item.footer_html,
|
||||
description: item.description || ''
|
||||
}));
|
||||
})
|
||||
.catch(() => {
|
||||
this.styleLoading = false;
|
||||
this.styleTableData = [];
|
||||
});
|
||||
},
|
||||
handleCreateStyle() {
|
||||
this.$router.push({ path: '/mailboxStyleDetail' });
|
||||
},
|
||||
handleEditStyle(row) {
|
||||
const styleId = row && (row.style_id || row.id);
|
||||
this.$router.push({ path: '/mailboxStyleDetail', query: styleId ? { style_id: String(styleId) } : {} });
|
||||
},
|
||||
handlePreviewStyle(row) {
|
||||
const header = (row && row.header_html) || '';
|
||||
const footer = (row && row.footer_html) || '';
|
||||
this.previewContent = `${header}${footer}`;
|
||||
this.previewVisible = true;
|
||||
},
|
||||
handleDeleteStyle(row) {
|
||||
const styleId = row && (row.style_id || row.id);
|
||||
if (!styleId) return;
|
||||
this.$confirm(this.$t('mailboxMould.deleteConfirm'), this.$t('mailboxMould.colActions'), {
|
||||
confirmButtonText: this.$t('mailboxMould.confirm'),
|
||||
cancelButtonText: this.$t('mailboxMould.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$api.post(API.deleteStyle, { style_id: String(styleId) }).then(res => {
|
||||
if (res && res.code === 0) {
|
||||
this.$message.success(this.$t('mailboxMould.deleteSuccess'));
|
||||
this.fetchStyles();
|
||||
} else {
|
||||
this.$message.error((res && res.msg) || this.$t('mailboxMould.deleteFail'));
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.error(this.$t('mailboxMould.deleteFail'));
|
||||
});
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.avatar-uploader {
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.avatar-uploader .el-upload--text {
|
||||
height: 0 !important;
|
||||
border: 0;
|
||||
}
|
||||
.admin-container {
|
||||
padding: 20px;
|
||||
background: #fff;
|
||||
}
|
||||
.subtitle {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.right-actions {
|
||||
margin-left: auto;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
.status-dot {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.status-dot.active {
|
||||
background-color: #52c41a;
|
||||
}
|
||||
.delete-btn {
|
||||
color: #f5222d !important;
|
||||
}
|
||||
.preview-body {
|
||||
max-height: 70vh;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
border: 1px solid #eee;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
|
||||
360
src/components/page/mailboxMouldDetail.vue
Normal file
360
src/components/page/mailboxMouldDetail.vue
Normal file
@@ -0,0 +1,360 @@
|
||||
<template>
|
||||
<div class="detail-container">
|
||||
<header class="action-bar">
|
||||
<div class="left">
|
||||
<el-button type="text" icon="el-icon-back" @click="goBack" class="back-btn">{{ $t('mailboxMouldDetail.back') }}</el-button>
|
||||
<el-divider direction="vertical"></el-divider>
|
||||
<span class="page-title">{{ isEditMode ? $t('mailboxMouldDetail.editTemplate') : $t('mailboxMouldDetail.createTemplate') }}</span>
|
||||
|
||||
</div>
|
||||
<div class="right">
|
||||
<el-button size="mini" @click="goBack">{{ $t('mailboxMouldDetail.cancel') }}</el-button>
|
||||
<el-button type="primary" size="mini" icon="el-icon-document-checked" @click="handleSave">{{ $t('mailboxMouldDetail.save') }}</el-button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="editor-layout" v-loading="journalLoading" :element-loading-text="$t('mailboxMouldDetail.loading')">
|
||||
<aside class="config-aside scroll-panel" v-show="!journalLoading">
|
||||
<el-form ref="detailForm" label-position="top" :model="form" :rules="rules" size="mini" class="compact-form">
|
||||
<div class="section-title"><i class="el-icon-setting"></i> {{ $t('mailboxMouldDetail.basicInfo') }}</div>
|
||||
|
||||
<el-form-item prop="title" :label="$t('mailboxMouldDetail.templateTitle')">
|
||||
<el-input v-model="form.title" :placeholder="$t('mailboxMouldDetail.templateTitlePlaceholder')"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="journalId" :label="$t('mailboxMouldDetail.journal')">
|
||||
<el-select v-model="form.journalId" filterable style="width: 100%">
|
||||
<el-option v-for="j in journalList" :key="j.journal_id" :label="j.title" :value="String(j.journal_id)" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="scene" :label="$t('mailboxMouldDetail.templateType')">
|
||||
<el-select v-model="form.scene" style="width: 100%">
|
||||
<el-option :label="$t('mailboxMouldDetail.sceneInviteSubmission')" value="invite_submission"></el-option>
|
||||
<el-option :label="$t('mailboxMouldDetail.scenePromoteCitation')" value="promote_citation"></el-option>
|
||||
<el-option :label="$t('mailboxMouldDetail.sceneGeneralThanks')" value="general_thanks"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-row :gutter="8">
|
||||
<el-col :span="14">
|
||||
<el-form-item prop="lang" :label="$t('mailboxMouldDetail.languageConfig')">
|
||||
<el-radio-group v-model="form.lang" class="full-width-radio">
|
||||
<el-radio-button label="en">EN</el-radio-button>
|
||||
<el-radio-button label="zh">ZH</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item prop="version" :label="$t('mailboxMouldDetail.version')">
|
||||
<el-input v-model="form.version" :placeholder="$t('mailboxMouldDetail.versionPlaceholder')"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-divider></el-divider>
|
||||
|
||||
<div class="section-title"><i class="el-icon-cpu"></i> {{ $t('mailboxMouldDetail.variablesJson') }}</div>
|
||||
<el-form-item class="no-m-b">
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="6"
|
||||
v-model="form.variables"
|
||||
class="dark-json-input"
|
||||
:placeholder="$t('mailboxMouldDetail.variablesPlaceholder')"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<div class="status-box">
|
||||
<span>{{ $t('mailboxMouldDetail.activeStatus') }}</span>
|
||||
<el-switch v-model="form.is_active" :active-value="1" :inactive-value="0"></el-switch>
|
||||
</div>
|
||||
</el-form>
|
||||
</aside>
|
||||
|
||||
<section class="main-editor" v-show="!journalLoading">
|
||||
<el-card shadow="never" class="editor-card">
|
||||
<div class="subject-input-wrapper">
|
||||
<div class="subject-label">{{ $t('mailboxMouldDetail.emailSubject') }}:</div>
|
||||
<el-input
|
||||
v-model="form.subject"
|
||||
size="small"
|
||||
:placeholder="$t('mailboxMouldDetail.emailSubjectPlaceholder')"
|
||||
class="subject-inner-input"
|
||||
></el-input>
|
||||
</div>
|
||||
|
||||
<div class="body-editor-container">
|
||||
<div class="subject-label" style="margin-bottom: 10px;">{{ $t('mailboxMouldDetail.emailBody') }}:</div>
|
||||
<CkeditorMail v-model="form.body" />
|
||||
</div>
|
||||
</el-card>
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CkeditorMail from '@/components/page/components/email/CkeditorMail.vue';
|
||||
|
||||
const API = {
|
||||
getAllJournal: 'api/Journal/getAllJournal',
|
||||
getTemplate: 'api/mail_template/getTemplate',
|
||||
saveTemplate: 'api/mail_template/saveTemplate'
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'mailboxMouldDetail',
|
||||
components: { CkeditorMail },
|
||||
data() {
|
||||
return {
|
||||
journalLoading: true,
|
||||
journalList: [],
|
||||
rules: {
|
||||
journalId: [{ required: true, message: this.$t('mailboxMouldDetail.rulesJournal'), trigger: 'change' }],
|
||||
scene: [{ required: true, message: this.$t('mailboxMouldDetail.rulesScene'), trigger: 'change' }],
|
||||
lang: [{ required: true, message: this.$t('mailboxMouldDetail.rulesLanguage'), trigger: 'change' }],
|
||||
title: [{ required: true, message: this.$t('mailboxMouldDetail.rulesTitle'), trigger: 'blur' }],
|
||||
version: [{ required: true, message: this.$t('mailboxMouldDetail.rulesVersion'), trigger: 'blur' }]
|
||||
},
|
||||
form: {
|
||||
journalId: '',
|
||||
scene: 'invite_submission',
|
||||
lang: 'en',
|
||||
version: '1.0.0',
|
||||
title: '',
|
||||
subject: '',
|
||||
body: '',
|
||||
variables: '',
|
||||
is_active: 1
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isEditMode() {
|
||||
const q = this.$route && this.$route.query ? this.$route.query : {};
|
||||
return !!(q.template_id || q.id);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.loadJournals();
|
||||
},
|
||||
methods: {
|
||||
loadJournals() {
|
||||
this.journalLoading = true;
|
||||
this.$api
|
||||
.post(API.getAllJournal, {})
|
||||
.then(res => {
|
||||
const list = (res && res.data && res.data.journals) || res.data || [];
|
||||
const mapped = (Array.isArray(list) ? list : []).map(j => ({
|
||||
journal_id: j.journal_id || j.id,
|
||||
title: j.title || j.name || ''
|
||||
}));
|
||||
this.journalList = mapped;
|
||||
if (!this.form.journalId && mapped.length > 0) {
|
||||
this.form.journalId = String(mapped[0].journal_id);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.journalList = [];
|
||||
})
|
||||
.then(() => {
|
||||
const q = this.$route && this.$route.query ? this.$route.query : {};
|
||||
const templateId = q.template_id || q.id || '';
|
||||
if (templateId) {
|
||||
return this.loadTemplate(String(templateId));
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.finally(() => {
|
||||
this.journalLoading = false;
|
||||
});
|
||||
},
|
||||
loadTemplate(templateId) {
|
||||
return this.$api.post(API.getTemplate, { template_id: String(templateId) }).then(res => {
|
||||
if (!res || res.code !== 0) return;
|
||||
const data = (res && res.data) || {};
|
||||
const t = data.template || data.detail || data || {};
|
||||
if (t.journal_id != null) this.form.journalId = String(t.journal_id);
|
||||
if (t.scene != null) this.form.scene = String(t.scene);
|
||||
if (t.language != null) this.form.lang = String(t.language).toLowerCase();
|
||||
if (t.title != null) this.form.title = String(t.title);
|
||||
if (t.subject != null) this.form.subject = String(t.subject);
|
||||
if (t.variables_json != null) this.form.variables = String(t.variables_json);
|
||||
if (t.version != null) this.form.version = String(t.version);
|
||||
if (t.is_active != null) this.form.is_active = Number(t.is_active) === 1 ? 1 : 0;
|
||||
const bodyHtml = t.body_html != null ? t.body_html : (t.body != null ? t.body : '');
|
||||
this.form.body = String(bodyHtml || '');
|
||||
});
|
||||
},
|
||||
goBack() {
|
||||
this.$router.push({ path: '/mailboxMould' });
|
||||
},
|
||||
handleSave() {
|
||||
const formRef = this.$refs.detailForm;
|
||||
const validatePromise = formRef && formRef.validate ? new Promise(resolve => formRef.validate(ok => resolve(ok))) : Promise.resolve(true);
|
||||
validatePromise.then(ok => {
|
||||
if (!ok) return;
|
||||
if (!this.form.subject) {
|
||||
this.$message.warning(this.$t('mailboxMouldDetail.rulesSubject'));
|
||||
return;
|
||||
}
|
||||
if (!this.form.body) {
|
||||
this.$message.warning(this.$t('mailboxMouldDetail.rulesBody'));
|
||||
return;
|
||||
}
|
||||
|
||||
const q = this.$route.query;
|
||||
const templateId = q.template_id || q.id || '';
|
||||
const bodyHtml = this.form.body || '';
|
||||
const bodyText = bodyHtml.replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim();
|
||||
const params = {
|
||||
journal_id: String(this.form.journalId || ''),
|
||||
scene: String(this.form.scene || 'invite_submission'),
|
||||
language: String(this.form.lang || 'en'),
|
||||
title: String(this.form.title || ''),
|
||||
subject: String(this.form.subject || ''),
|
||||
body_html: bodyHtml,
|
||||
body_text: bodyText || '',
|
||||
variables_json: String(this.form.variables || ''),
|
||||
version: String(this.form.version || '1.0.0'),
|
||||
is_active: this.form.is_active === 1 ? '1' : '0'
|
||||
};
|
||||
if (templateId) params.template_id = String(templateId);
|
||||
this.$api.post(API.saveTemplate, params).then(res => {
|
||||
if (res && res.code === 0) {
|
||||
this.$message.success(this.$t('mailboxMouldDetail.saveSuccess'));
|
||||
this.goBack();
|
||||
} else {
|
||||
this.$message.error((res && res.msg) || this.$t('mailboxMouldDetail.saveFail'));
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.error(this.$t('mailboxMouldDetail.saveFail'));
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 容器锁定 */
|
||||
.detail-container { height: 100vh; display: flex; flex-direction: column; background: #f0f2f5; overflow: hidden; }
|
||||
|
||||
/* 顶部栏高度压缩 */
|
||||
.action-bar {
|
||||
height: 40px;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 15px;
|
||||
border-bottom: 1px solid #dcdfe6;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.action-bar .left { display: flex; align-items: center; min-width: 0; }
|
||||
.page-title { font-size: 13px; font-weight: bold; color: #333; }
|
||||
.page-subject {
|
||||
margin-left: 10px;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
max-width: 520px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.editor-layout { flex: 1; display: flex; overflow: hidden; background: #f0f2f5; }
|
||||
|
||||
/* 左侧边栏 - 占比 2 (约 20%-25%) */
|
||||
.config-aside {
|
||||
width: 280px;
|
||||
background: #fff;
|
||||
border-right: 1px solid #dcdfe6;
|
||||
padding: 15px;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.section-title { font-size: 12px; font-weight: bold; color: #409EFF; margin-bottom: 12px; display: flex; align-items: center; gap: 5px; }
|
||||
.el-divider--horizontal { margin: 15px 0; }
|
||||
|
||||
/* 右侧编辑区 - 占比 8 */
|
||||
.main-editor {
|
||||
flex: 1;
|
||||
padding: 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.editor-card {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: none;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
|
||||
}
|
||||
.editor-card /deep/ .el-card__body {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0 !important;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 邮件主题行优化 */
|
||||
.subject-input-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px 15px;
|
||||
background: #fafafa;
|
||||
border-bottom: 1px solid #eee;
|
||||
gap: 10px;
|
||||
}
|
||||
.subject-label { font-size: 12px; font-weight: bold; color: #666; white-space: nowrap; }
|
||||
.subject-inner-input{
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
|
||||
}
|
||||
.subject-inner-input /deep/ .el-input__inner { border: transparent; background: transparent; font-weight: 500; font-size: 14px; }
|
||||
.subject-inner-input /deep/ .el-input__inner:focus { background: #fff; border-color: #dcdfe6; }
|
||||
|
||||
/* 编辑器容器撑满 */
|
||||
.body-editor-container { flex: 1; overflow: hidden; padding: 10px 15px; }
|
||||
.body-editor-container /deep/ .ck-editor { height: 100%; display: flex; flex-direction: column; }
|
||||
.body-editor-container /deep/ .ck-editor__main { flex: 1; overflow: auto; }
|
||||
|
||||
/* 状态切换栏 */
|
||||
.status-box {
|
||||
margin-top: auto;
|
||||
padding-top: 15px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
/* 黑色背景 JSON 输入框 */
|
||||
.dark-json-input /deep/ .el-textarea__inner {
|
||||
background: #1e1e1e;
|
||||
color: #9cdcfe;
|
||||
font-family: 'Consolas', 'Monaco', monospace;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
border: 1px solid #333;
|
||||
}
|
||||
|
||||
/* 滚动条 */
|
||||
.scroll-panel { overflow-y: auto; }
|
||||
.scroll-panel::-webkit-scrollbar { width: 4px; }
|
||||
.scroll-panel::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }
|
||||
|
||||
/* 表单紧凑微调 */
|
||||
.detail-container /deep/ .el-form-item--mini.el-form-item { margin-bottom: 12px; }
|
||||
.detail-container /deep/ .el-form--label-top .el-form-item__label { padding: 0 0 4px; font-size: 12px; color: #999; }
|
||||
</style>
|
||||
@@ -11,7 +11,7 @@
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="container" style="padding-top: 0px;">
|
||||
<div class="mail_shuru" style="position: relative; display: flex; align-items: center;">
|
||||
<span class="mail_tit">{{ $t('mailboxSend.to') }}</span>
|
||||
|
||||
@@ -51,15 +51,15 @@
|
||||
</el-autocomplete>
|
||||
</div>
|
||||
|
||||
<span class="sel_liby" @click="handleSetLibrary" style="position: static; margin-left: 10px;">
|
||||
<!-- <span class="sel_liby" @click="handleSetLibrary" style="position: static; margin-left: 10px;">
|
||||
<i class="el-icon-plus"></i>{{ $t('mailboxSend.selectFromLibrary') }}
|
||||
</span>
|
||||
</span> -->
|
||||
</div>
|
||||
<div class="mail_shuru">
|
||||
<span class="mail_tit">{{ $t('mailboxSend.subject') }}</span>
|
||||
<el-input v-model="queryMail.sendtitle" class="mail_inp" ></el-input>
|
||||
</div>
|
||||
<div class="mail_shuru" style="position: relative; display: flex; align-items: center;">
|
||||
<!-- <div class="mail_shuru" style="position: relative; display: flex; align-items: center;">
|
||||
<span class="mail_tit">{{ $t('mailboxSend.cc') }}</span>
|
||||
<div style="flex: 1; display: flex; flex-wrap: wrap; align-items: center;">
|
||||
<div class="selected-tags" v-if="ccList && ccList.length" style="display: inline-block;">
|
||||
@@ -93,14 +93,22 @@
|
||||
</template>
|
||||
</el-autocomplete>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div style="margin: 20px 0 0 0;">
|
||||
<quill-editor ref="myTextEditor" v-model="queryMail.content" :options="editorOption"></quill-editor>
|
||||
<el-upload class="avatar-uploader-mail" :action="baseUrl+'api/Suggest/upImg'" name="img" :show-file-list="false"
|
||||
:on-success="uploadSuccess">
|
||||
</el-upload>
|
||||
<div class="mail-editor-wrap" style="margin: 20px 0 0 0;">
|
||||
<!-- 仿阿里邮箱:工具栏中的 源代码编辑 / 退出源码编辑 -->
|
||||
|
||||
|
||||
<emailCkeditor
|
||||
ref="myTextEditor"
|
||||
v-model="queryMail.content"
|
||||
:is-source-mode="isSourceMode"
|
||||
:source-content.sync="sourceContent"
|
||||
:source-rows="16"
|
||||
:source-placeholder="$t('mailboxSend.sourcePlaceholder')"
|
||||
:show-select-template-button="true"
|
||||
@onSelectTemplate="showTemplateDialog = true"
|
||||
/>
|
||||
</div>
|
||||
<div class="mail-footer-bar" :style="{ left: footerBarLeft }">
|
||||
<div class="sender-info">
|
||||
@@ -114,7 +122,7 @@
|
||||
<el-button type="primary" icon="el-icon-s-promotion" :loading="sendLoading" :disabled="sendLoading" @click="handleSend">
|
||||
{{ $t('mailboxSend.send') }}
|
||||
</el-button>
|
||||
<el-button size="medium" :loading="saveDraftLoading" :disabled="saveDraftLoading" @click="handleSaveDraft">{{ $t('mailboxSend.saveDraft') }}</el-button>
|
||||
<!-- <el-button size="medium" :loading="saveDraftLoading" :disabled="saveDraftLoading" @click="handleSaveDraft">{{ $t('mailboxSend.saveDraft') }}</el-button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -147,40 +155,16 @@
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 选择模板 -->
|
||||
<el-dialog :title="$t('mailboxSend.selectTemplate')" :visible.sync="Templatebox" width="620px" :close-on-click-modal="false">
|
||||
<el-form ref="Tempform" :model="TempForm" label-width="225px">
|
||||
<el-form-item :label="$t('mailboxSend.chooseTemplate')">
|
||||
<el-select v-model="TempForm.board" :placeholder="$t('mailboxSend.chooseTemplatePlaceholder')" @change="select_tem($event)" style="width: 220px;">
|
||||
<el-option :key="0" :label="$t('mailboxSend.none') " :value="0"></el-option>
|
||||
<el-option v-for="item in fol_low" :key="item.value" :label="item.label" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('mailboxSend.previewTemplate')">
|
||||
<img src="../../assets/img/img.jpg" alt="" style="width: 250px;">
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="Templatebox = false">{{ $t('mailboxSend.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="saveTemplate">{{ $t('mailboxSend.save') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<template-selector-dialog v-if="showTemplateDialog"
|
||||
:visible.sync="showTemplateDialog"
|
||||
@confirm="handleTemplateApply"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 引入富文本quill-editor相关组件依赖
|
||||
import {
|
||||
quillEditor,
|
||||
Quill
|
||||
} from 'vue-quill-editor'
|
||||
// import {
|
||||
// container,
|
||||
// QuillWatch
|
||||
// } from 'quill-image-extend-module'
|
||||
// import ImageResize from 'quill-image-resize-module' // 引用,调整图片大小
|
||||
// Quill.register('modules/imageResize', ImageResize)
|
||||
import emailCkeditor from '@/components/page/components/email/CkeditorMail.vue'
|
||||
import TemplateSelectorDialog from '@/components/page/components/email/TemplateSelectorDialog.vue'
|
||||
import 'multi-items-input'
|
||||
import 'multi-items-input/dist/multi-items-input.css'
|
||||
import bus from '../common/bus'
|
||||
@@ -214,81 +198,13 @@
|
||||
},
|
||||
LibrForm: {},
|
||||
LibrarySelection: [],
|
||||
Templatebox: false,
|
||||
showTemplateDialog: false,
|
||||
Librarybox: false,
|
||||
link_TotalLibry: 0,
|
||||
editorOption: {
|
||||
placeholder: this.$t('mailboxSend.editorPlaceholder'),
|
||||
modules: {
|
||||
toolbar: {
|
||||
container: [
|
||||
['bold', 'italic', 'underline', 'strike'],
|
||||
['blockquote', 'code-block'],
|
||||
[{
|
||||
'header': 1
|
||||
}, {
|
||||
'header': 2
|
||||
}],
|
||||
[{
|
||||
'list': 'ordered'
|
||||
}, {
|
||||
'list': 'bullet'
|
||||
}],
|
||||
[{
|
||||
'script': 'sub'
|
||||
}, {
|
||||
'script': 'super'
|
||||
}],
|
||||
[{
|
||||
'indent': '-1'
|
||||
}, {
|
||||
'indent': '+1'
|
||||
}],
|
||||
[{
|
||||
'direction': 'rtl'
|
||||
}],
|
||||
[{
|
||||
'size': ['small', false, 'large', 'huge']
|
||||
}],
|
||||
[{
|
||||
'header': [1, 2, 3, 4, 5, 6, false]
|
||||
}],
|
||||
[{
|
||||
'color': []
|
||||
}, {
|
||||
'background': []
|
||||
}],
|
||||
[{
|
||||
'font': []
|
||||
}],
|
||||
[{
|
||||
'align': []
|
||||
}],
|
||||
['link', 'image']
|
||||
],
|
||||
// 工具栏
|
||||
handlers: {
|
||||
image: function(value) {
|
||||
if (value) {
|
||||
// upload点击上传事件
|
||||
document.querySelector('.avatar-uploader input').click()
|
||||
} else {
|
||||
this.quill.format('image', false)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// 调整图片大小
|
||||
// imageResize: {
|
||||
// displayStyles: {
|
||||
// backgroundColor: 'black',
|
||||
// border: 'none',
|
||||
// color: 'white'
|
||||
// },
|
||||
// modules: ['Resize', 'DisplaySize', 'Toolbar']
|
||||
// }
|
||||
}
|
||||
},
|
||||
isSourceMode: false,
|
||||
// 源码模式下的完整 HTML(保留 DOCTYPE、html、行内样式等),发送时若在源码模式则用此项
|
||||
sourceContent: '',
|
||||
|
||||
toInput: '',
|
||||
toSelecting: false,
|
||||
nextToUid: 1,
|
||||
@@ -301,6 +217,10 @@
|
||||
saveDraftLoading: false,
|
||||
};
|
||||
},
|
||||
components: {
|
||||
emailCkeditor,
|
||||
TemplateSelectorDialog,
|
||||
},
|
||||
computed: {
|
||||
footerBarLeft() {
|
||||
const collapsed = this.collapseValue === true || this.collapseValue === 'true';
|
||||
@@ -327,6 +247,35 @@
|
||||
bus.$off('collapse-content');
|
||||
},
|
||||
methods: {
|
||||
handleTemplateApply(htmlContent) {
|
||||
// 假设你使用的是 TinyMCE
|
||||
if (window.tinymce && window.tinymce.activeEditor) {
|
||||
// 建议:如果你想保留已有内容,用 insertContent;
|
||||
// 如果想彻底更换模板,用 setContent。
|
||||
window.tinymce.activeEditor.setContent(htmlContent);
|
||||
|
||||
this.$message.success('Template applied successfully!');
|
||||
}
|
||||
},
|
||||
// 切换富文本 / 源代码编辑模式(源码用 sourceContent 保留完整 HTML,可自由来回切换)
|
||||
toggleSourceMode() {
|
||||
if (this.isSourceMode) {
|
||||
// 退出源码 -> 先用 juice 做样式内联,再同步给富文本展示
|
||||
if (this.$refs.myTextEditor && this.$refs.myTextEditor.handleInlining) {
|
||||
const finalHtml = this.$refs.myTextEditor.handleInlining();
|
||||
this.sourceContent = finalHtml || this.sourceContent || '';
|
||||
this.queryMail.content = this.sourceContent;
|
||||
} else {
|
||||
this.queryMail.content = this.sourceContent || '';
|
||||
}
|
||||
} else {
|
||||
// 进入源码:仅当源码区为空时才从富文本同步,避免覆盖你已编辑的完整 HTML
|
||||
if (this.sourceContent === '' || this.sourceContent == null) {
|
||||
this.sourceContent = this.queryMail.content || '';
|
||||
}
|
||||
}
|
||||
this.isSourceMode = !this.isSourceMode;
|
||||
},
|
||||
// 返回收件箱(邮箱列表),带上 journal_id 和 j_email_id
|
||||
goBackInbox() {
|
||||
const q = this.$route.query;
|
||||
@@ -533,11 +482,13 @@
|
||||
return;
|
||||
}
|
||||
this.sendLoading = true;
|
||||
// 优先发送完整 HTML(sourceContent),这样富文本编辑后也能保持 head/style/table 等结构(像阿里邮箱)
|
||||
const bodyContent = this.sourceContent || (this.queryMail.content || '');
|
||||
const params = {
|
||||
journal_id: journalId,
|
||||
to_email: toList.join(','),
|
||||
subject: this.queryMail.sendtitle,
|
||||
content: this.queryMail.content || '',
|
||||
content: bodyContent,
|
||||
};
|
||||
const self = this;
|
||||
this.$api.post('api/email_client/sendOne', params).then((res) => {
|
||||
@@ -548,6 +499,7 @@
|
||||
self.queryMail.sendcc = '';
|
||||
self.ccList = [];
|
||||
self.queryMail.content = '';
|
||||
self.sourceContent = '';
|
||||
self.fileL_atta = [];
|
||||
self.goBackInbox();
|
||||
} else {
|
||||
@@ -619,19 +571,7 @@
|
||||
this.getLibary();
|
||||
},
|
||||
|
||||
// 模板选择-弹出框
|
||||
handleSetMoudle() {
|
||||
this.Templatebox = true
|
||||
},
|
||||
// 保存模板
|
||||
saveTemplate() {
|
||||
|
||||
},
|
||||
|
||||
// 下拉换模板预览
|
||||
select_tem(e) {
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -906,4 +846,32 @@
|
||||
box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
|
||||
}
|
||||
|
||||
/* Quill 工具栏“源代码编辑”按钮文案 */
|
||||
/* 仿阿里邮箱:源代码编辑 工具栏条 */
|
||||
.editor-toolbar-bar {
|
||||
border: 1px solid #dcdfe6;
|
||||
border-bottom: none;
|
||||
background: #fafafa;
|
||||
padding: 8px 12px;
|
||||
border-radius: 4px 4px 0 0;
|
||||
}
|
||||
.toolbar-source-btn {
|
||||
color: #409eff;
|
||||
padding: 0 4px;
|
||||
}
|
||||
.toolbar-source-btn.exit {
|
||||
color: #909399;
|
||||
}
|
||||
.source-editor-box {
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 0 0 4px 4px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.source-editor-box .el-textarea__inner {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
font-family: Consolas, Monaco, monospace;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
205
src/components/page/mailboxStyle.vue
Normal file
205
src/components/page/mailboxStyle.vue
Normal file
@@ -0,0 +1,205 @@
|
||||
<template>
|
||||
<div class="admin-container">
|
||||
<h2>{{ $t('mailboxStyle.title') }}</h2>
|
||||
<p class="subtitle">{{ $t('mailboxStyle.subtitle') }}</p>
|
||||
|
||||
<div class="toolbar">
|
||||
|
||||
<div class="right-actions">
|
||||
<el-button type="primary" icon="el-icon-refresh" @click="fetchList">{{ $t('mailboxStyle.searchBtn') }}</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-plus" @click="handleCreate">{{ $t('mailboxStyle.createStyle') }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-table :data="tableData" border style="width: 100%; margin-top: 20px;" v-loading="loading">
|
||||
<el-table-column prop="name" :label="$t('mailboxStyle.colName')" min-width="220">
|
||||
<template slot-scope="scope">
|
||||
<div class="title-cell">
|
||||
<strong>{{ scope.row.title }}</strong>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="description" :label="$t('mailboxStyle.colDescription')" min-width="220">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.description || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column width="160">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" icon="el-icon-view" @click="handlePreview(scope.row)"></el-button>
|
||||
<el-button type="text" icon="el-icon-edit" @click="handleEdit(scope.row)"></el-button>
|
||||
<el-button type="text" icon="el-icon-delete" class="delete-btn" @click="handleDelete(scope.row)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-dialog
|
||||
:title="$t('mailboxMould.previewTitle')"
|
||||
:visible.sync="previewVisible"
|
||||
width="80%"
|
||||
>
|
||||
<div class="preview-body" v-html="previewContent"></div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="previewVisible = false">{{ $t('mailboxMould.previewClose') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const API = {
|
||||
listStyles: 'api/mail_template/listStyles',
|
||||
getAllJournal: 'api/Journal/getAllJournal',
|
||||
deleteStyle: 'api/mail_template/deleteStyle'
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'mailboxStyle',
|
||||
data() {
|
||||
return {
|
||||
searchQuery: '',
|
||||
loading: false,
|
||||
journalList: [],
|
||||
filters: {
|
||||
journalId: '',
|
||||
scene: '',
|
||||
language: ''
|
||||
},
|
||||
tableData: [],
|
||||
previewVisible: false,
|
||||
previewContent: ''
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.loadJournals();
|
||||
},
|
||||
methods: {
|
||||
loadJournals() {
|
||||
this.$api
|
||||
.post(API.getAllJournal, {})
|
||||
.then(res => {
|
||||
const list = (res && res.data && res.data.journals) || res.data || [];
|
||||
const mapped = (Array.isArray(list) ? list : []).map(j => ({
|
||||
journal_id: j.journal_id || j.id,
|
||||
title: j.title || j.name || ''
|
||||
}));
|
||||
this.journalList = mapped;
|
||||
if (mapped.length > 0) {
|
||||
this.filters.journalId = String(mapped[0].journal_id);
|
||||
}
|
||||
this.fetchList();
|
||||
})
|
||||
.catch(() => {
|
||||
this.journalList = [];
|
||||
});
|
||||
},
|
||||
fetchList() {
|
||||
this.loading = true;
|
||||
const params = {
|
||||
journal_id: this.filters.journalId || '',
|
||||
scene: this.filters.scene || '',
|
||||
language: this.filters.language || ''
|
||||
};
|
||||
this.$api
|
||||
.post(API.listStyles, params)
|
||||
.then(res => {
|
||||
this.loading = false;
|
||||
const list = (res && res.data && res.data.list) || [];
|
||||
this.tableData = (Array.isArray(list) ? list : []).map(item => ({
|
||||
id: item.style_id || item.id,
|
||||
style_id: item.style_id || item.id,
|
||||
title: item.name,
|
||||
|
||||
header_html: item.header_html,
|
||||
footer_html: item.footer_html,
|
||||
description: item.description || '',
|
||||
|
||||
}));
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false;
|
||||
this.tableData = [];
|
||||
});
|
||||
},
|
||||
handleCreate() {
|
||||
this.$router.push({ path: '/mailboxStyleDetail' });
|
||||
},
|
||||
handleEdit(row) {
|
||||
const styleId = row && (row.style_id || row.id);
|
||||
// TODO: 跳转到“风格详情”页,并带上 style_id
|
||||
this.$router.push({ path: '/mailboxStyleDetail', query: styleId ? { style_id: String(styleId) } : {} });
|
||||
},
|
||||
handlePreview(row) {
|
||||
const header = (row && row.header_html) || '';
|
||||
const footer = (row && row.footer_html) || '';
|
||||
this.previewContent = `${header}${footer}`;
|
||||
this.previewVisible = true;
|
||||
},
|
||||
handleDelete(row) {
|
||||
const styleId = row && (row.style_id || row.id);
|
||||
if (!styleId) return;
|
||||
this.$confirm(this.$t('mailboxMould.deleteConfirm'), this.$t('mailboxMould.colActions'), {
|
||||
confirmButtonText: this.$t('mailboxMould.confirm'),
|
||||
cancelButtonText: this.$t('mailboxMould.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$api.post(API.deleteStyle, { style_id: String(styleId) }).then(res => {
|
||||
if (res && res.code === 0) {
|
||||
this.$message.success(this.$t('mailboxMould.deleteSuccess'));
|
||||
this.fetchList();
|
||||
} else {
|
||||
this.$message.error((res && res.msg) || this.$t('mailboxMould.deleteFail'));
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.error(this.$t('mailboxMould.deleteFail'));
|
||||
});
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.admin-container {
|
||||
padding: 20px;
|
||||
background: #fff;
|
||||
}
|
||||
.subtitle {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.right-actions {
|
||||
margin-left: auto;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
.status-dot {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.status-dot.active {
|
||||
background-color: #52c41a;
|
||||
}
|
||||
.delete-btn {
|
||||
color: #f5222d !important;
|
||||
}
|
||||
.preview-body {
|
||||
max-height: 70vh;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
border: 1px solid #eee;
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
|
||||
158
src/components/page/mailboxStyleDetail.vue
Normal file
158
src/components/page/mailboxStyleDetail.vue
Normal file
@@ -0,0 +1,158 @@
|
||||
<template>
|
||||
<div class="detail-container">
|
||||
<header class="action-bar">
|
||||
<div class="left">
|
||||
<el-button type="text" icon="el-icon-back" @click="goBack" class="back-btn">{{ $t('mailboxStyleDetail.back') }}</el-button>
|
||||
<el-divider direction="vertical"></el-divider>
|
||||
<span class="page-title">{{ isEditMode ? $t('mailboxStyleDetail.editStyle') : $t('mailboxStyleDetail.createStyle') }}</span>
|
||||
</div>
|
||||
<div class="right">
|
||||
<el-button size="mini" @click="goBack">{{ $t('mailboxStyleDetail.cancel') }}</el-button>
|
||||
<el-button type="primary" size="mini" icon="el-icon-document-checked" @click="handleSave">{{ $t('mailboxStyleDetail.save') }}</el-button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="editor-layout" v-loading="loading" :element-loading-text="$t('mailboxStyleDetail.loading')">
|
||||
<section class="scroll-panel edit-section">
|
||||
<el-form ref="styleForm" label-position="top" :model="form" :rules="rules" size="mini" class="compact-form">
|
||||
<el-form-item prop="name" :label="$t('mailboxStyleDetail.name')">
|
||||
<el-input v-model="form.name" :placeholder="$t('mailboxStyleDetail.namePlaceholder')"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="description" :label="$t('mailboxStyleDetail.description')">
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
v-model="form.description"
|
||||
:placeholder="$t('mailboxStyleDetail.descriptionPlaceholder')"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="header_html" :label="$t('mailboxStyleDetail.headerHtml')">
|
||||
<el-input type="textarea" v-model="form.header_html" rows="10" :placeholder="$t('mailboxStyleDetail.headerHtmlPlaceholder')"></el-input>
|
||||
<!-- <CkeditorMail v-model="form.header_html" /> -->
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="footer_html" :label="$t('mailboxStyleDetail.footerHtml')">
|
||||
<!-- <CkeditorMail v-model="form.footer_html" /> -->
|
||||
<el-input type="textarea" v-model="form.footer_html" rows="10" :placeholder="$t('mailboxStyleDetail.footerHtmlPlaceholder')"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CkeditorMail from '@/components/page/components/email/CkeditorMail.vue';
|
||||
|
||||
const API = {
|
||||
getStyle: 'api/mail_template/getStyle',
|
||||
saveStyle: 'api/mail_template/saveStyle'
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'mailboxStyleDetail',
|
||||
components: { CkeditorMail },
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
form: {
|
||||
style_id: '',
|
||||
name: '',
|
||||
description: '',
|
||||
header_html: '',
|
||||
footer_html: ''
|
||||
},
|
||||
rules: {
|
||||
name: [{ required: true, message: this.$t('mailboxStyleDetail.rulesName'), trigger: 'blur' }],
|
||||
description: [{ required: true, message: this.$t('mailboxStyleDetail.rulesDescription'), trigger: 'blur' }],
|
||||
header_html: [{ required: true, message: this.$t('mailboxStyleDetail.rulesHeaderHtml'), trigger: 'change' }],
|
||||
footer_html: [{ required: true, message: this.$t('mailboxStyleDetail.rulesFooterHtml'), trigger: 'change' }]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isEditMode() {
|
||||
const q = this.$route && this.$route.query ? this.$route.query : {};
|
||||
return !!(q.style_id || q.id);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const q = this.$route && this.$route.query ? this.$route.query : {};
|
||||
const styleId = q.style_id || q.id || '';
|
||||
if (styleId) {
|
||||
this.loadDetail(String(styleId));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadDetail(styleId) {
|
||||
this.loading = true;
|
||||
this.$api
|
||||
.post(API.getStyle, { style_id: styleId })
|
||||
.then(res => {
|
||||
const data = (res && res.data) || {};
|
||||
const s = data.style || data.detail || data || {};
|
||||
this.form.style_id = styleId;
|
||||
if (s.name != null) this.form.name = String(s.name);
|
||||
if (s.description != null) this.form.description = String(s.description);
|
||||
if (s.header_html != null) this.form.header_html = String(s.header_html);
|
||||
if (s.footer_html != null) this.form.footer_html = String(s.footer_html);
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
goBack() {
|
||||
this.$router.push({ path: '/mailboxStyle' });
|
||||
},
|
||||
handleSave() {
|
||||
const formRef = this.$refs.styleForm;
|
||||
const validatePromise =
|
||||
formRef && formRef.validate ? new Promise(resolve => formRef.validate(ok => resolve(ok))) : Promise.resolve(true);
|
||||
validatePromise.then(ok => {
|
||||
if (!ok) return;
|
||||
this.loading = true;
|
||||
const q = this.$route && this.$route.query ? this.$route.query : {};
|
||||
const styleId = q.style_id || q.id || '';
|
||||
const params = {
|
||||
style_id: styleId ? String(styleId) : '',
|
||||
name: this.form.name || '',
|
||||
description: this.form.description || '',
|
||||
header_html: this.form.header_html || '',
|
||||
footer_html: this.form.footer_html || ''
|
||||
};
|
||||
this.$api
|
||||
.post(API.saveStyle, params)
|
||||
.then(res => {
|
||||
if (res && res.code === 0) {
|
||||
this.$message.success(this.$t('mailboxStyleDetail.saveSuccess'));
|
||||
this.goBack();
|
||||
} else {
|
||||
this.$message.error((res && res.msg) || this.$t('mailboxStyleDetail.saveFail'));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.error(this.$t('mailboxStyleDetail.saveFail'));
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.detail-container { height: 100vh; display: flex; flex-direction: column; background: #f4f6f8; overflow: hidden; }
|
||||
.action-bar { height: 40px; background: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 15px; border-bottom: 1px solid #dcdfe6; flex-shrink: 0; }
|
||||
.page-title { font-size: 13px; font-weight: bold; color: #333; }
|
||||
.back-btn { font-size: 13px; }
|
||||
|
||||
.editor-layout { flex: 1; display: flex; padding: 12px; gap: 12px; overflow: hidden; }
|
||||
.edit-section { flex: 1; background: #fff; border: 1px solid #ebeef5; border-radius: 4px; padding: 15px; overflow-y: auto; }
|
||||
|
||||
.compact-form /deep/ .el-form-item__label { padding-bottom: 4px; font-size: 12px; color: #999; }
|
||||
.compact-form /deep/ .el-form-item--mini.el-form-item { margin-bottom: 12px; }
|
||||
</style>
|
||||
@@ -1,524 +1,434 @@
|
||||
<template>
|
||||
<div class="scholar-container">
|
||||
<div class="sidebar">
|
||||
<el-card class="params-card" shadow="never">
|
||||
<div slot="header" class="card-header" style="font-weight: bold;"><i class="el-icon-search"></i> Scholar Search</div>
|
||||
|
||||
<el-form :model="form" ref="searchForm" :rules="rules" label-position="top">
|
||||
<el-form-item label="Keyword" prop="keyword">
|
||||
<el-input v-model="form.keyword" placeholder="e.g. cancer" clearable></el-input>
|
||||
<div class="scholar-db-container">
|
||||
<div class="crumbs">
|
||||
<el-breadcrumb separator="/">
|
||||
<el-breadcrumb-item> <i class="el-icon-user"></i> Scholar Database </el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</div>
|
||||
<div class="toolbar">
|
||||
<div class="filters">
|
||||
<el-form :inline="true" :model="query" size="small">
|
||||
<el-form-item label="">
|
||||
<el-cascader
|
||||
ref="cascader"
|
||||
@change="handleChange(index)"
|
||||
v-model="major_id"
|
||||
:placeholder="'Please select field'"
|
||||
:options="options"
|
||||
:props="getProps()"
|
||||
style="width: 260px"
|
||||
></el-cascader>
|
||||
</el-form-item>
|
||||
<el-form-item label="">
|
||||
<el-input v-model="query.keyword" placeholder="Name / Email / Affiliation" clearable style="width: 260px" />
|
||||
</el-form-item>
|
||||
|
||||
<div class="form-row">
|
||||
<el-form-item label="Per Page (Articles)" class="half-width">
|
||||
<el-input-number v-model="per_page" :controls="false" :min="1" :max="100"></el-input-number>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="Page Number" class="half-width">
|
||||
<el-input-number v-model="page" :controls="false" :min="1" :max="maxPages"></el-input-number>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div style="display: flex; gap: 10px; margin-top: 15px;">
|
||||
<el-button type="primary" class="fetch-btn" style="flex: 3;" :loading="loading" @click="handleExecute">
|
||||
<i v-if="!loading" class="el-icon-coin"></i>
|
||||
{{ loading ? 'Fetching...' : 'Execute Fetch' }}
|
||||
</el-button>
|
||||
|
||||
<el-button @click="resetForm" class="custom-reset-btn">
|
||||
<i class="el-icon-refresh-left"></i> Reset
|
||||
</el-button>
|
||||
</div>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" :loading="loading" @click="handleSearch"> Search </el-button>
|
||||
<el-button @click="handleReset">Reset</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<div class="info-box">
|
||||
<h4>INFORMATION</h4>
|
||||
|
||||
<p>
|
||||
"This tool allows for systematic extraction of scholar data from academic publications. Note that per_page refers to the
|
||||
number of articles scanned, which may yield multiple scholar records."
|
||||
</p>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<el-button type="success" icon="el-icon-download" @click="handleExport" :loading="exportLoading">
|
||||
Download Excel
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-content" :style="{border:hasSearched && !loading ? 'none' : '2px solid #e2e2e2'}">
|
||||
<div v-if="!hasSearched && !loading" class="main-content-center">
|
||||
<div class="empty-state">
|
||||
<div class="state-icon"><i class="el-icon-user"></i></div>
|
||||
<el-card class="table-card" shadow="never">
|
||||
<div class="source-tag">Data sourced from PubMed</div>
|
||||
<el-table :data="list" border stripe v-loading="loading" header-row-class-name="dark-table-header">
|
||||
<el-table-column prop="name" label="Base Information" min-width="220">
|
||||
<template slot-scope="scope">
|
||||
<div>
|
||||
<p class="info-row">
|
||||
<span class="label">Name: </span><span class="value bold">{{ scope.row.name }}</span>
|
||||
</p>
|
||||
<p class="info-row">
|
||||
<span class="label">Email: </span><span class="value link">{{ scope.row.email }}</span>
|
||||
</p>
|
||||
<p class="info-row" style="margin-top: 10px; font-size: 12px">
|
||||
<span class="label">Acquisition Time:</span>
|
||||
<span class="value time">{{ scope.row.ctime_text ? scope.row.ctime_text : '-' }}</span>
|
||||
</p>
|
||||
|
||||
<h3>Scholar Search</h3>
|
||||
<span class="custom-tag">{{ scope.row.state_text }}</span>
|
||||
</div>
|
||||
</template></el-table-column
|
||||
>
|
||||
|
||||
<p>
|
||||
Enter a research keyword and specify the search depth to retrieve expert profiles from professional academic
|
||||
databases.
|
||||
</p>
|
||||
</div>
|
||||
<el-table-column prop="affiliation" label="Affiliation" min-width="260" />
|
||||
<el-table-column prop="fieldDisplay" label="Research areas" min-width="200">
|
||||
<template slot-scope="scope">
|
||||
<div v-for="(field, index) in scope.row.fields" :key="index">
|
||||
<span
|
||||
><span style="color: #006699">{{ index + 1 }}.</span> {{ field.field }}</span
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination">
|
||||
<el-pagination
|
||||
background
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:current-page="query.pageIndex"
|
||||
:page-size="query.pageSize"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
:total="total"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="main-content-center">
|
||||
<div class="processing-state">
|
||||
<div class="spinner-box"><i class="el-icon-loading"></i></div>
|
||||
|
||||
<h3>PROCESSING REQUEST</h3>
|
||||
|
||||
<p>Connecting to api.tmrjournals.com...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="hasSearched && !loading" class="results-container">
|
||||
<div class="results-header">
|
||||
<div class="results-stats">
|
||||
<i class="el-icon-user"></i> RESULTS FOUND: <strong>{{ total }}</strong>
|
||||
<span class="divider">|</span>
|
||||
<span class="page-info">PAGE {{ page }} OF APPROX. {{ maxPages }}</span>
|
||||
<template v-if="Source">
|
||||
<span class="divider">|</span>
|
||||
<span class="page-info">Source {{ Source }}</span>
|
||||
</template>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="results-nav">
|
||||
<el-button
|
||||
class="nav-btn"
|
||||
size="mini"
|
||||
icon="el-icon-arrow-left"
|
||||
:disabled="page <= 1"
|
||||
@click="changePage(-1)"
|
||||
></el-button>
|
||||
|
||||
<el-button
|
||||
class="nav-btn"
|
||||
size="mini"
|
||||
icon="el-icon-arrow-right"
|
||||
:disabled="page >= maxPages"
|
||||
@click="changePage(1)"
|
||||
></el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-table :data="exportFiles" class="custom-table" border stripe header-row-class-name="dark-table-header">
|
||||
<el-table-column prop="name" label="File name" min-width="200"></el-table-column>
|
||||
<el-table-column prop="url" label="File url" min-width="250">
|
||||
<template slot-scope="scope">
|
||||
<el-link class="file-link" :href="mediaUrl+scope.row.url" target="_blank">
|
||||
{{ scope.row.url }}
|
||||
<i class="el-icon-download download-icon"></i>
|
||||
</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="count" label="Count" width="120" align="center"></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Common from '@/components/common/common'
|
||||
import Common from '@/components/common/common';
|
||||
export default {
|
||||
name: 'scholarCrawlers',
|
||||
data() {
|
||||
return {
|
||||
mediaUrl: Common.mediaUrl,
|
||||
form: { keyword: '' },
|
||||
rules: {
|
||||
keyword: [{ required: true, message: 'Required', trigger: 'blur' }]
|
||||
major_id: [],
|
||||
majors: [],
|
||||
query: {
|
||||
major_id: null,
|
||||
keyword: '',
|
||||
|
||||
pageIndex: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
loading: false,
|
||||
exportLoading: false,
|
||||
hasSearched: false,
|
||||
page: 1,
|
||||
per_page: 20,
|
||||
maxPages: 100, // 初始上限
|
||||
list: [],
|
||||
total: 0,
|
||||
Source: '',
|
||||
exportFiles: [] // 模拟图二的文件列表数据
|
||||
loading: false,
|
||||
exportLoading: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.loadFields();
|
||||
this.fetchList();
|
||||
},
|
||||
methods: {
|
||||
resetForm() {
|
||||
this.form = { keyword: '' };
|
||||
this.page = 1;
|
||||
this.per_page=20;
|
||||
this.$refs.searchForm.resetFields();
|
||||
},
|
||||
async handleExecute() {
|
||||
this.$refs.searchForm.validate(async (valid) => {
|
||||
if (!valid) return;
|
||||
this.loading = true;
|
||||
this.hasSearched = false;
|
||||
loadFields() {
|
||||
this.$api.post('api/Major/getMajorList', {}).then((res) => {
|
||||
const transformData = (data) => {
|
||||
return data.map((item) => {
|
||||
const transformedItem = {
|
||||
...item,
|
||||
value: item.major_id,
|
||||
label: `${item.major_title}`
|
||||
};
|
||||
|
||||
try {
|
||||
// 1. 调用 Search 接口获取页数上限
|
||||
const searchRes = await this.$api.post('/api/expert_finder/search', {
|
||||
keyword: this.form.keyword,
|
||||
page: this.page,
|
||||
per_page: this.per_page
|
||||
});
|
||||
|
||||
if (searchRes && searchRes.code === 0) {
|
||||
this.total = searchRes.data.total || 0;
|
||||
this.maxPages = searchRes.data.total_pages || 1; // 2. 模拟处理延迟(配合图一动画)
|
||||
this.Source = searchRes.data.source || '';
|
||||
await new Promise((resolve) => setTimeout(resolve, 1500)); // 3. 调用 Export 接口生成文件
|
||||
|
||||
const exportRes = await this.$api.post('/api/expert_finder/export', {
|
||||
keyword: this.form.keyword,
|
||||
page: this.page,
|
||||
per_page: this.per_page
|
||||
});
|
||||
|
||||
if (exportRes && (exportRes.code === 0 || exportRes.status === 1)) {
|
||||
// 构造图二展示的数据格式
|
||||
const fileUrl = exportRes.data ? exportRes.data.file_url || exportRes.file_url : '';
|
||||
const fileName = fileUrl ? fileUrl.split('/').pop() : `experts_${this.form.keyword}_p${this.page}.xlsx`;
|
||||
this.exportFiles = [
|
||||
{
|
||||
url: fileUrl,
|
||||
name: fileName,
|
||||
count: searchRes.data.experts ? searchRes.data.experts.length : 0
|
||||
}
|
||||
];
|
||||
this.hasSearched = true;
|
||||
// 如果存在 children,递归处理
|
||||
if (item.children && item.children.length > 0) {
|
||||
transformedItem.children = transformData(item.children);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this.$message.error('Execution failed');
|
||||
console.error(error);
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
return transformedItem;
|
||||
});
|
||||
};
|
||||
|
||||
// 执行递归,获取选项数据
|
||||
const data = transformData(res.data.majors.find((item) => item.major_id == 1).children);
|
||||
this.options = [...data]; // 将选项数据赋给 options
|
||||
});
|
||||
},
|
||||
changePage(step) {
|
||||
this.page += step;
|
||||
this.handleExecute();
|
||||
handleChange(i) {
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.$refs[`cascader`].dropDownVisible = false;
|
||||
this.query.major_id = this.major_id[this.major_id.length - 1];
|
||||
this.query.pageIndex = 1;
|
||||
this.fetchList();
|
||||
|
||||
this.$forceUpdate();
|
||||
});
|
||||
},
|
||||
getProps() {
|
||||
return {
|
||||
value: 'value',
|
||||
label: 'label',
|
||||
children: 'children',
|
||||
checkStrictly: true, // 允许任意选择一级
|
||||
expandTrigger: 'hover' // 使用 hover 触发展开
|
||||
};
|
||||
},
|
||||
async fetchMajors() {
|
||||
try {
|
||||
const res = await this.$api.post('api/Ucenter/getMajor', { major_id: 1 });
|
||||
if (res && res.code === 0 && res.data && res.data.major) {
|
||||
this.majors = res.data.major.children || [];
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
},
|
||||
async fetchList() {
|
||||
this.loading = true;
|
||||
try {
|
||||
const params = {
|
||||
major_id: this.query.major_id,
|
||||
keyword: this.query.keyword,
|
||||
|
||||
pageIndex: this.query.pageIndex,
|
||||
pageSize: this.query.pageSize
|
||||
};
|
||||
const res = await this.$api.post('api/expert_manage/getList', params);
|
||||
if (res && res.code === 0 && res.data) {
|
||||
const rawList = res.data.list || [];
|
||||
// 后端已提供单个 field 字段,直接用于列表展示
|
||||
|
||||
this.list = rawList.map((item) => {
|
||||
// 1. 获取后端返回的原始 field 数组(看截图应该是 item.field)
|
||||
const fieldArray = item.fields || [];
|
||||
|
||||
// 2. 提取出数组中每个对象里的 'field' 属性字符串
|
||||
// 如果只需要展示文本,可以用 join 连起来
|
||||
const fieldNames = fieldArray.map((f) => f.field).join(', ');
|
||||
|
||||
return {
|
||||
...item,
|
||||
fieldDisplay: fieldNames
|
||||
};
|
||||
});
|
||||
this.total = res.data.total || 0;
|
||||
} else {
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
}
|
||||
} catch (e) {
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
handleSearch() {
|
||||
this.query.pageIndex = 1;
|
||||
this.fetchList();
|
||||
},
|
||||
handleReset() {
|
||||
this.major_id = [];
|
||||
this.query = {
|
||||
major_id: null,
|
||||
keyword: '',
|
||||
|
||||
pageIndex: 1,
|
||||
pageSize: 10
|
||||
};
|
||||
this.fetchList();
|
||||
},
|
||||
handleSizeChange(size) {
|
||||
this.query.pageSize = size;
|
||||
this.query.pageIndex = 1;
|
||||
this.fetchList();
|
||||
},
|
||||
handlePageChange(page) {
|
||||
this.query.pageIndex = page;
|
||||
this.fetchList();
|
||||
},
|
||||
async handleExport() {
|
||||
// 导出前必须至少选择领域或填写关键字
|
||||
if (!this.query.major_id && !this.query.keyword) {
|
||||
this.$message.warning('Please select a research area or enter a keyword before exporting.');
|
||||
return;
|
||||
}
|
||||
this.exportLoading = true;
|
||||
try {
|
||||
const params = {
|
||||
major_id: this.query.major_id,
|
||||
keyword: this.query.keyword
|
||||
};
|
||||
const res = await this.$api.post('api/expert_manage/exportExcel', params);
|
||||
if (res && res.code === 0 && res.data && res.data.file_url) {
|
||||
window.open(this.mediaUrl + res.data.file_url, '_blank');
|
||||
} else {
|
||||
this.$message.error(res.msg || 'Export failed');
|
||||
}
|
||||
} catch (e) {
|
||||
this.$message.error(e.msg || 'Export failed');
|
||||
} finally {
|
||||
this.exportLoading = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 全局基础:背景色与字体 */
|
||||
.scholar-container {
|
||||
display: flex;
|
||||
/* background-color: #E6E6E6; */
|
||||
|
||||
padding: 20px 0;
|
||||
box-sizing: border-box;
|
||||
/* font-family: "Georgia", "Times New Roman", serif; */
|
||||
color: #1a1a1a;
|
||||
.scholar-db-container {
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
/* --- 左侧边栏 --- */
|
||||
.sidebar {
|
||||
width: 420px;
|
||||
margin-right: 30px;
|
||||
}
|
||||
|
||||
/* 参数卡片:去掉 Element 默认圆角和阴影 */
|
||||
.params-card {
|
||||
border: 2px solid #000 !important;
|
||||
border-radius: 0 !important;
|
||||
background: #fff;
|
||||
/* 核心:右下角的硬阴影效果 */
|
||||
box-shadow: 6px 6px 0px 0px rgba(0, 0, 0, 0.8) !important;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
/* 卡片头部标题 */
|
||||
.card-header {
|
||||
font-size: 1.2rem;
|
||||
font-style: italic;
|
||||
font-weight: 500;
|
||||
.toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
.card-header i {
|
||||
margin-right: 8px;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
/* 表单元素重置 */
|
||||
/deep/ .el-form-item__label {
|
||||
font-family: 'Arial', sans-serif; /* 标签用无衬线体形成对比 */
|
||||
font-size: 12px;
|
||||
font-weight: 800;
|
||||
color: #333;
|
||||
padding: 0 !important;
|
||||
line-height: 20px !important;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
/deep/ .el-input__inner {
|
||||
border-radius: 0 !important;
|
||||
border: 1.5px solid #000 !important;
|
||||
height: 40px;
|
||||
font-family: 'Georgia', serif;
|
||||
background-color: #fcfcfc;
|
||||
/* 内部微阴影感 */
|
||||
box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.form-row {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
/deep/ .el-input-number {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 黑色大按钮 */
|
||||
.fetch-btn {
|
||||
width: 100%;
|
||||
height: 55px;
|
||||
background-color: #000 !important;
|
||||
border: none !important;
|
||||
border-radius: 0 !important;
|
||||
color: #fff !important;
|
||||
font-weight: 900;
|
||||
font-size: 16px;
|
||||
letter-spacing: 1.5px;
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.fetch-btn:hover {
|
||||
background-color: #333 !important;
|
||||
transform: translate(-1px, -1px);
|
||||
box-shadow: 2px 2px 0 #888;
|
||||
}
|
||||
|
||||
.fetch-btn i {
|
||||
font-size: 20px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
/* 信息框:黑底白字 */
|
||||
.info-box {
|
||||
background-color: #151515;
|
||||
color: #d0d0d0;
|
||||
padding: 25px;
|
||||
border-radius: 0;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.info-box h4 {
|
||||
color: #fff;
|
||||
font-family: 'Arial', sans-serif;
|
||||
font-size: 13px;
|
||||
letter-spacing: 2px;
|
||||
margin: 0 0 15px 0;
|
||||
border-bottom: 1px solid #444;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.info-box p {
|
||||
font-style: italic;
|
||||
font-size: 13px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.main-content-center {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
max-width: 450px;
|
||||
}
|
||||
|
||||
/* 数据库图标 */
|
||||
.state-icon {
|
||||
font-size: 80px;
|
||||
color: #bcbcbc;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.empty-state h3 {
|
||||
font-size: 24px;
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
color: #444;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.empty-state p {
|
||||
font-size: 14px;
|
||||
color: #888;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* 加载动画状态 */
|
||||
.processing-state {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.spinner-box {
|
||||
font-size: 50px;
|
||||
margin-bottom: 20px;
|
||||
animation: rotating 2s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes rotating {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.processing-state h3 {
|
||||
letter-spacing: 4px;
|
||||
font-weight: 900;
|
||||
color: #000;
|
||||
}
|
||||
/* 右侧容器改为顶部对齐 */
|
||||
.main-content {
|
||||
flex: 1;
|
||||
border: 2px dashed #bbb;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
justify-content: center;
|
||||
align-items: flex-start; /* 确保列表从顶部开始 */
|
||||
/* padding: 20px; */
|
||||
background-color: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.results-container {
|
||||
width: 100%;
|
||||
/* 模拟图二的实体阴影 */
|
||||
box-shadow: 8px 8px 0px 0px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 统计栏样式 */
|
||||
.results-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 15px 20px;
|
||||
background: #fff;
|
||||
border: 2px solid #000;
|
||||
border-bottom: none; /* 与下方表格衔接 */
|
||||
margin-bottom: 15px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.results-stats {
|
||||
font-family: 'Arial', sans-serif;
|
||||
font-weight: 800;
|
||||
font-size: 14px;
|
||||
letter-spacing: 0.5px;
|
||||
/* text-transform: uppercase; */
|
||||
}
|
||||
|
||||
.results-stats strong {
|
||||
.title {
|
||||
font-size: 18px;
|
||||
margin-left: 5px;
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.divider {
|
||||
margin: 0 15px;
|
||||
color: #ccc;
|
||||
font-weight: 100;
|
||||
.title i {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.page-info {
|
||||
color: #999;
|
||||
font-size: 11px;
|
||||
.filters {
|
||||
flex: 1;
|
||||
margin: 0 20px;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
/* 导航按钮 */
|
||||
.nav-btn {
|
||||
border: 1.5px solid #000 !important;
|
||||
border-radius: 0 !important;
|
||||
background: #fff !important;
|
||||
color: #000 !important;
|
||||
padding: 5px 10px !important;
|
||||
.actions {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.nav-btn:hover {
|
||||
background: #000 !important;
|
||||
color: #fff !important;
|
||||
.table-card {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
/* 表格主体还原 */
|
||||
/deep/ .custom-table {
|
||||
border: 2px solid #000 !important;
|
||||
.pagination {
|
||||
margin-top: 15px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/deep/ .dark-table-header th {
|
||||
background-color: #000 !important;
|
||||
color: #fff !important;
|
||||
/* font-family: "Arial", sans-serif; */
|
||||
font-weight: 900;
|
||||
letter-spacing: 1px;
|
||||
padding: 12px 0 !important;
|
||||
background-color: #f5f7fa;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/deep/ .el-table__row td {
|
||||
padding: 15px 0 !important;
|
||||
color: #333;
|
||||
/* font-family: "Georgia", serif; */
|
||||
/deep/ .el-form-item--mini.el-form-item,
|
||||
.el-form-item--small.el-form-item {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.custom-tag {
|
||||
/* 基础布局 */
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
right: 6px;
|
||||
top: 0px;
|
||||
|
||||
/* 链接样式 */
|
||||
.file-link {
|
||||
font-size: 13px;
|
||||
text-decoration: none !important;
|
||||
color: #0066cc;
|
||||
/* 颜色与背景 */
|
||||
|
||||
color: #ce4f15; /* 深灰色文字 */
|
||||
|
||||
/* 形状 */
|
||||
/* font-weight: bold; */
|
||||
|
||||
/* 字体 */
|
||||
font-size: 12px;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
}
|
||||
|
||||
.file-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.download-icon {
|
||||
margin-left: 6px;
|
||||
vertical-align: middle;
|
||||
/* 每一行的布局 */
|
||||
.info-row {
|
||||
margin-bottom: 4px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.custom-reset-btn {
|
||||
flex: 1;
|
||||
background-color: #fff;
|
||||
border: 2px solid #000;
|
||||
color: #000;
|
||||
font-weight: 800;
|
||||
font-family: 'Arial', sans-serif;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.1s;
|
||||
outline: none;
|
||||
margin-top: 10px
|
||||
line-height: 1.2;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
.custom-reset-btn i {
|
||||
margin-right: 4px;
|
||||
font-weight: 800;
|
||||
/* 左侧 Label 样式 */
|
||||
.label {
|
||||
color: #999; /* 浅灰色 */
|
||||
margin-right: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* 悬浮和点击效果:增加黑白对比度 */
|
||||
.custom-reset-btn:hover {
|
||||
background-color: #f0f0f0;
|
||||
/* 右侧 Value 样式 */
|
||||
.value {
|
||||
color: #333;
|
||||
}
|
||||
.value.bold {
|
||||
font-weight: bold;
|
||||
font-size: 15px;
|
||||
}
|
||||
.value.link {
|
||||
color: #0066a1;
|
||||
} /* 邮箱颜色 */
|
||||
.value.time {
|
||||
color: #888;
|
||||
} /* 邮箱颜色 */
|
||||
.value.italic {
|
||||
font-style: italic;
|
||||
color: #666;
|
||||
}
|
||||
.blue-text {
|
||||
color: #0066a1;
|
||||
}
|
||||
|
||||
.custom-reset-btn:active {
|
||||
transform: translate(1px, 1px);
|
||||
box-shadow: none;
|
||||
/* H-指数特有颜色 */
|
||||
.h-score {
|
||||
font-weight: bold;
|
||||
margin-right: 15px;
|
||||
}
|
||||
.green {
|
||||
color: #28a745;
|
||||
}
|
||||
.red {
|
||||
color: #dc3545;
|
||||
}
|
||||
|
||||
/* 星星评分 */
|
||||
.stars {
|
||||
color: #ffb400;
|
||||
font-size: 16px;
|
||||
}
|
||||
.stars .half {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* 状态标签 (参考你之前的要求) */
|
||||
.status-tag {
|
||||
background-color: #fffbe6; /* 浅黄背景 */
|
||||
color: #d48806; /* 橙黄色文字 */
|
||||
border: 1px solid #ffe58f;
|
||||
padding: 2px 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.source-tag {
|
||||
/* 布局 */
|
||||
float: right;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 6px 16px;
|
||||
margin-top: -10px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
/* 颜色与背景 */
|
||||
background-color: #f0f7ff; /* 极浅蓝背景 */
|
||||
color: #0077cc; /* 品牌蓝文字 */
|
||||
border: 1px solid #e1f0ff; /* 浅蓝色边框 */
|
||||
|
||||
/* 形状与阴影 */
|
||||
border-radius: 20px;
|
||||
box-shadow: 0 2px 6px rgba(0, 119, 204, 0.1); /* 淡淡的蓝色投影 */
|
||||
|
||||
/* 字体 */
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
|
||||
letter-spacing: 0.5px; /* 字间距增加 */
|
||||
}
|
||||
|
||||
/* 前置小圆点 */
|
||||
.source-tag::before {
|
||||
content: '';
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
background-color: #0095ff; /* 亮蓝色圆点 */
|
||||
border-radius: 50%;
|
||||
margin-right: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1046,7 +1046,34 @@ export default new Router({
|
||||
path: '/mailboxMould', //邮箱系统-模板
|
||||
component: () => import('../components/page/mailboxMould'),
|
||||
meta: {
|
||||
title: 'Mailbox template'
|
||||
title: 'Mailbox template',
|
||||
titleKey: 'sidebar.emailTemplates'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/mailboxMouldDetail', // 邮箱系统-模板详情
|
||||
component: () => import('../components/page/mailboxMouldDetail'),
|
||||
meta: {
|
||||
title: 'Mailbox template detail',
|
||||
hideSidebar: true,
|
||||
hideJournal: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/mailboxStyle', // 邮箱系统-邮件风格
|
||||
component: () => import('../components/page/mailboxStyle'),
|
||||
meta: {
|
||||
title: 'Email styles',
|
||||
titleKey: 'sidebar.emailStyles'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/mailboxStyleDetail', // 邮箱系统-邮件风格详情
|
||||
component: () => import('../components/page/mailboxStyleDetail'),
|
||||
meta: {
|
||||
title: 'Email style detail',
|
||||
hideSidebar: true,
|
||||
hideJournal: true
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1067,7 +1094,14 @@ export default new Router({
|
||||
path: '/scholarCrawlers', //学者抓取
|
||||
component: () => import('../components/page/scholarCrawlers'),
|
||||
meta: {
|
||||
title: 'Scholar Crawlers'
|
||||
title: 'Scholar Database'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/expertDatabase', //专家库
|
||||
component: () => import('../components/page/expertDatabase'),
|
||||
meta: {
|
||||
title: 'Expert Database'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user