完成基本功能
This commit is contained in:
parent
cb7fde76d7
commit
d215cf0a81
@ -14,10 +14,14 @@ import com.dd.admin.business.noteImg.domain.NoteImgDto;
|
||||
import com.dd.admin.business.noteImg.domain.NoteImgVo;
|
||||
import com.dd.admin.business.noteImg.entity.NoteImg;
|
||||
import com.dd.admin.business.noteImg.service.NoteImgService;
|
||||
import com.dd.admin.business.upNotes.domain.UpNotesDto;
|
||||
import com.dd.admin.business.upNotes.domain.UpNotesVo;
|
||||
import com.dd.admin.business.upNotes.service.UpNotesService;
|
||||
import com.dd.admin.common.aop.operationLog.aop.OperLog;
|
||||
import com.dd.admin.common.aop.operationLog.aop.OperType;
|
||||
import com.dd.admin.common.model.result.ResultBean;
|
||||
import com.dd.admin.common.security.SecurityUtil;
|
||||
import com.dd.admin.common.security.jwt.JwtTokenUtil;
|
||||
import com.dd.admin.common.utils.AddressUtils;
|
||||
import com.dd.admin.common.utils.IPUtils;
|
||||
import com.dd.admin.common.utils.RandomXiaohongshuAuthorName;
|
||||
@ -45,16 +49,85 @@ public class ApiController {
|
||||
HttpServletRequest request;
|
||||
@Autowired
|
||||
NoteImgService noteImgService;
|
||||
|
||||
@Autowired
|
||||
UpNotesService upNotesService;
|
||||
@Autowired
|
||||
private JwtTokenUtil jwtTokenUtil;
|
||||
@ApiOperation(value = "获取所有笔记")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@GetMapping("/api/notes")
|
||||
@OperLog(operModule = "获取所有笔记",operType = OperType.QUERY,operDesc = "获取所有笔记")
|
||||
@OperLog(operModule = "获取所有笔记", operType = OperType.QUERY, operDesc = "获取所有笔记")
|
||||
public ResultBean<IPage<NoteVo>> page(NoteDto noteDto) {
|
||||
// 1. 通过noteService根据传入的NoteDto参数查询笔记的分页信息,获取包含笔记数据的分页对象
|
||||
IPage<NoteVo> pageInfo = noteService.selectNotePage(noteDto);
|
||||
|
||||
// 2. 创建一个用于存储当前用户点赞笔记信息的列表,初始化为空
|
||||
List<UpNotesVo> upNotesVos = new ArrayList<>();
|
||||
|
||||
// 3. 从请求头中获取名为"token"的token字符串,用于后续解析获取用户ID
|
||||
String token = request.getHeader("token");
|
||||
String authorId = "";
|
||||
try {
|
||||
// 4. 尝试使用jwtTokenUtil工具类从获取到的token中解析出用户名(这里假设用户名就是用户ID),如果解析成功则赋值给authorId变量
|
||||
authorId = jwtTokenUtil.getUsernameFromToken(token);
|
||||
} catch (Exception e) {
|
||||
// 5. 如果在解析token过程中出现异常,此处捕获异常但不做任何处理,authorId仍为空字符串,后续可根据此情况决定是否继续相关业务逻辑
|
||||
}
|
||||
|
||||
// 6. 判断解析出的用户ID是否不为空(即是否成功获取到了用户ID)
|
||||
if (StringUtil.isNotEmpty(authorId)) {
|
||||
// 7. 如果获取到了用户ID,创建一个UpNotesDto对象,用于设置查询条件
|
||||
UpNotesDto upNotesDto = new UpNotesDto();
|
||||
// 8. 将获取到的用户ID设置到UpNotesDto对象中,作为查询当前用户点赞笔记的条件(表示要查询该用户点赞的笔记)
|
||||
upNotesDto.setFollowId(authorId);
|
||||
// 9. 通过upNotesService根据设置好的查询条件,查询当前用户点赞的笔记列表,并将结果赋值给upNotesVos列表
|
||||
upNotesVos = upNotesService.selectUpNotesList(upNotesDto);
|
||||
}
|
||||
|
||||
// 10. 通过upNotesService查询所有笔记的点赞数量统计信息,获取一个包含各笔记点赞数量相关信息的列表
|
||||
List<UpNotesVo> selectAllUpCount = upNotesService.selectAllUpCount();
|
||||
|
||||
// 11. 获取前面查询到的笔记分页信息中的具体笔记记录列表,后续要对这些笔记记录进行相关属性的设置操作
|
||||
List<NoteVo> records = pageInfo.getRecords();
|
||||
// 12. 为了能在下面的lambda表达式中使用upNotesVos变量,创建一个final修饰的变量来引用它,因为lambda表达式中访问的外部变量需要是final或者事实上的final(不可重新赋值)
|
||||
List<UpNotesVo> finalUpNotesVos = upNotesVos;
|
||||
// 13. 同样,为了在lambda表达式中使用authorId变量,创建一个final修饰的变量来引用它
|
||||
String finalAuthorId = authorId;
|
||||
|
||||
// 14. 使用Java 8的Stream API对每条笔记记录进行遍历处理
|
||||
records.stream().forEach(noteVo -> {
|
||||
// 15. 判断当前用户ID是否不为空(即是否获取到了用户ID且有效),如果为空则不进行当前用户对该笔记点赞状态的判断设置操作
|
||||
if (StringUtil.isNotEmpty(finalAuthorId)) {
|
||||
// 16. 在当前用户点赞笔记列表(finalUpNotesVos)中,通过Stream的filter操作筛选出与当前遍历的笔记(noteVo)的ID相等的点赞笔记记录,然后获取第一个匹配的记录(如果有的话),否则返回null
|
||||
UpNotesVo upNote = finalUpNotesVos.stream().filter(upNotesVo -> noteVo.getNoteId().equals(upNotesVo.getNoteId())).findFirst().orElse(null);
|
||||
// 17. 如果找到了对应的点赞笔记记录(即upNote不为null),说明当前用户点赞了这条笔记,将笔记的IsUp属性设置为true,表示已点赞状态
|
||||
if (upNote!= null) {
|
||||
noteVo.setIsUp(Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
// 18. 在所有笔记的点赞数量统计信息列表(selectAllUpCount)中,通过Stream的filter操作筛选出与当前遍历的笔记(noteVo)的ID相等的记录,然后获取第一个匹配的记录(如果有的话),否则返回null
|
||||
UpNotesVo noteCount = selectAllUpCount.stream().filter(upNotesVo -> upNotesVo.getNoteId().equals(noteVo.getNoteId())).findFirst().orElse(null);
|
||||
// 19. 如果找到了对应的点赞数量统计记录(即noteCount不为null),将笔记的UpCount属性设置为该记录中的点赞数量,从而为每条笔记设置对应的点赞数量信息
|
||||
if (noteCount!= null) {
|
||||
noteVo.setUpCount(noteCount.getUpCount());
|
||||
}
|
||||
});
|
||||
|
||||
// 20. 将处理好的包含笔记信息(已设置点赞状态和点赞数量)的分页对象包装在ResultBean中返回,以便前端或其他调用方获取处理后的结果数据
|
||||
return ResultBean.success(pageInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取ip地址")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@GetMapping("/api/getIpAddress")
|
||||
@OperLog(operModule = "获取ip地址",operType = OperType.QUERY,operDesc = "获取单个笔记")
|
||||
public ResultBean<String> getIpAddress() {
|
||||
String ipAddr = IPUtils.getIpAddr(request);
|
||||
String realAddress = AddressUtils.getRealAddress(ipAddr);
|
||||
return ResultBean.success(realAddress);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取单个笔记")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@GetMapping("/api/getNote")
|
||||
|
@ -2,20 +2,35 @@ package com.dd.admin.business.api;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.dd.admin.business.author.entity.Author;
|
||||
import com.dd.admin.business.author.service.AuthorService;
|
||||
import com.dd.admin.business.file.entity.File;
|
||||
import com.dd.admin.business.file.service.FileService;
|
||||
import com.dd.admin.business.follow.entity.Follow;
|
||||
import com.dd.admin.business.follow.service.FollowService;
|
||||
import com.dd.admin.business.note.domain.NoteDto;
|
||||
import com.dd.admin.business.note.domain.NoteVo;
|
||||
import com.dd.admin.business.note.entity.Note;
|
||||
import com.dd.admin.business.note.service.NoteService;
|
||||
import com.dd.admin.business.noteImg.entity.NoteImg;
|
||||
import com.dd.admin.business.noteImg.service.NoteImgService;
|
||||
import com.dd.admin.business.starNotes.domain.StarNotesDto;
|
||||
import com.dd.admin.business.starNotes.domain.StarNotesVo;
|
||||
import com.dd.admin.business.starNotes.entity.StarNotes;
|
||||
import com.dd.admin.business.starNotes.service.StarNotesService;
|
||||
import com.dd.admin.business.upNotes.domain.UpNotesDto;
|
||||
import com.dd.admin.business.upNotes.domain.UpNotesVo;
|
||||
import com.dd.admin.business.upNotes.entity.UpNotes;
|
||||
import com.dd.admin.business.upNotes.service.UpNotesService;
|
||||
import com.dd.admin.common.aop.operationLog.aop.OperLog;
|
||||
import com.dd.admin.common.aop.operationLog.aop.OperType;
|
||||
import com.dd.admin.common.model.result.ResultBean;
|
||||
import com.dd.admin.common.utils.AddressUtils;
|
||||
import com.dd.admin.common.utils.CommonUtil;
|
||||
import com.dd.admin.common.utils.IPUtils;
|
||||
import com.dd.admin.common.utils.StringUtil;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -43,6 +58,182 @@ public class AuthApi {
|
||||
NoteImgService noteImgService;
|
||||
@Value("${server.port}")
|
||||
String port;
|
||||
@Autowired
|
||||
UpNotesService upNotesService;
|
||||
@Autowired
|
||||
StarNotesService starNotesService;
|
||||
@Autowired
|
||||
FollowService followService;
|
||||
|
||||
@ApiOperation(value = "获取所有笔记")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@GetMapping("/api/auth/notes")
|
||||
@OperLog(operModule = "获取所有笔记",operType = OperType.QUERY,operDesc = "获取所有笔记")
|
||||
public ResultBean<IPage<NoteVo>> page(NoteDto noteDto) {
|
||||
String authorId = String.valueOf(request.getAttribute("authorId"));
|
||||
|
||||
IPage<NoteVo> pageInfo = noteService.selectNotePage(noteDto);
|
||||
List<NoteVo> records = pageInfo.getRecords();
|
||||
UpNotesDto upNotesDto = new UpNotesDto();
|
||||
upNotesDto.setFollowId(authorId);
|
||||
List<UpNotesVo> upNotesVos = upNotesService.selectUpNotesList(upNotesDto);
|
||||
|
||||
List<UpNotesVo> selectAllUpCount = upNotesService.selectAllUpCount();
|
||||
records.stream().forEach(noteVo->{
|
||||
UpNotesVo upNote = upNotesVos.stream().filter(upNotesVo -> noteVo.getNoteId().equals(upNotesVo.getNoteId())).findFirst().orElse(null);
|
||||
if(upNote!=null){
|
||||
noteVo.setIsUp(Boolean.TRUE);
|
||||
}
|
||||
UpNotesVo noteCount = selectAllUpCount.stream().filter(upNotesVo -> upNotesVo.getNoteId().equals(noteVo.getNoteId())).findFirst().orElse(null);
|
||||
if(noteCount!=null){
|
||||
noteVo.setUpCount(noteCount.getUpCount());
|
||||
}
|
||||
});
|
||||
|
||||
return ResultBean.success(pageInfo);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "获取所有笔记")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@GetMapping("/api/auth/getFollowNotes")
|
||||
@OperLog(operModule = "获取所有笔记",operType = OperType.QUERY,operDesc = "获取所有笔记")
|
||||
public ResultBean<IPage<NoteVo>> getFollowNotes(NoteDto noteDto) {
|
||||
String followId = String.valueOf(request.getAttribute("authorId"));
|
||||
|
||||
List<Follow> follows = followService.selectFollowListByFollowId(followId);
|
||||
|
||||
IPage<NoteVo> pageInfo = new IPage<NoteVo>() {
|
||||
@Override
|
||||
public List<OrderItem> orders() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NoteVo> getRecords() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<NoteVo> setRecords(List<NoteVo> records) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotal() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<NoteVo> setTotal(long total) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<NoteVo> setSize(long size) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCurrent() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<NoteVo> setCurrent(long current) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
if(CollectionUtil.isNotEmpty(follows)){
|
||||
String authorIds = CommonUtil.getIds(follows, "authorId");
|
||||
noteDto.setAuthorIds(authorIds);
|
||||
pageInfo = noteService.selectNotePage(noteDto);
|
||||
List<NoteVo> records = pageInfo.getRecords();
|
||||
UpNotesDto upNotesDto = new UpNotesDto();
|
||||
upNotesDto.setFollowId(followId);
|
||||
List<UpNotesVo> upNotesVos = upNotesService.selectUpNotesList(upNotesDto);
|
||||
|
||||
List<UpNotesVo> selectAllUpCount = upNotesService.selectAllUpCount();
|
||||
records.stream().forEach(noteVo->{
|
||||
UpNotesVo upNote = upNotesVos.stream().filter(upNotesVo -> noteVo.getNoteId().equals(upNotesVo.getNoteId())).findFirst().orElse(null);
|
||||
if(upNote!=null){
|
||||
noteVo.setIsUp(Boolean.TRUE);
|
||||
}
|
||||
UpNotesVo noteCount = selectAllUpCount.stream().filter(upNotesVo -> upNotesVo.getNoteId().equals(noteVo.getNoteId())).findFirst().orElse(null);
|
||||
if(noteCount!=null){
|
||||
noteVo.setUpCount(noteCount.getUpCount());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return ResultBean.success(pageInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "获取所有点赞笔记")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@GetMapping("/api/auth/getUpNotes")
|
||||
@OperLog(operModule = "获取所有点赞笔记",operType = OperType.QUERY,operDesc = "获取所有点赞笔记")
|
||||
public ResultBean<IPage<NoteVo>> getUpNotes(NoteDto noteDto) {
|
||||
String authorId = String.valueOf(request.getAttribute("authorId"));
|
||||
|
||||
IPage<NoteVo> pageInfo = noteService.selectMineUpNotes(authorId);
|
||||
List<NoteVo> records = pageInfo.getRecords();
|
||||
UpNotesDto upNotesDto = new UpNotesDto();
|
||||
upNotesDto.setFollowId(authorId);
|
||||
List<UpNotesVo> upNotesVos = upNotesService.selectUpNotesList(upNotesDto);
|
||||
|
||||
List<UpNotesVo> selectAllUpCount = upNotesService.selectAllUpCount();
|
||||
records.stream().forEach(noteVo->{
|
||||
UpNotesVo upNote = upNotesVos.stream().filter(upNotesVo -> noteVo.getNoteId().equals(upNotesVo.getNoteId())).findFirst().orElse(null);
|
||||
if(upNote!=null){
|
||||
noteVo.setIsUp(Boolean.TRUE);
|
||||
}
|
||||
UpNotesVo noteCount = selectAllUpCount.stream().filter(upNotesVo -> upNotesVo.getNoteId().equals(noteVo.getNoteId())).findFirst().orElse(null);
|
||||
if(noteCount!=null){
|
||||
noteVo.setUpCount(noteCount.getUpCount());
|
||||
}
|
||||
});
|
||||
|
||||
return ResultBean.success(pageInfo);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "获取所有收藏笔记")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@GetMapping("/api/auth/getStarNotes")
|
||||
@OperLog(operModule = "获取所有收藏笔记",operType = OperType.QUERY,operDesc = "获取所有收藏笔记")
|
||||
public ResultBean<IPage<NoteVo>> getStarNotes(NoteDto noteDto) {
|
||||
String authorId = String.valueOf(request.getAttribute("authorId"));
|
||||
|
||||
IPage<NoteVo> pageInfo = noteService.selectMineStarNotes(authorId);
|
||||
List<NoteVo> records = pageInfo.getRecords();
|
||||
|
||||
UpNotesDto upNotesDto = new UpNotesDto();
|
||||
upNotesDto.setFollowId(authorId);
|
||||
List<UpNotesVo> upNotesVos = upNotesService.selectUpNotesList(upNotesDto);
|
||||
|
||||
List<UpNotesVo> selectAllUpCount = upNotesService.selectAllUpCount();
|
||||
records.stream().forEach(noteVo->{
|
||||
UpNotesVo upNote = upNotesVos.stream().filter(upNotesVo -> noteVo.getNoteId().equals(upNotesVo.getNoteId())).findFirst().orElse(null);
|
||||
if(upNote!=null){
|
||||
noteVo.setIsUp(Boolean.TRUE);
|
||||
}
|
||||
UpNotesVo noteCount = selectAllUpCount.stream().filter(upNotesVo -> upNotesVo.getNoteId().equals(noteVo.getNoteId())).findFirst().orElse(null);
|
||||
if(noteCount!=null){
|
||||
noteVo.setUpCount(noteCount.getUpCount());
|
||||
}
|
||||
});
|
||||
|
||||
return ResultBean.success(pageInfo);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "获取博主信息")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@ -55,6 +246,49 @@ public class AuthApi {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "获取博主笔记")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@GetMapping("/api/auth/getMineNotes")
|
||||
@OperLog(operModule = "获取博主笔记",operType = OperType.QUERY,operDesc = "获取博主笔记")
|
||||
public ResultBean<IPage<NoteVo>> getMineNotes(NoteDto noteDto) {
|
||||
String authorId = String.valueOf(request.getAttribute("authorId"));
|
||||
noteDto.setAuthorId(authorId);
|
||||
IPage<NoteVo> pageInfo = noteService.selectNotePage(noteDto);
|
||||
return ResultBean.success(pageInfo);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "点赞笔记")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@PostMapping("/api/auth/upNote")
|
||||
@OperLog(operModule = "点赞笔记",operType = OperType.ADD,operDesc = "点赞笔记")
|
||||
public ResultBean upNote(@RequestBody NoteDto noteDto) {
|
||||
String followId = String.valueOf(request.getAttribute("authorId"));
|
||||
Author follow = authorService.getById(followId);
|
||||
Boolean upNote = Boolean.FALSE;
|
||||
//查看在不在点赞列表
|
||||
UpNotes upNotes = upNotesService.selectOneByFollowId(noteDto.getNoteId(),noteDto.getAuthorId(), followId);
|
||||
//不在证明是点赞
|
||||
if(upNotes==null){
|
||||
upNotes = new UpNotes();
|
||||
upNotes.setAuthorId(noteDto.getAuthorId());
|
||||
upNotes.setAuthorName(noteDto.getAuthorName());
|
||||
upNotes.setFollowId(follow.getAuthorId());
|
||||
upNotes.setFollowName(follow.getAuthorName());
|
||||
upNotes.setNoteId(noteDto.getNoteId());
|
||||
upNotes.setNoteTitle(noteDto.getNoteTitle());
|
||||
upNote = Boolean.TRUE;
|
||||
upNotesService.save(upNotes);
|
||||
}else{
|
||||
//在则表示取消赞删除数据
|
||||
upNotesService.removeById(upNotes);
|
||||
}
|
||||
return ResultBean.success(upNote);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "创建笔记")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@PostMapping("/api/auth/addNote")
|
||||
|
@ -54,6 +54,8 @@ public class NoteDto {
|
||||
@ApiModelProperty(value = "作者ID")
|
||||
private String authorId;
|
||||
|
||||
private String authorIds;
|
||||
|
||||
@ApiModelProperty(value = "作者头像")
|
||||
private String authorAvatar;
|
||||
|
||||
|
@ -83,7 +83,10 @@ public class NoteVo {
|
||||
private String ipRealAddress;
|
||||
|
||||
@ApiModelProperty(value = "点赞数")
|
||||
private Long upCount;
|
||||
private Integer upCount = 0;
|
||||
|
||||
@ApiModelProperty(value = "被当前达人点赞")
|
||||
private Boolean isUp = Boolean.FALSE;
|
||||
|
||||
@ApiModelProperty(value = "收藏数")
|
||||
private Long starCount;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.dd.admin.business.note.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.dd.admin.business.noteImg.domain.NoteImgVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -25,4 +26,7 @@ public interface NoteMapper extends BaseMapper<Note> {
|
||||
IPage<NoteVo> selectNotePage(Page<NoteVo> page, @Param("noteDto") NoteDto noteDto);
|
||||
|
||||
List<NoteVo> selectNoteList(@Param("noteDto") NoteDto noteDto);
|
||||
|
||||
IPage<NoteVo> selectMineUpNotes(Page<NoteVo> page, @Param("followId")String followId);
|
||||
IPage<NoteVo> selectMineStarNotes(Page<NoteVo> page, @Param("followId")String followId);
|
||||
}
|
||||
|
@ -32,7 +32,16 @@
|
||||
<select id="selectNotePage" resultType="com.dd.admin.business.note.domain.NoteVo">
|
||||
select
|
||||
*,CREATE_TIME AS createTimeStr
|
||||
from business_note where 1 = 1
|
||||
from business_note where deleted = 0
|
||||
<if test="noteDto.authorId != null and noteDto.authorId != ''">
|
||||
and AUTHOR_ID = #{noteDto.authorId}
|
||||
</if>
|
||||
<if test="noteDto.authorIds != null and noteDto.authorId != ''">
|
||||
and AUTHOR_ID in ${noteDto.authorIds}
|
||||
</if>
|
||||
<if test="noteDto.ipRealAddress != null and noteDto.ipRealAddress != ''">
|
||||
and IP_REAL_ADDRESS = #{noteDto.ipRealAddress}
|
||||
</if>
|
||||
order by CREATE_TIME desc
|
||||
</select>
|
||||
|
||||
@ -41,4 +50,15 @@
|
||||
*
|
||||
from business_note where 1 = 1
|
||||
</select>
|
||||
|
||||
<select id="selectMineUpNotes" resultType="com.dd.admin.business.note.domain.NoteVo">
|
||||
select * from business_note a left join business_up_notes b on a.note_id = b.note_id
|
||||
where b.follow_id = #{followId}
|
||||
order by b.create_time desc
|
||||
</select>
|
||||
<select id="selectMineStarNotes" resultType="com.dd.admin.business.note.domain.NoteVo">
|
||||
select * from business_note a left join business_star_notes b on a.note_id = b.note_id
|
||||
where b.follow_id = #{followId}
|
||||
order by b.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -1,10 +1,13 @@
|
||||
package com.dd.admin.business.note.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.dd.admin.business.note.entity.Note;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dd.admin.business.note.domain.NoteVo;
|
||||
import com.dd.admin.business.note.domain.NoteDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -23,4 +26,9 @@ public interface NoteService extends IService<Note> {
|
||||
//笔记表-列表
|
||||
List<NoteVo> selectNoteList(NoteDto noteDto);
|
||||
|
||||
IPage<NoteVo> selectMineUpNotes( String followId);
|
||||
|
||||
IPage<NoteVo> selectMineStarNotes( String followId);
|
||||
|
||||
|
||||
}
|
||||
|
@ -33,4 +33,16 @@ public class NoteServiceImpl extends ServiceImpl<NoteMapper, Note> implements No
|
||||
public List<NoteVo> selectNoteList(NoteDto noteDto) {
|
||||
return baseMapper.selectNoteList(noteDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<NoteVo> selectMineUpNotes(String followId) {
|
||||
Page page = PageFactory.defaultPage();
|
||||
return baseMapper.selectMineUpNotes(page,followId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<NoteVo> selectMineStarNotes(String followId) {
|
||||
Page page = PageFactory.defaultPage();
|
||||
return baseMapper.selectMineStarNotes(page,followId);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.dd.admin.business.note.domain.NoteVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -27,7 +29,7 @@ public class NoteImgVo {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "关联id")
|
||||
private String noteImgId;
|
||||
private NoteVo noteImgId;
|
||||
|
||||
@ApiModelProperty(value = "图片上传的文件id")
|
||||
private String imgId;
|
||||
|
@ -25,4 +25,5 @@ public interface NoteImgMapper extends BaseMapper<NoteImg> {
|
||||
IPage<NoteImgVo> selectNoteImgPage(Page<NoteImgVo> page, @Param("noteImgDto") NoteImgDto noteImgDto);
|
||||
|
||||
List<NoteImgVo> selectNoteImgList(@Param("noteImgDto") NoteImgDto noteImgDto);
|
||||
|
||||
}
|
||||
|
@ -34,4 +34,5 @@
|
||||
</if>
|
||||
order by IMG_SORT asc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -43,6 +43,8 @@ public class ApiInterceptor implements HandlerInterceptor {
|
||||
if (StrUtil.isBlank(token)) {
|
||||
throw new ApiException("请登录后访问");
|
||||
}
|
||||
|
||||
|
||||
//解析token
|
||||
System.out.println(token);
|
||||
String authorId = jwtTokenUtil.getUsernameFromToken(token);
|
||||
|
@ -24,10 +24,11 @@ public class AddressUtils {
|
||||
String rspStr = RegionUtil.getRegion(ip);
|
||||
if (StringUtils.isNotEmpty(rspStr)) {
|
||||
String[] obj = rspStr.split("\\|");
|
||||
String region = obj[2];
|
||||
// String region = obj[2];
|
||||
String city = obj[3];
|
||||
|
||||
return String.format("%s%s", region, city);
|
||||
// return String.format("%s%s", region, city);
|
||||
return String.format("%s", city);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取地理位置异常 {}", e.toString());
|
||||
|
41
web/src/api/business/follow/follow.js
Normal file
41
web/src/api/business/follow/follow.js
Normal file
@ -0,0 +1,41 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getFollowPage(params) {
|
||||
return request({
|
||||
url: '/admin/follow/page',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function getFollowList(params) {
|
||||
return request({
|
||||
url: '/admin/follow/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function addFollow(data) {
|
||||
return request({
|
||||
url: '/admin/follow/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function editFollow(data) {
|
||||
return request({
|
||||
url: '/admin/follow/update',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteFollow(followId) {
|
||||
return request({
|
||||
url: '/admin/follow/delete/' + followId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
41
web/src/api/business/noteImg/noteImg.js
Normal file
41
web/src/api/business/noteImg/noteImg.js
Normal file
@ -0,0 +1,41 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getNoteImgPage(params) {
|
||||
return request({
|
||||
url: '/admin/noteImg/page',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function getNoteImgList(params) {
|
||||
return request({
|
||||
url: '/admin/noteImg/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function addNoteImg(data) {
|
||||
return request({
|
||||
url: '/admin/noteImg/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function editNoteImg(data) {
|
||||
return request({
|
||||
url: '/admin/noteImg/update',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteNoteImg(noteImgId) {
|
||||
return request({
|
||||
url: '/admin/noteImg/delete/' + noteImgId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
41
web/src/api/business/starNotes/starNotes.js
Normal file
41
web/src/api/business/starNotes/starNotes.js
Normal file
@ -0,0 +1,41 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getStarNotesPage(params) {
|
||||
return request({
|
||||
url: '/admin/starNotes/page',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function getStarNotesList(params) {
|
||||
return request({
|
||||
url: '/admin/starNotes/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function addStarNotes(data) {
|
||||
return request({
|
||||
url: '/admin/starNotes/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function editStarNotes(data) {
|
||||
return request({
|
||||
url: '/admin/starNotes/update',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteStarNotes(starNotesId) {
|
||||
return request({
|
||||
url: '/admin/starNotes/delete/' + starNotesId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
41
web/src/api/business/upNotes/upNotes.js
Normal file
41
web/src/api/business/upNotes/upNotes.js
Normal file
@ -0,0 +1,41 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getUpNotesPage(params) {
|
||||
return request({
|
||||
url: '/admin/upNotes/page',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function getUpNotesList(params) {
|
||||
return request({
|
||||
url: '/admin/upNotes/list',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function addUpNotes(data) {
|
||||
return request({
|
||||
url: '/admin/upNotes/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function editUpNotes(data) {
|
||||
return request({
|
||||
url: '/admin/upNotes/update',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteUpNotes(upNotesId) {
|
||||
return request({
|
||||
url: '/admin/upNotes/delete/' + upNotesId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
106
web/src/views/business/follow/addFollow.vue
Normal file
106
web/src/views/business/follow/addFollow.vue
Normal file
@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
top="8vh"
|
||||
width="40%"
|
||||
:visible.sync="dialogVisible"
|
||||
center
|
||||
@close="handleCancel"
|
||||
>
|
||||
<div class="el-dialog-div">
|
||||
<el-form
|
||||
:rules="rules"
|
||||
ref="dataForm"
|
||||
:model="temp"
|
||||
label-position="right"
|
||||
label-width="120px"
|
||||
style="height: 90%;"
|
||||
>
|
||||
|
||||
<el-form-item label="" prop="id" class="is-required">
|
||||
<el-input v-model="temp.id" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="被关注id" prop="authorId" class="is-required">
|
||||
<el-input v-model="temp.authorId" placeholder="被关注id" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="被关注名字" prop="authorName" class="is-required">
|
||||
<el-input v-model="temp.authorName" placeholder="被关注名字" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关注者" prop="followId" class="is-required">
|
||||
<el-input v-model="temp.followId" placeholder="关注者" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关注者名字" prop="followName" class="is-required">
|
||||
<el-input v-model="temp.followName" placeholder="关注者名字" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="创建时间" prop="createTime" class="is-required">
|
||||
<el-input v-model="temp.createTime" placeholder="创建时间" />
|
||||
</el-form-item>
|
||||
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleCancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {addFollow} from "@/api/business/follow/follow";
|
||||
import {setRequiredFields} from "@/utils";
|
||||
const requiredFields = []
|
||||
export default {
|
||||
name: "addForm",
|
||||
data() {
|
||||
return {
|
||||
rules: setRequiredFields(requiredFields),
|
||||
dialogVisible: false,
|
||||
temp: {
|
||||
id:'',
|
||||
authorId:'',
|
||||
authorName:'',
|
||||
followId:'',
|
||||
followName:'',
|
||||
createTime:'',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.dialogVisible = true
|
||||
},
|
||||
submit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
addFollow(this.temp).then(response =>{
|
||||
this.handleCancel()
|
||||
this.$emit('ok', response.data)
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!!');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCancel() {
|
||||
//初始化
|
||||
this.temp = this.$options.data().temp
|
||||
this.dialogVisible = false
|
||||
this.$refs['dataForm'].resetFields();
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
107
web/src/views/business/follow/editFollow.vue
Normal file
107
web/src/views/business/follow/editFollow.vue
Normal file
@ -0,0 +1,107 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
top="8vh"
|
||||
width="40%"
|
||||
:visible.sync="dialogVisible"
|
||||
center
|
||||
@close="handleCancel"
|
||||
>
|
||||
<div class="el-dialog-div">
|
||||
<el-form
|
||||
:rules="rules"
|
||||
ref="dataForm"
|
||||
:model="temp"
|
||||
label-position="right"
|
||||
label-width="120px"
|
||||
style="height: 90%;"
|
||||
>
|
||||
|
||||
<el-form-item label="" prop="id" class="is-required">
|
||||
<el-input v-model="temp.id" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="被关注id" prop="authorId" class="is-required">
|
||||
<el-input v-model="temp.authorId" placeholder="被关注id" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="被关注名字" prop="authorName" class="is-required">
|
||||
<el-input v-model="temp.authorName" placeholder="被关注名字" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关注者" prop="followId" class="is-required">
|
||||
<el-input v-model="temp.followId" placeholder="关注者" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关注者名字" prop="followName" class="is-required">
|
||||
<el-input v-model="temp.followName" placeholder="关注者名字" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="创建时间" prop="createTime" class="is-required">
|
||||
<el-input v-model="temp.createTime" placeholder="创建时间" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleCancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { editFollow } from "@/api/business/follow/follow";
|
||||
import {setRequiredFields} from "@/utils";
|
||||
const requiredFields = []
|
||||
|
||||
export default {
|
||||
name: "editForm",
|
||||
data() {
|
||||
return {
|
||||
rules: setRequiredFields(requiredFields),
|
||||
dialogVisible: false,
|
||||
temp: {
|
||||
id:'',
|
||||
authorId:'',
|
||||
authorName:'',
|
||||
followId:'',
|
||||
followName:'',
|
||||
createTime:'',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(row) {
|
||||
this.temp = this.$options.data().temp
|
||||
this.temp = row
|
||||
this.dialogVisible = true
|
||||
},
|
||||
submit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
editFollow(this.temp).then(response => {
|
||||
this.handleCancel()
|
||||
this.$emit('ok', response.data)
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!!');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCancel() {
|
||||
//初始化
|
||||
this.temp = this.$options.data().temp
|
||||
this.dialogVisible = false
|
||||
this.$refs['dataForm'].resetFields()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
243
web/src/views/business/follow/followList.vue
Normal file
243
web/src/views/business/follow/followList.vue
Normal file
@ -0,0 +1,243 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<div class="filter-container">
|
||||
<el-input
|
||||
v-model="listQuery.keyword"
|
||||
size="small"
|
||||
placeholder="请输入关键词"
|
||||
clearable
|
||||
class="filter-item"
|
||||
style="width: 200px;margin-left: 10px;"
|
||||
/>
|
||||
<el-button-group style="margin-left: 10px;">
|
||||
<el-button
|
||||
size="small"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="search"
|
||||
>
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-refresh"
|
||||
@click="refresh"
|
||||
>
|
||||
重置
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
<el-button
|
||||
size="small"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
style="margin-left: 10px;"
|
||||
@click="add"
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="list"
|
||||
element-loading-text="Loading"
|
||||
border
|
||||
fit
|
||||
height="100%"
|
||||
class="table-container"
|
||||
highlight-current-row
|
||||
>
|
||||
|
||||
<el-table-column
|
||||
label="序号"
|
||||
width="150"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.$index+1 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label=""
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.id }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="被关注id"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.authorId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="被关注名字"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.authorName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="关注者"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.followId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="关注者名字"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.followName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.createTime }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
label="操作"
|
||||
width="200"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button-group>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
@click="edit(scope)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
@click="del(scope)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
:total="total"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.limit"
|
||||
@pagination="fetchData"
|
||||
/>
|
||||
|
||||
<add-form ref="addForm" @ok="addOk" />
|
||||
<edit-form ref="editForm" @ok="editOk" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getFollowPage,deleteFollow} from "@/api/business/follow/follow";
|
||||
import {deepClone,success} from "@/utils";
|
||||
|
||||
import confirm from "@/utils/confirm";
|
||||
import Pagination from '@/components/Pagination'
|
||||
import addForm from "@/views/business/follow/addFollow";
|
||||
import editForm from "@/views/business/follow/editFollow";
|
||||
|
||||
export default {
|
||||
name: 'follow',
|
||||
components: {addForm,editForm,Pagination},
|
||||
data() {
|
||||
return {
|
||||
total: 0,
|
||||
list: [],
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
page: 1,
|
||||
limit: 50,
|
||||
keyword: ''
|
||||
},
|
||||
temp: {},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
this.fetchData()
|
||||
},
|
||||
refresh() {
|
||||
this.listQuery = this.$options.data().listQuery
|
||||
this.fetchData()
|
||||
},
|
||||
fetchData() {
|
||||
this.listLoading = true
|
||||
getFollowPage(this.listQuery).then(response => {
|
||||
const { records, total } = response.data
|
||||
this.list = records
|
||||
this.total = total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
add(){
|
||||
this.$refs.addForm.open()
|
||||
},
|
||||
addOk(){
|
||||
this.fetchData()
|
||||
},
|
||||
edit(scope) {
|
||||
const temp = deepClone(scope.row)
|
||||
this.$refs.editForm.open(temp)
|
||||
},
|
||||
editOk(){
|
||||
this.fetchData()
|
||||
},
|
||||
del(scope) {
|
||||
confirm("确定要删除吗?").then(res=>{
|
||||
if(res){
|
||||
deleteFollow(scope.row.followId).then(response => {
|
||||
console.log(response)
|
||||
success('删除成功')
|
||||
this.fetchData()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
116
web/src/views/business/noteImg/addNoteImg.vue
Normal file
116
web/src/views/business/noteImg/addNoteImg.vue
Normal file
@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
top="8vh"
|
||||
width="40%"
|
||||
:visible.sync="dialogVisible"
|
||||
center
|
||||
@close="handleCancel"
|
||||
>
|
||||
<div class="el-dialog-div">
|
||||
<el-form
|
||||
:rules="rules"
|
||||
ref="dataForm"
|
||||
:model="temp"
|
||||
label-position="right"
|
||||
label-width="120px"
|
||||
style="height: 90%;"
|
||||
>
|
||||
|
||||
<el-form-item label="关联id" prop="noteImgId" class="is-required">
|
||||
<el-input v-model="temp.noteImgId" placeholder="关联id" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="图片上传的文件id" prop="imgId" class="is-required">
|
||||
<el-input v-model="temp.imgId" placeholder="图片上传的文件id" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="相应的笔记id" prop="noteId" class="is-required">
|
||||
<el-input v-model="temp.noteId" placeholder="相应的笔记id" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="图片排序" prop="imgSort" class="is-required">
|
||||
<el-input v-model="temp.imgSort" placeholder="图片排序" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="作者ID" prop="authorId" class="is-required">
|
||||
<el-input v-model="temp.authorId" placeholder="作者ID" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="创建时间" prop="createTime" class="is-required">
|
||||
<el-input v-model="temp.createTime" placeholder="创建时间" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="修改时间" prop="updateTime" class="is-required">
|
||||
<el-input v-model="temp.updateTime" placeholder="修改时间" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="图片地址" prop="imgUrl" class="is-required">
|
||||
<el-input v-model="temp.imgUrl" placeholder="图片地址" />
|
||||
</el-form-item>
|
||||
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleCancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {addNoteImg} from "@/api/business/noteImg/noteImg";
|
||||
import {setRequiredFields} from "@/utils";
|
||||
const requiredFields = []
|
||||
export default {
|
||||
name: "addForm",
|
||||
data() {
|
||||
return {
|
||||
rules: setRequiredFields(requiredFields),
|
||||
dialogVisible: false,
|
||||
temp: {
|
||||
noteImgId:'',
|
||||
imgId:'',
|
||||
noteId:'',
|
||||
imgSort:'',
|
||||
authorId:'',
|
||||
createTime:'',
|
||||
updateTime:'',
|
||||
imgUrl:'',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.dialogVisible = true
|
||||
},
|
||||
submit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
addNoteImg(this.temp).then(response =>{
|
||||
this.handleCancel()
|
||||
this.$emit('ok', response.data)
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!!');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCancel() {
|
||||
//初始化
|
||||
this.temp = this.$options.data().temp
|
||||
this.dialogVisible = false
|
||||
this.$refs['dataForm'].resetFields();
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
117
web/src/views/business/noteImg/editNoteImg.vue
Normal file
117
web/src/views/business/noteImg/editNoteImg.vue
Normal file
@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
top="8vh"
|
||||
width="40%"
|
||||
:visible.sync="dialogVisible"
|
||||
center
|
||||
@close="handleCancel"
|
||||
>
|
||||
<div class="el-dialog-div">
|
||||
<el-form
|
||||
:rules="rules"
|
||||
ref="dataForm"
|
||||
:model="temp"
|
||||
label-position="right"
|
||||
label-width="120px"
|
||||
style="height: 90%;"
|
||||
>
|
||||
|
||||
<el-form-item label="关联id" prop="noteImgId" class="is-required">
|
||||
<el-input v-model="temp.noteImgId" placeholder="关联id" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="图片上传的文件id" prop="imgId" class="is-required">
|
||||
<el-input v-model="temp.imgId" placeholder="图片上传的文件id" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="相应的笔记id" prop="noteId" class="is-required">
|
||||
<el-input v-model="temp.noteId" placeholder="相应的笔记id" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="图片排序" prop="imgSort" class="is-required">
|
||||
<el-input v-model="temp.imgSort" placeholder="图片排序" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="作者ID" prop="authorId" class="is-required">
|
||||
<el-input v-model="temp.authorId" placeholder="作者ID" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="创建时间" prop="createTime" class="is-required">
|
||||
<el-input v-model="temp.createTime" placeholder="创建时间" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="修改时间" prop="updateTime" class="is-required">
|
||||
<el-input v-model="temp.updateTime" placeholder="修改时间" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="图片地址" prop="imgUrl" class="is-required">
|
||||
<el-input v-model="temp.imgUrl" placeholder="图片地址" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleCancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { editNoteImg } from "@/api/business/noteImg/noteImg";
|
||||
import {setRequiredFields} from "@/utils";
|
||||
const requiredFields = []
|
||||
|
||||
export default {
|
||||
name: "editForm",
|
||||
data() {
|
||||
return {
|
||||
rules: setRequiredFields(requiredFields),
|
||||
dialogVisible: false,
|
||||
temp: {
|
||||
noteImgId:'',
|
||||
imgId:'',
|
||||
noteId:'',
|
||||
imgSort:'',
|
||||
authorId:'',
|
||||
createTime:'',
|
||||
updateTime:'',
|
||||
imgUrl:'',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(row) {
|
||||
this.temp = this.$options.data().temp
|
||||
this.temp = row
|
||||
this.dialogVisible = true
|
||||
},
|
||||
submit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
editNoteImg(this.temp).then(response => {
|
||||
this.handleCancel()
|
||||
this.$emit('ok', response.data)
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!!');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCancel() {
|
||||
//初始化
|
||||
this.temp = this.$options.data().temp
|
||||
this.dialogVisible = false
|
||||
this.$refs['dataForm'].resetFields()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
263
web/src/views/business/noteImg/noteImgList.vue
Normal file
263
web/src/views/business/noteImg/noteImgList.vue
Normal file
@ -0,0 +1,263 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<div class="filter-container">
|
||||
<el-input
|
||||
v-model="listQuery.keyword"
|
||||
size="small"
|
||||
placeholder="请输入关键词"
|
||||
clearable
|
||||
class="filter-item"
|
||||
style="width: 200px;margin-left: 10px;"
|
||||
/>
|
||||
<el-button-group style="margin-left: 10px;">
|
||||
<el-button
|
||||
size="small"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="search"
|
||||
>
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-refresh"
|
||||
@click="refresh"
|
||||
>
|
||||
重置
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
<el-button
|
||||
size="small"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
style="margin-left: 10px;"
|
||||
@click="add"
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="list"
|
||||
element-loading-text="Loading"
|
||||
border
|
||||
fit
|
||||
height="100%"
|
||||
class="table-container"
|
||||
highlight-current-row
|
||||
>
|
||||
|
||||
<el-table-column
|
||||
label="序号"
|
||||
width="150"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.$index+1 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="关联id"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.noteImgId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="图片上传的文件id"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.imgId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="相应的笔记id"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.noteId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="图片排序"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.imgSort }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="作者ID"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.authorId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.createTime }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="修改时间"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.updateTime }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="图片地址"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.imgUrl }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
label="操作"
|
||||
width="200"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button-group>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
@click="edit(scope)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
@click="del(scope)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
:total="total"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.limit"
|
||||
@pagination="fetchData"
|
||||
/>
|
||||
|
||||
<add-form ref="addForm" @ok="addOk" />
|
||||
<edit-form ref="editForm" @ok="editOk" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getNoteImgPage,deleteNoteImg} from "@/api/business/noteImg/noteImg";
|
||||
import {deepClone,success} from "@/utils";
|
||||
|
||||
import confirm from "@/utils/confirm";
|
||||
import Pagination from '@/components/Pagination'
|
||||
import addForm from "@/views/business/noteImg/addNoteImg";
|
||||
import editForm from "@/views/business/noteImg/editNoteImg";
|
||||
|
||||
export default {
|
||||
name: 'noteImg',
|
||||
components: {addForm,editForm,Pagination},
|
||||
data() {
|
||||
return {
|
||||
total: 0,
|
||||
list: [],
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
page: 1,
|
||||
limit: 50,
|
||||
keyword: ''
|
||||
},
|
||||
temp: {},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
this.fetchData()
|
||||
},
|
||||
refresh() {
|
||||
this.listQuery = this.$options.data().listQuery
|
||||
this.fetchData()
|
||||
},
|
||||
fetchData() {
|
||||
this.listLoading = true
|
||||
getNoteImgPage(this.listQuery).then(response => {
|
||||
const { records, total } = response.data
|
||||
this.list = records
|
||||
this.total = total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
add(){
|
||||
this.$refs.addForm.open()
|
||||
},
|
||||
addOk(){
|
||||
this.fetchData()
|
||||
},
|
||||
edit(scope) {
|
||||
const temp = deepClone(scope.row)
|
||||
this.$refs.editForm.open(temp)
|
||||
},
|
||||
editOk(){
|
||||
this.fetchData()
|
||||
},
|
||||
del(scope) {
|
||||
confirm("确定要删除吗?").then(res=>{
|
||||
if(res){
|
||||
deleteNoteImg(scope.row.noteImgId).then(response => {
|
||||
console.log(response)
|
||||
success('删除成功')
|
||||
this.fetchData()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
116
web/src/views/business/starNotes/addStarNotes.vue
Normal file
116
web/src/views/business/starNotes/addStarNotes.vue
Normal file
@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
top="8vh"
|
||||
width="40%"
|
||||
:visible.sync="dialogVisible"
|
||||
center
|
||||
@close="handleCancel"
|
||||
>
|
||||
<div class="el-dialog-div">
|
||||
<el-form
|
||||
:rules="rules"
|
||||
ref="dataForm"
|
||||
:model="temp"
|
||||
label-position="right"
|
||||
label-width="120px"
|
||||
style="height: 90%;"
|
||||
>
|
||||
|
||||
<el-form-item label="" prop="starNoteId" class="is-required">
|
||||
<el-input v-model="temp.starNoteId" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="" prop="noteId" class="is-required">
|
||||
<el-input v-model="temp.noteId" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="" prop="noteTitle" class="is-required">
|
||||
<el-input v-model="temp.noteTitle" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="被关注id" prop="authorId" class="is-required">
|
||||
<el-input v-model="temp.authorId" placeholder="被关注id" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="被关注名字" prop="authorName" class="is-required">
|
||||
<el-input v-model="temp.authorName" placeholder="被关注名字" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关注者" prop="followId" class="is-required">
|
||||
<el-input v-model="temp.followId" placeholder="关注者" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关注者名字" prop="followName" class="is-required">
|
||||
<el-input v-model="temp.followName" placeholder="关注者名字" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="创建时间" prop="createTime" class="is-required">
|
||||
<el-input v-model="temp.createTime" placeholder="创建时间" />
|
||||
</el-form-item>
|
||||
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleCancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {addStarNotes} from "@/api/business/starNotes/starNotes";
|
||||
import {setRequiredFields} from "@/utils";
|
||||
const requiredFields = []
|
||||
export default {
|
||||
name: "addForm",
|
||||
data() {
|
||||
return {
|
||||
rules: setRequiredFields(requiredFields),
|
||||
dialogVisible: false,
|
||||
temp: {
|
||||
starNoteId:'',
|
||||
noteId:'',
|
||||
noteTitle:'',
|
||||
authorId:'',
|
||||
authorName:'',
|
||||
followId:'',
|
||||
followName:'',
|
||||
createTime:'',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.dialogVisible = true
|
||||
},
|
||||
submit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
addStarNotes(this.temp).then(response =>{
|
||||
this.handleCancel()
|
||||
this.$emit('ok', response.data)
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!!');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCancel() {
|
||||
//初始化
|
||||
this.temp = this.$options.data().temp
|
||||
this.dialogVisible = false
|
||||
this.$refs['dataForm'].resetFields();
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
117
web/src/views/business/starNotes/editStarNotes.vue
Normal file
117
web/src/views/business/starNotes/editStarNotes.vue
Normal file
@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
top="8vh"
|
||||
width="40%"
|
||||
:visible.sync="dialogVisible"
|
||||
center
|
||||
@close="handleCancel"
|
||||
>
|
||||
<div class="el-dialog-div">
|
||||
<el-form
|
||||
:rules="rules"
|
||||
ref="dataForm"
|
||||
:model="temp"
|
||||
label-position="right"
|
||||
label-width="120px"
|
||||
style="height: 90%;"
|
||||
>
|
||||
|
||||
<el-form-item label="" prop="starNoteId" class="is-required">
|
||||
<el-input v-model="temp.starNoteId" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="" prop="noteId" class="is-required">
|
||||
<el-input v-model="temp.noteId" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="" prop="noteTitle" class="is-required">
|
||||
<el-input v-model="temp.noteTitle" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="被关注id" prop="authorId" class="is-required">
|
||||
<el-input v-model="temp.authorId" placeholder="被关注id" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="被关注名字" prop="authorName" class="is-required">
|
||||
<el-input v-model="temp.authorName" placeholder="被关注名字" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关注者" prop="followId" class="is-required">
|
||||
<el-input v-model="temp.followId" placeholder="关注者" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关注者名字" prop="followName" class="is-required">
|
||||
<el-input v-model="temp.followName" placeholder="关注者名字" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="创建时间" prop="createTime" class="is-required">
|
||||
<el-input v-model="temp.createTime" placeholder="创建时间" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleCancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { editStarNotes } from "@/api/business/starNotes/starNotes";
|
||||
import {setRequiredFields} from "@/utils";
|
||||
const requiredFields = []
|
||||
|
||||
export default {
|
||||
name: "editForm",
|
||||
data() {
|
||||
return {
|
||||
rules: setRequiredFields(requiredFields),
|
||||
dialogVisible: false,
|
||||
temp: {
|
||||
starNoteId:'',
|
||||
noteId:'',
|
||||
noteTitle:'',
|
||||
authorId:'',
|
||||
authorName:'',
|
||||
followId:'',
|
||||
followName:'',
|
||||
createTime:'',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(row) {
|
||||
this.temp = this.$options.data().temp
|
||||
this.temp = row
|
||||
this.dialogVisible = true
|
||||
},
|
||||
submit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
editStarNotes(this.temp).then(response => {
|
||||
this.handleCancel()
|
||||
this.$emit('ok', response.data)
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!!');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCancel() {
|
||||
//初始化
|
||||
this.temp = this.$options.data().temp
|
||||
this.dialogVisible = false
|
||||
this.$refs['dataForm'].resetFields()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
263
web/src/views/business/starNotes/starNotesList.vue
Normal file
263
web/src/views/business/starNotes/starNotesList.vue
Normal file
@ -0,0 +1,263 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<div class="filter-container">
|
||||
<el-input
|
||||
v-model="listQuery.keyword"
|
||||
size="small"
|
||||
placeholder="请输入关键词"
|
||||
clearable
|
||||
class="filter-item"
|
||||
style="width: 200px;margin-left: 10px;"
|
||||
/>
|
||||
<el-button-group style="margin-left: 10px;">
|
||||
<el-button
|
||||
size="small"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="search"
|
||||
>
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-refresh"
|
||||
@click="refresh"
|
||||
>
|
||||
重置
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
<el-button
|
||||
size="small"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
style="margin-left: 10px;"
|
||||
@click="add"
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="list"
|
||||
element-loading-text="Loading"
|
||||
border
|
||||
fit
|
||||
height="100%"
|
||||
class="table-container"
|
||||
highlight-current-row
|
||||
>
|
||||
|
||||
<el-table-column
|
||||
label="序号"
|
||||
width="150"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.$index+1 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label=""
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.starNoteId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label=""
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.noteId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label=""
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.noteTitle }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="被关注id"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.authorId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="被关注名字"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.authorName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="关注者"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.followId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="关注者名字"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.followName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.createTime }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
label="操作"
|
||||
width="200"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button-group>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
@click="edit(scope)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
@click="del(scope)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
:total="total"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.limit"
|
||||
@pagination="fetchData"
|
||||
/>
|
||||
|
||||
<add-form ref="addForm" @ok="addOk" />
|
||||
<edit-form ref="editForm" @ok="editOk" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getStarNotesPage,deleteStarNotes} from "@/api/business/starNotes/starNotes";
|
||||
import {deepClone,success} from "@/utils";
|
||||
|
||||
import confirm from "@/utils/confirm";
|
||||
import Pagination from '@/components/Pagination'
|
||||
import addForm from "@/views/business/starNotes/addStarNotes";
|
||||
import editForm from "@/views/business/starNotes/editStarNotes";
|
||||
|
||||
export default {
|
||||
name: 'starNotes',
|
||||
components: {addForm,editForm,Pagination},
|
||||
data() {
|
||||
return {
|
||||
total: 0,
|
||||
list: [],
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
page: 1,
|
||||
limit: 50,
|
||||
keyword: ''
|
||||
},
|
||||
temp: {},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
this.fetchData()
|
||||
},
|
||||
refresh() {
|
||||
this.listQuery = this.$options.data().listQuery
|
||||
this.fetchData()
|
||||
},
|
||||
fetchData() {
|
||||
this.listLoading = true
|
||||
getStarNotesPage(this.listQuery).then(response => {
|
||||
const { records, total } = response.data
|
||||
this.list = records
|
||||
this.total = total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
add(){
|
||||
this.$refs.addForm.open()
|
||||
},
|
||||
addOk(){
|
||||
this.fetchData()
|
||||
},
|
||||
edit(scope) {
|
||||
const temp = deepClone(scope.row)
|
||||
this.$refs.editForm.open(temp)
|
||||
},
|
||||
editOk(){
|
||||
this.fetchData()
|
||||
},
|
||||
del(scope) {
|
||||
confirm("确定要删除吗?").then(res=>{
|
||||
if(res){
|
||||
deleteStarNotes(scope.row.starNotesId).then(response => {
|
||||
console.log(response)
|
||||
success('删除成功')
|
||||
this.fetchData()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
116
web/src/views/business/upNotes/addUpNotes.vue
Normal file
116
web/src/views/business/upNotes/addUpNotes.vue
Normal file
@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
top="8vh"
|
||||
width="40%"
|
||||
:visible.sync="dialogVisible"
|
||||
center
|
||||
@close="handleCancel"
|
||||
>
|
||||
<div class="el-dialog-div">
|
||||
<el-form
|
||||
:rules="rules"
|
||||
ref="dataForm"
|
||||
:model="temp"
|
||||
label-position="right"
|
||||
label-width="120px"
|
||||
style="height: 90%;"
|
||||
>
|
||||
|
||||
<el-form-item label="" prop="upNoteId" class="is-required">
|
||||
<el-input v-model="temp.upNoteId" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="" prop="noteId" class="is-required">
|
||||
<el-input v-model="temp.noteId" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="" prop="noteTitle" class="is-required">
|
||||
<el-input v-model="temp.noteTitle" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="被关注id" prop="authorId" class="is-required">
|
||||
<el-input v-model="temp.authorId" placeholder="被关注id" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="被关注名字" prop="authorName" class="is-required">
|
||||
<el-input v-model="temp.authorName" placeholder="被关注名字" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关注者" prop="followId" class="is-required">
|
||||
<el-input v-model="temp.followId" placeholder="关注者" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关注者名字" prop="followName" class="is-required">
|
||||
<el-input v-model="temp.followName" placeholder="关注者名字" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="创建时间" prop="createTime" class="is-required">
|
||||
<el-input v-model="temp.createTime" placeholder="创建时间" />
|
||||
</el-form-item>
|
||||
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleCancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {addUpNotes} from "@/api/business/upNotes/upNotes";
|
||||
import {setRequiredFields} from "@/utils";
|
||||
const requiredFields = []
|
||||
export default {
|
||||
name: "addForm",
|
||||
data() {
|
||||
return {
|
||||
rules: setRequiredFields(requiredFields),
|
||||
dialogVisible: false,
|
||||
temp: {
|
||||
upNoteId:'',
|
||||
noteId:'',
|
||||
noteTitle:'',
|
||||
authorId:'',
|
||||
authorName:'',
|
||||
followId:'',
|
||||
followName:'',
|
||||
createTime:'',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.dialogVisible = true
|
||||
},
|
||||
submit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
addUpNotes(this.temp).then(response =>{
|
||||
this.handleCancel()
|
||||
this.$emit('ok', response.data)
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!!');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCancel() {
|
||||
//初始化
|
||||
this.temp = this.$options.data().temp
|
||||
this.dialogVisible = false
|
||||
this.$refs['dataForm'].resetFields();
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
117
web/src/views/business/upNotes/editUpNotes.vue
Normal file
117
web/src/views/business/upNotes/editUpNotes.vue
Normal file
@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
top="8vh"
|
||||
width="40%"
|
||||
:visible.sync="dialogVisible"
|
||||
center
|
||||
@close="handleCancel"
|
||||
>
|
||||
<div class="el-dialog-div">
|
||||
<el-form
|
||||
:rules="rules"
|
||||
ref="dataForm"
|
||||
:model="temp"
|
||||
label-position="right"
|
||||
label-width="120px"
|
||||
style="height: 90%;"
|
||||
>
|
||||
|
||||
<el-form-item label="" prop="upNoteId" class="is-required">
|
||||
<el-input v-model="temp.upNoteId" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="" prop="noteId" class="is-required">
|
||||
<el-input v-model="temp.noteId" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="" prop="noteTitle" class="is-required">
|
||||
<el-input v-model="temp.noteTitle" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="被关注id" prop="authorId" class="is-required">
|
||||
<el-input v-model="temp.authorId" placeholder="被关注id" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="被关注名字" prop="authorName" class="is-required">
|
||||
<el-input v-model="temp.authorName" placeholder="被关注名字" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关注者" prop="followId" class="is-required">
|
||||
<el-input v-model="temp.followId" placeholder="关注者" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="关注者名字" prop="followName" class="is-required">
|
||||
<el-input v-model="temp.followName" placeholder="关注者名字" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="创建时间" prop="createTime" class="is-required">
|
||||
<el-input v-model="temp.createTime" placeholder="创建时间" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleCancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { editUpNotes } from "@/api/business/upNotes/upNotes";
|
||||
import {setRequiredFields} from "@/utils";
|
||||
const requiredFields = []
|
||||
|
||||
export default {
|
||||
name: "editForm",
|
||||
data() {
|
||||
return {
|
||||
rules: setRequiredFields(requiredFields),
|
||||
dialogVisible: false,
|
||||
temp: {
|
||||
upNoteId:'',
|
||||
noteId:'',
|
||||
noteTitle:'',
|
||||
authorId:'',
|
||||
authorName:'',
|
||||
followId:'',
|
||||
followName:'',
|
||||
createTime:'',
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(row) {
|
||||
this.temp = this.$options.data().temp
|
||||
this.temp = row
|
||||
this.dialogVisible = true
|
||||
},
|
||||
submit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
editUpNotes(this.temp).then(response => {
|
||||
this.handleCancel()
|
||||
this.$emit('ok', response.data)
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!!');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCancel() {
|
||||
//初始化
|
||||
this.temp = this.$options.data().temp
|
||||
this.dialogVisible = false
|
||||
this.$refs['dataForm'].resetFields()
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
263
web/src/views/business/upNotes/upNotesList.vue
Normal file
263
web/src/views/business/upNotes/upNotesList.vue
Normal file
@ -0,0 +1,263 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<div class="filter-container">
|
||||
<el-input
|
||||
v-model="listQuery.keyword"
|
||||
size="small"
|
||||
placeholder="请输入关键词"
|
||||
clearable
|
||||
class="filter-item"
|
||||
style="width: 200px;margin-left: 10px;"
|
||||
/>
|
||||
<el-button-group style="margin-left: 10px;">
|
||||
<el-button
|
||||
size="small"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="search"
|
||||
>
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-refresh"
|
||||
@click="refresh"
|
||||
>
|
||||
重置
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
<el-button
|
||||
size="small"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
style="margin-left: 10px;"
|
||||
@click="add"
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="list"
|
||||
element-loading-text="Loading"
|
||||
border
|
||||
fit
|
||||
height="100%"
|
||||
class="table-container"
|
||||
highlight-current-row
|
||||
>
|
||||
|
||||
<el-table-column
|
||||
label="序号"
|
||||
width="150"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.$index+1 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label=""
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.upNoteId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label=""
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.noteId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label=""
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.noteTitle }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="被关注id"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.authorId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="被关注名字"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.authorName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="关注者"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.followId }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="关注者名字"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.followName }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.createTime }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
label="操作"
|
||||
width="200"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button-group>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
@click="edit(scope)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
@click="del(scope)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</el-button-group>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
:total="total"
|
||||
:page.sync="listQuery.page"
|
||||
:limit.sync="listQuery.limit"
|
||||
@pagination="fetchData"
|
||||
/>
|
||||
|
||||
<add-form ref="addForm" @ok="addOk" />
|
||||
<edit-form ref="editForm" @ok="editOk" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getUpNotesPage,deleteUpNotes} from "@/api/business/upNotes/upNotes";
|
||||
import {deepClone,success} from "@/utils";
|
||||
|
||||
import confirm from "@/utils/confirm";
|
||||
import Pagination from '@/components/Pagination'
|
||||
import addForm from "@/views/business/upNotes/addUpNotes";
|
||||
import editForm from "@/views/business/upNotes/editUpNotes";
|
||||
|
||||
export default {
|
||||
name: 'upNotes',
|
||||
components: {addForm,editForm,Pagination},
|
||||
data() {
|
||||
return {
|
||||
total: 0,
|
||||
list: [],
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
page: 1,
|
||||
limit: 50,
|
||||
keyword: ''
|
||||
},
|
||||
temp: {},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
this.fetchData()
|
||||
},
|
||||
refresh() {
|
||||
this.listQuery = this.$options.data().listQuery
|
||||
this.fetchData()
|
||||
},
|
||||
fetchData() {
|
||||
this.listLoading = true
|
||||
getUpNotesPage(this.listQuery).then(response => {
|
||||
const { records, total } = response.data
|
||||
this.list = records
|
||||
this.total = total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
add(){
|
||||
this.$refs.addForm.open()
|
||||
},
|
||||
addOk(){
|
||||
this.fetchData()
|
||||
},
|
||||
edit(scope) {
|
||||
const temp = deepClone(scope.row)
|
||||
this.$refs.editForm.open(temp)
|
||||
},
|
||||
editOk(){
|
||||
this.fetchData()
|
||||
},
|
||||
del(scope) {
|
||||
confirm("确定要删除吗?").then(res=>{
|
||||
if(res){
|
||||
deleteUpNotes(scope.row.upNotesId).then(response => {
|
||||
console.log(response)
|
||||
success('删除成功')
|
||||
this.fetchData()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
Loading…
x
Reference in New Issue
Block a user