发送通知测试

This commit is contained in:
MoeSnowyFox
2025-09-13 23:57:56 +08:00
parent e49d67f501
commit 1866495379

View File

@@ -17,6 +17,8 @@ import type { SettingsData } from '../types/settings'
import { Service, type VersionOut } from '@/api'
import UpdateModal from '@/components/UpdateModal.vue'
import { mirrorManager } from '@/utils/mirrorManager'
import { request } from '@/api/core/request'
import { OpenAPI } from '@/api'
const updateData = ref<Record<string, string[]>>({})
@@ -300,6 +302,28 @@ const onUpdateConfirmed = () => {
updateVisible.value = false
}
const testingNotify = ref(false)
const testNotify = async () => {
testingNotify.value = true
try {
const res: any = await request<any>(OpenAPI, {
method: 'POST',
url: '/api/setting/test_notify',
})
if (res?.code && res.code !== 200) {
message.warning(res?.message || '测试通知发送结果未知')
} else {
message.success('测试通知已发送')
}
} catch (error) {
console.error('测试通知发送失败:', error)
message.error('测试通知发送失败')
} finally {
testingNotify.value = false
}
}
onMounted(() => {
loadSettings()
getBackendVersion()
@@ -955,6 +979,19 @@ onMounted(() => {
</a-col>
</a-row>
</div>
<div class="form-section">
<div class="section-header">
<h3>通知测试</h3>
</div>
<a-row :gutter="24">
<a-col :span="24">
<a-space>
<a-button type="primary" :loading="testingNotify" @click="testNotify">发送测试通知</a-button>
</a-space>
</a-col>
</a-row>
</div>
</div>
</a-tab-pane>