新增显示所有邮箱邮件
This commit is contained in:
@@ -34,7 +34,7 @@ http.interceptors.response.use((res) => {
|
||||
repeatNum: -4,
|
||||
})
|
||||
localStorage.removeItem('token')
|
||||
router.push('/login')
|
||||
router.replace('/login')
|
||||
reject(data)
|
||||
} else if (data.code === 403) {
|
||||
ElMessage({
|
||||
|
||||
@@ -496,6 +496,8 @@ function updateCheckStatus() {
|
||||
}
|
||||
|
||||
function jumpDetails(email) {
|
||||
const sel = window.getSelection();
|
||||
if (sel && !sel.isCollapsed) return;
|
||||
emit('jump', email)
|
||||
}
|
||||
|
||||
@@ -907,7 +909,7 @@ function loadData() {
|
||||
|
||||
.header-actions {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr auto auto;
|
||||
grid-template-columns: auto 1fr auto;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
padding: 3px 15px;
|
||||
|
||||
@@ -64,10 +64,6 @@ const language = computed(() => {
|
||||
return 'zh_CN'
|
||||
}
|
||||
|
||||
if (locale.value === 'zhTW') {
|
||||
return 'zh_TW'
|
||||
}
|
||||
|
||||
return 'en'
|
||||
})
|
||||
|
||||
|
||||
4
mail-vue/src/enums/account-enum.js
Normal file
4
mail-vue/src/enums/account-enum.js
Normal file
@@ -0,0 +1,4 @@
|
||||
export const AccountAllReceiveEnum = {
|
||||
DISABLED: 0,
|
||||
ENABLED: 1
|
||||
}
|
||||
@@ -309,7 +309,8 @@ const en = {
|
||||
atLeast: 'At Least',
|
||||
character: '',
|
||||
mustNotContain: 'Must Not Contain',
|
||||
mustNotContainDesc: 'Separate with commas'
|
||||
mustNotContainDesc: 'Separate with commas',
|
||||
setSuccess: 'Settings saved successfully'
|
||||
}
|
||||
|
||||
export default en
|
||||
|
||||
@@ -309,6 +309,7 @@ const zh = {
|
||||
atLeast: '至少',
|
||||
character: '位',
|
||||
mustNotContain: '禁止包含',
|
||||
mustNotContainDesc: '输入多个值用,分开'
|
||||
mustNotContainDesc: '输入多个值用,分开',
|
||||
setSuccess: '设置成功'
|
||||
}
|
||||
export default zh
|
||||
|
||||
@@ -694,4 +694,16 @@ addCollection({
|
||||
}
|
||||
}
|
||||
})
|
||||
addCollection({
|
||||
"prefix": "flat-color-icons",
|
||||
"lastModified": 1754899066,
|
||||
"aliases": {},
|
||||
"width": 48,
|
||||
"height": 48,
|
||||
"icons": {
|
||||
"folder": {
|
||||
"body": "<path fill=\"rgb(51, 126, 204)\" d=\"M40 12H22l-4-4H8c-2.2 0-4 1.8-4 4v8h40v-4c0-2.2-1.8-4-4-4\"/><path fill=\"#23C5F0\" d=\"M40 12H8c-2.2 0-4 1.8-4 4v20c0 2.2 1.8 4 4 4h32c2.2 0 4-1.8 4-4V16c0-2.2-1.8-4-4-4\"/>"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
</div>
|
||||
<div class="opt">
|
||||
<div class="send-email" @click.stop>
|
||||
<Icon icon="eva:email-fill" width="22" height="22" color="#fccb1a"/>
|
||||
<Icon @click="setAllReceive(item)" v-if="!item.allReceive" icon="eva:email-fill" width="22" height="22" color="#fccb1a"/>
|
||||
<Icon @click="setAllReceive(item)" v-else icon="flat-color-icons:folder" width="22" height="22" color="#23c4f1" />
|
||||
</div>
|
||||
<div class="settings" @click.stop>
|
||||
<Icon icon="fluent-color:clipboard-24" width="22" height="22" @click.stop="copyAccount(item.email)"/>
|
||||
@@ -127,19 +128,22 @@
|
||||
<script setup>
|
||||
import {Icon} from "@iconify/vue";
|
||||
import {nextTick, reactive, ref, watch} from "vue";
|
||||
import {accountList, accountAdd, accountDelete, accountSetName} from "@/request/account.js";
|
||||
import {accountList, accountAdd, accountDelete, accountSetName, accountSetAllReceive} from "@/request/account.js";
|
||||
import {sleep} from "@/utils/time-utils.js"
|
||||
import {isEmail} from "@/utils/verify-utils.js";
|
||||
import {useSettingStore} from "@/store/setting.js";
|
||||
import {useAccountStore} from "@/store/account.js";
|
||||
import {useEmailStore} from "@/store/email.js";
|
||||
import {useUserStore} from "@/store/user.js";
|
||||
import {hasPerm} from "@/perm/perm.js"
|
||||
import {useI18n} from "vue-i18n";
|
||||
import {AccountAllReceiveEnum} from "@/enums/account-enum.js";
|
||||
|
||||
const {t} = useI18n();
|
||||
const userStore = useUserStore();
|
||||
const accountStore = useAccountStore();
|
||||
const settingStore = useSettingStore();
|
||||
const emailStore = useEmailStore();
|
||||
const showAdd = ref(false)
|
||||
const addLoading = ref(false);
|
||||
const domainList = settingStore.domainList
|
||||
@@ -254,6 +258,28 @@ function openSetName(accountItem) {
|
||||
setNameShow.value = true
|
||||
}
|
||||
|
||||
function setAllReceive(account) {
|
||||
let allReceiveAccount = accounts.find(account => account.allReceive === AccountAllReceiveEnum.ENABLED);
|
||||
if (allReceiveAccount && allReceiveAccount.accountId !== account.accountId) allReceiveAccount.allReceive = AccountAllReceiveEnum.DISABLED;
|
||||
account.allReceive = account.allReceive === AccountAllReceiveEnum.DISABLED ? AccountAllReceiveEnum.ENABLED : AccountAllReceiveEnum.DISABLED;
|
||||
accountSetAllReceive(account.accountId).catch(() => {
|
||||
account.allReceive = account.allReceive === AccountAllReceiveEnum.DISABLED ? AccountAllReceiveEnum.ENABLED : AccountAllReceiveEnum.DISABLED;
|
||||
if (allReceiveAccount) allReceiveAccount.allReceive = AccountAllReceiveEnum.ENABLED;
|
||||
}).then(() => {
|
||||
if (account.allReceive === AccountAllReceiveEnum.ENABLED) {
|
||||
ElMessage({
|
||||
message: t('setSuccess'),
|
||||
type: 'success',
|
||||
plain: true,
|
||||
})
|
||||
}
|
||||
changeAccount(account);
|
||||
emailStore.emailScroll?.refreshList();
|
||||
emailStore.sendScroll?.refreshList();
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function showNullSetting(item) {
|
||||
return !hasPerm('email:send') && !(item.accountId !== userStore.user.accountId && hasPerm('account:delete'))
|
||||
}
|
||||
@@ -351,7 +377,7 @@ function getAccountList() {
|
||||
noLoading.value = true
|
||||
}
|
||||
if (accounts.length === 0) {
|
||||
accountStore.currentAccount = list[0].accountId
|
||||
accountStore.currentAccount = list[0]
|
||||
}
|
||||
queryParams.accountId = list.at(-1).accountId
|
||||
accounts.push(...list)
|
||||
|
||||
@@ -116,6 +116,7 @@ import {useWriterStore} from "@/store/writer.js";
|
||||
import db from "@/db/db.js";
|
||||
import dayjs from "dayjs";
|
||||
import {useI18n} from "vue-i18n";
|
||||
import router from "@/router/index.js";
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
@@ -392,6 +393,10 @@ async function sendEmail() {
|
||||
message: h('span', {style: 'color: teal'}, e.message),
|
||||
position: 'bottom-right'
|
||||
})
|
||||
if (e.code === 401) {
|
||||
localStorage.removeItem('token');
|
||||
router.replace('/login');
|
||||
}
|
||||
show.value = true
|
||||
addRecipientRecord();
|
||||
}).finally(() => {
|
||||
|
||||
@@ -16,3 +16,7 @@ export function accountDelete(accountId) {
|
||||
return http.delete('/account/delete', {params: {accountId}})
|
||||
}
|
||||
|
||||
export function accountSetAllReceive(accountId) {
|
||||
return http.put('/account/setAllReceive', {accountId})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import http from '@/axios/index.js';
|
||||
|
||||
export function emailList(accountId, emailId, timeSort, size, type) {
|
||||
return http.get('/email/list', {params: {accountId, emailId, timeSort, size, type}})
|
||||
export function emailList(accountId, allReceive, emailId, timeSort, size, type) {
|
||||
return http.get('/email/list', {params: {accountId, allReceive, emailId, timeSort, size, type}})
|
||||
}
|
||||
|
||||
export function emailDelete(emailIds) {
|
||||
return http.delete('/email/delete?emailIds=' + emailIds)
|
||||
}
|
||||
|
||||
export function emailLatest(emailId, accountId) {
|
||||
return http.get('/email/latest', {params: {emailId, accountId}, noMsg: true })
|
||||
export function emailLatest(emailId, accountId, allReceive) {
|
||||
return http.get('/email/latest', {params: {emailId, accountId, allReceive}, noMsg: true })
|
||||
}
|
||||
|
||||
export function emailRead(emailIds) {
|
||||
|
||||
@@ -397,7 +397,7 @@ function getEmailList(emailId, size) {
|
||||
}
|
||||
|
||||
.clear {
|
||||
@media (max-width: 409px) {
|
||||
@media (max-width: 419px) {
|
||||
position: absolute;
|
||||
top: 41px;
|
||||
left: 242px;
|
||||
@@ -405,7 +405,7 @@ function getEmailList(emailId, size) {
|
||||
}
|
||||
|
||||
:deep(.reload) {
|
||||
@media (max-width: 409px) {
|
||||
@media (max-width: 419px) {
|
||||
position: absolute;
|
||||
top: 42px;
|
||||
left: 208px;
|
||||
@@ -413,10 +413,16 @@ function getEmailList(emailId, size) {
|
||||
}
|
||||
|
||||
:deep(.delete) {
|
||||
@media (max-width: 443px) {
|
||||
@media (max-width: 456px) {
|
||||
position: absolute;
|
||||
top: 43px;
|
||||
left: 284px;
|
||||
left: 294px;
|
||||
}
|
||||
|
||||
@media (max-width: 419px) {
|
||||
position: absolute;
|
||||
top: 43px;
|
||||
left: 282px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -33,6 +33,7 @@ import {defineOptions, h, onMounted, reactive, ref, watch} from "vue";
|
||||
import {sleep} from "@/utils/time-utils.js";
|
||||
import router from "@/router/index.js";
|
||||
import {Icon} from "@iconify/vue";
|
||||
import {AccountAllReceiveEnum} from "@/enums/account-enum.js";
|
||||
|
||||
defineOptions({
|
||||
name: 'email'
|
||||
@@ -79,20 +80,24 @@ async function latest() {
|
||||
if (!scroll.value.firstLoad && settingStore.settings.autoRefreshTime) {
|
||||
try {
|
||||
const accountId = accountStore.currentAccountId
|
||||
const allReceive = scroll.value.latestEmail?.allReceive
|
||||
const curTimeSort = params.timeSort
|
||||
let list = []
|
||||
|
||||
//确保发起请求时最后一个邮件是当前账号的,或者
|
||||
if (accountId === scroll.value.latestEmail?.accountId) {
|
||||
list = await emailLatest(latestId, accountId);
|
||||
if (accountId === scroll.value.latestEmail?.reqAccountId) {
|
||||
list = await emailLatest(latestId, accountId, allReceive);
|
||||
}
|
||||
|
||||
//确保请求回来后,账号没有切换,时间排序没有改变
|
||||
if (accountId === accountStore.currentAccountId && params.timeSort === curTimeSort) {
|
||||
//确保请求回来后,账号没有切换,时间排序没有改变,全部邮件类型没变
|
||||
if (accountId === accountStore.currentAccountId && params.timeSort === curTimeSort && allReceive === accountStore.currentAccount.allReceive) {
|
||||
if (list.length > 0) {
|
||||
|
||||
for (let email of list) {
|
||||
|
||||
email.reqAccountId = accountId;
|
||||
email.allReceive = allReceive;
|
||||
|
||||
if (!existIds.has(email.emailId)) {
|
||||
|
||||
existIds.add(email.emailId)
|
||||
@@ -135,7 +140,13 @@ function cancelStar(email) {
|
||||
}
|
||||
|
||||
function getEmailList(emailId, size) {
|
||||
return emailList(accountStore.currentAccountId, emailId, params.timeSort, size, 0)
|
||||
const accountId = accountStore.currentAccountId;
|
||||
const allReceive = accountStore.currentAccount.allReceive;
|
||||
return emailList(accountId, allReceive, emailId, params.timeSort, size, 0).then(data => {
|
||||
data.latestEmail.reqAccountId = accountId;
|
||||
data.latestEmail.allReceive = allReceive;
|
||||
return data;
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -29,6 +29,7 @@ import {starAdd, starCancel} from "@/request/star.js";
|
||||
import {defineOptions, onMounted, reactive, ref, watch} from "vue";
|
||||
import router from "@/router/index.js";
|
||||
import {Icon} from "@iconify/vue";
|
||||
import {AccountAllReceiveEnum} from "@/enums/account-enum.js";
|
||||
|
||||
defineOptions({
|
||||
name: 'send'
|
||||
@@ -71,7 +72,13 @@ function cancelStar(email) {
|
||||
}
|
||||
|
||||
function getEmailList(emailId, size) {
|
||||
return emailList(accountStore.currentAccountId, emailId, params.timeSort, size, 1)
|
||||
const accountId = accountStore.currentAccountId;
|
||||
const allReceive = accountStore.currentAccount.allReceive;
|
||||
return emailList(accountId, allReceive, emailId, params.timeSort, size, 1).then(data => {
|
||||
data.latestEmail.reqAccountId = accountId;
|
||||
data.latestEmail.allReceive = allReceive;
|
||||
return data;
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -754,7 +754,7 @@ defineOptions({
|
||||
name: 'sys-setting'
|
||||
})
|
||||
|
||||
const currentVersion = 'v2.5.0'
|
||||
const currentVersion = 'v2.6.0'
|
||||
const hasUpdate = ref(false)
|
||||
let getUpdateErrorCount = 1;
|
||||
const {t, locale} = useI18n();
|
||||
|
||||
Reference in New Issue
Block a user