This commit is contained in:
jxxghp
2023-07-13 20:42:35 +08:00
parent 660fa639db
commit 0a7ce0fa95
2 changed files with 35 additions and 35 deletions
+11
View File
@@ -480,3 +480,14 @@ export interface ScheduleInfo {
// 下次运行时间 // 下次运行时间
next_run: string; next_run: string;
} }
// 消息通知
export interface NotificationSwitch {
// 消息类型
mtype: string;
// 开关
wechat: boolean;
telegram: boolean;
slack: boolean;
}
@@ -1,36 +1,22 @@
<script lang="ts" setup> <script lang="ts" setup>
const messageTypes = ref([ import api from "@/api";
{ import { NotificationSwitch } from "@/api/types";
type: "资源下载",
wechat: true, const messagemTypes = ref<NotificationSwitch[]>([]);
telegram: true,
slack: true, // 调用API查询消息开关
}, const loadNotificationSwitchs = async () => {
{ try {
type: "整理入库", const result: NotificationSwitch[] = await api.get("message/switchs");
wechat: true, messagemTypes.value = result;
telegram: true, } catch (error) {
slack: true, console.log(error);
}, }
{ };
type: "订阅",
wechat: true, onMounted(() => {
telegram: true, loadNotificationSwitchs();
slack: true, });
},
{
type: "站点消息",
wechat: true,
telegram: true,
slack: true,
},
{
type: "媒体服务器通知",
wechat: true,
telegram: true,
slack: true,
},
]);
</script> </script>
<template> <template>
@@ -47,9 +33,9 @@ const messageTypes = ref([
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="message in messageTypes" :key="message.type"> <tr v-for="message in messagemTypes" :key="message.mtype">
<td> <td>
{{ message.type }} {{ message.mtype }}
</td> </td>
<td> <td>
<VCheckbox v-model="message.wechat" /> <VCheckbox v-model="message.wechat" />
@@ -61,6 +47,9 @@ const messageTypes = ref([
<VCheckbox v-model="message.slack" /> <VCheckbox v-model="message.slack" />
</td> </td>
</tr> </tr>
<tr v-if="messagemTypes.length === 0">
<td colspan="4" align="center">没有设置任何通知渠道</td>
</tr>
</tbody> </tbody>
</VTable> </VTable>
<VDivider /> <VDivider />
@@ -68,7 +57,7 @@ const messageTypes = ref([
<VCardText> <VCardText>
<VForm @submit.prevent="() => {}"> <VForm @submit.prevent="() => {}">
<div class="d-flex flex-wrap gap-4 mt-4"> <div class="d-flex flex-wrap gap-4 mt-4">
<VBtn type="submit"> 保存 </VBtn> <VBtn mtype="submit"> 保存 </VBtn>
</div> </div>
</VForm> </VForm>
</VCardText> </VCardText>