邮件提醒

This commit is contained in:
Liu 宇阳
2024-10-21 16:37:11 +08:00
parent 59fee1d33a
commit 327e19497b
3 changed files with 20 additions and 3 deletions

View File

@@ -1,5 +1,10 @@
import Request from '@/utils/request' import Request from '@/utils/request'
import { DismissEmail } from '@/types/app/email' import { CommentEmail, DismissEmail } from '@/types/app/email'
// 发送评论邮件
export const sendCommentEmailAPI = async (data: CommentEmail) => {
return await Request<string>("POST", `/email/comment`, { data });
}
// 发送驳回邮件 // 发送驳回邮件
export const sendDismissEmailAPI = async (data: DismissEmail) => { export const sendDismissEmailAPI = async (data: DismissEmail) => {

View File

@@ -11,13 +11,14 @@ import { useWebStore, useUserStore } from '@/stores'
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import TextArea from 'antd/es/input/TextArea'; import TextArea from 'antd/es/input/TextArea';
import { sendCommentEmailAPI } from '@/api/Email';
const CommentPage = () => { const CommentPage = () => {
const web = useWebStore(state => state.web) const web = useWebStore(state => state.web)
const user = useUserStore(state => state.user) const user = useUserStore(state => state.user)
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [comment, setComment] = useState<Comment>(); const [comment, setComment] = useState<Comment>({} as Comment);
const [list, setList] = useState<Comment[]>([]); const [list, setList] = useState<Comment[]>([]);
const [isCommentModalOpen, setIsCommentModalOpen] = useState(false); const [isCommentModalOpen, setIsCommentModalOpen] = useState(false);
@@ -143,6 +144,17 @@ const CommentPage = () => {
setIsReplyModalOpen(false) setIsReplyModalOpen(false)
setReplyInfo("") setReplyInfo("")
getCommentList() getCommentList()
// 发送邮件通知
await sendCommentEmailAPI({
content: comment.content,
reviewers: comment.name,
subject: comment.articleTitle!,
title: comment.articleTitle!,
url: location.href,
time: dayjs(Date.now()).format('YYYY年MM月DD日 HH:mm'),
to: comment.id !== comment.articleId ? comment.email : undefined
})
} }
return ( return (

View File

@@ -6,7 +6,7 @@ export interface Comment {
url: string, url: string,
content: string, content: string,
articleId: number, articleId: number,
articleTitle?: number, articleTitle?: string,
commentId: number, commentId: number,
auditStatus: number auditStatus: number
createTime: string, createTime: string,