banner-group.html 支持自定义图标

This commit is contained in:
liuzhihang 2022-11-19 19:35:43 +08:00
parent b15e845fca
commit f7ce8780bd
3 changed files with 83 additions and 47 deletions

View File

@ -9,7 +9,7 @@
---
预览:[程序员小航](https://liuzhihang.com)
预览:[程序员小航](http://hao.liuzhihang.com/)
文档:[语雀](https://www.yuque.com/liuzhihangs/halo-theme-hao)

View File

@ -36,15 +36,6 @@ spec:
- group: top
label: 顶部
formSchema:
- $formkit: radio
name: recentTop
label: 首页顶部
value: true
options:
- label: 显示
value: true
- label: 隐藏
value: false
- $formkit: radio
name: moment
label: 说说模块
@ -54,32 +45,98 @@ spec:
value: true
- label: 隐藏
value: false
- $formkit: radio
name: recentTop
id: recentTop
key: recentTop
label: 首页顶部
value: true
options:
- label: 显示
value: true
- label: 隐藏
value: false
- $formkit: text
if: "$get(recentTop).value"
name: bannersTitleBig
label: Banners 大标题
placeholder: 请输入大标题
help: 支持 HTML 语法
- $formkit: text
if: "$get(recentTop).value"
name: bannersTitleSmall
label: Banners 小标题
placeholder: 请输入小标题
help: 支持 HTML 语法
- $formkit: repeater
if: "$get(recentTop).value"
name: bannersIconPair
label: Banner 滚动图标
help: 为空时会使用系统内置图标
value:
- top:
bottom:
children:
- $formkit: group
name: top
label: 上图标
value:
url:
name:
background:
children:
- $formkit: url
name: url
label: 路径
placeholder: 请输入图标路径
validation: "url"
- $formkit: text
name: name
label: 名称
placeholder: 请输入名称
- $formkit: color
name: background
label: 背景色
- $formkit: group
name: bottom
label: 下图标
value:
url:
name:
background:
children:
- $formkit: url
name: url
label: 路径
placeholder: 请输入图标路径
validation: "url"
- $formkit: text
name: name
label: 名称
placeholder: 请输入名称
- $formkit: color
name: background
label: 背景色
- $formkit: url
if: "$get(recentTop).value"
name: bikan
label: 必看精选
placeholder: 请输入地址
validation: "url"
- $formkit: url
if: "$get(recentTop).value"
name: remen
label: 必看精选
placeholder: 请输入地址
validation: "url"
- $formkit: url
if: "$get(recentTop).value"
name: shiyong
label: 必看精选
placeholder: 请输入地址
validation: "url"
- $formkit: radio
if: "$get(recentTop).value"
name: todayRecommend
label: 今日推荐
value: false
@ -89,16 +146,19 @@ spec:
- label: 隐藏
value: false
- $formkit: url
if: "$get(recentTop).value"
name: todayRecommendUrl
label: 今日推荐跳转地址
placeholder: 请输入地址
validation: "url"
- $formkit: text
if: "$get(recentTop).value"
name: todayRecommendTitle
label: 今日推荐标题
placeholder: 请输入标题
value: "今日推荐"
- $formkit: url
if: "$get(recentTop).value"
name: todayRecommendCover
label: 今日推荐背景图
placeholder: 请输入地址
@ -155,42 +215,6 @@ spec:
label: "右侧"
- value: "left-aside"
label: "左侧"
# - $formkit: repeater
# name: widgets
# label: 小部件
# value:
# - value: profile
# - value: wechat
# - value: comments
# - value: recent-posts
# - value: comments
# - value: categories
# - value: tags
# - value: stat
# - value: tags-stat
# children:
# - $formkit: select
# name: value
# label: 部件
# options:
# - label: 站点资料
# value: profile
# - label: 微信
# value: wechat
# - label: 近期文章
# value: recent-posts
# - label: 最新评论
# value: comments
# - label: 文章分类
# value: categories
# - label: 文章标签
# value: tags
# - label: 统计
# value: stat
# - label: 标签&统计
# value: tags-stat
- $formkit: textarea
name: widgets
label: 小部件

View File

@ -15,7 +15,7 @@
<!-- 改成后台动态可配置-->
<div class="tags-group-all">
<div class="tags-group-wrapper">
<div class="tags-group-wrapper" th:if="${#lists.isEmpty(theme.config.top.bannersIconPair)}">
<div class="tags-group-icon-pair">
<div class="tags-group-icon" style="background:#989bf8">
<img th:src="@{/assets/images/icons/AfterEffect.png}" title="AfterEffect">
@ -129,6 +129,18 @@
</div>
</div>
</div>
<div class="tags-group-wrapper"
th:if="${not #lists.isEmpty(theme.config.top.bannersIconPair)}"
th:with="iconPairs = ${theme.config.top.bannersIconPair}" >
<div class="tags-group-icon-pair" th:each="iconPair : ${iconPairs}">
<div class="tags-group-icon" th:style="'background:' + ${iconPair.top.background}">
<img th:src="@{${iconPair.top.url}}" th:title="${iconPair.top.name}">
</div>
<div class="tags-group-icon" th:style="'background:' + ${iconPair.bottom.background}">
<img th:src="@{${iconPair.bottom.url}}" th:title="${iconPair.bottom.name}">
</div>
</div>
</div>
</div>
<!-- 随机前往一篇文章 -->
<a id="banner-hover" onclick="randomPost()">