修改一些已知BUG

优化站内发件无需第三方

修改一些已知BUG
This commit is contained in:
eoao
2026-02-07 22:41:01 +08:00
parent 24e37288e5
commit 216f7272d8
10 changed files with 70 additions and 20 deletions

View File

@@ -152,7 +152,7 @@
> >
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item v-if="props.type === 'email'" @click="emailRead()" > <el-dropdown-item v-if="['email'].includes(props.type)" @click="emailRead(rightClickEmail.emailId)" >
<template #default> <template #default>
<div class="right-dropdown-item"> <div class="right-dropdown-item">
<Icon icon="fluent:mail-read-20-regular" width="20" height="20" /> <Icon icon="fluent:mail-read-20-regular" width="20" height="20" />
@@ -160,7 +160,7 @@
</div> </div>
</template> </template>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item v-if="props.type === 'email'" @click="openReply(rightClickEmail)"> <el-dropdown-item v-if="['email','star'].includes(props.type)" @click="openReply(rightClickEmail)">
<template #default> <template #default>
<div class="right-dropdown-item"> <div class="right-dropdown-item">
<Icon icon="la:reply" width="20" height="20" /> <Icon icon="la:reply" width="20" height="20" />
@@ -168,6 +168,14 @@
</div> </div>
</template> </template>
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item v-if="['email','send', 'star'].includes(props.type)" @click="openForward(rightClickEmail)">
<template #default>
<div class="right-dropdown-item">
<Icon icon="iconoir:arrow-up-right" width="19" height="19" />
<span>{{t('forward')}}</span>
</div>
</template>
</el-dropdown-item>
<el-dropdown-item v-if="['email','send', 'star'].includes(props.type)" @click="starChange(rightClickEmail)"> <el-dropdown-item v-if="['email','send', 'star'].includes(props.type)" @click="starChange(rightClickEmail)">
<template #default> <template #default>
<div class="right-dropdown-item"> <div class="right-dropdown-item">
@@ -471,6 +479,10 @@ function openReply(email) {
uiStore.writerRef.openReply(email) uiStore.writerRef.openReply(email)
} }
function openForward(email) {
uiStore.writerRef.openForward(email)
}
function visibleChange(e) { function visibleChange(e) {
dropdownShow.value = e; dropdownShow.value = e;
dropdownCloseLock.value = true; dropdownCloseLock.value = true;
@@ -593,6 +605,15 @@ function changeAccountShow() {
const handleRead = () => { const handleRead = () => {
const emailIds = getSelectedMailsIds(); const emailIds = getSelectedMailsIds();
props.emailRead(emailIds); props.emailRead(emailIds);
localRead(emailIds);
}
function emailRead(emailId) {
props.emailRead([emailId])
localRead([emailId]);
}
function localRead(emailIds) {
emailIds.forEach(emailId => { emailIds.forEach(emailId => {
const index = emailList.findIndex(email => email.emailId === emailId); const index = emailList.findIndex(email => email.emailId === emailId);
if (index > -1) { if (index > -1) {
@@ -602,11 +623,6 @@ const handleRead = () => {
}) })
} }
function emailRead() {
const emailIds = getSelectedMailsIds();
props.emailRead(emailIds)
}
function rightDelete(emailId) { function rightDelete(emailId) {
if (props.type === 'all-email') { if (props.type === 'all-email') {

View File

@@ -73,7 +73,7 @@ const en = {
unauthorized: 'Unauthorized', unauthorized: 'Unauthorized',
unlimited: 'Unlimited', unlimited: 'Unlimited',
sendCount: 'Send email : ', sendCount: 'Send email : ',
accountCount: 'Add Address : ', accountCount: 'Add address : ',
action: 'Action', action: 'Action',
chgPwd: 'Password', chgPwd: 'Password',
perm: 'Role', perm: 'Role',
@@ -248,6 +248,7 @@ const en = {
language: 'Language', language: 'Language',
totalUserAccount: '{msg}', totalUserAccount: '{msg}',
sendBanned: 'Banned', sendBanned: 'Banned',
sendInternal: 'Only internal',
wrote: 'wrote', wrote: 'wrote',
support: 'Support', support: 'Support',
supportDesc: 'Buy me tea', supportDesc: 'Buy me tea',

View File

@@ -248,6 +248,7 @@ const zh = {
language: '网站语言', language: '网站语言',
totalUserAccount: '{msg} 个', totalUserAccount: '{msg} 个',
sendBanned: '已禁用', sendBanned: '已禁用',
sendInternal: '仅站内',
wrote: '来信', wrote: '来信',
support: '捐助', support: '捐助',
supportDesc: '请我喝杯奶茶', supportDesc: '请我喝杯奶茶',

View File

@@ -113,6 +113,10 @@ const sendType = computed(() => {
return t('sendBanned') return t('sendBanned')
} }
if (userStore.user.role.sendType === 'internal') {
return t('sendInternal')
}
if (!userStore.user.role.sendCount) { if (!userStore.user.role.sendCount) {
return t('unlimited') return t('unlimited')
} }
@@ -137,6 +141,10 @@ const sendCount = computed(() => {
return null return null
} }
if (userStore.user.role.sendType === 'internal') {
return null
}
if (!userStore.user.role.sendCount) { if (!userStore.user.role.sendCount) {
return null return null
} }

View File

@@ -32,6 +32,7 @@
:key="item" :key="item"
:label="item" :label="item"
:value="item" :value="item"
style="color: #999896;"
/> />
</el-select> </el-select>
</template> </template>
@@ -111,6 +112,7 @@ import db from "@/db/db.js";
import dayjs from "dayjs"; import dayjs from "dayjs";
import {useI18n} from "vue-i18n"; import {useI18n} from "vue-i18n";
import router from "@/router/index.js"; import router from "@/router/index.js";
import {ElMessageBox} from "element-plus";
defineExpose({ defineExpose({
open, open,
@@ -119,7 +121,7 @@ defineExpose({
openDraft openDraft
}) })
const {t, locale} = useI18n() const {t} = useI18n()
const writerStore = useWriterStore(); const writerStore = useWriterStore();
const draftStore = userDraftStore() const draftStore = userDraftStore()
const settingStore = useSettingStore() const settingStore = useSettingStore()
@@ -305,6 +307,10 @@ async function sendEmail() {
return return
} }
if (!form.content) {
form.content = editor.value.getContent();
}
if (!form.content) { if (!form.content) {
ElMessage({ ElMessage({
message: t('emptyContentMsg'), message: t('emptyContentMsg'),
@@ -433,15 +439,12 @@ function openForward(email) {
form.subject = email.subject form.subject = email.subject
form.sendType = 'forward' form.sendType = 'forward'
form.emailId = email.emailId
defValue.value = '' defValue.value = ''
setTimeout(() => { setTimeout(() => {
defValue.value = ` defValue.value = `
<articl class="mceNonEditable" >
${formatImage(email.content) || `<pre style="font-family: inherit;word-break: break-word;white-space: pre-wrap;margin: 0">${email.text}</pre>`} ${formatImage(email.content) || `<pre style="font-family: inherit;word-break: break-word;white-space: pre-wrap;margin: 0">${email.text}</pre>`}
</article>
` `
open() open()
@@ -466,7 +469,7 @@ function openReply(email) {
email.subject.startsWith('Re:') || email.subject.startsWith('Re:') ||
email.subject.startsWith('Re') || email.subject.startsWith('Re') ||
email.subject.startsWith('回复:') || email.subject.startsWith('回复:') ||
email.subject.startsWith('回复:')) ? email.subject : 'Re:' + email.subject email.subject.startsWith('回复:')) ? email.subject : 'Re: ' + email.subject
form.sendType = 'reply' form.sendType = 'reply'
form.emailId = email.emailId form.emailId = email.emailId
@@ -542,6 +545,10 @@ function close() {
if (selectStatus) openSelect(); if (selectStatus) openSelect();
if (!form.content) {
form.content = editor.value.getContent();
}
if (form.draftId) { if (form.draftId) {
draftStore.setDraft = {...toRaw(form)} draftStore.setDraft = {...toRaw(form)}
show.value = false show.value = false
@@ -559,6 +566,9 @@ function close() {
let subjectFlag = form.subject === backReply.subject let subjectFlag = form.subject === backReply.subject
let contentFlag = editor.value.getContent() === backReply.content let contentFlag = editor.value.getContent() === backReply.content
let receiveFlag = form.receiveEmail.length === 1 && form.receiveEmail[0] === backReply.receiveEmail[0] let receiveFlag = form.receiveEmail.length === 1 && form.receiveEmail[0] === backReply.receiveEmail[0]
if (backReply.sendType === 'forward' && form.receiveEmail.length === 0) {
receiveFlag = true;
}
if (subjectFlag && contentFlag && receiveFlag) { if (subjectFlag && contentFlag && receiveFlag) {
resetForm(); resetForm();
close() close()
@@ -572,7 +582,7 @@ function close() {
type: 'warning', type: 'warning',
distinguishCancelAndClose: true distinguishCancelAndClose: true
}).then(async () => { }).then(async () => {
const formData = {...toRaw(form)} const formData = {...toRaw(form)};
delete formData.draftId delete formData.draftId
delete formData.attachments delete formData.attachments
formData.createTime = dayjs().utc().format('YYYY-MM-DD HH:mm:ss'); formData.createTime = dayjs().utc().format('YYYY-MM-DD HH:mm:ss');
@@ -580,7 +590,9 @@ function close() {
db.value.att.add({draftId, attachments: toRaw(form.attachments)}) db.value.att.add({draftId, attachments: toRaw(form.attachments)})
draftStore.refreshList++ draftStore.refreshList++
show.value = false show.value = false
resetForm() await nextTick(() => {
resetForm()
})
}).catch((action) => { }).catch((action) => {
if (action === 'cancel') { if (action === 'cancel') {
show.value = false show.value = false
@@ -591,7 +603,18 @@ function close() {
} }
</script> </script>
<style>
.el-select-dropdown__list {
padding: 4px 4px !important;
}
.el-select-dropdown__item {
padding: 0 10px 0 10px;
}
.el-select-dropdown {
min-width: 0 !important;
}
</style>
<style scoped lang="scss"> <style scoped lang="scss">
.send { .send {
position: fixed; position: fixed;

View File

@@ -8,7 +8,7 @@
<Icon class="icon" @click="changeStar" v-else icon="solar:star-line-duotone" width="18" height="18"/> <Icon class="icon" @click="changeStar" v-else icon="solar:star-line-duotone" width="18" height="18"/>
</span> </span>
<Icon class="icon" v-if="emailStore.contentData.showReply" v-perm="'email:send'" @click="openReply" icon="la:reply" width="21" height="21" /> <Icon class="icon" v-if="emailStore.contentData.showReply" v-perm="'email:send'" @click="openReply" icon="la:reply" width="21" height="21" />
<Icon class="icon" v-if="emailStore.contentData.showReply" v-perm="'email:send'" @click="openForward" icon="tabler:location-share" width="19" height="19" /> <Icon class="icon" v-if="emailStore.contentData.showReply" v-perm="'email:send'" @click="openForward" icon="iconoir:arrow-up-right" width="20" height="20" />
</div> </div>
<div></div> <div></div>
<el-scrollbar class="scrollbar"> <el-scrollbar class="scrollbar">

View File

@@ -116,7 +116,7 @@
<div> <div>
<span>{{ node.label }}</span> <span>{{ node.label }}</span>
<span class="send-num" v-if="data.permKey === 'email:send'" @click.stop> <span class="send-num" v-if="data.permKey === 'email:send'" @click.stop>
<el-input-number v-model="form.sendCount" controls-position="right" :min="0" :max="99999" size="small" <el-input-number v-if="form.sendType === 'day' || form.sendType === 'count'" v-model="form.sendCount" controls-position="right" :min="0" :max="99999" size="small"
:placeholder="$t('total')"> :placeholder="$t('total')">
</el-input-number> </el-input-number>
<el-select v-model="form.sendType" placeholder="Select" size="small" <el-select v-model="form.sendType" placeholder="Select" size="small"

View File

@@ -754,7 +754,7 @@ defineOptions({
name: 'sys-setting' name: 'sys-setting'
}) })
const currentVersion = 'v2.8.0' const currentVersion = 'v2.9.0'
const hasUpdate = ref(false) const hasUpdate = ref(false)
let getUpdateErrorCount = 1; let getUpdateErrorCount = 1;
const {t, locale} = useI18n(); const {t, locale} = useI18n();

View File

@@ -761,6 +761,7 @@ function formatSendType(user) {
if (user.sendAction.sendType === 'day') return t('daily') if (user.sendAction.sendType === 'day') return t('daily')
if (user.sendAction.sendType === 'count') return t('total') if (user.sendAction.sendType === 'count') return t('total')
if (user.sendAction.sendType === 'ban') return t('sendBanned') if (user.sendAction.sendType === 'ban') return t('sendBanned')
if (user.sendAction.sendType === 'internal') return t('sendInternal')
} }
function formatSendCount(user) { function formatSendCount(user) {

View File

@@ -322,7 +322,7 @@ const emailService = {
} }
//如果权限有发送次数增加用户发送次数 //如果权限有发送次数增加用户发送次数
if (roleRow.sendCount) { if (roleRow.sendCount && roleRow.sendType !== 'internal') {
await userService.incrUserSendCount(c, receiveEmail.length, userId); await userService.incrUserSendCount(c, receiveEmail.length, userId);
} }
@@ -473,7 +473,7 @@ const emailService = {
status = emailConst.status.BOUNCED; status = emailConst.status.BOUNCED;
} }
await orm(c).update(email).set({ status: emailConst.status.DELIVERED, message: message }).where(eq(email.emailId, sendEmailData.emailId)).run(); await orm(c).update(email).set({ status, message: message }).where(eq(email.emailId, sendEmailData.emailId)).run();
}, },