diff --git a/README.md b/README.md index 88866230..e8fb05e9 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ [![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 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)]() 交流群 配套教程 @@ -67,7 +67,7 @@ Echo 是一套前后端不分离的开源社区系统,基于目前主流 Java - [Echo 的帖子列表与分页是怎么做的](https://mp.weixin.qq.com/s/R5CtsXaS9hIOOePxQZcZhg) - [Echo 的评论是如何显示的](https://mp.weixin.qq.com/s/0avudnypPu3EewzoU3sEwA) - [Echo 的发布评论是怎么做的](https://mp.weixin.qq.com/s/S5bNpzuZFga2u15ik2t2iQ) -- Echo 的私信列表与详情页是怎么做的 +- [Echo 的私信列表与详情页是怎么做的](https://mp.weixin.qq.com/s/ymYrAsJoilO531lilwdmfg) - Echo 的发送私信是怎么做的 - Echo 的点赞模块是怎么做的 - Echo 的关注模块是怎么做的 @@ -135,10 +135,20 @@ Echo 是一套前后端不分离的开源社区系统,基于目前主流 Java ![](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/20210211205820.png) @@ -262,7 +272,7 @@ Echo 是一套前后端不分离的开源社区系统,基于目前主流 Java 以下是我觉得本项目还可以添加的功能,同样欢迎各位小伙伴提 issue 指出还可以增加哪些功能,或者直接提 PR 实现该功能: -- [ ] 发帖支持 Markdown 格式 +- [x] 发帖支持 Markdown 格式 - [ ] 忘记密码(发送邮件找回密码) - [ ] 查询我的点赞 - [ ] 管理员对帖子的二次点击取消置顶功能 @@ -504,6 +514,7 @@ double score = Math.log10(Math.max(w, 1)) - [freedom_dh](https://gitee.com/dh_free) - [paulisusu](https://gitee.com/paulisusu) +- [Max (Lyingfromyou)](https://gitee.com/Lyingfromyou) > 🔗 友情链接(若您想要出现在这里,可以上方扫描微信二维码联系我): > diff --git a/docs/README.md b/docs/README.md index dccacbf0..db5c15e7 100644 --- a/docs/README.md +++ b/docs/README.md @@ -40,7 +40,7 @@ Echo 是一套前后端不分离的开源社区系统,基于目前主流 Java - [Echo 的帖子列表与分页是怎么做的](https://mp.weixin.qq.com/s/R5CtsXaS9hIOOePxQZcZhg) - [Echo 的评论是如何显示的](https://mp.weixin.qq.com/s/0avudnypPu3EewzoU3sEwA) - [Echo 的发布评论是怎么做的](https://mp.weixin.qq.com/s/S5bNpzuZFga2u15ik2t2iQ) -- Echo 的私信列表与详情页是怎么做的 +- [Echo 的私信列表与详情页是怎么做的](https://mp.weixin.qq.com/s/ymYrAsJoilO531lilwdmfg) - Echo 的发送私信是怎么做的 - Echo 的点赞模块是怎么做的 - Echo 的关注模块是怎么做的 @@ -108,6 +108,14 @@ Echo 是一套前后端不分离的开源社区系统,基于目前主流 Java ![](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) @@ -477,6 +485,7 @@ double score = Math.log10(Math.max(w, 1)) - [freedom_dh](https://gitee.com/dh_free) - [paulisusu](https://gitee.com/paulisusu) +- [Max (Lyingfromyou)](https://gitee.com/Lyingfromyou) > 🔗 友情链接(若您想要出现在这里,可以上方扫描微信二维码联系我): > diff --git a/docs/_coverpage.md b/docs/_coverpage.md index 571bc6d9..9091f289 100644 --- a/docs/_coverpage.md +++ b/docs/_coverpage.md @@ -1,6 +1,6 @@ ![Logo](https://gitee.com/veal98/images/raw/master/img/20210211175136.png) -# Echo 2.0 +# Echo 2.1 > 🦄 开源社区系统 diff --git a/src/main/java/com/greate/community/controller/DiscussPostController.java b/src/main/java/com/greate/community/controller/DiscussPostController.java index 7dee75a8..4dda60ca 100644 --- a/src/main/java/com/greate/community/controller/DiscussPostController.java +++ b/src/main/java/com/greate/community/controller/DiscussPostController.java @@ -10,9 +10,6 @@ import com.greate.community.util.CommunityConstant; import com.greate.community.util.CommunityUtil; import com.greate.community.util.HostHolder; 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.Value; 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.util.HtmlUtils; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.File; import java.util.*; @@ -63,18 +58,6 @@ public class DiscussPostController implements CommunityConstant { @Value("${server.servlet.context-path}") 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 图片上传地址 @Value("${community.path.editormdUploadPath}") private String editormdUploadPath; @@ -251,8 +234,8 @@ public class DiscussPostController implements CommunityConstant { */ @PostMapping("/top") @ResponseBody - public String setTop(int id) { - discussPostService.updateType(id, 1); + public String updateTop(int id, int type) { + discussPostService.updateType(id, type); // 触发发帖事件,通过消息队列将其存入 Elasticsearch 服务器 Event event = new Event() diff --git a/src/main/java/com/greate/community/controller/MessageController.java b/src/main/java/com/greate/community/controller/MessageController.java index 4028c9b8..7065e4bb 100644 --- a/src/main/java/com/greate/community/controller/MessageController.java +++ b/src/main/java/com/greate/community/controller/MessageController.java @@ -40,6 +40,8 @@ public class MessageController implements CommunityConstant { @GetMapping("/letter/list") public String getLetterList(Model model, Page page) { // Integer.valueOf("abc"); // 测试统一异常处理(普通请求) + + // 获取当前登录用户信息 User user = hostHolder.getUser(); // 分页信息 page.setLimit(5); @@ -114,7 +116,6 @@ public class MessageController implements CommunityConstant { } return "/site/letter-detail"; - } /** diff --git a/src/main/resources/static/editor-md-upload/323b95b3bc6e43f7a8824b43b1e8100c.jpg b/src/main/resources/static/editor-md-upload/323b95b3bc6e43f7a8824b43b1e8100c.jpg new file mode 100644 index 00000000..85e9127c Binary files /dev/null and b/src/main/resources/static/editor-md-upload/323b95b3bc6e43f7a8824b43b1e8100c.jpg differ diff --git a/src/main/resources/static/js/discuss.js b/src/main/resources/static/js/discuss.js index 8cc4c54f..547c490e 100644 --- a/src/main/resources/static/js/discuss.js +++ b/src/main/resources/static/js/discuss.js @@ -1,5 +1,5 @@ $(function(){ - $("#topBtn").click(setTop); + $("#topBtn").click(updateTop); $("#wonderfulBtn").click(setWonderful); $("#deleteBtn").click(setDelete); }); @@ -23,16 +23,20 @@ function like(btn, entityType, entityId, entityUserId, postId) { ) } -// 置顶 -function setTop() { +// 置顶 or 取消置顶 +function updateTop() { $.post( CONTEXT_PATH + "/discuss/top", - {"id":$("#postId").val()}, + { + "id": $("#postId").val(), + // $("#postType").val() 帖子当前的 type + "type": ($("#postType").val() == 1) ? 0 : 1 + }, function (data) { data = $.parseJSON(data); if (data.code == 0) { - // 置顶成功后,将置顶按钮设置为不可用 - $("#topBtn").attr("disabled", "disable") + // 偷个懒,直接刷新界面 + window.location.reload(); } else { alert(data.msg); diff --git a/src/main/resources/templates/site/discuss-detail.html b/src/main/resources/templates/site/discuss-detail.html index 03a7c633..9dd29450 100644 --- a/src/main/resources/templates/site/discuss-detail.html +++ b/src/main/resources/templates/site/discuss-detail.html @@ -28,8 +28,11 @@
- + +
- +