-
Notifications
You must be signed in to change notification settings - Fork 37
/
article.html
221 lines (220 loc) · 8.13 KB
/
article.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#include("./_inc/_layout.html")
#@layout()
#define content()
<div class="layui-col-xs12 layui-col-sm7 layui-col-md8 perfree-content-left">
<link rel="stylesheet" href="static/plugin/vue-markdown/vue.css" media="all">
<link rel="stylesheet" href="static/css/article.css" media="all">
<script src="static/js/article.js"></script>
<!-- 文章start -->
<div class="layui-card">
<div class="layui-card-header article-title">
<h2>#(article.title ??)</h2>
<p>
<i class="fa fa-user-o"></i> #(article.user.nickname ??)
<i class="fa fa-eye"></i> #(article.view_count ??)浏览
<i class="fa fa-comment-o"></i> #(article.comment_count ??)评论
<i class="fa fa-clock-o"></i> #date(article.created, "yyyy-MM-dd")
</p>
</div>
<div class="layui-card-body article-body">
<span id="edit-model" style="display: none">#(article.edit_mode)</span>
<div class="perfree-article-content">
#(article.content ??)
</div>
<div class="article-content-bottom">
<span class="article-content-bottom-left"><i class="fa fa-clock-o"></i> 最后修改于 #date(article.created, "yyyy-MM-dd HH:mm:ss")</span>
</div>
#if(option('page_appreciate') == null || option('page_appreciate') == true)
<div class="appreciate-box">
<button class="layui-btn layui-btn-radius layui-btn-normal" onclick="appreciate();">
<i class="layui-icon"></i>赞赏
</button>
<span class="appreciate-tip">如果觉得我的文章对你有用,请随意赞赏</span>
</div>
<div id="appreciate-content">
<div class="appreciate-content-tip">扫一扫支付</div>
<img src="#option('perfree_alipay' ??)" id="appreciate-content-aLiImg">
<img src="#option('perfree_wechat' ??)" id="appreciate-content-wechatImg">
<div class="appreciate-content-btn-box">
<button class="layui-btn layui-btn-normal" onclick="changeImg(1);">支付宝支付</button>
<button class="layui-btn" onclick="changeImg(2);">微信支付</button>
</div>
</div>
#end
<div class="switch-article">
#previousArticle()
<a href="#(WEB_DOMAIN ??)#(previous.url)" title="#(previous.title)" class="pre-article pjax">
<i class="fa fa-angle-double-left" aria-hidden="true"></i> 上一篇
</a>
#end
#nextArticle()
<a href="#(WEB_DOMAIN ??)#(next.url)" title="#(next.title)" class="next-article pjax">
下一篇 <i class="fa fa-angle-double-right" aria-hidden="true"></i>
</a>
#end
</div>
</div>
</div>
<!-- 文章end -->
#relevantArticles(article)
<div class="layui-card">
<div class="layui-card-header" style="padding: 0 20px;">推荐文章</div>
<div class="layui-card-body relevant-body">
#for(article :relevantArticles)
<a href="#(WEB_DOMAIN ??)#(article.url)" title="#(article.title)" class="relevant-box">
#if(article.showImage == null)
<img src="static/img/#(for.count).jpg" class="relevant-img">
#else
<img src="#(article.showImage)" class="relevant-img">
#end
<div class="relevant-right">
<h2 class="relevant-title">#(article.title)</h2>
<span class="relevant-article-msg"><i class="fa fa-clock-o"></i> #date(article.created, "yyyy-MM-dd") <i class="fa fa-eye"></i> #(article.view_count ??)</span>
</div>
</a>
#end
</div>
</div>
#end
<div class="layui-card">
<div class="layui-card-header" style="padding: 0 20px;">发表评论</div>
<div class="layui-card-body revert-body">
<!-- 评论框start -->
<div class="revert-box">
<form class="layui-form" action="#(CPATH)/article/postComment" id="commentForm" method="post">
<input type="hidden" name="articleId" value="#(article.id)" id="articleId">
<input type="hidden" name="pid" id="pid">
<textarea id="revert" style="display: none;" name="content" lay-verify="content"></textarea>
#if(option('article_comment_vcode_enable'))
<img src="/commons/captcha" style="height: 25px" onclick="this.src='#(CPATH)/commons/captcha?d='+Math.random();" class="comment-verify">
<input placeholder="请输入验证码" autocomplete="off" required class="layui-input captcha" name="captcha" type="text" lay-verify="required">
#end
<button class="layui-btn layui-btn-normal revert-submit" lay-submit lay-filter="comment">发表评论</button>
</form>
</div>
<!-- 评论框end -->
<!-- 评论列表start -->
<div class="revert-list" id="allComment">
#commentPage(pageSize=5)
#for(comment : commentPage.list)
<div class="revert-content-box">
<div class="revert-user">
<img src="#(comment.user.avatar ?? 'static/img/avatar.png')" width="40px" height="40px"/>
<span class="revert-user-msg">
<span class="revert-user-name">#(comment.author ?? '匿名用户')</span>
<br>
<span class="revert-user-time">#date(comment.created, "yyyy-MM-dd HH:mm:ss")</span>
</span>
</div>
<div class="revert-content">
#(comment.text ??)
</div>
#if(comment.parent)
<div class="revert-comment-content-box">
<div class="revert-user">
<img src="#(comment.parent.user.avatar ?? 'static/img/avatar.png')" width="40px" height="40px"/>
<span class="revert-user-msg">
<span class="revert-user-name">#(comment.parent.author ?? '匿名用户')</span>
<br>
<span class="revert-user-time">#date(comment.parent.created, "yyyy-MM-dd HH:mm:ss")</span>
</span>
</div>
<div class="revert-content">
#(comment.parent.text ??)
</div>
</div>
#end
<a class="toReply" href="javascript:;" data-cid="#(comment.id)" data-author="#(comment.author ?? '匿名用户')">回复</a>
</div>
<hr class="layui-bg-gray">
#else
<div class="no-comment">
<i class="fa fa-volume-up" aria-hidden="true"></i> 还没有人评论哦~赶快抢占沙发吧~
</div>
#end
#commentPaginate(anchor="allComment")
<div class="layui-card">
<div class="layui-card-body">
<div class="perfree-page-box">
#for(page : pages)
<a class="page-item #(page.style)" href="#(WEB_DOMAIN ??)#(page.url ??)">#(page.text ??)</a>
#end
</div>
</div>
</div>
#end
#end
</div>
<!-- 评论列表end -->
</div>
</div>
<script>
layer.photos({
photos: '.perfree-article-content',
anim: 5
});
$(document).on("mousewheel DOMMouseScroll", ".layui-layer-phimg img", function(e) {
var delta = (e.originalEvent.wheelDelta && (e.originalEvent.wheelDelta > 0 ? 1 : -1)) || // chrome & ie
(e.originalEvent.detail && (e.originalEvent.detail > 0 ? -1 : 1)); // firefox
var imagep = $(".layui-layer-phimg").parent().parent();
var image = $(".layui-layer-phimg").parent();
var h = image.height();
var w = image.width();
if(delta > 0) {
if(h < (window.innerHeight)) {
h = h * 1.05;
w = w * 1.05;
}
} else if(delta < 0) {
if(h > 100) {
h = h * 0.95;
w = w * 0.95;
}
}
imagep.css("top", (window.innerHeight - h) / 2);
imagep.css("left", (window.innerWidth - w) / 2);
image.height(h);
image.width(w);
imagep.height(h);
imagep.width(w);
});
function appreciate() {
layer.open({
type: 1,
title:'赞赏作者',
shade: 0.6,
shadeClose:true,
content: $('#appreciate-content')
});
}
function changeImg(type) {
if(type == 1){
$(".layui-layer-wrap > #appreciate-content-wechatImg").hide();
$(".layui-layer-wrap > #appreciate-content-aLiImg").show();
}else{
$(".layui-layer-wrap > #appreciate-content-aLiImg").hide();
$(".layui-layer-wrap > #appreciate-content-wechatImg").show();
}
}
</script>
#if(option('page_code_line') == null || option('page_code_line') != '不开启')
<script>
$('pre code').each(function(){
var edit = $("#edit-model").text();
var lines = $(this).text().split('\n').length-1;
if(edit == 'html'){
lines = $(this).text().split('\n').length;
}
var $numbering = $('<ul/>').addClass('pre-numbering hljs');
$(this)
.addClass('has-numbering')
.parent()
.append($numbering);
for(i=1;i<=lines;i++){
$numbering.append($('<li/>').text(i+"."));
}
});
</script>
#end
</div>
#end