新增自定义通知类型支持,更新相关提示信息和样式

This commit is contained in:
jxxghp
2025-05-18 13:39:44 +08:00
parent 59e12c5e96
commit c4a02f7497
6 changed files with 48 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -6,6 +6,7 @@ import vocechat_image from '@images/logos/vocechat.png'
import synologychat_image from '@images/logos/synologychat.png'
import slack_image from '@images/logos/slack.webp'
import chrome_image from '@images/logos/chrome.png'
import custom_image from '@images/logos/notification.png'
import { useToast } from 'vue-toast-notification'
import { cloneDeep } from 'lodash-es'
import { useI18n } from 'vue-i18n'
@@ -51,6 +52,7 @@ const notificationTypeNames: { [key: string]: string } = {
synologychat: t('notification.synologychat.name'),
slack: t('notification.slack.name'),
webpush: t('notification.webpush.name'),
custom: t('setting.notification.custom'),
}
// 消息类型下拉字典
@@ -104,8 +106,10 @@ const getIcon = computed(() => {
return slack_image
case 'webpush':
return chrome_image
default:
case 'wechat':
return wechat_image
default:
return custom_image
}
})
@@ -131,7 +135,7 @@ function onClose() {
</div>
<div class="text-body-1 mb-3">{{ notificationTypeNames[notification.type] }}</div>
</div>
<VImg :src="getIcon" cover class="mt-7 me-3" max-width="3rem" />
<VImg :src="getIcon" cover class="mt-7 me-1" max-width="3rem" />
</VCardText>
</VCard>
<VDialog v-if="notificationInfoDialog" v-model="notificationInfoDialog" scrollable max-width="40rem">
@@ -225,7 +229,7 @@ function onClose() {
/>
</VCol>
</VRow>
<VRow v-if="notificationInfo.type == 'telegram'">
<VRow v-else-if="notificationInfo.type == 'telegram'">
<VCol cols="12" md="6">
<VTextField
v-model="notificationInfo.name"
@@ -270,7 +274,7 @@ function onClose() {
/>
</VCol>
</VRow>
<VRow v-if="notificationInfo.type == 'slack'">
<VRow v-else-if="notificationInfo.type == 'slack'">
<VCol cols="12" md="6">
<VTextField
v-model="notificationInfo.name"
@@ -308,7 +312,7 @@ function onClose() {
/>
</VCol>
</VRow>
<VRow v-if="notificationInfo.type == 'synologychat'">
<VRow v-else-if="notificationInfo.type == 'synologychat'">
<VCol cols="12" md="6">
<VTextField
v-model="notificationInfo.name"
@@ -335,7 +339,7 @@ function onClose() {
/>
</VCol>
</VRow>
<VRow v-if="notificationInfo.type == 'vocechat'">
<VRow v-else-if="notificationInfo.type == 'vocechat'">
<VCol cols="12" md="6">
<VTextField
v-model="notificationInfo.name"
@@ -371,7 +375,7 @@ function onClose() {
/>
</VCol>
</VRow>
<VRow v-if="notificationInfo.type == 'webpush'">
<VRow v-else-if="notificationInfo.type == 'webpush'">
<VCol cols="12" md="6">
<VTextField
v-model="notificationInfo.name"
@@ -390,6 +394,26 @@ function onClose() {
/>
</VCol>
</VRow>
<VRow v-else>
<VCol cols="12" md="6">
<VTextField
v-model="notificationInfo.type"
:label="t('notification.type')"
:hint="t('notification.customTypeHint')"
persistent-hint
active
/>
</VCol>
<VCol cols="12" md="6">
<VTextField
v-model="notificationInfo.name"
:label="t('notification.name')"
:hint="t('notification.nameRequired')"
persistent-hint
active
/>
</VCol>
</VRow>
</VForm>
</VCardText>
<VCardActions class="pt-3">

View File

@@ -279,6 +279,9 @@ export default {
nameHint: 'Name of notification channel',
type: 'Type',
typeHint: 'Type of notification channel',
customTypeHint: 'Custom notification type, used for plugin implementation scenarios',
customTypePlaceholder: 'custom',
nameRequired: 'Please enter name',
enabled: 'Enabled',
config: 'Configuration',
wechat: {
@@ -1184,6 +1187,7 @@ export default {
synologyChat: 'SynologyChat',
voceChat: 'VoceChat',
webPush: 'WebPush',
custom: 'Custom Notification',
},
words: {
customIdentifiers: 'Custom Identifiers',

View File

@@ -278,6 +278,9 @@ export default {
nameHint: '通知渠道名称',
type: '类型',
typeHint: '通知渠道类型',
customTypeHint: '自定义通知类型,用于插件实现场景',
customTypePlaceholder: 'custom',
nameRequired: '请输入名称',
enabled: '启用',
config: '配置',
wechat: {
@@ -1171,6 +1174,7 @@ export default {
synologyChat: 'SynologyChat',
voceChat: 'VoceChat',
webPush: 'WebPush',
custom: '自定义通知',
},
words: {
customIdentifiers: '自定义识别词',

View File

@@ -279,6 +279,9 @@ export default {
nameHint: '通知渠道名稱',
type: '類型',
typeHint: '通知渠道類型',
customTypeHint: '自定義通知類型,用於插件實現場景',
customTypePlaceholder: 'custom',
nameRequired: '請輸入名稱',
enabled: '啟用',
config: '配置',
wechat: {
@@ -1173,6 +1176,7 @@ export default {
synologyChat: 'SynologyChat',
voceChat: 'VoceChat',
webPush: 'WebPush',
custom: '自定義通知',
},
words: {
customIdentifiers: '自定義識別詞',

View File

@@ -313,6 +313,9 @@ onMounted(() => {
<VListItem @click="addNotification('webpush')">
<VListItemTitle>{{ t('setting.notification.webPush') }}</VListItemTitle>
</VListItem>
<VListItem @click="addNotification('custom')">
<VListItemTitle>{{ t('setting.system.custom') }}</VListItemTitle>
</VListItem>
</VList>
</VMenu>
</VBtn>
@@ -466,10 +469,10 @@ onMounted(() => {
<style scoped>
/* Monaco编辑器容器样式 */
.monaco-editor-container {
overflow: hidden;
border: 1px solid rgba(var(--v-border-color), var(--v-border-opacity));
border-radius: 8px;
overflow: hidden;
margin-top: 1rem;
margin-block-start: 1rem;
}
.template-card {