看板图只能由浏览器渲染,改为确认动作内自动生成并上传,不再要求另点按钮;只在已附图时提供重新生成。
This commit is contained in:
@@ -63,6 +63,13 @@ export function QAWeeklyMail({ week, busy }: { week: string; busy: boolean }) {
|
||||
setConfirmation(next)
|
||||
setNotice(confirm ? '已确认本周周报;到设定时间会自动发送,正文改动后需重新确认' : '已取消确认,不会自动发送')
|
||||
setSends(await fetchWeeklyMailSends(week))
|
||||
// The chart can only be rendered by the browser, so it is generated and attached
|
||||
// the moment the operator confirms — no separate step for the common path.
|
||||
if (confirm && next?.current) {
|
||||
setNotice('已确认本周周报;正在生成并附上统计看板图片…')
|
||||
setAttaching(true)
|
||||
setCapture(true)
|
||||
}
|
||||
} catch (reason) {
|
||||
setError(reason instanceof Error ? reason.message : '确认失败')
|
||||
} finally {
|
||||
@@ -135,9 +142,11 @@ export function QAWeeklyMail({ week, busy }: { week: string; busy: boolean }) {
|
||||
<button type="button" disabled={working || testing} onClick={() => void testSend()}>
|
||||
{testing ? '正在发送测试…' : '发送测试邮件'}
|
||||
</button>
|
||||
<button type="button" disabled={working || attaching || !confirmation || stale} onClick={attachDashboard}>
|
||||
{attaching ? '正在生成图片…' : confirmation?.has_image ? '重新附看板图片' : '附上统计看板图片'}
|
||||
</button>
|
||||
{confirmation?.has_image && !stale ? (
|
||||
<button type="button" disabled={working || attaching} onClick={attachDashboard}>
|
||||
{attaching ? '正在生成图片…' : '重新生成看板图片'}
|
||||
</button>
|
||||
) : null}
|
||||
<button type="button" disabled={working} onClick={() => setEditing(!editing)}>
|
||||
{editing ? '收起发送设置' : '发送设置'}
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user