diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostHeat.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostHeat.java index 5911242..2a3ca53 100644 --- a/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostHeat.java +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostHeat.java @@ -31,6 +31,8 @@ public class CommunityPostHeat extends BaseEntity @Excel(name = "回复数") private Integer replies; + private CommunityPostInfo communityPostInfo; + public void setPostId(String postId) { this.postId = postId; @@ -68,6 +70,14 @@ public class CommunityPostHeat extends BaseEntity return replies; } + public CommunityPostInfo getCommunityPostInfo() { + return communityPostInfo; + } + + public void setCommunityPostInfo(CommunityPostInfo communityPostInfo) { + this.communityPostInfo = communityPostInfo; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostInfoServiceImpl.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostInfoServiceImpl.java index 47f2e19..90e4bf0 100644 --- a/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostInfoServiceImpl.java +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostInfoServiceImpl.java @@ -66,6 +66,7 @@ public class CommunityPostInfoServiceImpl implements ICommunityPostInfoService communityPostInfo.setPostId(IdUtils.simpleUUID()); communityPostInfo.setPostTime(new Date()); communityPostInfo.setUserId(SecurityUtils.getUserId()); + communityPostInfo.setStatus("0"); //热度榜单新增记录 CommunityPostHeat postHeat = new CommunityPostHeat(); postHeat.setPostId(communityPostInfo.getPostId()); diff --git a/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostHeatMapper.xml b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostHeatMapper.xml index fbc37b2..82f8933 100644 --- a/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostHeatMapper.xml +++ b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostHeatMapper.xml @@ -9,20 +9,35 @@ + + + + + + + + + + + + + + + - select post_id, likes, views, replies from community_post_heat + select a.post_id, a.likes, a.views, a.replies,b.post_id,b.post_type,b.om_field,b.om_industry,b.post_title,b.post_content,b.post_time,b.user_id,b.last_edit_time,b.views,b.status from community_post_heat a + left join community_post_info b on a.post_id = b.post_id - - and post_type = #{postType} - and om_field = #{omField} - and om_industry = #{omIndustry} - and post_title = #{postTitle} - and post_content = #{postContent} - and post_time = #{postTime} - and a.user_id = #{userId} - and last_edit_time = #{lastEditTime} - and views = #{views} - and a.status = #{status} - + where a.status = '0' + and post_type = #{postType} + and om_field = #{omField} + and om_industry = #{omIndustry} + and post_title = #{postTitle} + and post_content = #{postContent} + and post_time = #{postTime} + and a.user_id = #{userId} + and last_edit_time = #{lastEditTime} + and views = #{views} + and a.status = #{status} order by post_time desc diff --git a/inspur-ui/src/api/community/heat.js b/inspur-ui/src/api/community/heat.js index 21536be..814d801 100644 --- a/inspur-ui/src/api/community/heat.js +++ b/inspur-ui/src/api/community/heat.js @@ -1,6 +1,6 @@ import request from "@/utils/request"; -// 查询社区帖子热度列表 +// 查询社区贴子热度列表 export function listHeat(query) { return request({ url: "/community/heat/list", @@ -9,7 +9,7 @@ export function listHeat(query) { }); } -// 查询社区帖子热度详细 +// 查询社区贴子热度详细 export function getHeat(postId) { return request({ url: "/community/heat/" + postId, @@ -17,7 +17,7 @@ export function getHeat(postId) { }); } -// 新增社区帖子热度 +// 新增社区贴子热度 export function addHeat(data) { return request({ url: "/community/heat", @@ -26,7 +26,7 @@ export function addHeat(data) { }); } -// 修改社区帖子热度 +// 修改社区贴子热度 export function updateHeat(data) { return request({ url: "/community/heat", @@ -35,7 +35,7 @@ export function updateHeat(data) { }); } -// 删除社区帖子热度 +// 删除社区贴子热度 export function delHeat(postId) { return request({ url: "/community/heat/" + postId, diff --git a/inspur-ui/src/api/community/info.js b/inspur-ui/src/api/community/info.js index 4e42fff..9a27269 100644 --- a/inspur-ui/src/api/community/info.js +++ b/inspur-ui/src/api/community/info.js @@ -1,6 +1,6 @@ import request from "@/utils/request"; -// 查询社区帖子信息列表 +// 查询社区贴子信息列表 export function listCommunityInfo(query) { return request({ url: "/community/info/list", @@ -9,7 +9,7 @@ export function listCommunityInfo(query) { }); } -// 查询社区帖子信息详细 +// 查询社区贴子信息详细 export function getCommunityInfo(postId) { return request({ url: "/community/info/" + postId, @@ -17,7 +17,7 @@ export function getCommunityInfo(postId) { }); } -// 新增社区帖子信息 +// 新增社区贴子信息 export function addCommunityInfo(data) { return request({ url: "/community/info", @@ -26,7 +26,7 @@ export function addCommunityInfo(data) { }); } -// 修改社区帖子信息 +// 修改社区贴子信息 export function updateCommunityInfo(data) { return request({ url: "/community/info", @@ -43,7 +43,7 @@ export function addViews(postId) { }); } -// 删除社区帖子信息 +// 删除社区贴子信息 export function delCommunityInfo(postId) { return request({ url: "/community/info/" + postId, diff --git a/inspur-ui/src/api/community/reply.js b/inspur-ui/src/api/community/reply.js index 1dd92e2..0d83e7a 100644 --- a/inspur-ui/src/api/community/reply.js +++ b/inspur-ui/src/api/community/reply.js @@ -1,6 +1,6 @@ import request from "@/utils/request"; -// 查询社区帖子回复列表 +// 查询社区贴子回复列表 export function listReply(query) { return request({ url: "/community/reply/list", @@ -9,7 +9,7 @@ export function listReply(query) { }); } -// 查询社区帖子回复详细 +// 查询社区贴子回复详细 export function getReply(replyId) { return request({ url: "/community/reply/" + replyId, @@ -17,7 +17,7 @@ export function getReply(replyId) { }); } -// 新增社区帖子回复 +// 新增社区贴子回复 export function addReply(data) { return request({ url: "/community/reply", @@ -26,7 +26,7 @@ export function addReply(data) { }); } -// 修改社区帖子回复 +// 修改社区贴子回复 export function updateReply(data) { return request({ url: "/community/reply", @@ -35,7 +35,7 @@ export function updateReply(data) { }); } -// 删除社区帖子回复 +// 删除社区贴子回复 export function delReply(replyId) { return request({ url: "/community/reply/" + replyId, diff --git a/inspur-ui/src/api/community/report.js b/inspur-ui/src/api/community/report.js index 16aa775..e0c3894 100644 --- a/inspur-ui/src/api/community/report.js +++ b/inspur-ui/src/api/community/report.js @@ -1,6 +1,6 @@ import request from "@/utils/request"; -// 查询社区帖子举报列表 +// 查询社区贴子举报列表 export function listReport(query) { return request({ url: "/community/report/list", @@ -9,7 +9,7 @@ export function listReport(query) { }); } -// 查询社区帖子举报详细 +// 查询社区贴子举报详细 export function getReport(reportId) { return request({ url: "/community/report/" + reportId, @@ -17,7 +17,7 @@ export function getReport(reportId) { }); } -// 新增社区帖子举报 +// 新增社区贴子举报 export function addReport(data) { return request({ url: "/community/report", @@ -26,7 +26,7 @@ export function addReport(data) { }); } -// 修改社区帖子举报 +// 修改社区贴子举报 export function updateReport(data) { return request({ url: "/community/report", @@ -35,7 +35,7 @@ export function updateReport(data) { }); } -// 删除社区帖子举报 +// 删除社区贴子举报 export function delReport(reportId) { return request({ url: "/community/report/" + reportId, diff --git a/inspur-ui/src/assets/icons/svg/heat.svg b/inspur-ui/src/assets/icons/svg/heat.svg new file mode 100644 index 0000000..505340d --- /dev/null +++ b/inspur-ui/src/assets/icons/svg/heat.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/inspur-ui/src/views/community/forum/forumForm.vue b/inspur-ui/src/views/community/forum/forumForm.vue index 6a46bb2..7dc0d78 100644 --- a/inspur-ui/src/views/community/forum/forumForm.vue +++ b/inspur-ui/src/views/community/forum/forumForm.vue @@ -106,7 +106,7 @@ { if (valid) { diff --git a/inspur-ui/src/views/community/forum/index.vue b/inspur-ui/src/views/community/forum/index.vue index b4ca6e0..5f158b2 100644 --- a/inspur-ui/src/views/community/forum/index.vue +++ b/inspur-ui/src/views/community/forum/index.vue @@ -147,7 +147,7 @@ slot="header" class="attributes" > - 帖子热度榜 + 贴子热度榜
  • -
    + + +
    {{heat.communityPostInfo.postTitle}}
    +
- 标签 + 贴子类型标签
- {{tag.tagName}} - {{tag.blogNum}} + {{tag.label}}
@@ -261,15 +260,92 @@ slot="header" class="attributes" > - 最新推荐 + 贴子行业类型 + +
+
+
+
+
+
+ {{tag.label}} +
+
- {{forum.title}} + + +
+ + +
+ 贴子领域类型 +
+
+
+
+
+
+
+ {{tag.label}} +
+
+
+
+ +
@@ -294,11 +370,13 @@ import { CommunityInfo, addViews, } from "@/api/community/info"; +import { listHeat, getHeat } from "@/api/community/heat"; export default { name: "forum", components: { forumForm, }, + dicts: ["post_type", "community_field", "community_industry"], data() { return { totalcount: 100, @@ -309,12 +387,12 @@ export default { }, intro: "", forumList: [], - typeList: [], - tagList: [], - fullTypeList: [], + heatList: [], + tagTypeList: [], + fullheatList: [], fullTagList: [], recommendList: [], - selectMethod: "全部帖子", + selectMethod: "全部贴子", typeId: -1, tagId: -1, selected: false, @@ -350,10 +428,11 @@ export default { window.addEventListener("resize", this.screenAdapter); }, mounted() { + this.getHeatList(); this.getForumList(); // this.$nextTick(function () { // // 仅在整个视图都被渲染之后才会运行的代码 - // this.getTypeList() + // this.getheatList() // this.getForumList(); // this.getTagList() // this.getRecommendList() @@ -384,6 +463,10 @@ export default { let loadingInstance = Loading.service({ target: ".left-item", }); + this.queryParams = { + pageNum: 1, + pageSize: 10, + }; listCommunityInfo(this.queryParams) .then((response) => { this.forumList = response.rows; @@ -419,26 +502,29 @@ export default { }); }, // 获取博客类型列表 - async getTypeList() { - getForumDetail(this.$route.query.id).then((response) => { - for (let i = 0; i < response.types.length; i++) { - let typeInfo = response.types[i]; - if (typeInfo.typePic.length > 0) { - response.types[i].typePic = - process.env.VUE_APP_BASE_API + typeInfo.typePic; - } - } - const { data: res } = response; - this.fullTypeList = response.types; - this.typeList = response.types.slice(0, 4); + async getHeatList() { + listHeat(this.queryParams).then((response) => { + this.heatList = response.rows; }); + // getForumDetail(this.$route.query.id).then((response) => { + // for (let i = 0; i < response.types.length; i++) { + // let typeInfo = response.types[i]; + // if (typeInfo.typePic.length > 0) { + // response.types[i].typePic = + // process.env.VUE_APP_BASE_API + typeInfo.typePic; + // } + // } + // const { data: res } = response; + // this.fullheatList = response.types; + // this.heatList = response.types.slice(0, 4); + // }); }, // 获取博客标签列表 async getTagList() { getForumDetail(this.$route.query.id).then((response) => { const { data: res } = response; this.fullTagList = response.tags; - this.tagList = response.tags.slice(0, 6); + this.tagTypeList = response.tags.slice(0, 6); }); }, // 跳转到博客详情页 @@ -459,37 +545,62 @@ export default { handleSizeChange(newSize) { this.queryInfo.pagesize = newSize; }, - // 按分类筛选博客 - async selectType(cmsType) { + // 点击热度榜 + async clickHeat(heat) { + this.getForumInfo(heat.postId); + }, + // 按标签筛选博客 + async selectPostTag(tag) { + this.queryParams.postType = tag.value; let loadingInstance = Loading.service({ target: ".left-item", }); - this.typeId = cmsType.typeId; - cmsListByTypeId(this.typeId) + listCommunityInfo(this.queryParams) .then((response) => { - this.blogList = this.picSrc(response.rows); - this.total = response.total; - // this.totalcount = res.data.totalElements - this.selectMethod = "分类: " + cmsType.typeName; this.selected = true; + this.selectMethod = tag.label + "的贴子"; + this.forumList = response.rows; + this.total = response.total; }) .finally(() => { loadingInstance.close(); }); }, - // 按标签筛选博客 - async selectTag(tag) { + selectIndustryTag(tag) { + this.queryParams = { + pageNum: 1, + pageSize: 10, + }; + this.queryParams.omIndustry = tag.value; let loadingInstance = Loading.service({ target: ".left-item", }); - this.tagId = tag.tagId; - cmsListByTagId(this.tagId) + listCommunityInfo(this.queryParams) .then((response) => { - this.blogList = this.picSrc(response.rows); - this.total = response.total; - // this.totalcount = res.data.totalElements - this.selectMethod = "标签: " + tag.tagName; this.selected = true; + this.selectMethod = tag.label + "的贴子"; + this.forumList = response.rows; + this.total = response.total; + }) + .finally(() => { + loadingInstance.close(); + }); + }, + selectFieldTag(tag) { + this.queryParams = { + pageNum: 1, + pageSize: 10, + }; + this.queryParams.omField = tag.value; + let loadingInstance = Loading.service({ + target: ".left-item", + }); + listCommunityInfo(this.queryParams) + .then((response) => { + this.selected = true; + this.selectMethod = tag.label + "的贴子"; + this.forumList = response.rows; + this.total = response.total; }) .finally(() => { loadingInstance.close(); @@ -498,20 +609,18 @@ export default { // 更新博客列表 updateForumList() { this.selected = false; - this.typeId = -1; - this.tagId = -1; - this.selectMethod = "全部博客"; + this.selectMethod = "全部贴子"; this.getForumList(); }, // 得到所有的标签 async getFullTagList() { - this.tagList = this.fullTagList; + this.tagTypeList = this.fullTagList; }, async dealType() { if (this.moreType) { - this.typeList = this.fullTypeList; + this.heatList = this.fullheatList; } else { - this.typeList = this.fullTypeList.slice(0, 4); + this.heatList = this.fullheatList.slice(0, 4); } this.moreType = !this.moreType; }, @@ -671,9 +780,9 @@ export default { margin-bottom: 20px; } -.forum-type-li:first-child { +/* .forum-type-li:first-child { border-top: 1px solid rgba(179, 216, 255, 0.5); -} +} */ .forum-type-li { border-bottom: 1px solid rgba(179, 216, 255, 0.5); @@ -705,7 +814,7 @@ export default { flex-wrap: wrap; align-items: center; margin: 15px 13px 0; - border-bottom: 1px solid rgba(179, 216, 255, 0.5); + border-bottom: 1px solid rgba(250, 255, 179, 0.5); } .tag-item {