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

View File

@@ -480,3 +480,14 @@ export interface ScheduleInfo {
// 下次运行时间
next_run: string;
}
// 消息通知
export interface NotificationSwitch {
// 消息类型
mtype: string;
// 开关
wechat: boolean;
telegram: boolean;
slack: boolean;
}

View File

@@ -1,36 +1,22 @@
<script lang="ts" setup>
const messageTypes = ref([
{
type: "资源下载",
wechat: true,
telegram: true,
slack: true,
},
{
type: "整理入库",
wechat: true,
telegram: true,
slack: true,
},
{
type: "订阅",
wechat: true,
telegram: true,
slack: true,
},
{
type: "站点消息",
wechat: true,
telegram: true,
slack: true,
},
{
type: "媒体服务器通知",
wechat: true,
telegram: true,
slack: true,
},
]);
import api from "@/api";
import { NotificationSwitch } from "@/api/types";
const messagemTypes = ref<NotificationSwitch[]>([]);
// 调用API查询消息开关
const loadNotificationSwitchs = async () => {
try {
const result: NotificationSwitch[] = await api.get("message/switchs");
messagemTypes.value = result;
} catch (error) {
console.log(error);
}
};
onMounted(() => {
loadNotificationSwitchs();
});
</script>
<template>
@@ -47,9 +33,9 @@ const messageTypes = ref([
</tr>
</thead>
<tbody>
<tr v-for="message in messageTypes" :key="message.type">
<tr v-for="message in messagemTypes" :key="message.mtype">
<td>
{{ message.type }}
{{ message.mtype }}
</td>
<td>
<VCheckbox v-model="message.wechat" />
@@ -61,6 +47,9 @@ const messageTypes = ref([
<VCheckbox v-model="message.slack" />
</td>
</tr>
<tr v-if="messagemTypes.length === 0">
<td colspan="4" align="center">没有设置任何通知渠道</td>
</tr>
</tbody>
</VTable>
<VDivider />
@@ -68,7 +57,7 @@ const messageTypes = ref([
<VCardText>
<VForm @submit.prevent="() => {}">
<div class="d-flex flex-wrap gap-4 mt-4">
<VBtn type="submit"> 保存 </VBtn>
<VBtn mtype="submit"> 保存 </VBtn>
</div>
</VForm>
</VCardText>