适配官方图库

This commit is contained in:
1152958806@qq.com 2023-08-03 17:08:16 +08:00
parent e033bb1380
commit 2c28ea2662
8 changed files with 139 additions and 45 deletions

View File

@ -58,3 +58,24 @@ spec:
name: "labelColor" name: "labelColor"
value: "#425AEF" value: "#425AEF"
label: "标签颜色" label: "标签颜色"
---
apiVersion: v1alpha1
kind: AnnotationSetting
metadata:
generateName: annotation-setting-
spec:
targetRef:
group: "core.halo.run"
kind: PhotoGroup
formSchema:
- $formkit: "attachment"
name: "cover"
label: "分组图片"
- $formkit: "attachment"
name: "background"
label: "分组顶部 banner 图片"
- $formkit: "textarea"
name: "description"
label: "分组描述"

View File

@ -1,6 +1,6 @@
{ {
"name": "halo-theme-hao", "name": "halo-theme-hao",
"version": "1.3.0", "version": "1.3.1",
"dependencies": { "dependencies": {
} }
} }

View File

@ -219,21 +219,64 @@ spec:
placeholder: 请输入小标题 placeholder: 请输入小标题
value: 更多信息请关注 GitHub value: 更多信息请关注 GitHub
help: 支持 HTML 语法 help: 支持 HTML 语法
- $formkit: repeater
name: categoryGroup
min: 3
max: 3
value:
- title: "必看精选"
icon: "iconfont icon-book"
url: "/"
colorOneLight: "#358bff"
colorTwoLight: "#15c6ff"
colorOneDark: "#0653b8"
colorTwoDark: "#2fcbff"
- title: "热门文章"
icon: "iconfont icon-burn"
url: "/"
colorOneLight: "#ff6655"
colorTwoLight: "#ffbf37"
colorOneDark: "#e22a16"
colorTwoDark: "#da980c"
- title: "实用教程"
icon: "iconfont icon-book"
url: "/"
colorOneLight: "#18e7ae"
colorTwoLight: "#1eebeb"
colorOneDark: "#099e74"
colorTwoDark: "#0ea4a4"
children:
- $formkit: text
name: title
label: 标题
placeholder: 请输入内容
validation: required
- $formkit: text
name: icon
label: 图标
placeholder: 请输入内容
validation: required
- $formkit: url - $formkit: url
name: bikan name: url
label: 必看精选 label: 跳转地址
placeholder: 请输入地址 placeholder: 请输入内容
value: / validation: required
- $formkit: url - $formkit: color
name: remen name: colorOneLight
label: 热门文章 label: 颜色1 (浅色)
placeholder: 请输入地址 validation: required
value: / - $formkit: color
- $formkit: url name: colorTwoLight
name: shiyong label: 颜色2 (浅色)
label: 实用教程 validation: required
placeholder: 请输入地址 - $formkit: color
value: / name: colorOneDark
label: 颜色1 (深色)
validation: required
- $formkit: color
name: colorTwoDark
label: 颜色2 (深色)
validation: required
- $formkit: group - $formkit: group
name: BannerRight name: BannerRight
label: Banner 右侧 label: Banner 右侧

View File

@ -24,10 +24,10 @@
<th:block th:each="group : ${photoFinder.groupBy()}"> <th:block th:each="group : ${photoFinder.groupBy()}">
<div class="card" th:onclick="go([[${group.metadata.name}]])"> <div class="card" th:onclick="go([[${group.metadata.name}]])">
<img class="card_cover entered loaded" <img class="card_cover entered loaded"
th:src="${group.spec.cover}"> th:src="${#annotations.get(group, 'cover')}">
<div class="card__content"> <div class="card__content">
<p class="card__category" th:text="${group.spec.displayName}"></p> <p class="card__category" th:text="${group.spec.displayName}"></p>
<h3 class="card__heading" th:text="${group.spec.description}"></h3> <h3 class="card__heading" th:text="${#annotations.get(group, 'description')}"></h3>
</div> </div>
</div> </div>
</th:block> </th:block>

View File

@ -172,9 +172,6 @@
color: #eee; color: #eee;
} }
.default-style a:hover {
text-decoration: underline;
}
:root { :root {
--hao-purple: #4976f5; --hao-purple: #4976f5;
} }

View File

