添加二次点击取消置顶功能 + 更新配套教程
This commit is contained in:
parent
de5bd1adcb
commit
98c604ed53
17
README.md
17
README.md
@ -15,7 +15,7 @@
|
|||||||
[![fork](https://gitee.com/veal98/Echo/badge/fork.svg?theme=dark)](https://gitee.com/veal98/Echo/members)
|
[![fork](https://gitee.com/veal98/Echo/badge/fork.svg?theme=dark)](https://gitee.com/veal98/Echo/members)
|
||||||
[![GitHub stars](https://img.shields.io/github/stars/Veal98/Echo?logo=github)](https://github.com/Veal98/Echo/stargazers)
|
[![GitHub stars](https://img.shields.io/github/stars/Veal98/Echo?logo=github)](https://github.com/Veal98/Echo/stargazers)
|
||||||
[![GitHub forks](https://img.shields.io/github/forks/Veal98/Echo?logo=github)](https://github.com/Veal98/Echo/network)
|
[![GitHub forks](https://img.shields.io/github/forks/Veal98/Echo?logo=github)](https://github.com/Veal98/Echo/network)
|
||||||
[![version](https://img.shields.io/badge/version-2.0-brightgreen)]()
|
[![version](https://img.shields.io/badge/version-2.1-brightgreen)]()
|
||||||
|
|
||||||
<a href="#-微信交流群"><img src="https://img.shields.io/badge/交流-微信群-orange" alt="交流群"></a>
|
<a href="#-微信交流群"><img src="https://img.shields.io/badge/交流-微信群-orange" alt="交流群"></a>
|
||||||
<a href="#-配套教程"><img src="https://img.shields.io/badge/配套教程-公众号飞天小牛肉-blueviolet" alt="配套教程"></a>
|
<a href="#-配套教程"><img src="https://img.shields.io/badge/配套教程-公众号飞天小牛肉-blueviolet" alt="配套教程"></a>
|
||||||
@ -67,7 +67,7 @@ Echo 是一套前后端不分离的开源社区系统,基于目前主流 Java
|
|||||||
- [Echo 的帖子列表与分页是怎么做的](https://mp.weixin.qq.com/s/R5CtsXaS9hIOOePxQZcZhg)
|
- [Echo 的帖子列表与分页是怎么做的](https://mp.weixin.qq.com/s/R5CtsXaS9hIOOePxQZcZhg)
|
||||||
- [Echo 的评论是如何显示的](https://mp.weixin.qq.com/s/0avudnypPu3EewzoU3sEwA)
|
- [Echo 的评论是如何显示的](https://mp.weixin.qq.com/s/0avudnypPu3EewzoU3sEwA)
|
||||||
- [Echo 的发布评论是怎么做的](https://mp.weixin.qq.com/s/S5bNpzuZFga2u15ik2t2iQ)
|
- [Echo 的发布评论是怎么做的](https://mp.weixin.qq.com/s/S5bNpzuZFga2u15ik2t2iQ)
|
||||||
- Echo 的私信列表与详情页是怎么做的
|
- [Echo 的私信列表与详情页是怎么做的](https://mp.weixin.qq.com/s/ymYrAsJoilO531lilwdmfg)
|
||||||
- Echo 的发送私信是怎么做的
|
- Echo 的发送私信是怎么做的
|
||||||
- Echo 的点赞模块是怎么做的
|
- Echo 的点赞模块是怎么做的
|
||||||
- Echo 的关注模块是怎么做的
|
- Echo 的关注模块是怎么做的
|
||||||
@ -135,10 +135,20 @@ Echo 是一套前后端不分离的开源社区系统,基于目前主流 Java
|
|||||||
|
|
||||||
![](https://gitee.com/veal98/images/raw/master/img/20210211205558.png)
|
![](https://gitee.com/veal98/images/raw/master/img/20210211205558.png)
|
||||||
|
|
||||||
|
帖子发布页(支持 MarkDown):
|
||||||
|
|
||||||
|
![](https://gitee.com/veal98/images/raw/master/img/20210512101041.png)
|
||||||
|
|
||||||
|
帖子详情页(MarkDown 渲染):
|
||||||
|
|
||||||
|
![](https://gitee.com/veal98/images/raw/master/img/20210512101202.png)
|
||||||
|
|
||||||
帖子详情页:
|
帖子详情页:
|
||||||
|
|
||||||
![](https://gitee.com/veal98/images/raw/master/img/20210211205741.png)
|
![](https://gitee.com/veal98/images/raw/master/img/20210211205741.png)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
个人主页:
|
个人主页:
|
||||||
|
|
||||||
![](https://gitee.com/veal98/images/raw/master/img/20210211205820.png)
|
![](https://gitee.com/veal98/images/raw/master/img/20210211205820.png)
|
||||||
@ -262,7 +272,7 @@ Echo 是一套前后端不分离的开源社区系统,基于目前主流 Java
|
|||||||
|
|
||||||
以下是我觉得本项目还可以添加的功能,同样欢迎各位小伙伴提 issue 指出还可以增加哪些功能,或者直接提 PR 实现该功能:
|
以下是我觉得本项目还可以添加的功能,同样欢迎各位小伙伴提 issue 指出还可以增加哪些功能,或者直接提 PR 实现该功能:
|
||||||
|
|
||||||
- [ ] 发帖支持 Markdown 格式
|
- [x] 发帖支持 Markdown 格式
|
||||||
- [ ] 忘记密码(发送邮件找回密码)
|
- [ ] 忘记密码(发送邮件找回密码)
|
||||||
- [ ] 查询我的点赞
|
- [ ] 查询我的点赞
|
||||||
- [ ] 管理员对帖子的二次点击取消置顶功能
|
- [ ] 管理员对帖子的二次点击取消置顶功能
|
||||||
@ -504,6 +514,7 @@ double score = Math.log10(Math.max(w, 1))
|
|||||||
|
|
||||||
- [freedom_dh](https://gitee.com/dh_free)
|
- [freedom_dh](https://gitee.com/dh_free)
|
||||||
- [paulisusu](https://gitee.com/paulisusu)
|
- [paulisusu](https://gitee.com/paulisusu)
|
||||||
|
- [Max (Lyingfromyou)](https://gitee.com/Lyingfromyou)
|
||||||
|
|
||||||
> 🔗 友情链接(若您想要出现在这里,可以上方扫描微信二维码联系我):
|
> 🔗 友情链接(若您想要出现在这里,可以上方扫描微信二维码联系我):
|
||||||
>
|
>
|
||||||
|
@ -40,7 +40,7 @@ Echo 是一套前后端不分离的开源社区系统,基于目前主流 Java
|
|||||||
- [Echo 的帖子列表与分页是怎么做的](https://mp.weixin.qq.com/s/R5CtsXaS9hIOOePxQZcZhg)
|
- [Echo 的帖子列表与分页是怎么做的](https://mp.weixin.qq.com/s/R5CtsXaS9hIOOePxQZcZhg)
|
||||||
- [Echo 的评论是如何显示的](https://mp.weixin.qq.com/s/0avudnypPu3EewzoU3sEwA)
|
- [Echo 的评论是如何显示的](https://mp.weixin.qq.com/s/0avudnypPu3EewzoU3sEwA)
|
||||||
- [Echo 的发布评论是怎么做的](https://mp.weixin.qq.com/s/S5bNpzuZFga2u15ik2t2iQ)
|
- [Echo 的发布评论是怎么做的](https://mp.weixin.qq.com/s/S5bNpzuZFga2u15ik2t2iQ)
|
||||||
- Echo 的私信列表与详情页是怎么做的
|
- [Echo 的私信列表与详情页是怎么做的](https://mp.weixin.qq.com/s/ymYrAsJoilO531lilwdmfg)
|
||||||
- Echo 的发送私信是怎么做的
|
- Echo 的发送私信是怎么做的
|
||||||
- Echo 的点赞模块是怎么做的
|
- Echo 的点赞模块是怎么做的
|
||||||
- Echo 的关注模块是怎么做的
|
- Echo 的关注模块是怎么做的
|
||||||
@ -108,6 +108,14 @@ Echo 是一套前后端不分离的开源社区系统,基于目前主流 Java
|
|||||||
|
|
||||||
![](https://gitee.com/veal98/images/raw/master/img/20210211205558.png)
|
![](https://gitee.com/veal98/images/raw/master/img/20210211205558.png)
|
||||||
|
|
||||||
|
帖子发布页(支持 MarkDown):
|
||||||
|
|
||||||
|
![](https://gitee.com/veal98/images/raw/master/img/20210512101041.png)
|
||||||
|
|
||||||
|
帖子详情页(MarkDown 渲染):
|
||||||
|
|
||||||
|
![](https://gitee.com/veal98/images/raw/master/img/20210512101202.png)
|
||||||
|
|
||||||
帖子详情页:
|
帖子详情页:
|
||||||
|
|
||||||
![](https://gitee.com/veal98/images/raw/master/img/20210211205741.png)
|
![](https://gitee.com/veal98/images/raw/master/img/20210211205741.png)
|
||||||
@ -477,6 +485,7 @@ double score = Math.log10(Math.max(w, 1))
|
|||||||
|
|
||||||
- [freedom_dh](https://gitee.com/dh_free)
|
- [freedom_dh](https://gitee.com/dh_free)
|
||||||
- [paulisusu](https://gitee.com/paulisusu)
|
- [paulisusu](https://gitee.com/paulisusu)
|
||||||
|
- [Max (Lyingfromyou)](https://gitee.com/Lyingfromyou)
|
||||||
|
|
||||||
> 🔗 友情链接(若您想要出现在这里,可以上方扫描微信二维码联系我):
|
> 🔗 友情链接(若您想要出现在这里,可以上方扫描微信二维码联系我):
|
||||||
>
|
>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
![Logo](https://gitee.com/veal98/images/raw/master/img/20210211175136.png)
|
![Logo](https://gitee.com/veal98/images/raw/master/img/20210211175136.png)
|
||||||
|
|
||||||
# Echo <small>2.0</small>
|
# Echo <small>2.1</small>
|
||||||
|
|
||||||
> 🦄 开源社区系统
|
> 🦄 开源社区系统
|
||||||
|
|
||||||
|
@ -10,9 +10,6 @@ import com.greate.community.util.CommunityConstant;
|
|||||||
import com.greate.community.util.CommunityUtil;
|
import com.greate.community.util.CommunityUtil;
|
||||||
import com.greate.community.util.HostHolder;
|
import com.greate.community.util.HostHolder;
|
||||||
import com.greate.community.util.RedisKeyUtil;
|
import com.greate.community.util.RedisKeyUtil;
|
||||||
import com.qiniu.util.Auth;
|
|
||||||
import com.qiniu.util.StringMap;
|
|
||||||
import org.checkerframework.checker.units.qual.A;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
@ -22,8 +19,6 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.util.HtmlUtils;
|
import org.springframework.web.util.HtmlUtils;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@ -63,18 +58,6 @@ public class DiscussPostController implements CommunityConstant {
|
|||||||
@Value("${server.servlet.context-path}")
|
@Value("${server.servlet.context-path}")
|
||||||
private String contextPath;
|
private String contextPath;
|
||||||
|
|
||||||
@Value("${qiniu.key.access}")
|
|
||||||
private String accessKey;
|
|
||||||
|
|
||||||
@Value("${qiniu.key.secret}")
|
|
||||||
private String secretKey;
|
|
||||||
|
|
||||||
@Value("${qiniu.bucket.header.name}")
|
|
||||||
private String headerBucketName;
|
|
||||||
|
|
||||||
@Value("${qiniu.bucket.header.url}")
|
|
||||||
private String headerBucketUrl;
|
|
||||||
|
|
||||||
// editorMd 图片上传地址
|
// editorMd 图片上传地址
|
||||||
@Value("${community.path.editormdUploadPath}")
|
@Value("${community.path.editormdUploadPath}")
|
||||||
private String editormdUploadPath;
|
private String editormdUploadPath;
|
||||||
@ -251,8 +234,8 @@ public class DiscussPostController implements CommunityConstant {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/top")
|
@PostMapping("/top")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String setTop(int id) {
|
public String updateTop(int id, int type) {
|
||||||
discussPostService.updateType(id, 1);
|
discussPostService.updateType(id, type);
|
||||||
|
|
||||||
// 触发发帖事件,通过消息队列将其存入 Elasticsearch 服务器
|
// 触发发帖事件,通过消息队列将其存入 Elasticsearch 服务器
|
||||||
Event event = new Event()
|
Event event = new Event()
|
||||||
|
@ -40,6 +40,8 @@ public class MessageController implements CommunityConstant {
|
|||||||
@GetMapping("/letter/list")
|
@GetMapping("/letter/list")
|
||||||
public String getLetterList(Model model, Page page) {
|
public String getLetterList(Model model, Page page) {
|
||||||
// Integer.valueOf("abc"); // 测试统一异常处理(普通请求)
|
// Integer.valueOf("abc"); // 测试统一异常处理(普通请求)
|
||||||
|
|
||||||
|
// 获取当前登录用户信息
|
||||||
User user = hostHolder.getUser();
|
User user = hostHolder.getUser();
|
||||||
// 分页信息
|
// 分页信息
|
||||||
page.setLimit(5);
|
page.setLimit(5);
|
||||||
@ -114,7 +116,6 @@ public class MessageController implements CommunityConstant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return "/site/letter-detail";
|
return "/site/letter-detail";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -1,5 +1,5 @@
|
|||||||
$(function(){
|
$(function(){
|
||||||
$("#topBtn").click(setTop);
|
$("#topBtn").click(updateTop);
|
||||||
$("#wonderfulBtn").click(setWonderful);
|
$("#wonderfulBtn").click(setWonderful);
|
||||||
$("#deleteBtn").click(setDelete);
|
$("#deleteBtn").click(setDelete);
|
||||||
});
|
});
|
||||||
@ -23,16 +23,20 @@ function like(btn, entityType, entityId, entityUserId, postId) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 置顶
|
// 置顶 or 取消置顶
|
||||||
function setTop() {
|
function updateTop() {
|
||||||
$.post(
|
$.post(
|
||||||
CONTEXT_PATH + "/discuss/top",
|
CONTEXT_PATH + "/discuss/top",
|
||||||
{"id":$("#postId").val()},
|
{
|
||||||
|
"id": $("#postId").val(),
|
||||||
|
// $("#postType").val() 帖子当前的 type
|
||||||
|
"type": ($("#postType").val() == 1) ? 0 : 1
|
||||||
|
},
|
||||||
function (data) {
|
function (data) {
|
||||||
data = $.parseJSON(data);
|
data = $.parseJSON(data);
|
||||||
if (data.code == 0) {
|
if (data.code == 0) {
|
||||||
// 置顶成功后,将置顶按钮设置为不可用
|
// 偷个懒,直接刷新界面
|
||||||
$("#topBtn").attr("disabled", "disable")
|
window.location.reload();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert(data.msg);
|
alert(data.msg);
|
||||||
|
@ -28,8 +28,11 @@
|
|||||||
<span th:utext="${post.title}"></span>
|
<span th:utext="${post.title}"></span>
|
||||||
<div class="float-right">
|
<div class="float-right">
|
||||||
<input type="hidden" id="postId" th:value="${post.id}">
|
<input type="hidden" id="postId" th:value="${post.id}">
|
||||||
<button type="button" class="btn btn-danger btn-sm" id="topBtn"
|
<input type="hidden" id="postType" th:value="${post.type}">
|
||||||
th:disabled="${post.type == 1}" sec:authorize="hasAnyAuthority('moderator')">置顶</button>
|
<button type="button" th:class="|btn ${post.type == 0 ? 'btn-danger' : 'btn-info'} btn-sm|" id="topBtn"
|
||||||
|
th:text="${post.type == 0 ? '置顶' : '取消置顶'}"
|
||||||
|
sec:authorize="hasAnyAuthority('moderator')">
|
||||||
|
</button>
|
||||||
<button type="button" class="btn btn-danger btn-sm" id="wonderfulBtn"
|
<button type="button" class="btn btn-danger btn-sm" id="wonderfulBtn"
|
||||||
th:disabled="${post.status == 1}" sec:authorize="hasAnyAuthority('moderator')">加精</button>
|
th:disabled="${post.status == 1}" sec:authorize="hasAnyAuthority('moderator')">加精</button>
|
||||||
<button type="button" class="btn btn-danger btn-sm" id="deleteBtn"
|
<button type="button" class="btn btn-danger btn-sm" id="deleteBtn"
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
<span>注册于 <i class="text-muted" th:text="${#dates.format(user.createTime, 'yyyy-MM-dd HH:mm:ss')}"></i></span>
|
<span>注册于 <i class="text-muted" th:text="${#dates.format(user.createTime, 'yyyy-MM-dd HH:mm:ss')}"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-muted mt-3 mb-5">
|
<div class="text-muted mt-3 mb-5">
|
||||||
<a class="text-primary" th:href="@{|/followees/${user.id}|}" style="margin-right: 6px">
|
<a class="text-primary" th:href="@{|/fo 11llowees/${user.id}|}" style="margin-right: 6px">
|
||||||
<button type="button" class="btn btn-secondary">
|
<button type="button" class="btn btn-secondary">
|
||||||
关注了 <span class="badge badge-info" th:text="${followeeCount}"></span> 人
|
关注了 <span class="badge badge-info" th:text="${followeeCount}"></span> 人
|
||||||
</button>
|
</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user