|
|
@ -1,7 +1,9 @@
|
|
|
|
import { useState, useEffect } from 'react'
|
|
|
|
import { useState, useEffect } from 'react'
|
|
|
|
import { isEmpty } from '@/utils/commons'
|
|
|
|
import { isEmpty } from '@/utils/commons'
|
|
|
|
import { getEmailDetailAction, postResendEmailAction } from '@/actions/EmailActions'
|
|
|
|
import { getEmailDetailAction, postResendEmailAction, } from '@/actions/EmailActions'
|
|
|
|
import { App, Button, Divider, Avatar } from 'antd'
|
|
|
|
import { App } from 'antd'
|
|
|
|
|
|
|
|
import useConversationStore from '@/stores/ConversationStore';
|
|
|
|
|
|
|
|
import { msgStatusRenderMapped } from '@/channel/bubbleMsgUtils';
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @param mai_sn 邮件编号ID
|
|
|
|
* @param mai_sn 邮件编号ID
|
|
|
@ -13,6 +15,8 @@ export const useEmailDetail = (mai_sn, data) => {
|
|
|
|
const [loading, setLoading] = useState(false)
|
|
|
|
const [loading, setLoading] = useState(false)
|
|
|
|
const [mailData, setMailData] = useState({ loading, info: {}, content: '', attachments: [] })
|
|
|
|
const [mailData, setMailData] = useState({ loading, info: {}, content: '', attachments: [] })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [updateMessageItem] = useConversationStore(state => [state.updateMessageItem]);
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
useEffect(() => {
|
|
|
|
const getEmailDetail = async () => {
|
|
|
|
const getEmailDetail = async () => {
|
|
|
|
if (isEmpty(mai_sn)) {
|
|
|
|
if (isEmpty(mai_sn)) {
|
|
|
@ -43,7 +47,13 @@ export const useEmailDetail = (mai_sn, data) => {
|
|
|
|
return false
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
await postResendEmailAction({ mai_sn, externalid, actionid, token: 0 })
|
|
|
|
await postResendEmailAction({ mai_sn, externalid, actionid, token: 0 })
|
|
|
|
|
|
|
|
// 重发没有状态返回值, 此处前端处理为'待发送', todo: 刷新页面后消息仍为上一个状态'失败'
|
|
|
|
|
|
|
|
updateMessageItem({ conversationid: externalid, actionid, id: actionid, status: msgStatusRenderMapped['accepted'] })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return { loading, mailData, postEmailResend }
|
|
|
|
return { loading, mailData, postEmailResend }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const EmailBuilder = ({subject, content}) => {
|
|
|
|
|
|
|
|
return `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html lang="en"><head><title>${subject}</title><meta http-equiv="Content-Type" content="text/html charset=UTF-8" /><meta content="width=device-width" name="viewport"><meta charset="UTF-8"><meta content="IE=edge" http-equiv="X-UA-Compatible"><meta content="width=device-width" name="viewport"><meta charset="UTF-8"><meta content="IE=edge" http-equiv="X-UA-Compatible"><meta content="telephone=no,address=no,email=no,date=no,url=no" name="format-detection"><meta content="light" name="color-scheme"><meta content="light" name="supported-color-schemes"><style id="font">*{ font-family: Verdana, sans-serif;} table{ border-collapse: collapse; border-spacing: 0;} </style></head><body id="highlights-email" style="margin: 0 auto; padding: undefined; width: 900px; background-color: #fcfcfc;">${content}</body></html>`;
|
|
|
|
|
|
|
|
}
|
|
|
|