@ -161,24 +161,54 @@
<!-- category --> <!-- category -->
<div class="categoryGroup"> <div class="categoryGroup">
<div class="categoryItem" style="box-shadow:var(--heo-shadow-blue)"> <th:block th:with="groups = ${theme.config.top.BannerLeft.categoryGroup}">
<a class="categoryButton CB1 bikan" <div class="categoryItem">
th:href="@{${theme.config.top.BannerLeft.bikan}}"> <a class="categoryButton CB1 bikan" th:href="@{${groups[0].url}}">
<span class="categoryButtonText">必看精选</span><i class="iconfont icon-book"></i> <span class="categoryButtonText">[[${groups[0].title}]]</span><i th:class="${groups[0].icon}"></i>
</a> </a>
</div> </div>
<div class="categoryItem" style="box-shadow:var(--heo-shadow-red)"> <div class="categoryItem">
<a class="categoryButton remen" <a class="categoryButton remen" th:href="@{${groups[1].url}}">
th:href="@{${theme.config.top.BannerLeft.remen}}"> <span class="categoryButtonText">[[${groups[1].title}]]</span><i th:class="${groups[1].icon}"></i>
<span class="categoryButtonText">热门文章</span><i class="iconfont icon-burn"></i>
</a> </a>
</div> </div>
<div class="categoryItem" style="box-shadow:var(--heo-shadow-green)"> <div class="categoryItem">
<a class="categoryButton shiyong" <a class="categoryButton shiyong" th:href="@{${groups[2].url}}">
th:href="@{${theme.config.top.BannerLeft.shiyong}}"> <span class="categoryButtonText">[[${groups[2].title}]]</span><i th:class="${groups[2].icon}"></i>
<span class="categoryButtonText">实用教程</span><i class="iconfont icon-book"></i>
</a> </a>
</div> </div>
<style>
a.categoryButton.bikan {
background: linear-gradient(to right, [[${groups[0].colorOneLight}]], [[${groups[0].colorTwoLight}]]);
background-size: 200%;
}
a.categoryButton.remen {
background: linear-gradient(to right, [[${groups[1].colorOneLight}]], [[${groups[1].colorTwoLight}]]);
background-size: 200%;
}
a.categoryButton.shiyong {
background: linear-gradient(to right, [[${groups[2].colorOneLight}]], [[${groups[2].colorTwoLight}]]);
background-size: 200%;
}
[data-theme=dark] a.categoryButton.bikan {
background: linear-gradient(to right, [[${groups[0].colorOneDark}]], [[${groups[0].colorTwoDark}]]);
background-size: 200%;
}
[data-theme=dark] a.categoryButton.remen {
background: linear-gradient(to right, [[${groups[1].colorOneDark}]], [[${groups[1].colorTwoDark}]]);
background-size: 200%;
}
[data-theme=dark] a.categoryButton.shiyong {
background: linear-gradient(to right, [[${groups[2].colorOneDark}]], [[${groups[2].colorTwoDark}]]);
background-size: 200%;
}
</style>
</th:block>
</div> </div>
<script th:inline="javascript"> <script th:inline="javascript">

View File

@ -13,11 +13,14 @@
<div id="page"> <div id="page">
<th:block th:each="group : ${photoFinder.groupBy()}"> <th:block th:each="group : ${photoFinder.groupBy()}">
<th:block th:if="${#strings.equals(group.metadata.name, param.photo_group_name)}">
<th:div th:replace="~{macro/author-content :: author-content(background = ${group.spec.background}, <th:block th:if="${#strings.equals(group.metadata.name, param.photo_group_name)}"
th:with="description = ${#annotations.get(group, 'description')},
background = ${#annotations.get(group, 'background')}">
<th:div th:replace="~{macro/author-content :: author-content(background = ${background},
smallTitle = '相册集', smallTitle = '相册集',
bigTitle = ${group.spec.displayName}, bigTitle = ${group.spec.displayName},
detail = ${group.spec.description}, detail = ${description},
buttonUrl = '', buttonUrl = '',
buttonTitle = '')}" /> buttonTitle = '')}" />
</th:block> </th:block>

View File

@ -47,5 +47,5 @@ spec:
repo: https://github.com/liuzhihang/halo-theme-hao repo: https://github.com/liuzhihang/halo-theme-hao
settingName: "theme-hao-setting" settingName: "theme-hao-setting"
configMapName: "theme-hao-configMap" configMapName: "theme-hao-configMap"
version: "1.3.0" version: "1.3.1"
require: ">=2.6.0" require: ">=2.8.0"