邮件提醒

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

@@ -11,13 +11,14 @@ import { useWebStore, useUserStore } from '@/stores'
import dayjs from 'dayjs';
import TextArea from 'antd/es/input/TextArea';
import { sendCommentEmailAPI } from '@/api/Email';
const CommentPage = () => {
const web = useWebStore(state => state.web)
const user = useUserStore(state => state.user)
const [loading, setLoading] = useState(false);
const [comment, setComment] = useState<Comment>();
const [comment, setComment] = useState<Comment>({} as Comment);
const [list, setList] = useState<Comment[]>([]);
const [isCommentModalOpen, setIsCommentModalOpen] = useState(false);
@@ -143,6 +144,17 @@ const CommentPage = () => {
setIsReplyModalOpen(false)
setReplyInfo("")
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 (