feat: award

This commit is contained in:
shenyu 2019-12-05 23:31:52 +08:00
parent b7dd081c74
commit 100ee436a9
9 changed files with 145 additions and 1 deletions

View File

@ -74,6 +74,16 @@ nav_text:
# 文章页是否显示目录 # 文章页是否显示目录
toc: true toc: true
# 打赏
# 打赏type设定0-关闭打赏; 1-文章对应的md文件里有reward:true属性才有打赏 2-所有文章均有打赏
reward_type: 2
# 打赏wording
reward_wording: '请我喝杯咖啡吧~'
# 支付宝二维码图片地址跟你设置logo的方式一样。比如/images/alipay.jpg
alipay: /images/alipay.jpg
# 微信二维码图片地址
weixin: /images/wechat.jpg
# 是否启用搜索 # 是否启用搜索
search: true search: true

View File

@ -35,6 +35,16 @@ nav_text:
# 文章页是否显示目录 # 文章页是否显示目录
toc: true toc: true
# 打赏
# 打赏type设定0-关闭打赏; 1-文章对应的md文件里有reward:true属性才有打赏 2-所有文章均有打赏
reward_type: 2
# 打赏wording
reward_wording: '请我喝杯咖啡吧~'
# 支付宝二维码图片地址跟你设置logo的方式一样。比如/images/alipay.jpg
alipay: /images/alipay.jpg
# 微信二维码图片地址
weixin: /images/wechat.jpg
# 是否启用搜索 # 是否启用搜索
search: true search: true

View File

@ -30,6 +30,40 @@
<% } else { %> <% } else { %>
<%- post.content %> <%- post.content %>
<% } %> <% } %>
<!-- 打赏 -->
<% if ((theme.reward_type === 2 || (theme.reward_type === 1 && post.reward)) && !index){ %>
<div class="page-reward">
<a href="javascript:void(0);" class="page-reward-btn tooltip-top" target="_self">
<div class="tooltip tooltip-east">
<span class="tooltip-item">
</span>
<span class="tooltip-content">
<span class="tooltip-text">
<span class="tooltip-inner">
<p class="reward-p"><i class="icon icon-quo-left"></i><%= theme.reward_wording%><i
class="icon icon-quo-right"></i></p>
<div class="reward-box">
<% if(theme.alipay) {%>
<div class="reward-box-item">
<img class="reward-img" src="<%- url_for(theme.alipay) %>">
<span class="reward-type">支付宝</span>
</div>
<% } %>
<% if(theme.weixin) {%>
<div class="reward-box-item">
<img class="reward-img" src="<%- url_for(theme.weixin) %>">
<span class="reward-type">微信</span>
</div>
<% } %>
</div>
</span>
</span>
</span>
</div>
</a>
</div>
<% } %>
</div> </div>
<footer class="article-footer"> <footer class="article-footer">
<a data-url="<%- post.permalink %>" data-id="<%= post._id %>" <a data-url="<%- post.permalink %>" data-id="<%= post._id %>"

View File

@ -0,0 +1,54 @@
.page-reward
margin: 60px 0;
text-align: center;
.page-reward-btn
position: relative;
display: inline-block;
width: 56px;
height: 56px;
line-height: 56px;
font-size: 20px;
color: #fff;
background: body-color;
border-radius: 50%;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
-webkit-transition: .4s ease-in-out;
transition: .4s ease-in-out;
&:hover,
&:active
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2), 0 4px 15px rgba(0, 0, 0, 0.2);
.tooltip-item
display: block;
width: 56px;
height: 56px;
.reward-box
display: flex;
justify-content: space-around;
.reward-p
color: body-color;
font-weight: bold;
text-shadow: 1px 1px 1px main-color;
.icon
margin: 0 10px;
color: #ddd;
.reward-type
font-size: 16px;
display: block;
color: #4d4d4d;
margin: 20px 0 0 0;
.reward-img
width: 130px;
height: 130px;
border: 6px solid #fff;
border-radius: 3px;

View File

@ -0,0 +1,29 @@
.tooltip-top
.tooltip
display: inline;
position: relative;
z-index: 999;
/* Tooltip */
.tooltip-content
position: absolute;
z-index: 9999;
width: 370px;
left: 50%;
bottom: 70px;
font-size: 20px;
line-height: 1.4;
text-align: center;
font-weight: 400;
color: #4d4d4d;
background: water;
margin: 0 0 -10px -185px;
cursor: default;
display: none;
padding-bottom: 20px;

View File

@ -67,6 +67,8 @@ button
@import "_partial/pace" @import "_partial/pace"
@import "_partial/gitalk" @import "_partial/gitalk"
@import "_partial/apple" @import "_partial/apple"
@import "_partial/reward"
@import "_partial/tooltip"
if sidebar if sidebar
@import "_partial/sidebar" @import "_partial/sidebar"

BIN
source/images/alipay.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

BIN
source/images/wechat.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -208,7 +208,12 @@
$content.addClass('on'); $content.addClass('on');
$sidebar.addClass('on'); $sidebar.addClass('on');
} }
// 赞赏
$('.tooltip-item').hover(function () {
$('.tooltip-content').slideDown(150)
}, function () {
$('.tooltip-content').slideUp(150)
})
})(jQuery); })(jQuery);