完成驳回通知邮件功能

This commit is contained in:
宇阳
2024-10-18 15:42:17 +08:00
parent f3989f922c
commit 7cccd0a4d4
4 changed files with 82 additions and 4 deletions

View File

@@ -16,6 +16,7 @@ import Empty from "@/components/Empty";
import { useWebStore } from '@/stores';
import TextArea from "antd/es/input/TextArea";
import { sendDismissEmailAPI } from "@/api/Email";
type Menu = "comment" | "link" | "wall";
@@ -58,12 +59,58 @@ const ListItem = ({ item, type, fetchData }: ListItemProps) => {
message.success('🎉 留言驳回成功');
}
console.log(dismissInfo);
setIsModalOpen(false)
fetchData(type);
setDismissInfo("")
// 发送驳回通知邮件
sendDismissEmail()
};
// 发送驳回通知邮件
const sendDismissEmail = () => {
// 类型名称
let email_info = {
name: "",
type: "",
url: ""
}
switch (type) {
case "link":
email_info = {
name: item.title,
type: "友链",
url: `${web.url}/friend`,
}
break;
case "comment":
email_info = {
name: item.name,
type: "评论",
url: `${web.url}/article/${item.articleId}`,
}
break;
case "wall":
email_info = {
name: item.name,
type: "留言",
url: `${web.url}/wall/all`,
}
break;
}
sendDismissEmailAPI({
to: item.email,
content: dismissInfo,
recipient: email_info.name,
subject: `${email_info.type}驳回通知`,
time: dayjs(Date.now()).format('YYYY年MM月DD日 HH:mm'),
type: email_info.type,
url: email_info.url
})
}
return (
<div key={item.id}>
<div className="text-center text-xs text-[#e0e0e0] mb-4">