From 100ee436a93df69255a63fe74f4e45c92e053e53 Mon Sep 17 00:00:00 2001 From: shenyu <448766534@qq.com> Date: Thu, 5 Dec 2019 23:31:52 +0800 Subject: [PATCH] feat: award --- README.md | 10 ++++++ _config.yml | 10 ++++++ layout/_partial/article.ejs | 34 +++++++++++++++++++ source/css/_partial/reward.styl | 54 +++++++++++++++++++++++++++++++ source/css/_partial/tooltip.styl | 29 +++++++++++++++++ source/css/style.styl | 2 ++ source/images/alipay.jpg | Bin 0 -> 119556 bytes source/images/wechat.jpg | Bin 0 -> 73215 bytes source/js/ayer.js | 7 +++- 9 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 source/css/_partial/reward.styl create mode 100644 source/css/_partial/tooltip.styl create mode 100644 source/images/alipay.jpg create mode 100644 source/images/wechat.jpg diff --git a/README.md b/README.md index 338b833..b7106dd 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,16 @@ nav_text: # 文章页是否显示目录 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 diff --git a/_config.yml b/_config.yml index e5bf6e1..3def1e3 100644 --- a/_config.yml +++ b/_config.yml @@ -35,6 +35,16 @@ nav_text: # 文章页是否显示目录 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 diff --git a/layout/_partial/article.ejs b/layout/_partial/article.ejs index 98e223d..63787c9 100644 --- a/layout/_partial/article.ejs +++ b/layout/_partial/article.ejs @@ -30,6 +30,40 @@ <% } else { %> <%- post.content %> <% } %> + + <% if ((theme.reward_type === 2 || (theme.reward_type === 1 && post.reward)) && !index){ %> +
+ +
+ + 赏 + + + + +

<%= theme.reward_wording%>

+
+ <% if(theme.alipay) {%> +
+ + 支付宝 +
+ <% } %> + <% if(theme.weixin) {%> +
+ + 微信 +
+ <% } %> +
+
+
+
+
+
+
+ <% } %>