运维社区运维社区个人中心更新

This commit is contained in:
zhangjunwen 2024-05-09 11:25:47 +08:00
parent 8b22032d56
commit 58120a31e9
22 changed files with 1794 additions and 13 deletions

View File

@ -0,0 +1,105 @@
package com.inspur.web.controller.community;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.inspur.common.annotation.Log;
import com.inspur.common.core.controller.BaseController;
import com.inspur.common.core.domain.AjaxResult;
import com.inspur.common.enums.BusinessType;
import com.inspur.community.domain.CommunityNotice;
import com.inspur.community.service.ICommunityNoticeService;
import com.inspur.common.utils.poi.ExcelUtil;
import com.inspur.common.core.page.TableDataInfo;
/**
* 社区通知Controller
*
* @author inspur
* @date 2024-05-08
*/
@RestController
@RequestMapping("/community/notice")
public class CommunityNoticeController extends BaseController
{
@Autowired
private ICommunityNoticeService communityNoticeService;
/**
* 查询社区通知列表
*/
@PreAuthorize("@ss.hasPermi('community:notice:list')")
@GetMapping("/list")
public TableDataInfo list(CommunityNotice communityNotice)
{
startPage();
List<CommunityNotice> list = communityNoticeService.selectCommunityNoticeList(communityNotice);
return getDataTable(list);
}
/**
* 导出社区通知列表
*/
@PreAuthorize("@ss.hasPermi('community:notice:export')")
@Log(title = "社区通知", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CommunityNotice communityNotice)
{
List<CommunityNotice> list = communityNoticeService.selectCommunityNoticeList(communityNotice);
ExcelUtil<CommunityNotice> util = new ExcelUtil<CommunityNotice>(CommunityNotice.class);
util.exportExcel(response, list, "社区通知数据");
}
/**
* 获取社区通知详细信息
*/
@PreAuthorize("@ss.hasPermi('community:notice:query')")
@GetMapping(value = "/{noticeId}")
public AjaxResult getInfo(@PathVariable("noticeId") String noticeId)
{
return success(communityNoticeService.selectCommunityNoticeByNoticeId(noticeId));
}
/**
* 新增社区通知
*/
@PreAuthorize("@ss.hasPermi('community:notice:add')")
@Log(title = "社区通知", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CommunityNotice communityNotice)
{
return toAjax(communityNoticeService.insertCommunityNotice(communityNotice));
}
/**
* 修改社区通知
*/
@PreAuthorize("@ss.hasPermi('community:notice:edit')")
@Log(title = "社区通知", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CommunityNotice communityNotice)
{
return toAjax(communityNoticeService.updateCommunityNotice(communityNotice));
}
/**
* 删除社区通知
*/
@PreAuthorize("@ss.hasPermi('community:notice:remove')")
@Log(title = "社区通知", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}")
public AjaxResult remove(@PathVariable String[] noticeIds)
{
return toAjax(communityNoticeService.deleteCommunityNoticeByNoticeIds(noticeIds));
}
}

View File

@ -1,8 +1,10 @@
package com.inspur.web.controller.community; package com.inspur.web.controller.community;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.inspur.common.utils.SecurityUtils;
import com.inspur.community.domain.vo.CommunityPostInfoVO; import com.inspur.community.domain.vo.CommunityPostInfoVO;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -48,6 +50,25 @@ public class CommunityPostInfoController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* 查询当前登录用户社区帖子信息列表
*/
@PreAuthorize("@ss.hasPermi('community:info:list')")
@GetMapping("/listLogUser")
public TableDataInfo listLogUser(CommunityPostInfo communityPostInfo)
{
startPage();
List<CommunityPostInfoVO> list = new ArrayList<>();
if(SecurityUtils.getLoginUser()!=null) {
communityPostInfo.setUserId(SecurityUtils.getLoginUser().getUserId());
list = communityPostInfoService.selectCommunityPostInfoList(communityPostInfo);
}else {
list = null;
}
return getDataTable(list);
}
/** /**
* 导出社区帖子信息列表 * 导出社区帖子信息列表
*/ */

View File

@ -1,9 +1,11 @@
package com.inspur.web.controller.community; package com.inspur.web.controller.community;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.inspur.common.utils.SecurityUtils; import com.inspur.common.utils.SecurityUtils;
import com.inspur.community.domain.vo.CommunityPostLikeVO;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -48,6 +50,23 @@ public class CommunityPostLikeController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* 查询当前登录用户社区点赞信息列表
*/
@PreAuthorize("@ss.hasPermi('community:like:list')")
@GetMapping("/listLogUser")
public TableDataInfo listLogUser(CommunityPostLike communityPostLike)
{
startPage();
List<CommunityPostLikeVO> list = new ArrayList<>();
if(SecurityUtils.getLoginUser() != null){
list = communityPostLikeService.selectCommunityPostLikeListByUserId(SecurityUtils.getLoginUser().getUserId());
}else{
list = null;
}
return getDataTable(list);
}
/** /**
* 导出社区点赞信息列表 * 导出社区点赞信息列表
*/ */

View File

@ -0,0 +1,137 @@
package com.inspur.community.domain;
import com.inspur.common.annotation.Excel;
import com.inspur.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 社区通知对象 community_notice
*
* @author zhangjunwen
* @date 2024-05-08
*/
public class CommunityNotice extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private String noticeId;
/** 帖子id */
@Excel(name = "帖子id")
private String postId;
/**
* 回复id
*/
private String replyId;
/**
* 用户id
*/
private Long userId;
/** 帖子名称 */
@Excel(name = "帖子名称")
private String postName;
/**
* 回复内容
*/
private String replyContent;
/** 通知类型1 点赞2 回复3 封禁 */
@Excel(name = "通知类型1 点赞2 回复3 封禁")
private String noticeType;
/** 状态0未读1 已读 */
@Excel(name = "状态0未读1 已读")
private String status;
public void setNoticeId(String noticeId)
{
this.noticeId = noticeId;
}
public String getNoticeId()
{
return noticeId;
}
public void setPostId(String postId)
{
this.postId = postId;
}
public String getPostId()
{
return postId;
}
public String getReplyId() {
return replyId;
}
public void setReplyId(String replyId) {
this.replyId = replyId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public void setPostName(String postName)
{
this.postName = postName;
}
public String getPostName()
{
return postName;
}
public String getReplyContent() {
return replyContent;
}
public void setReplyContent(String replyContent) {
this.replyContent = replyContent;
}
public void setNoticeType(String noticeType)
{
this.noticeType = noticeType;
}
public String getNoticeType()
{
return noticeType;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("noticeId", getNoticeId())
.append("postId", getPostId())
.append("replyId", getReplyId())
.append("postName", getPostName())
.append("noticeType", getNoticeType())
.append("remark", getRemark())
.append("status", getStatus())
.toString();
}
}

