码农笔录博客源码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
3.7 KiB

{{template "header"}}
<title>博客 - 个人随笔</title>
<link type="text/css" rel="styleSheet" href="/static/css/blog.css"/>
</head>
<body>
<div class="root-container">
{{template "nav" .}}
<div class="blog-user">
<div style="height: 50px;line-height: 50px">
<a href=""><img src="/static/img/2.png" alt="头像" class="img-circle"></a>
<a href="" style="margin-left: 15px;font-size: 18px;text-decoration: none">{{.Blog.User.NickName}}</a>
</div>
<hr style="height:1px;border:none;border-top:1px solid #EEE;margin: 6px;"/>
<div style="display: flex;height: 30px;line-height: 30px;">
<div style="display: inline-block;width: 100px">
<span>文章: </span>
<span>{{.Blog.User.BlogCount}}</span>
</div>
<div style="display: inline-block;flex: 1">
<span>访问: </span>
<span>{{.Blog.User.BlogBrowes}}</span>
</div>
</div>
<div style="display: flex;height: 30px;line-height: 30px;">
<div style="display: inline-block;width: 100px">
<span>评论: </span>
<span>{{.Blog.User.BlogComment}}</span>
</div>
<div style="display: inline-block;flex: 1">
<span>喜欢: </span>
<span>{{.Blog.User.BlogLike}}</span>
</div>
</div>
<hr style="height:1px;border:none;border-top:1px solid #EEE;margin: 6px;"/>
6 years ago
{{range .Top}}
<div>
<a href=""><p style="max-width:245px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{.Title}}</p></a>
</div>
{{end}}
</div>
<div class="blog-root">
6 years ago
<h1 style="text-align: center">{{.Blog.Title}}</h1>
<div class="blog-info">
6 years ago
{{if .IsLike}}
<span><img src="/static/img/liked.png" alt="" onclick="unlike({{.Blog.Id}})"></span>
{{else}}
<span><img src="/static/img/like.png" alt="" onclick="like({{.Blog.Id}})"></span>
{{end}}
<span><a href="">{{.Blog.User.NickName}}</a></span>
6 years ago
<span><em>时间:</em>{{.Blog.Ctime.Format "2006-01-02"}}</span>
<span><em>阅读数:</em>{{.Blog.Browses}}</span>
<div class="tag-group" style="display: inline-block">
{{range .Blog.Lables}}
<label class='tag tag-info disabled'>{{.Title}}</label>
{{end}}
</div>
</div>
<div style="width: 100%">
{{str2html .Blog.BlogHtml}}
</div>
6 years ago
{{template "footer"}}
</div>
6 years ago
</div>
</div>
</body>
6 years ago
<script>
function like(id) {
$.get('/like/' + id,
function (data) {
if (data.Status == 0) {
window.location.href = window.location.href
} else if (data.Status == 401) {
window.location.href = "/login"
} else if (data.Status == 403) {
layer.msg("暂无权限", {icon: 5});
} else {
layer.msg("服务器异常", {icon: 5});
}
}, 'json')
}
function unlike(id) {
$.get('/unlike/' + id,
function (data) {
if (data.Status == 0) {
window.location.href = window.location.href
} else if (data.Status == 401) {
window.location.href = "/login"
} else if (data.Status == 403) {
layer.msg("暂无权限", {icon: 5});
} else {
layer.msg("服务器异常", {icon: 5});
}
}, 'json')
}
</script>
</html>