feat: 优化收发信安全提示与状态标签,增加历史发信收件人管理与租户隔离
This commit is contained in:
1 parent
1853afbad4
commit
a8be83b64d
17 files changed
+615
-25
No files matched your search
@@ -306,3 +306,39 @@
|
||||
padding: 12px 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.contact-option-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.contact-option-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.contact-option-name {
|
||||
font-weight: 600;
|
||||
color: var(--pm-text-primary);
|
||||
}
|
||||
|
||||
.contact-option-email {
|
||||
color: var(--pm-text-secondary);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.contact-del-icon {
|
||||
font-size: 14px;
|
||||
color: var(--pm-text-muted);
|
||||
padding: 4px;
|
||||
border-radius: 4px;
|
||||
transition: color 0.15s ease, background 0.15s ease;
|
||||
}
|
||||
|
||||
.contact-del-icon:hover {
|
||||
color: #ef4444;
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import {ElMessage} from 'element-plus'
|
||||
|
||||
import {onBeforeUnmount, reactive, ref, shallowRef} from 'vue'
|
||||
|
||||
import {Close, Paperclip, Position, ArrowDown, Document} from '@element-plus/icons-vue';
|
||||
import {Close, Paperclip, Position, ArrowDown, Document, Delete} from '@element-plus/icons-vue';
|
||||
|
||||
import lang from '../../i18n/i18n';
|
||||
|
||||
@@ -68,8 +68,32 @@ export function usePage() {
|
||||
})
|
||||
|
||||
const fileList = reactive([]);
|
||||
const contactOptions = ref([]);
|
||||
|
||||
const loadContacts = function () {
|
||||
http.get("/api/v1/email/contacts").then(res => {
|
||||
if (res.errorNo === 0 && Array.isArray(res.data)) {
|
||||
contactOptions.value = res.data
|
||||
}
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
const deleteContact = function (email) {
|
||||
if (!email) return
|
||||
http.post("/api/v1/email/contacts/delete", {email: email}).then(res => {
|
||||
if (res.errorNo === 0) {
|
||||
ElMessage.success("已从历史联系人中删除")
|
||||
contactOptions.value = contactOptions.value.filter(c => c.email !== email)
|
||||
} else {
|
||||
ElMessage.error(res.errorMsg || "删除失败")
|
||||
}
|
||||
}).catch(() => {
|
||||
ElMessage.error("删除联系人失败")
|
||||
})
|
||||
}
|
||||
|
||||
const init = function () {
|
||||
loadContacts()
|
||||
if ( Object.keys(globalStatus.userInfos)==0 || globalStatus.userInfos === null || globalStatus.userInfos == undefined ){
|
||||
globalStatus.init(()=>{
|
||||
ruleForm.sender = globalStatus.userInfos.account
|
||||
@@ -228,10 +252,10 @@ export function usePage() {
|
||||
Position,
|
||||
ArrowDown,
|
||||
Document,
|
||||
Delete,
|
||||
lang,
|
||||
Editor,
|
||||
Toolbar,
|
||||
i18nChangeLanguage,
|
||||
useRouter,
|
||||
http,
|
||||
useGroupStore,
|
||||
@@ -260,7 +284,10 @@ export function usePage() {
|
||||
send,
|
||||
upload,
|
||||
fileChange,
|
||||
delFile
|
||||
delFile,
|
||||
contactOptions,
|
||||
loadContacts,
|
||||
deleteContact
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,5 +298,6 @@ export {
|
||||
Toolbar,
|
||||
Editor,
|
||||
Document,
|
||||
Close
|
||||
Close,
|
||||
Delete
|
||||
}
|
||||
@@ -59,8 +59,25 @@
|
||||
<el-select
|
||||
v-model="ruleForm.receivers"
|
||||
multiple filterable allow-create :reserve-keyword="false"
|
||||
placeholder="请输入收件人地址"
|
||||
></el-select>
|
||||
placeholder="请输入收件人地址(输入后按回车,或从下方历史联系人选择)"
|
||||
>
|
||||
<el-option
|
||||
v-for="contact in contactOptions"
|
||||
:key="contact.email"
|
||||
:label="contact.name ? `${contact.name} <${contact.email}>` : contact.email"
|
||||
:value="contact.email"
|
||||
>
|
||||
<div class="contact-option-item">
|
||||
<div class="contact-option-info">
|
||||
<span class="contact-option-name" v-if="contact.name">{{ contact.name }}</span>
|
||||
<span class="contact-option-email">{{ contact.email }}</span>
|
||||
</div>
|
||||
<el-tooltip content="从历史记录删除" placement="top">
|
||||
<el-icon class="contact-del-icon" @click.stop="deleteContact(contact.email)"><Delete /></el-icon>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
@@ -71,7 +88,18 @@
|
||||
v-model="ruleForm.cc"
|
||||
multiple filterable allow-create :reserve-keyword="false"
|
||||
placeholder="请输入抄送人地址"
|
||||
></el-select>
|
||||
>
|
||||
<el-option
|
||||
v-for="contact in contactOptions"
|
||||
:key="'cc-' + contact.email"
|
||||
:label="contact.name ? `${contact.name} <${contact.email}>` : contact.email"
|
||||
:value="contact.email"
|
||||
>
|
||||
<div class="contact-option-item">
|
||||
<span class="contact-option-email">{{ contact.email }}</span>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
@@ -82,7 +110,18 @@
|
||||
v-model="ruleForm.bcc"
|
||||
multiple filterable allow-create :reserve-keyword="false"
|
||||
placeholder="请输入密送人地址"
|
||||
></el-select>
|
||||
>
|
||||
<el-option
|
||||
v-for="contact in contactOptions"
|
||||
:key="'bcc-' + contact.email"
|
||||
:label="contact.name ? `${contact.name} <${contact.email}>` : contact.email"
|
||||
:value="contact.email"
|
||||
>
|
||||
<div class="contact-option-item">
|
||||
<span class="contact-option-email">{{ contact.email }}</span>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
@@ -111,7 +150,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { usePage, Paperclip, Position, ArrowDown, Toolbar, Editor, Document, Close } from './Editer.js'
|
||||
import { usePage, Paperclip, Position, ArrowDown, Toolbar, Editor, Document, Close, Delete } from './Editer.js'
|
||||
|
||||
const {
|
||||
lang,
|
||||
@@ -131,7 +170,9 @@ const {
|
||||
editorConfig,
|
||||
handleCreated,
|
||||
fileList,
|
||||
delFile
|
||||
delFile,
|
||||
contactOptions,
|
||||
deleteContact
|
||||
} = usePage()
|
||||
</script>
|
||||
|
||||
|
||||
@@ -233,3 +233,30 @@
|
||||
padding-top: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.mail-status-tags {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.clickable-tag {
|
||||
cursor: pointer;
|
||||
transition: transform 0.15s ease, box-shadow 0.15s ease;
|
||||
}
|
||||
|
||||
.clickable-tag:hover {
|
||||
transform: scale(1.04);
|
||||
box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
|
||||
}
|
||||
|
||||
.error-dialog-body {
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.error-label {
|
||||
font-weight: 600;
|
||||
margin-bottom: 8px;
|
||||
color: var(--pm-text-primary);
|
||||
}
|
||||
@@ -2,11 +2,11 @@ import './List.js'
|
||||
|
||||
import {EpArrowDownBold} from "vue-icons-plus/ep";
|
||||
|
||||
import {Delete, View, Folder, EditPen, Warning, CircleCheck, Switch} from "@element-plus/icons-vue";
|
||||
import {Delete, View, Folder, EditPen, Warning, CircleCheck, Switch, Check} from "@element-plus/icons-vue";
|
||||
|
||||
import {useRouter} from 'vue-router'
|
||||
|
||||
import {ref, watch} from 'vue'
|
||||
import {ref, watch, computed} from 'vue'
|
||||
|
||||
import useGroupStore from '../../stores/group'
|
||||
|
||||
@@ -27,11 +27,23 @@ export function usePage() {
|
||||
|
||||
const selectedRows = ref([])
|
||||
|
||||
const errorDialogVisible = ref(false)
|
||||
const currentErrorMsg = ref('')
|
||||
|
||||
let tag = groupStore.tag;
|
||||
|
||||
if (tag === "") {
|
||||
tag = '{"type":0,"status":-1}'
|
||||
}
|
||||
|
||||
const isOutbox = computed(() => {
|
||||
try {
|
||||
const parsed = JSON.parse(groupStore.tag || tag || '{}')
|
||||
return parsed.type === 1 || groupStore.name === lang.outbox || groupStore.name === '已发送'
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
watch(groupStore, async (newV) => {
|
||||
tag = newV.tag;
|
||||
@@ -110,7 +122,7 @@ export function usePage() {
|
||||
http.post("/api/v1/email/read", {"ids": ids}).then(res => {
|
||||
if (res.errorNo === 0) {
|
||||
updateList()
|
||||
ElMessage.success('Marked as read');
|
||||
ElMessage.success('已标记为已读');
|
||||
} else {
|
||||
ElMessage.error(res.errorMsg)
|
||||
}
|
||||
@@ -172,6 +184,38 @@ export function usePage() {
|
||||
})
|
||||
}
|
||||
|
||||
const trustSender = function (senderEmail) {
|
||||
if (!senderEmail) return
|
||||
ElMessageBox.confirm(
|
||||
`确定将发件人 "${senderEmail}" 加入信任白名单吗?后续来自该地址的新邮件将不再提示风险。`,
|
||||
'信任发件人',
|
||||
{
|
||||
confirmButtonText: '信任并加入白名单',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
).then(() => {
|
||||
http.post("/api/v1/email/trust-sender", {email: senderEmail, trusted: true}).then(res => {
|
||||
if (res.errorNo === 0) {
|
||||
ElMessage.success('已加入信任白名单,风险提示已免除')
|
||||
// 局部更新视图,避免整页重新刷新
|
||||
data.value.forEach(item => {
|
||||
if (item.sender?.EmailAddress === senderEmail) {
|
||||
item.dangerous = false
|
||||
}
|
||||
})
|
||||
} else {
|
||||
ElMessage.error(res.errorMsg || '操作失败')
|
||||
}
|
||||
})
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
const showError = function (row) {
|
||||
currentErrorMsg.value = row.error || '未知投递错误'
|
||||
errorDialogVisible.value = true
|
||||
}
|
||||
|
||||
return {
|
||||
EpArrowDownBold,
|
||||
Delete,
|
||||
@@ -179,11 +223,13 @@ export function usePage() {
|
||||
Folder,
|
||||
EditPen,
|
||||
Warning,
|
||||
Check,
|
||||
CircleCheck,
|
||||
Switch,
|
||||
useRouter,
|
||||
ref,
|
||||
watch,
|
||||
computed,
|
||||
useGroupStore,
|
||||
lang,
|
||||
http,
|
||||
@@ -208,7 +254,12 @@ export function usePage() {
|
||||
move,
|
||||
del,
|
||||
rowStyle,
|
||||
pageChange
|
||||
pageChange,
|
||||
isOutbox,
|
||||
trustSender,
|
||||
showError,
|
||||
errorDialogVisible,
|
||||
currentErrorMsg
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,5 +271,6 @@ export {
|
||||
Folder,
|
||||
EpArrowDownBold,
|
||||
EditPen,
|
||||
Warning
|
||||
Warning,
|
||||
Check
|
||||
}
|
||||
@@ -54,12 +54,6 @@
|
||||
<template #default="scope">
|
||||
<div class="status-indicator">
|
||||
<el-badge is-dot class="unread-dot" type="primary" v-if="!scope.row.is_read"></el-badge>
|
||||
<el-tooltip effect="dark" :content="lang.dangerous" placement="top-start" v-if="scope.row.dangerous">
|
||||
<el-icon color="#ef4444"><Warning /></el-icon>
|
||||
</el-tooltip>
|
||||
<el-tooltip effect="dark" :content="scope.row.error" placement="top-start" v-if="scope.row.error !== ''">
|
||||
<el-icon color="#ef4444"><Warning /></el-icon>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -71,6 +65,27 @@
|
||||
<div class="mail-sender">
|
||||
{{ scope.row.sender.Name !== '' ? scope.row.sender.Name : scope.row.sender.EmailAddress }}
|
||||
</div>
|
||||
|
||||
<!-- 高辨识度安全与发送状态标签 -->
|
||||
<div class="mail-status-tags" v-if="scope.row.dangerous || isOutbox">
|
||||
<el-tooltip content="点击将该发件人添加至信任白名单,后续免除风险提示" placement="top" v-if="scope.row.dangerous">
|
||||
<el-tag type="danger" effect="dark" size="small" class="clickable-tag" @click.stop="trustSender(scope.row.sender.EmailAddress)">
|
||||
<el-icon><Warning /></el-icon> 疑似不安全 (点击信任)
|
||||
</el-tag>
|
||||
</el-tooltip>
|
||||
|
||||
<template v-if="isOutbox">
|
||||
<el-tag type="success" effect="light" size="small" v-if="!scope.row.error || scope.row.error === ''">
|
||||
<el-icon><Check /></el-icon> 发送成功
|
||||
</el-tag>
|
||||
<el-tooltip :content="scope.row.error" placement="top" v-else>
|
||||
<el-tag type="danger" effect="light" size="small" class="clickable-tag" @click.stop="showError(scope.row)">
|
||||
<el-icon><Warning /></el-icon> 发送失败 (查看详情)
|
||||
</el-tag>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div class="mail-subject">{{ scope.row.title }}</div>
|
||||
<div class="mail-snippet">{{ scope.row.desc }}</div>
|
||||
</div>
|
||||
@@ -91,11 +106,22 @@
|
||||
@current-change="pageChange"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 错误详情对话框 -->
|
||||
<el-dialog v-model="errorDialogVisible" title="邮件发送失败详情" width="500px">
|
||||
<div class="error-dialog-body">
|
||||
<p class="error-label">错误原因:</p>
|
||||
<el-alert :title="currentErrorMsg" type="error" :closable="false" show-icon />
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button type="primary" @click="errorDialogVisible = false">关闭</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { usePage, CircleCheck, Switch, Delete, View, Folder, EpArrowDownBold, EditPen, Warning } from './List.js'
|
||||
import { usePage, CircleCheck, Switch, Delete, View, Folder, EpArrowDownBold, EditPen, Warning, Check } from './List.js'
|
||||
|
||||
const {
|
||||
taskTableDataRef,
|
||||
@@ -114,7 +140,12 @@ const {
|
||||
rowStyle,
|
||||
formatShortDate,
|
||||
totalPage,
|
||||
pageChange
|
||||
pageChange,
|
||||
isOutbox,
|
||||
trustSender,
|
||||
showError,
|
||||
errorDialogVisible,
|
||||
currentErrorMsg
|
||||
} = usePage()
|
||||
</script>
|
||||
|
||||
|
||||
Reference in new issue
Block a user