From 1bf48e7c5790891d18fedbbbc9f4d8e00665c2cb Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 24 Jul 2023 11:35:30 +0800 Subject: [PATCH] fix plugin form --- app/plugins/autosignin/__init__.py | 58 +++++++++++++++++++++------ app/plugins/sitestatistic/__init__.py | 39 ++++++++++++++---- 2 files changed, 77 insertions(+), 20 deletions(-) diff --git a/app/plugins/autosignin/__init__.py b/app/plugins/autosignin/__init__.py index fb2e1564..0bb81130 100644 --- a/app/plugins/autosignin/__init__.py +++ b/app/plugins/autosignin/__init__.py @@ -118,6 +118,9 @@ class AutoSignIn(_PluginBase): """ 拼装插件配置页面,需要返回两块数据:1、页面配置;2、数据结构 """ + # 站点的可选项 + site_options = [{"title": site.get("name"), "value": site.get("id")} + for site in self.sites.get_indexers()] return [ { 'component': 'VForm', @@ -127,6 +130,10 @@ class AutoSignIn(_PluginBase): 'content': [ { 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, 'content': [ { 'component': 'VSwitch', @@ -134,7 +141,16 @@ class AutoSignIn(_PluginBase): 'model': 'enabled', 'label': '启用插件', } - }, + } + ] + }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, + 'content': [ { 'component': 'VSwitch', 'props': { @@ -151,31 +167,47 @@ class AutoSignIn(_PluginBase): 'content': [ { 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, 'content': [ { 'component': 'VTextField', 'props': { - 'cols': 12, - 'md': 6, 'model': 'cron', 'label': '执行周期', 'placeholder': '0 9,18 * * *' } - }, + } + ] + }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, + 'content': [ { 'component': 'VTextField', 'props': { - 'cols': 12, - 'md': 6, 'model': 'queue_cnt', 'label': '队列数量' } - }, + } + ] + }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, + 'content': [ { 'component': 'VTextField', 'props': { - 'cols': 12, - 'md': 6, 'model': 'retry_keyword', 'label': '重试关键字' } @@ -197,7 +229,7 @@ class AutoSignIn(_PluginBase): 'multiple': True, 'model': 'sign_sites', 'label': '签到站点', - 'items': [] + 'items': site_options } } ] @@ -215,9 +247,9 @@ class AutoSignIn(_PluginBase): 'props': { 'chips': True, 'multiple': True, - 'model': 'sign_sites', - 'label': '签到站点', - 'items': [] + 'model': 'special_sites', + 'label': '特殊站点', + 'items': site_options } } ] diff --git a/app/plugins/sitestatistic/__init__.py b/app/plugins/sitestatistic/__init__.py index f06603d7..4a42568f 100644 --- a/app/plugins/sitestatistic/__init__.py +++ b/app/plugins/sitestatistic/__init__.py @@ -122,6 +122,9 @@ class SiteStatistic(_PluginBase): """ 拼装插件配置页面,需要返回两块数据:1、页面配置;2、数据结构 """ + # 站点的可选项 + site_options = [{"title": site.get("name"), "value": site.get("id")} + for site in self.sites.get_indexers()] return [ { 'component': 'VForm', @@ -131,6 +134,10 @@ class SiteStatistic(_PluginBase): 'content': [ { 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, 'content': [ { 'component': 'VSwitch', @@ -138,7 +145,16 @@ class SiteStatistic(_PluginBase): 'model': 'enabled', 'label': '启用插件', } - }, + } + ] + }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, + 'content': [ { 'component': 'VSwitch', 'props': { @@ -155,22 +171,31 @@ class SiteStatistic(_PluginBase): 'content': [ { 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, 'content': [ { 'component': 'VTextField', 'props': { - 'cols': 12, - 'md': 6, 'model': 'cron', 'label': '执行周期', 'placeholder': '0 9,18 * * *' } - }, + } + ] + }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, + 'content': [ { 'component': 'VTextField', 'props': { - 'cols': 12, - 'md': 6, 'model': 'queue_cnt', 'label': '队列数量' } @@ -192,7 +217,7 @@ class SiteStatistic(_PluginBase): 'multiple': True, 'model': 'statistic_sites', 'label': '统计站点', - 'items': [] + 'items': site_options } } ]