对小工具进行了一些修复

This commit is contained in:
2026-08-26 11:06:05 +08:00
parent c6b1acfe0e
commit 523af723ae
12 changed files with 433 additions and 37 deletions
+91 -10
View File
@@ -89,8 +89,29 @@ final class WidgetSchemas {
];
case 'notice':
return [
['id' => 'interval', 'type' => 'spinner', 'label' => '滚动间隔(秒)', 'default' => 4, 'min' => 1, 'max' => 60],
['id' => 'items', 'type' => 'group', 'label' => '公告内容', 'max_items' => 30, 'fields' => self::card_fields(true)],
['id' => 'blank', 'type' => 'switcher', 'label' => '链接新窗口打开', 'default' => false],
['id' => 'radius', 'type' => 'switcher', 'label' => '两边显示为圆形', 'default' => false],
['id' => 'interval', 'type' => 'spinner', 'label' => '滚动间隔', 'default' => 3, 'min' => 1, 'max' => 10, 'step' => 1, 'unit' => '秒'],
['id' => 'color', 'type' => 'palette', 'label' => '颜色', 'default' => 'c-blue', 'options' => self::zib_palette()],
['id' => 'source', 'type' => 'radio', 'label' => '内容来源', 'default' => '', 'options' => ['' => '自定义', 'posts' => '文章', 'forums' => '论坛帖子']],
['id' => 'msg_icon', 'type' => 'icon', 'label' => '消息图标', 'default' => 'zibsvg-hot', 'dependency' => ['source', '!=', '']],
['id' => 'count', 'type' => 'spinner', 'label' => '获取帖子或文章数量', 'default' => 8, 'min' => 1, 'max' => 50, 'dependency' => ['source', '!=', '']],
['id' => 'desc_s', 'type' => 'switcher', 'label' => '显示简介(关闭则只显示标题)', 'default' => false],
['id' => 'forums_opts', 'type' => 'fieldset', 'label' => '论坛帖子筛选', 'default' => [], 'dependency' => ['source', '==', 'forums'], 'fields' => self::notice_forum_fields()],
['id' => 'posts_opts', 'type' => 'fieldset', 'label' => '文章筛选', 'default' => [], 'dependency' => ['source', '==', 'posts'], 'fields' => self::notice_post_fields()],
[
'id' => 'img_ids', 'type' => 'group', 'label' => '消息列表', 'max_items' => 50,
'dependency' => ['source', '==', ''],
'default' => [
['title' => '子比主题,更优雅的Wordpress主题', 'icon' => 'zibsvg-hot', 'href' => 'https://zibll.com'],
['title' => '更优雅的WordPress网站主题:子比主题!全面开启', 'icon' => 'zibsvg-hot', 'href' => 'https://zibll.com'],
],
'fields' => [
['id' => 'title', 'type' => 'text', 'label' => '消息内容', 'default' => '', 'allow_html' => true],
['id' => 'icon', 'type' => 'icon', 'label' => '图标', 'default' => 'fa-home'],
['id' => 'href', 'type' => 'text', 'label' => '跳转链接', 'default' => '', 'sanitize' => 'url'],
],
],
];
case 'text_title':
return [
@@ -100,9 +121,25 @@ final class WidgetSchemas {
];
case 'buttons':
return [
['id' => 'alignment', 'type' => 'button_set', 'label' => '对齐', 'default' => 'center', 'options' => ['left' => '左', 'center' => '中', 'right' => '右']],
['id' => 'gap', 'type' => 'slider', 'label' => '按钮间距', 'default' => 10, 'min' => 0, 'max' => 60],
['id' => 'buttons', 'type' => 'group', 'label' => '按钮', 'max_items' => 12, 'fields' => self::button_fields()],
['id' => 'obs_animation', 'type' => 'select', 'label' => '入场动画', 'default' => '', 'options' => self::animation_options()],
['id' => 'animation_repeat', 'type' => 'switcher', 'label' => '重复动画', 'default' => false, 'dependency' => ['obs_animation', '!=', '']],
['id' => 'pc_width', 'type' => 'spinner', 'label' => '按钮宽度(PC端宽度,0为自动)', 'default' => 0, 'min' => 0, 'max' => 500, 'step' => 4, 'unit' => 'px'],
['id' => 'm_width', 'type' => 'spinner', 'label' => '移动端宽度(0为自动)', 'default' => 0, 'min' => 0, 'max' => 500, 'step' => 4, 'unit' => 'px'],
['id' => 'pc_padding', 'type' => 'radio', 'label' => 'PC端按钮尺寸', 'default' => 'large', 'options' => ['small' => '小尺寸', 'medium' => '中尺寸', 'large' => '大尺寸']],
['id' => 'm_padding', 'type' => 'radio', 'label' => '移动端按钮尺寸', 'default' => 'medium', 'options' => ['small' => '小尺寸', 'medium' => '中尺寸', 'large' => '大尺寸']],
['id' => 'pc_gap', 'type' => 'spinner', 'label' => 'PC端按钮间距', 'default' => 12, 'min' => 0, 'max' => 60, 'step' => 4, 'unit' => 'px'],
['id' => 'm_gap', 'type' => 'spinner', 'label' => '移动端按钮间距', 'default' => 6, 'min' => 0, 'max' => 60, 'step' => 4, 'unit' => 'px'],
['id' => 'align', 'type' => 'radio', 'label' => '对齐方式', 'default' => 'center', 'options' => ['left' => '左对齐', 'center' => '居中', 'right' => '右对齐']],
['id' => 'radius', 'type' => 'switcher', 'label' => '两端圆角', 'default' => false],
['id' => 'hollow', 'type' => 'switcher', 'label' => '空心样式', 'default' => false],
['id' => 'go_link', 'type' => 'switcher', 'label' => '外链重定向', 'default' => true],
['id' => 'items', 'type' => 'group', 'label' => '添加按钮', 'max_items' => 50, 'default' => [], 'fields' => [
['id' => 'text', 'type' => 'text', 'label' => '按钮文字', 'default' => '', 'allow_html' => true],
['id' => 'icon_left', 'type' => 'icon', 'label' => '按钮前图标', 'default' => ''],
['id' => 'icon_right', 'type' => 'icon', 'label' => '按钮后图标', 'default' => ''],
['id' => 'link', 'type' => 'link', 'label' => '按钮链接', 'default' => []],
['id' => 'color', 'type' => 'palette', 'label' => '按钮颜色', 'default' => '', 'options' => self::button_palette()],
]],
];
case 'partners':
return [
@@ -407,12 +444,56 @@ final class WidgetSchemas {
return $fields;
}
private static function button_fields(): array {
private static function animation_options(): array {
return ['' => '无动画', 'fade' => '淡入', 'slideup' => '从下往上滑出', 'slidedown' => '从上往下滑出', 'slideright' => '从左往右滑出', 'slideleft' => '从右往左滑出', 'zoomin' => '由小变大', 'zoomout' => '由大变小'];
}
private static function button_palette(): array {
return ['' => '默认'] + self::zib_palette();
}
private static function zib_palette(): array {
return [
['id' => 'text', 'type' => 'text', 'label' => '文字', 'default' => '按钮'],
['id' => 'icon', 'type' => 'icon', 'label' => '图标', 'default' => ''],
['id' => 'color', 'type' => 'palette', 'label' => '颜色', 'default' => 'jb-blue', 'options' => CommonFields::palette()],
['id' => 'link', 'type' => 'link', 'label' => '链接', 'default' => []],
'c-red' => '红色', 'c-red-2' => '深红', 'c-yellow' => '黄色', 'c-yellow-2' => '深黄',
'c-cyan' => '青色', 'c-blue' => '蓝色', 'c-blue-2' => '深蓝', 'c-green' => '绿色',
'c-green-2' => '深绿', 'c-purple' => '紫色', 'c-purple-2' => '深紫',
'b-red' => '红色背景', 'b-yellow' => '黄色背景', 'b-cyan' => '青色背景', 'b-blue' => '蓝色背景',
'b-green' => '绿色背景', 'b-purple' => '紫色背景', 'b-black' => '黑色背景',
'jb-red' => '渐变红', 'jb-pink' => '渐变粉', 'jb-yellow' => '渐变黄', 'jb-cyan' => '渐变青',
'jb-blue' => '渐变蓝', 'jb-green' => '渐变绿', 'jb-purple' => '渐变紫', 'jb-vip1' => '会员金', 'jb-vip2' => '会员黑',
];
}
private static function notice_post_fields(): array {
return [
['id' => 'cat', 'type' => 'text', 'label' => '分类限制', 'default' => '', 'sanitize' => 'reference_ids'],
['id' => 'topics', 'type' => 'text', 'label' => '专题限制', 'default' => '', 'sanitize' => 'reference_ids'],
['id' => 'zibpay_type', 'type' => 'checkbox', 'label' => '商品类型筛选', 'default' => [], 'options' => ['1' => '付费阅读', '2' => '付费下载', '5' => '付费图片', '6' => '付费视频']],
['id' => 'orderby', 'type' => 'select', 'label' => '排序方式', 'default' => '', 'options' => self::posts_orderby()],
['id' => 'order', 'type' => 'radio', 'label' => '顺序', 'default' => 'desc', 'options' => ['desc' => '升序', 'asc' => '降序']],
];
}
private static function notice_forum_fields(): array {
return [
['id' => 'plate', 'type' => 'select', 'label' => '包含版块', 'default' => [], 'options' => 'post', 'query_args' => ['post_type' => 'plate'], 'ajax' => true, 'settings' => ['min_length' => 2], 'placeholder' => '输入关键词以搜索', 'chosen' => true, 'multiple' => true, 'sortable' => true],
['id' => 'plate_exclude', 'type' => 'select', 'label' => '排除版块', 'default' => [], 'options' => 'post', 'query_args' => ['post_type' => 'plate'], 'ajax' => true, 'settings' => ['min_length' => 2], 'placeholder' => '输入关键词以搜索版块分类', 'chosen' => true, 'multiple' => true, 'sortable' => true, 'dependency' => ['plate', '==', '', '', 'visible']],
['id' => 'topic', 'type' => 'select', 'label' => '包含话题', 'default' => [], 'options' => 'categories', 'query_args' => ['taxonomy' => 'forum_topic'], 'placeholder' => '输入关键词以搜索', 'chosen' => true, 'multiple' => true, 'sortable' => true, 'ajax' => true, 'settings' => ['min_length' => 2]],
['id' => 'tag', 'type' => 'select', 'label' => '包含标签', 'default' => [], 'options' => 'categories', 'query_args' => ['taxonomy' => 'forum_tag'], 'placeholder' => '输入关键词以搜索', 'chosen' => true, 'multiple' => true, 'sortable' => true, 'ajax' => true, 'settings' => ['min_length' => 2]],
['id' => 'bbs_type', 'type' => 'checkbox', 'label' => '类型筛选', 'default' => [], 'options' => ['' => '标准', 'question' => '提问']],
['id' => 'allow_view', 'type' => 'checkbox', 'label' => '阅读权限筛选', 'default' => [], 'options' => ['signin' => '登录后查看', 'comment' => '评论后查看', 'pay' => '付费查看', 'points' => '支付积分查看', 'roles' => '部分用户可查看']],
['id' => 'filter', 'type' => 'checkbox', 'label' => '其它筛选', 'default' => [], 'options' => ['topping' => '置顶帖子', 'vote' => '投票帖子', 'essence' => '精华帖子', 'question_status' => '提问已解决', 'is_hot' => '热门帖子']],
['id' => 'orderby', 'type' => 'select', 'label' => '排序方式', 'default' => 'date', 'options' => self::notice_forum_orderby()],
['id' => 'order', 'type' => 'radio', 'label' => '顺序', 'default' => 'desc', 'options' => ['desc' => '升序', 'asc' => '降序']],
];
}
private static function notice_forum_orderby(): array {
return [
'name' => '标题名称', 'date' => '最新发布', 'modified' => '最近更新', 'last_reply' => '最新回复',
'dynamic_score' => '推荐指数', 'views' => '最多查看', 'score' => '评分最高', 'comment_count' => '最多回复',
'favorite_count' => '最多收藏', 'zibpay_price' => '售价金额', 'zibpay_points_price' => '积分金额',
'sales_volume' => '销售数量', 'rand' => '随机',
];
}