mirror of https://github.com/halo-dev/halo
🍎 评论框显示头像
parent
000f7ed465
commit
1220484f3b
24
pom.xml
24
pom.xml
|
@ -23,7 +23,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.0.1.RELEASE</version>
|
<version>2.0.2.RELEASE</version>
|
||||||
<relativePath/>
|
<relativePath/>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -149,7 +149,29 @@
|
||||||
<scope>true</scope>
|
<scope>true</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 又拍云 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.upyun</groupId>
|
||||||
|
<artifactId>java-sdk</artifactId>
|
||||||
|
<version>4.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>nexus-aliyun</id>
|
||||||
|
<name>Nexus aliyun</name>
|
||||||
|
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
<!-- 生产环境打包配置 -->
|
<!-- 生产环境打包配置 -->
|
||||||
<profile>
|
<profile>
|
||||||
|
|
|
@ -1,8 +1,53 @@
|
||||||
package cc.ryanc.halo.web.controller.api;
|
package cc.ryanc.halo.web.controller.api;
|
||||||
|
|
||||||
|
import cc.ryanc.halo.model.dto.Archive;
|
||||||
|
import cc.ryanc.halo.model.dto.JsonResult;
|
||||||
|
import cc.ryanc.halo.service.PostService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : RYAN0UP
|
* @author : RYAN0UP
|
||||||
* @date : 2018/6/6
|
* @date : 2018/6/6
|
||||||
*/
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(value = "/api/archives")
|
||||||
public class ApiArchivesController {
|
public class ApiArchivesController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PostService postService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据年份归档
|
||||||
|
*
|
||||||
|
* @return JsonResult
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/year")
|
||||||
|
public JsonResult archivesYear(){
|
||||||
|
List<Archive> archives = postService.findPostGroupByYear();
|
||||||
|
if(null!=archives || archives.size()>0){
|
||||||
|
return new JsonResult(200,"success",archives);
|
||||||
|
}else {
|
||||||
|
return new JsonResult(200,"empty");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据月份归档
|
||||||
|
*
|
||||||
|
* @return JsonResult
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/year/month")
|
||||||
|
public JsonResult archivesYearAndMonth(){
|
||||||
|
List<Archive> archives = postService.findPostGroupByYearAndMonth();
|
||||||
|
if(null!=archives || archives.size()>0){
|
||||||
|
return new JsonResult(200,"success",archives);
|
||||||
|
}else {
|
||||||
|
return new JsonResult(200,"empty");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<li>
|
<li>
|
||||||
<a href="/admin/comments?status=1">
|
<a href="/admin/comments?status=1">
|
||||||
<div class="pull-left">
|
<div class="pull-left">
|
||||||
<img src="http://www.gravatar.com/avatar/${comment.commentAuthorAvatarMd5?default("hash")}?s=256&d=${options.native_comment_avatar?default("mm")}" class="img-circle" alt="User Image">
|
<img src="//www.gravatar.com/avatar/${comment.commentAuthorAvatarMd5?default("hash")}?s=256&d=${options.native_comment_avatar?default("mm")}" class="img-circle" alt="User Image">
|
||||||
</div>
|
</div>
|
||||||
<h4>${comment.commentAuthor}
|
<h4>${comment.commentAuthor}
|
||||||
<small> ${comment.commentDate?string("yyyy/MM/dd HH:mm")}</small>
|
<small> ${comment.commentDate?string("yyyy/MM/dd HH:mm")}</small>
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
margin-left: 58px;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, textarea, button {
|
input, textarea, button {
|
||||||
|
@ -172,6 +173,22 @@
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #555;
|
color: #555;
|
||||||
}
|
}
|
||||||
|
.comment-avatar{
|
||||||
|
position: relative;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.comment-avatar img{
|
||||||
|
border-radius: 100%;
|
||||||
|
-webkit-transition: 0.4s;
|
||||||
|
-webkit-transition: -webkit-transform 0.4s ease-out;
|
||||||
|
transition: transform 0.4s ease-out;
|
||||||
|
-moz-transition: -moz-transform 0.4s ease-out;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-avatar img:hover{
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
|
||||||
.native-nav{
|
.native-nav{
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
|
@ -193,12 +210,15 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="native-comment">
|
<div class="native-comment">
|
||||||
|
<div class="comment-avatar">
|
||||||
|
<img src="//www.gravatar.com/avatar/none?s=256&d=${options.native_comment_avatar?default('mm')}" height="48" width="48" class="comment-author-avatar">
|
||||||
|
</div>
|
||||||
<div class="native-wrap">
|
<div class="native-wrap">
|
||||||
<div class="comment-header">
|
<div class="comment-header">
|
||||||
<input type="hidden" name="postId" value="${post.postId?c}">
|
<input type="hidden" name="postId" value="${post.postId?c}">
|
||||||
<input type="hidden" name="commentParent" id="commentParent" value="0">
|
<input type="hidden" name="commentParent" id="commentParent" value="0">
|
||||||
<input type="text" class="comment-input comment-input-who" name="commentAuthor" id="commentAuthor" placeholder="昵称(必填)">
|
<input type="text" class="comment-input comment-input-who" name="commentAuthor" id="commentAuthor" placeholder="昵称(必填)">
|
||||||
<input type="text" class="comment-input comment-input-email" name="commentAuthorEmail" id="commentAuthorEmail" placeholder="邮箱(选填)">
|
<input type="text" class="comment-input comment-input-email" name="commentAuthorEmail" id="commentAuthorEmail" onblur="loadAvatar()" placeholder="邮箱(选填)">
|
||||||
<input type="text" class="comment-input comment-input-website" name="commentAuthorUrl" id="commentAuthorUrl" placeholder="网址(选填)">
|
<input type="text" class="comment-input comment-input-website" name="commentAuthorUrl" id="commentAuthorUrl" placeholder="网址(选填)">
|
||||||
</div>
|
</div>
|
||||||
<div class="comment-content">
|
<div class="comment-content">
|
||||||
|
@ -258,6 +278,7 @@
|
||||||
$("#commentAuthor").val(localStorage.getItem("author"));
|
$("#commentAuthor").val(localStorage.getItem("author"));
|
||||||
$("#commentAuthorEmail").val(localStorage.getItem("email"));
|
$("#commentAuthorEmail").val(localStorage.getItem("email"));
|
||||||
$("#commentAuthorUrl").val(localStorage.getItem("url"));
|
$("#commentAuthorUrl").val(localStorage.getItem("url"));
|
||||||
|
loadAvatar();
|
||||||
});
|
});
|
||||||
$('#btn-push').click(function () {
|
$('#btn-push').click(function () {
|
||||||
var author = $("#commentAuthor");
|
var author = $("#commentAuthor");
|
||||||
|
@ -310,6 +331,12 @@
|
||||||
$('#commentContent').val("@"+commentParentAuthor+": ");
|
$('#commentContent').val("@"+commentParentAuthor+": ");
|
||||||
$('#commentContent').focus();
|
$('#commentContent').focus();
|
||||||
});
|
});
|
||||||
|
function loadAvatar() {
|
||||||
|
$(".comment-author-avatar").attr("src","//www.gravatar.com/avatar/"+md5(localStorage.getItem("email"))+"?s=256&d=${options.native_comment_avatar?default('mm')}");
|
||||||
|
if($('input[name=commentAuthorEmail]').val()!='' && $('input[name=commentAuthorEmail]').val()!=null){
|
||||||
|
$(".comment-author-avatar").attr("src","//www.gravatar.com/avatar/"+md5($('input[name=commentAuthorEmail]').val())+"?s=256&d=${options.native_comment_avatar?default('mm')}");
|
||||||
|
}
|
||||||
|
}
|
||||||
var parser = new UAParser();
|
var parser = new UAParser();
|
||||||
function show_ua(string){
|
function show_ua(string){
|
||||||
parser.setUA(string);
|
parser.setUA(string);
|
||||||
|
|
Loading…
Reference in New Issue