fix(email): complete mail settings and templates

This commit is contained in:
kate522 committed 2026-09-04 12:06:42 +08:00
1 parent 4f8ab94fac
commit 4833053a5c
29 files changed
+716 -426

No files matched your search

+24 -5
View File
@@ -14,6 +14,7 @@
@update:form-data="formData = $event"
@save="handleSave"
@reload="handleReload"
@field-action="handleFieldAction"
>
<template
v-if="isPermissionsLogin"
@@ -142,6 +143,7 @@ const captchaProviderTab = ref('tencent')
/** Resolve domain/section from props or route meta (canonicalDomain + section, with legacy fallback) */
const resolvedDomain = computed(() => normalizeSchemaDomain(props.domain || route.meta?.canonicalDomain || route.meta?.schemaDomain || resolveDomainFromPath(route.path)))
const resolvedSection = computed(() => props.section || route.meta?.section || route.meta?.schemaSection || resolveSectionFromPath(route.path))
const isEmailPage = computed(() => resolvedDomain.value === 'global' && resolvedSection.value === 'email')
const isPermissionsLogin = computed(() => resolvedDomain.value === 'permissions' && resolvedSection.value === 'login')
const isPermissionsModeration = computed(() => resolvedDomain.value === 'permissions' && resolvedSection.value === 'moderation')
@@ -158,7 +160,7 @@ function resolveSectionFromPath(path) {
/** Load schema from the Vue-side registry */
const pageMeta = computed(() => {
const schema = resolvedDomain.value === 'page_display'
const schema = (isEmailPage.value || resolvedDomain.value === 'page_display')
? serverSchema.value
: getSchema(resolvedDomain.value, resolvedSection.value)
if (schema && schema.groups && schema.groups.length > 0) {
@@ -180,7 +182,7 @@ const pageMeta = computed(() => {
/** Default values from schema */
const defaults = computed(() => {
const schema = resolvedDomain.value === 'page_display'
const schema = (isEmailPage.value || resolvedDomain.value === 'page_display')
? serverSchema.value
: getSchema(resolvedDomain.value, resolvedSection.value)
if (!schema) return {}
@@ -202,9 +204,7 @@ const {
} = useSectionForm({
fetch: async () => {
const response = await api.getSchemaPage(resolvedDomain.value, resolvedSection.value)
if (resolvedDomain.value === 'page_display') {
serverSchema.value = response?.schema || null
}
serverSchema.value = response?.schema || serverSchema.value
return response
},
submit: async (data) => {
@@ -231,6 +231,25 @@ const {
},
})
async function handleFieldAction(key) {
if (key !== 'email_test_send' || !isEmailPage.value) return
const to = String(formData.value?.email_test_to || '').trim()
if (!to) {
message.warning('请先填写测试收件地址')
return
}
if (dirty.value) {
message.warning('请先保存当前配置,再发送测试邮件')
return
}
try {
const response = await api.testMail(to)
message.success(response?.message || '测试邮件已发送')
} catch (error) {
message.error(error?.message || '测试邮件发送失败')
}
}
async function handleSave() {
try {
await doSave()