From 94ba3c4514c0fea50b21a0c1776d7f27ca56de29 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Thu, 15 Aug 2024 11:45:45 +0800 Subject: [PATCH] style: Update grid-customrule-card to use larger minimum width for columns --- .../cards/NotificationChannelCard.vue | 23 +++++ src/components/input/PathField.vue | 7 +- src/styles/styles.scss | 2 +- src/views/setting/AccountSettingDirectory.vue | 2 + .../setting/AccountSettingNotification.vue | 89 ++++++++++++++++++- src/views/setting/AccountSettingSearch.vue | 27 +++++- src/views/setting/AccountSettingSubscribe.vue | 26 +++++- 7 files changed, 164 insertions(+), 12 deletions(-) diff --git a/src/components/cards/NotificationChannelCard.vue b/src/components/cards/NotificationChannelCard.vue index 9df937dc..3419da17 100644 --- a/src/components/cards/NotificationChannelCard.vue +++ b/src/components/cards/NotificationChannelCard.vue @@ -42,6 +42,18 @@ const notificationTypeNames: { [key: string]: string } = { webpush: 'WebPush', } +// 消息类型下拉字典 +const notificationTypes = [ + { value: '资源下载', title: '资源下载' }, + { value: '整理入库', title: '整理入库' }, + { value: '订阅', title: '订阅' }, + { value: '站点', title: '站点' }, + { value: '媒体服务器', title: '媒体服务器' }, + { value: '手动处理', title: '手动处理' }, + { value: '插件', title: '插件' }, + { value: '其它', title: '其它' }, +] + // 打开详情弹窗 function openNotificationInfoDialog() { notificationInfo.value = props.notification @@ -106,6 +118,17 @@ function onClose() { + + + diff --git a/src/components/input/PathField.vue b/src/components/input/PathField.vue index a4d83042..8c89551c 100644 --- a/src/components/input/PathField.vue +++ b/src/components/input/PathField.vue @@ -27,21 +27,24 @@ const treeItems = ref([ name: '/', path: props.root, children: [], - type: '', + type: 'dir', basename: props.root, extension: '', size: 0, modify_time: 0, fileid: '', parent_fileid: '', + storage: 'local', }, ]) // 拉取子目录 async function fetchDirs(item: any) { return api - .get('/local/listdir?path=' + item.path) + .post('/storage/list', item) .then((data: any) => { + // 只添加目录到子目录 + data = data.filter((i: any) => i.type === 'dir') item.children.push(...data) }) .catch(err => console.warn(err)) diff --git a/src/styles/styles.scss b/src/styles/styles.scss index beada878..37ddc4b6 100644 --- a/src/styles/styles.scss +++ b/src/styles/styles.scss @@ -177,7 +177,7 @@ } .grid-customrule-card { - grid-template-columns: repeat(auto-fill, minmax(1rem, 1fr)); + grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); padding-block-end: 1rem; } diff --git a/src/views/setting/AccountSettingDirectory.vue b/src/views/setting/AccountSettingDirectory.vue index b1037273..bc69e74b 100644 --- a/src/views/setting/AccountSettingDirectory.vue +++ b/src/views/setting/AccountSettingDirectory.vue @@ -80,6 +80,8 @@ function addDirectory() { download_path: '', priority: -1, monitor_type: '', + media_type: '', + media_category: '', }) orderDirectoryCards() } diff --git a/src/views/setting/AccountSettingNotification.vue b/src/views/setting/AccountSettingNotification.vue index 1ddaddcc..8438cf93 100644 --- a/src/views/setting/AccountSettingNotification.vue +++ b/src/views/setting/AccountSettingNotification.vue @@ -2,7 +2,7 @@ import { useToast } from 'vue-toast-notification' import api from '@/api' import draggable from 'vuedraggable' -import type { NotificationConf } from '@/api/types' +import type { NotificationConf, NotificationSwitchConf } from '@/api/types' import NotificationChannelCard from '@/components/cards/NotificationChannelCard.vue' // 所有消息渠道 @@ -11,6 +11,42 @@ const notifications = ref([]) // 提示框 const $toast = useToast() +// 消息类型开关 +const notificationSwitchs = ref([ + { + type: '资源下载', + action: 'all', + }, + { + type: '整理入库', + action: 'all', + }, + { + type: '订阅', + action: 'all', + }, + { + type: '站点', + action: 'admin', + }, + { + type: '媒体服务器', + action: 'admin', + }, + { + type: '手动处理', + action: 'admin', + }, + { + type: '插件', + action: 'admin', + }, + { + type: '其它', + action: 'admin', + }, +]) + // 添加媒体服务器 function addNotification(notification: string) { notifications.value.push({ @@ -48,9 +84,34 @@ async function saveNotificationSetting() { } } +// 加载消息类型开关 +async function loadNotificationSwitchs() { + try { + const result: { [key: string]: any } = await api.get('system/setting/NotificationSwitchs') + notificationSwitchs.value = result.data?.value ?? [] + } catch (error) { + console.log(error) + } +} + +// 保存消息类型开关 +async function saveNotificationSwitchs() { + try { + const result: { [key: string]: any } = await api.post( + 'system/setting/NotificationSwitchs', + notificationSwitchs.value, + ) + if (result.success) $toast.success('消息类型开关保存成功') + else $toast.error('消息类型开关保存失败!') + } catch (error) { + console.log(error) + } +} + // 加载数据 onMounted(() => { loadNotificationSetting() + loadNotificationSwitchs() }) @@ -117,11 +178,33 @@ onMounted(() => { 通知发送范围 对应消息类型只会发送给设定的用户。 - + + + + 消息类型 + 范围 + + + + + + {{ item.type }} + + + + + + + + + + + +
- 保存 + 保存
diff --git a/src/views/setting/AccountSettingSearch.vue b/src/views/setting/AccountSettingSearch.vue index 0d8b6bee..8264de0d 100644 --- a/src/views/setting/AccountSettingSearch.vue +++ b/src/views/setting/AccountSettingSearch.vue @@ -1,7 +1,7 @@ @@ -142,7 +161,7 @@ onMounted(() => { v-model="selectedFilterGroup" multiple chips - :items="[]" + :items="filterRuleGroupOptions" label="过滤规则组" hint="搜索媒体信息时按选定的过滤规则组对结果进行过滤" persistent-hint diff --git a/src/views/setting/AccountSettingSubscribe.vue b/src/views/setting/AccountSettingSubscribe.vue index 68df5008..f80a52d0 100644 --- a/src/views/setting/AccountSettingSubscribe.vue +++ b/src/views/setting/AccountSettingSubscribe.vue @@ -1,7 +1,7 @@ @@ -146,7 +168,7 @@ onMounted(() => {