View File

@ -0,0 +1,41 @@
package com.inspur.community.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.inspur.common.annotation.Excel;
import com.inspur.community.domain.CommunityPostInfo;
import com.inspur.community.domain.CommunityPostReply;
import lombok.Data;
import java.util.Date;
/**
* @Author zhangjunwen
* @create 2024/5/9
*/
@Data
public class CommunityPostLikeVO {
/** 用户id */
private Long userId;
/** 点赞帖子id */
private String likePostId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
/** 点赞时间 */
private Date likeTime;
private String replyContent;
private String postTitle;
/**
* 点赞的回复信息
*/
private CommunityPostReply communityPostReply;
/**
* 贴子信息
*/
private CommunityPostInfo communityPostInfo;
}

View File

@ -0,0 +1,62 @@
package com.inspur.community.mapper;
import java.util.List;
import com.inspur.community.domain.CommunityNotice;
/**
* 社区通知Mapper接口
*
* @author zjw
* @date 2024-05-08
*/
public interface CommunityNoticeMapper
{
/**
* 查询社区通知
*
* @param noticeId 社区通知主键
* @return 社区通知
*/
public CommunityNotice selectCommunityNoticeByNoticeId(String noticeId);
/**
* 查询社区通知列表
*
* @param communityNotice 社区通知
* @return 社区通知集合
*/
public List<CommunityNotice> selectCommunityNoticeList(CommunityNotice communityNotice);
/**
* 新增社区通知
*
* @param communityNotice 社区通知
* @return 结果
*/
public int insertCommunityNotice(CommunityNotice communityNotice);
/**
* 修改社区通知
*
* @param communityNotice 社区通知
* @return 结果
*/
public int updateCommunityNotice(CommunityNotice communityNotice);
/**
* 删除社区通知
*
* @param noticeId 社区通知主键
* @return 结果
*/
public int deleteCommunityNoticeByNoticeId(String noticeId);
/**
* 批量删除社区通知
*
* @param noticeIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteCommunityNoticeByNoticeIds(String[] noticeIds);
}

View File

@ -2,6 +2,7 @@ package com.inspur.community.mapper;
import java.util.List; import java.util.List;
import com.inspur.community.domain.CommunityPostLike; import com.inspur.community.domain.CommunityPostLike;
import com.inspur.community.domain.vo.CommunityPostLikeVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
@ -28,6 +29,11 @@ public interface CommunityPostLikeMapper
*/ */
public List<CommunityPostLike> selectCommunityPostLikeList(CommunityPostLike communityPostLike); public List<CommunityPostLike> selectCommunityPostLikeList(CommunityPostLike communityPostLike);
/**
* 查询用户点赞的详细信息
*/
public List<CommunityPostLikeVO> selectCommunityPostLikeListByUserId(Long userId);
/** /**
* 根据postid统计点赞数 * 根据postid统计点赞数
*/ */

View File

@ -0,0 +1,62 @@
package com.inspur.community.service;
import java.util.List;
import com.inspur.community.domain.CommunityNotice;
/**
* 社区通知Service接口
*
* @author zjw
* @date 2024-05-08
*/
public interface ICommunityNoticeService
{
/**
* 查询社区通知
*
* @param noticeId 社区通知主键
* @return 社区通知
*/
public CommunityNotice selectCommunityNoticeByNoticeId(String noticeId);
/**
* 查询社区通知列表
*
* @param communityNotice 社区通知
* @return 社区通知集合
*/
public List<CommunityNotice> selectCommunityNoticeList(CommunityNotice communityNotice);
/**
* 新增社区通知
*
* @param communityNotice 社区通知
* @return 结果
*/
public int insertCommunityNotice(CommunityNotice communityNotice);
/**
* 修改社区通知
*
* @param communityNotice 社区通知
* @return 结果
*/
public int updateCommunityNotice(CommunityNotice communityNotice);
/**
* 批量删除社区通知
*
* @param noticeIds 需要删除的社区通知主键集合
* @return 结果
*/
public int deleteCommunityNoticeByNoticeIds(String[] noticeIds);
/**
* 删除社区通知信息
*
* @param noticeId 社区通知主键
* @return 结果
*/
public int deleteCommunityNoticeByNoticeId(String noticeId);
}

View File

@ -2,6 +2,7 @@ package com.inspur.community.service;
import java.util.List; import java.util.List;
import com.inspur.community.domain.CommunityPostLike; import com.inspur.community.domain.CommunityPostLike;
import com.inspur.community.domain.vo.CommunityPostLikeVO;
/** /**
* 社区点赞信息Service接口 * 社区点赞信息Service接口
@ -27,6 +28,11 @@ public interface ICommunityPostLikeService
*/ */
public List<CommunityPostLike> selectCommunityPostLikeList(CommunityPostLike communityPostLike); public List<CommunityPostLike> selectCommunityPostLikeList(CommunityPostLike communityPostLike);
/**
* 查询用户点赞的详细信息
*/
public List<CommunityPostLikeVO> selectCommunityPostLikeListByUserId(Long userId);
/** /**
* 新增社区点赞信息 * 新增社区点赞信息
* *

View File

@ -0,0 +1,111 @@
package com.inspur.community.service.impl;
import java.util.List;
import com.inspur.common.utils.uuid.IdUtils;
import com.inspur.community.domain.CommunityPostReply;
import com.inspur.community.mapper.CommunityPostReplyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.inspur.community.mapper.CommunityNoticeMapper;
import com.inspur.community.domain.CommunityNotice;
import com.inspur.community.service.ICommunityNoticeService;
/**
* 社区通知Service业务层处理
*
* @author zjw
* @date 2024-05-08
*/
@Service
public class CommunityNoticeServiceImpl implements ICommunityNoticeService
{
@Autowired
private CommunityNoticeMapper communityNoticeMapper;
@Autowired
private CommunityPostReplyMapper communityPostReplyMapper;
/**
* 查询社区通知
*
* @param noticeId 社区通知主键
* @return 社区通知
*/
@Override
public CommunityNotice selectCommunityNoticeByNoticeId(String noticeId)
{
return communityNoticeMapper.selectCommunityNoticeByNoticeId(noticeId);
}
/**
* 查询社区通知列表
*
* @param communityNotice 社区通知
* @return 社区通知
*/
@Override
public List<CommunityNotice> selectCommunityNoticeList(CommunityNotice communityNotice)
{
List<CommunityNotice> list = communityNoticeMapper.selectCommunityNoticeList(communityNotice);
for (CommunityNotice notice : list) {
if(notice.getReplyId() == null || notice.getReplyId().equals("")){
continue;
}
CommunityPostReply reply = communityPostReplyMapper.selectCommunityPostReplyByReplyId(notice.getReplyId());
notice.setReplyContent(reply.getReplyContent());
}
return list;
}
/**
* 新增社区通知
*
* @param communityNotice 社区通知
* @return 结果
*/
@Override
public int insertCommunityNotice(CommunityNotice communityNotice)
{
communityNotice.setNoticeId(IdUtils.simpleUUID());
communityNotice.setStatus("0");
return communityNoticeMapper.insertCommunityNotice(communityNotice);
}
/**
* 修改社区通知
*
* @param communityNotice 社区通知
* @return 结果
*/
@Override
public int updateCommunityNotice(CommunityNotice communityNotice)
{
return communityNoticeMapper.updateCommunityNotice(communityNotice);
}
/**
* 批量删除社区通知
*
* @param noticeIds 需要删除的社区通知主键
* @return 结果
*/
@Override
public int deleteCommunityNoticeByNoticeIds(String[] noticeIds)
{
return communityNoticeMapper.deleteCommunityNoticeByNoticeIds(noticeIds);
}
/**
* 删除社区通知信息
*
* @param noticeId 社区通知主键
* @return 结果
*/
@Override
public int deleteCommunityNoticeByNoticeId(String noticeId)
{
return communityNoticeMapper.deleteCommunityNoticeByNoticeId(noticeId);
}
}

View File

@ -1,6 +1,8 @@
package com.inspur.community.service.impl; package com.inspur.community.service.impl;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.inspur.community.mapper.CommunityPostHeatMapper; import com.inspur.community.mapper.CommunityPostHeatMapper;
@ -40,7 +42,10 @@ public class CommunityPostHeatServiceImpl implements ICommunityPostHeatService
@Override @Override
public List<CommunityPostHeat> selectCommunityPostHeatList(CommunityPostHeat communityPostHeat) public List<CommunityPostHeat> selectCommunityPostHeatList(CommunityPostHeat communityPostHeat)
{ {
return communityPostHeatMapper.selectCommunityPostHeatList(communityPostHeat); //排序
List<CommunityPostHeat> heatList = communityPostHeatMapper.selectCommunityPostHeatList(communityPostHeat);
heatList.stream().sorted((o1, o2) -> heatSortCalculate(o1).compareTo(heatSortCalculate(o2))).collect(Collectors.toList());
return heatList;
} }
/** /**
@ -90,5 +95,9 @@ public class CommunityPostHeatServiceImpl implements ICommunityPostHeatService
{ {
return communityPostHeatMapper.deleteCommunityPostHeatByPostId(postId); return communityPostHeatMapper.deleteCommunityPostHeatByPostId(postId);
} }
private Double heatSortCalculate(CommunityPostHeat communityPostHeat){
return 0.4 * communityPostHeat.getViews() + 0.6 * communityPostHeat.getReplies();
}
} }

View File

@ -5,7 +5,12 @@ import java.util.List;
import com.inspur.common.utils.DateUtils; import com.inspur.common.utils.DateUtils;
import com.inspur.common.utils.SecurityUtils; import com.inspur.common.utils.SecurityUtils;
import com.inspur.community.domain.CommunityNotice;
import com.inspur.community.domain.CommunityPostReply;
import com.inspur.community.domain.vo.CommunityPostLikeVO;
import com.inspur.community.mapper.CommunityPostHeatMapper; import com.inspur.community.mapper.CommunityPostHeatMapper;
import com.inspur.community.service.ICommunityNoticeService;
import com.inspur.community.service.ICommunityPostReplyService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.inspur.community.mapper.CommunityPostLikeMapper; import com.inspur.community.mapper.CommunityPostLikeMapper;
@ -27,6 +32,11 @@ public class CommunityPostLikeServiceImpl implements ICommunityPostLikeService
@Autowired @Autowired
private CommunityPostHeatMapper communityPostHeatMapper; private CommunityPostHeatMapper communityPostHeatMapper;
@Autowired
private ICommunityNoticeService communityNoticeService;
@Autowired
private ICommunityPostReplyService communityPostReplyService;
/** /**
* 查询社区点赞信息 * 查询社区点赞信息
* *
@ -51,6 +61,13 @@ public class CommunityPostLikeServiceImpl implements ICommunityPostLikeService
return communityPostLikeMapper.selectCommunityPostLikeList(communityPostLike); return communityPostLikeMapper.selectCommunityPostLikeList(communityPostLike);
} }
/**
* 查询用户点赞的详细信息
*/
public List<CommunityPostLikeVO> selectCommunityPostLikeListByUserId(Long userId){
return communityPostLikeMapper.selectCommunityPostLikeListByUserId(userId);
}
/** /**
* 新增社区点赞信息 * 新增社区点赞信息
* *
@ -63,8 +80,19 @@ public class CommunityPostLikeServiceImpl implements ICommunityPostLikeService
communityPostLike.setUserId(SecurityUtils.getLoginUser().getUserId()); communityPostLike.setUserId(SecurityUtils.getLoginUser().getUserId());
communityPostLike.setLikeTime(new Date()); communityPostLike.setLikeTime(new Date());
//增加热度榜点赞记录加一 //增加热度榜点赞记录加一
//增加通知
return communityPostLikeMapper.insertCommunityPostLike(communityPostLike); CommunityNotice communityNotice = new CommunityNotice();
CommunityPostReply postReply = communityPostReplyService.selectCommunityPostReplyByReplyId(communityPostLike.getLikePostId());
if(postReply!=null){
communityNotice.setPostId(postReply.getPostId());
// communityNotice.setPostName(postReply.getReplyContent());
communityNotice.setUserId(postReply.getUserId());
communityNotice.setReplyContent(postReply.getReplyContent());
communityNotice.setReplyId(postReply.getReplyId());
communityNotice.setNoticeType("1");
communityNotice.setRemark(postReply.getReplyTime());
}
return communityPostLikeMapper.insertCommunityPostLike(communityPostLike) & communityNoticeService.insertCommunityNotice(communityNotice);
} }
/** /**

View File

@ -8,15 +8,12 @@ import com.inspur.common.core.domain.entity.SysUser;
import com.inspur.common.utils.DateUtils; import com.inspur.common.utils.DateUtils;
import com.inspur.common.utils.SecurityUtils; import com.inspur.common.utils.SecurityUtils;
import com.inspur.common.utils.uuid.IdUtils; import com.inspur.common.utils.uuid.IdUtils;
import com.inspur.community.domain.CommunityComment; import com.inspur.community.domain.*;
import com.inspur.community.domain.CommunityPostLike; import com.inspur.community.domain.vo.CommunityPostInfoVO;
import com.inspur.community.mapper.CommunityPostHeatMapper; import com.inspur.community.mapper.*;
import com.inspur.community.mapper.CommunityPostLikeMapper;
import com.inspur.system.mapper.SysUserMapper; import com.inspur.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.inspur.community.mapper.CommunityPostReplyMapper;
import com.inspur.community.domain.CommunityPostReply;
import com.inspur.community.service.ICommunityPostReplyService; import com.inspur.community.service.ICommunityPostReplyService;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -43,6 +40,12 @@ public class CommunityPostReplyServiceImpl implements ICommunityPostReplyService
@Autowired @Autowired
private CommunityPostHeatMapper communityPostHeatMapper; private CommunityPostHeatMapper communityPostHeatMapper;
@Autowired
private CommunityNoticeMapper communityNoticeMapper;
@Autowired
private CommunityPostInfoMapper communityPostInfoMapper;
/** /**
* 查询社区帖子回复 * 查询社区帖子回复
* *
@ -158,7 +161,27 @@ public class CommunityPostReplyServiceImpl implements ICommunityPostReplyService
communityPostReply.setUserId(SecurityUtils.getLoginUser().getUserId()); communityPostReply.setUserId(SecurityUtils.getLoginUser().getUserId());
communityPostReply.setReplyTime(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS)); communityPostReply.setReplyTime(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS));
//帖子热度回复量加一 //帖子热度回复量加一
return communityPostReplyMapper.insertCommunityPostReply(communityPostReply) & communityPostHeatMapper.addReplies(communityPostReply.getPostId()); //添加通知
CommunityNotice notice = new CommunityNotice();
notice.setNoticeId(IdUtils.simpleUUID());
notice.setStatus("0");
if("0".equals(communityPostReply.getParentReplyId())){//给发贴人添加通知
notice.setPostId(communityPostReply.getPostId());
CommunityPostInfoVO post = communityPostInfoMapper.selectCommunityPostInfoByPostId(communityPostReply.getPostId());
notice.setUserId(post.getUserId());
notice.setNoticeType("2");
notice.setPostName(post.getPostTitle());
notice.setRemark(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,post.getPostTime()));
}else{//给评论人添加通知
notice.setReplyId(communityPostReply.getParentReplyId());
CommunityPostReply parentReply = communityPostReplyMapper.selectCommunityPostReplyByReplyId(communityPostReply.getParentReplyId());
notice.setUserId(parentReply.getUserId());
notice.setNoticeType("2");
notice.setReplyContent(parentReply.getReplyContent());
notice.setRemark(parentReply.getReplyTime());
}
return communityPostReplyMapper.insertCommunityPostReply(communityPostReply) & communityPostHeatMapper.addReplies(communityPostReply.getPostId())
& communityNoticeMapper.insertCommunityNotice(notice);
} }
/** /**

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.community.mapper.CommunityNoticeMapper">
<resultMap type="CommunityNotice" id="CommunityNoticeResult">
<result property="noticeId" column="notice_id" />
<result property="postId" column="post_id" />
<result property="replyId" column="reply_id" />
<result property="replyContent" column="reply_content" />
<result property="postName" column="post_name" />
<result property="noticeType" column="notice_type" />
<result property="remark" column="remark" />
<result property="status" column="status" />
</resultMap>
<sql id="selectCommunityNoticeVo">
select notice_id, post_id, reply_id, user_id, reply_content, post_name, notice_type, remark, status from community_notice
</sql>
<select id="selectCommunityNoticeList" parameterType="CommunityNotice" resultMap="CommunityNoticeResult">
<include refid="selectCommunityNoticeVo"/>
<where>
<if test="postId != null and postId != ''"> and post_id = #{postId}</if>
<if test="replyId != null and replyId != ''"> and reply_id = #{replyId}</if>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="replyContent != null and replyContent != ''"> and reply_content = #{replyContent}</if>
<if test="postName != null and postName != ''"> and post_name like concat('%', #{postName}, '%')</if>
<if test="noticeType != null and noticeType != ''"> and notice_type = #{noticeType}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
order by status
</select>
<select id="selectCommunityNoticeByNoticeId" parameterType="String" resultMap="CommunityNoticeResult">
<include refid="selectCommunityNoticeVo"/>
where notice_id = #{noticeId}
</select>
<insert id="insertCommunityNotice" parameterType="CommunityNotice">
insert into community_notice
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="noticeId != null">notice_id,</if>
<if test="postId != null">post_id,</if>
<if test="replyId != null">reply_id,</if>
<if test="userId != null">user_id,</if>
<if test="replyContent != null">reply_content,</if>
<if test="postName != null">post_name,</if>
<if test="noticeType != null">notice_type,</if>
<if test="remark != null">remark,</if>
<if test="status != null">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="noticeId != null">#{noticeId},</if>
<if test="postId != null">#{postId},</if>
<if test="replyId != null">#{replyId},</if>
<if test="userId != null">#{userId},</if>
<if test="replyContent != null">#{replyContent},</if>
<if test="postName != null">#{postName},</if>
<if test="noticeType != null">#{noticeType},</if>
<if test="remark != null">#{remark},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
<update id="updateCommunityNotice" parameterType="CommunityNotice">
update community_notice
<trim prefix="SET" suffixOverrides=",">
<if test="postId != null">post_id = #{postId},</if>
<if test="replyId != null">reply_id = #{replyId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="replyContent != null">reply_content = #{replyContent},</if>
<if test="postName != null">post_name = #{postName},</if>
<if test="noticeType != null">notice_type = #{noticeType},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="status != null">status = #{status},</if>
</trim>
where notice_id = #{noticeId}
</update>
<delete id="deleteCommunityNoticeByNoticeId" parameterType="String">
delete from community_notice where notice_id = #{noticeId}
</delete>
<delete id="deleteCommunityNoticeByNoticeIds" parameterType="String">
delete from community_notice where notice_id in
<foreach item="noticeId" collection="array" open="(" separator="," close=")">
#{noticeId}
</foreach>
</delete>
</mapper>

View File

@ -37,7 +37,6 @@
<if test="postId != null and postId != ''"> and post_id = #{postId}</if> <if test="postId != null and postId != ''"> and post_id = #{postId}</if>
<if test="likes != null "> and likes = #{likes}</if> <if test="likes != null "> and likes = #{likes}</if>
<if test="views != null "> and views = #{views}</if> <if test="views != null "> and views = #{views}</if>
order by a.views * 0.4 + a.replies * 0.6 desc
</select> </select>
<select id="selectCommunityPostHeatByPostId" parameterType="String" resultMap="CommunityPostHeatResult"> <select id="selectCommunityPostHeatByPostId" parameterType="String" resultMap="CommunityPostHeatResult">

View File

@ -10,10 +10,51 @@
<result property="likeTime" column="like_time" /> <result property="likeTime" column="like_time" />
</resultMap> </resultMap>
<resultMap type="CommunityPostLikeVO" id="CommunityPostLikeVOResult">
<result property="userId" column="user_id" />
<result property="likePostId" column="like_post_id" />
<result property="likeTime" column="like_time" />
<result property="replyContent" column="reply_content"/>
<result property="postTitle" column="post_title"/>
<association property="communityPostReply" javaType="CommunityPostReply" resultMap="CommunityPostReplyResult"/>
<association property="communityPostInfo" javaType="CommunityPostInfo" resultMap="CommunityPostInfoResult"/>
</resultMap>
<resultMap type="CommunityPostReply" id="CommunityPostReplyResult">
<result property="replyId" column="reply_id" />
<result property="postId" column="post_id" />
<result property="userId" column="user_id" />
<result property="replyContent" column="reply_content" />
<result property="replyTime" column="reply_time" />
<result property="parentReplyId" column="parent_reply_id" />
<result property="rootReplyId" column="root_reply_id" />
<result property="status" column="status" />
</resultMap>
<resultMap type="CommunityPostInfo" id="CommunityPostInfoResult">
<result property="postId" column="post_id" />
<result property="postType" column="post_type" />
<result property="omField" column="om_field" />
<result property="omIndustry" column="om_industry" />
<result property="postTitle" column="post_title" />
<result property="postContent" column="post_content" />
<result property="postTime" column="post_time" />
<result property="userId" column="user_id" />
<result property="lastEditTime" column="last_edit_time" />
<result property="views" column="views"/>
<result property="status" column="status" />
</resultMap>
<sql id="selectCommunityPostLikeVo"> <sql id="selectCommunityPostLikeVo">
select user_id, like_post_id, like_time from community_post_like select user_id, like_post_id, like_time from community_post_like
</sql> </sql>
<sql id="selectCommunityPostLikeDetails">
select a.user_id, a.like_post_id, a.like_time, b.reply_id, b.post_id, b.reply_content, b.reply_time, b.parent_reply_id, b.root_reply_id, b.status, c.post_id, c.post_title from community_post_like a
left join community_post_reply b on a.like_post_id = b.reply_id
left join community_post_info c on b.post_id = c.post_id
</sql>
<select id="selectCommunityPostLikeList" parameterType="CommunityPostLike" resultMap="CommunityPostLikeResult"> <select id="selectCommunityPostLikeList" parameterType="CommunityPostLike" resultMap="CommunityPostLikeResult">
<include refid="selectCommunityPostLikeVo"/> <include refid="selectCommunityPostLikeVo"/>
<where> <where>
@ -28,6 +69,11 @@
where user_id = #{userId} where user_id = #{userId}
</select> </select>
<!--查询用户点赞的详细信息 selectCommunityPostLikeListByUserId-->
<select id="selectCommunityPostLikeListByUserId" parameterType="Long" resultMap="CommunityPostLikeVOResult">
<include refid="selectCommunityPostLikeDetails"/>
where a.user_id = #{userId} and b.status = '0' and c.status = '0'
</select>
<!--根据postid统计点赞数 <!--根据postid统计点赞数
public int countCommunityPostLikeByLikePostId--> public int countCommunityPostLikeByLikePostId-->
<select id="countCommunityPostLikeByLikePostId" parameterType="String" resultType="long"> <select id="countCommunityPostLikeByLikePostId" parameterType="String" resultType="long">

View File

@ -9,6 +9,15 @@ export function listCommunityInfo(query) {
}); });
} }
// 查询社区贴子信息列表
export function listLogUserCommunityInfo(query) {
return request({
url: "/community/info/listLogUser",
method: "get",
params: query,
});
}
// 查询社区贴子信息详细 // 查询社区贴子信息详细
export function getCommunityInfo(postId) { export function getCommunityInfo(postId) {
return request({ return request({

View File

@ -0,0 +1,44 @@
import request from "@/utils/request";
// 查询社区通知列表
export function listNotice(query) {
return request({
url: "/community/notice/list",
method: "get",
params: query,
});
}
// 查询社区通知详细
export function getNotice(noticeId) {
return request({
url: "/community/notice/" + noticeId,
method: "get",
});
}
// 新增社区通知
export function addNotice(data) {
return request({
url: "/community/notice",
method: "post",
data: data,
});
}
// 修改社区通知
export function updateNotice(data) {
return request({
url: "/community/notice",
method: "put",
data: data,
});
}
// 删除社区通知
export function delNotice(noticeId) {
return request({
url: "/community/notice/" + noticeId,
method: "delete",
});
}

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1715153992021" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9749" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M43.52 324.096c-19.968 12.8-32.256 34.304-32.256 57.856v472.064c0 68.096 55.296 123.392 123.904 123.392H888.32c68.096 0 123.392-55.296 123.392-123.392V381.952c0-23.552-11.776-45.056-32.256-57.856L552.96 57.856c-25.6-15.872-58.368-15.872-83.456 0L43.52 324.096zM73.728 872.96c-2.048-7.168-3.072-12.8-3.072-18.944V445.44l289.792 199.168-2.048 1.536L74.752 875.52l-1.024-2.56z m816.128 46.08H133.632l-4.608-12.8 1.024-1.024L409.088 678.4l1.024 1.024 56.32 38.912c26.624 18.432 62.976 18.432 89.6 0l57.344-39.424 1.024 1.024 279.04 226.816-3.584 12.288z m63.488-64.512c0 6.144-1.024 12.288-3.072 18.944l-1.024 2.56-2.048-2.048-283.648-229.376 2.048-1.536L953.344 445.44v409.088zM549.376 123.904l405.504 250.88-401.92 276.992c-12.288 8.192-26.624 12.8-40.96 12.8s-28.672-4.096-40.96-12.8L69.12 374.272l2.56-1.536L473.6 123.392c23.04-13.824 52.224-13.824 75.776 0.512z" fill="#f4ea2a" p-id="9750"></path></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1715153929556" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6190" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M166.8 794.3c-2.6 0-5.1-0.4-7.5-0.8 1.4-1.6 3.1-3.4 5.3-5.5L386 582.1l51 57.6c19.5 22 45.7 34.2 73.6 34.2 28 0 54.1-12.1 73.6-34.2l51-57.6L856.7 788c2.2 2.1 3.9 3.9 5.4 5.5-2.5 0.4-5 0.8-7.5 0.8H166.8z m-49.1-35.6c-2.4-6.4-3.8-13.3-3.8-20.6V288.4c0-4.4 0.6-8.7 1.5-12.8 2.2 3 4.4 6 7.2 9.1l227.1 256.4-220 204.5c-4.7 4.6-8.6 8.9-12 13.1z m736.8-526.5c4.9 0 9.5 0.9 13.9 2.2-1.3 2.7-3.7 6.7-8.2 11.8l-314.5 355c-18.8 21.3-51.4 21.3-70.3 0L161 246.2c-4.5-5.1-6.9-9.1-8.2-11.8 4.5-1.3 9.1-2.2 13.9-2.2h687.8z m52.9 56.2v449.7c0 7.3-1.4 14.2-3.8 20.6-3.4-4.2-7.3-8.5-12-12.9l-220-204.5 227.1-256.4c2.8-3.1 5-6.1 7.2-9.1 1 3.9 1.5 8.2 1.5 12.6z m-13.9-104.3c-9.5-4.8-22.1-8.1-39-8.1H166.8c-16.9 0-29.5 3.3-39 8.1-39.1 16.6-66.8 57-66.8 104.3v449.7c0 47 27.3 87.2 66 104 9.4 4.9 22.2 8.4 39.8 8.4h687.7c17.6 0 30.4-3.5 39.8-8.4 38.6-16.8 66-57 66-104V288.4c0.1-47.3-27.7-87.7-66.8-104.3z" fill="#FFCE6A" p-id="6191"></path></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -174,11 +174,11 @@ export default {
// this.replyForm.createBy = this.$store.getters.name; // this.replyForm.createBy = this.$store.getters.name;
this.replyForm.status = "0"; this.replyForm.status = "0";
} }
console.log("aaa:", this.replyForm); // console.log("aaa:", this.replyForm);
addReply(this.replyForm).then((response) => { addReply(this.replyForm).then((response) => {
this.$modal.msgSuccess("评论发表成功"); this.$modal.msgSuccess("评论发表成功");
this.reset(); this.reset();
this.listReply(); this.getMessageList();
}); });
}); });
}, },

View File

@ -0,0 +1,959 @@
<template>
<div class="app-container">
<el-tabs
v-model="activeName"
:tab-position="tabPosition"
@tab-click="handleTabClick"
>
<el-tab-pane
label="最新通知"
name="notice"
>
<el-row :gutter="20">
<el-col
:sm="2"
class="hidden-xs-only"
style="opacity:0;"
>左侧占位</el-col>
<el-col
:xs="24"
:sm="15"
>
<el-card
style="background-color: rgba(255,255,255,0.9)"
class="left-item"
>
<div
slot="header"
class="total"
>
<div class="titleIndex">
<!-- <i
v-if="selected"
class="el-icon-back"
@click="updateForumList"
></i> -->
<span>我的通知</span>
</div>
</div>
<!-- <el-row
type="flex"
align="middle"
style="flex-wrap: wrap"
:gutter="20"
v-for="notice in noticeList"
:key="notice.noticeId"
shadow="never"
class="forum-content"
> -->
<div
v-for="notice in noticeList"
:key="notice.noticeId"
shadow="never"
class="forum-content"
>
<!-- <el-col
:xs="24"
:sm="18"
style="padding-left: 10px;padding-right: 10px;margin-bottom: 5px;margin-top: -5px;"
> -->
<div style="display:flex;align-items: center;justify-content: space-between;">
<!-- <h3><svg-icon icon-class="Topping" /> {{notice.postName}}</h3> -->
<div class="forum-info">
<!-- <div class="user-info">
<i class="el-icon-user"></i>
<span class="header">{{ forum.userName}}</span>
</div>
<div class="forum-date">
<i class="el-icon-date"></i>
<span> {{forum.postTime}}</span>
</div>
<div class="forum-views">
<i class="el-icon-view"></i>
<span> {{forum.views}}</span>
</div> -->
<!-- <div style="display:flex">您的<span v-if="notice.replyId != null">评论:<span>{{ notice.replyContent }}</span></span> <span v-else>贴子:<span>{{ notice.postName }}</span></span> </div> -->
<svg-icon
v-if="notice.status === '0'"
icon-class="unread"
class="icon"
/>
<svg-icon
v-else
icon-class="readed"
class="icon"
/>
<h1
class="notice-content"
v-if="notice.replyId != null"
>您的评论 <div
class="word-link"
@click="toPost(notice)"
>{{ notice.replyContent }}</div> <template>
<dict-tag
:options="dict.type.community_notice_type"
:value="notice.noticeType"
/>
</template></h1>
<h1
class="notice-content"
v-else
>您的贴子<div
class="word-link"
@click="toPost(notice)"
>{{ notice.postName }}</div><template>
<dict-tag
:options="dict.type.community_notice_type"
:value="notice.noticeType"
/>
</template></h1>
</div>
<div>{{ notice.remark }}</div>
<div> <el-button
v-if="notice.status == '0'"
size="mini"
type="text"
@click="markReaded(notice)"
>标为已读</el-button>
<span
style="color:lightgreen"
v-else
>已读</span>
</div>
</div>
<!-- </el-col> -->
</div>
<!-- </el-row> -->
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
background
layout="total, sizes, prev, pager, next, jumper"
@pagination="getList"
style="margin-bottom: 30px;float: right;margin-right: 10px;"
/>
</el-card>
<!-- <forumForm
ref="form"
@addSucess="releaseSuc"
></forumForm> -->
</el-col>
<el-col
:sm="2"
class="hidden-xs-only"
style="opacity:0;"
>右侧占位</el-col>
</el-row></el-tab-pane>
<el-tab-pane
label="我的贴子"
name="post"
>
<el-card
style="background-color: rgba(255,255,255,0.9)"
class="left-item"
>
<div
slot="header"
class="total"
>
<div class="titleIndex">
<span>我的贴子</span>
</div>
</div>
<el-row
type="flex"
align="middle"
style="flex-wrap: wrap"
:gutter="20"
v-for="forum in forumList"
:key="forum.postId"
shadow="never"
class="post-forum-content"
>
<div @click="getForumInfo(forum.postId)">
<el-col
:xs="24"
:sm="18"
style="padding-left: 10px;padding-right: 10px;margin-bottom: 5px;margin-top: -5px;"
>
<div>
<h3><svg-icon
icon-class="Topping"
v-show="forum.top==1"
/> {{forum.postTitle}}</h3>
<div class="forum-info">
<div class="user-info">
<i class="el-icon-user"></i>
<span class="header">{{ forum.userName}}</span>
</div>
<div class="forum-date">
<i class="el-icon-date"></i>
<span> {{forum.postTime}}</span>
</div>
<div class="forum-views">
<i class="el-icon-view"></i>
<span> {{forum.views}}</span>
</div>
</div>
</div>
</el-col>
</div>
</el-row>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
background
layout="total, sizes, prev, pager, next, jumper"
@pagination="getForumList"
style="margin-bottom: 30px;float: right;margin-right: 10px;"
/>
</el-card>
</el-tab-pane>
<el-tab-pane
label="我的点赞"
name="like"
>
<el-row :gutter="20">
<el-col
:sm="2"
class="hidden-xs-only"
style="opacity:0;"
>左侧占位</el-col>
<el-col
:xs="24"
:sm="15"
>
<el-card
style="background-color: rgba(255,255,255,0.9)"
class="left-item"
>
<div
slot="header"
class="total"
>
<div class="titleIndex">
<!-- <i
v-if="selected"
class="el-icon-back"
@click="updateForumList"
></i> -->
<span>我的点赞</span>
</div>
</div>
<!-- <el-row
type="flex"
align="middle"
style="flex-wrap: wrap"
:gutter="20"
v-for="notice in noticeList"
:key="notice.noticeId"
shadow="never"
class="forum-content"
> -->
<div
v-for="like in likeList"
:key="like.userId"
shadow="never"
class="forum-content"
>
<div style="display:flex;align-items: center;justify-content: space-between;">
<div class="forum-info">
<h1 class="notice-content">您于{{ like.likeTime }}点赞了评论<div
class="word-link"
@click="likeToPost(like)"
>{{ like.replyContent }}</div>在贴子<div
class="word-link"
@click="likeToPost(like)"
>{{ like.postTitle }}</div>
</h1>
</div>
</div>
<!-- </el-col> -->
</div>
<!-- </el-row> -->
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
background
layout="total, sizes, prev, pager, next, jumper"
@pagination="getLikeList"
style="margin-bottom: 30px;float: right;margin-right: 10px;"
/>
</el-card>
<!-- <forumForm
ref="form"
@addSucess="releaseSuc"
></forumForm> -->
</el-col>
<el-col
:sm="2"
class="hidden-xs-only"
style="opacity:0;"
>右侧占位</el-col>
</el-row>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import { Loading } from "element-ui";
import {
listNotice,
getNotice,
delNotice,
addNotice,
updateNotice,
} from "@/api/community/notice";
import {
listCommunityInfo,
getCommunityInfo,
addCommunityInfo,
updateCommunityInfo,
CommunityInfo,
addViews,
listLogUserCommunityInfo,
} from "@/api/community/info";
import { listLogUserLike } from "@/api/community/like";
export default {
name: "Notice",
dicts: ["community_notice_type"],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
noticeList: [],
//
forumList: [],
//
likeList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
},
//
form: {},
//
rules: {},
activeName: "notice",
tabPosition: "left",
};
},
created() {
this.getList();
},
methods: {
handleTabClick(tab) {
if (this.activeName === "notice") {
this.getList();
} else if (this.activeName === "post") {
this.getForumList();
} else {
this.getLikeList();
}
},
getLikeList() {
let loadingInstance = Loading.service({
target: ".left-item",
});
this.queryParams = {
pageNum: 1,
pageSize: 10,
};
listLogUserLike(this.queryParams)
.then((response) => {
this.likeList = response.rows;
this.total = response.total;
})
.finally(() => {
loadingInstance.close();
});
},
/** 获取贴子列表 */
getForumList() {
let loadingInstance = Loading.service({
target: ".left-item",
});
this.queryParams = {
pageNum: 1,
pageSize: 10,
};
listLogUserCommunityInfo(this.queryParams)
.then((response) => {
this.forumList = response.rows;
this.total = response.total;
})
.finally(() => {
loadingInstance.close();
});
},
//
getForumInfo(postId) {
let routeUrl = this.$router.push({
path: "/community/forumDetails",
query: {
id: postId,
},
});
},
/**标为已读 */
markReaded(notice) {
let form = {
noticeId: notice.noticeId,
status: "1",
};
updateNotice(form).then((response) => {
this.getList();
});
},
likeToPost(like) {
let routeUrl = this.$router.push({
path: "/community/forumDetails",
query: {
id: like.communityPostInfo.postId,
},
});
},
toPost(notice) {
this.markReaded(notice);
let routeUrl = this.$router.push({
path: "/community/forumDetails",
query: {
id: notice.postId,
},
});
},
/** 查询社区通知列表 */
getList() {
let loadingInstance = Loading.service({
target: ".left-item",
});
this.queryParams = {
pageNum: 1,
pageSize: 10,
};
listNotice(this.queryParams)
.then((response) => {
this.noticeList = response.rows;
this.total = response.total;
})
.finally(() => {
loadingInstance.close();
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
noticeId: null,
postId: null,
postName: null,
noticeType: null,
remark: null,
status: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.noticeId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加社区通知";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const noticeId = row.noticeId || this.ids;
getNotice(noticeId).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改社区通知";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.noticeId != null) {
updateNotice(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addNotice(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const noticeIds = row.noticeId || this.ids;
this.$modal
.confirm('是否确认删除社区通知编号为"' + noticeIds + '"的数据项?')
.then(function () {
return delNotice(noticeIds);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"system/notice/export",
{
...this.queryParams,
},
`notice_${new Date().getTime()}.xlsx`
);
},
},
};
</script>
<style scoped>
.icon {
height: 20px;
width: 30px;
}
.word-link {
color: #3a8ee6;
cursor: pointer;
font-size: medium;
text-decoration: underline;
}
.border {
width: 812px;
height: 112px;
position: absolute;
top: -6px;
left: -6px;
border: 3px solid white;
box-sizing: border-box;
animation: clipMe 5s linear infinite;
}
.tit {
box-sizing: border-box;
position: relative;
width: 800px;
height: 100px;
line-height: 100px;
box-shadow: inset 0 0 0 1px white;
margin: 40px auto;
margin-top: 80px;
color: white;
text-align: center;
font-size: 50px;
font-weight: normal;
letter-spacing: 10px;
}
.intro {
letter-spacing: 5px;
line-height: 50px;
width: 80%;
margin: 0 auto;
text-align: center;
font-weight: normal;
color: white;
}
.down {
animation: bounce 2s infinite;
animation-duration: 3s;
font-size: 25px;
position: absolute;
bottom: 5px;
left: 50%;
transform: translateX(-50%);
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 50px;
border-radius: 50%;
border: 2px solid #fff;
}
.down:hover {
animation: none;
cursor: pointer;
box-shadow: 0 0 20px 0 white;
transition: all 0.2s;
}
.left-item .pagination-container {
background: rgb(255, 255, 255, 0);
}
@keyframes clipMe {
0%,
100% {
clip: rect(0px, 806px, 6px, 0px);
}
25% {
clip: rect(0px, 6px, 112px, 0px);
}
50% {
clip: rect(112px, 812px, 112px, 0px);
}
75% {
clip: rect(0px, 812px, 112px, 806px);
}
}
@keyframes bounce {
0%,
20%,
50%,
80%,
100% {
transform: translate(-50%, 0);
}
40% {
transform: translate(-50%, -30px);
}
60% {
transform: translate(-50%, -15px);
}
}
.forum-type-ul {
padding-left: 10px;
padding-right: 10px;
margin-bottom: 0;
border-radius: 5px;
}
.el-pagination {
padding-bottom: 20px;
}
.el-card /deep/ .el-card__body {
padding: 0;
}
.right-item {
margin-bottom: 20px;
}
/* .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);
}
.more {
text-align: center;
color: #3a8ee6;
padding: 8px;
}
.more:hover {
cursor: pointer;
color: #3a8ee6;
}
.forum-type-li:hover {
background-color: rgba(213, 255, 255, 0.3);
cursor: pointer;
}
.activeType {
background-color: rgba(58, 142, 230, 0.3);
cursor: pointer;
}
.tags {
display: flex;
flex-wrap: wrap;
align-items: center;
margin: 15px 13px 0;
border-bottom: 1px solid rgba(250, 255, 179, 0.5);
}
.tag-item {
display: flex;
justify-content: space-around;
align-items: center;
margin-left: 5px;
margin-right: 5px;
margin-bottom: 10px;
box-sizing: border-box;
}
.tag {
background-color: #ecf5ff;
box-sizing: border-box;
display: inline-block;
height: 22px;
padding: 0 10px;
line-height: 22px;
font-size: 10px;
color: #409eff;
border-radius: 4px;
white-space: nowrap;
border: 1px solid #409eff;
transition: 0.2s;
}
.sjx-outer {
width: 0;
height: 0;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
border-right: 6px solid #409eff;
position: relative;
transition: 0.2s;
}
.sjx-inner {
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
border-right: 6px solid #ecf5ff;
top: -6px;
left: 1px;
position: absolute;
transition: 0.2s;
}
.tag-item:hover,
.activeTag {
box-sizing: border-box;
}
.tag {
color: white;
background-color: #409eff;
cursor: pointer;
}
.sjx-inner {
border-right: 6px solid #409eff;
}
.forum-type-li {
display: flex;
justify-content: space-between;
align-items: center;
line-height: 40px;
}
.recommend-forum {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
padding-left: 10px;
padding-right: 10px;
margin-bottom: 0;
border-radius: 5px;
}
.recommend-a {
border-bottom: 1px solid rgba(34, 36, 38, 0.15);
line-height: 40px;
display: block;
text-decoration: none;
color: black;
}
.recommend-a:hover {
color: #3a8ee6;
}
.total {
display: flex;
justify-content: space-between;
align-items: center;
font-size: larger;
font-weight: bold;
}
.titleIndex {
display: flex;
align-items: center;
}
.el-icon-back {
font-weight: bolder;
color: #3a8ee6;
margin-right: 10px;
}
.el-icon-back:hover {
cursor: pointer;
}
.forum-content:hover {
border-left: 5px solid #3a8ee6;
border-right: 5px solid #3a8ee6;
background-color: rgba(58, 142, 230, 0.3);
/* cursor: pointer; */
}
.forum-content {
padding: 10px;
height: auto;
border-bottom: 1px solid rgb(199, 163, 92);
/*border-bottom: 1px solid rgba(34, 36, 38, .15);*/
transition: 0.3s;
}
.post-forum-content {
padding: 10px;
height: auto;
border-bottom: 1px solid rgb(199, 163, 92);
transition: 0.3s;
}
.post-forum-content:hover {
border-left: 5px solid #3a8ee6;
border-right: 5px solid #3a8ee6;
background-color: rgba(58, 142, 230, 0.3);
cursor: pointer;
}
.el-image {
border-radius: 5px;
box-sizing: border-box;
flex-shrink: 0;
}
.forum-info {
display: flex;
justify-content: space-around;
align-items: center;
color: black;
font-size: 12px;
}
.notice-content {
display: flex;
align-items: center;
margin-left: 10px;
}
.user-info {
display: flex;
align-items: center;
margin-right: 15px;
float: left;
}
.header {
display: flex;
align-items: center;
text-decoration: none;
color: #3a8ee6;
font-weight: bold;
word-break: keep-all;
}
.forum-date {
display: flex;
align-items: center;
float: right;
margin-left: 5px;
width: 200px;
}
.forum-views {
display: flex;
align-items: center;
float: right;
margin-left: 5px;
width: 180px;
}
.forum-type {
float: right;
margin-left: auto;
}
.forum-tag {
float: right;
margin-left: auto;
}
@media screen and (max-width: 768px) {
.border {
display: none;
}
.tit {
font-size: 2rem;
width: 100%;
line-height: 50px;
letter-spacing: 2px;
height: auto;
}
.intro {
font-size: 1rem;
line-height: 30px;
}
.el-pagination {
width: 100%;
}
}
</style>