diff --git a/Yi.BBS.Vue3/src/apis/commentApi.js b/Yi.BBS.Vue3/src/apis/commentApi.js index 78e2a034..84e4d43c 100644 --- a/Yi.BBS.Vue3/src/apis/commentApi.js +++ b/Yi.BBS.Vue3/src/apis/commentApi.js @@ -12,4 +12,11 @@ export function add(data){ method: 'post', data:data }) +}; + +export function del(ids){ + return myaxios({ + url: `/comment/${ids}`, + method: 'delete' + }) }; \ No newline at end of file diff --git a/Yi.BBS.Vue3/src/components/BottomInfo.vue b/Yi.BBS.Vue3/src/components/BottomInfo.vue index 4dcca62c..b1ebbe07 100644 --- a/Yi.BBS.Vue3/src/components/BottomInfo.vue +++ b/Yi.BBS.Vue3/src/components/BottomInfo.vue @@ -1,25 +1,36 @@ \ No newline at end of file diff --git a/Yi.BBS.Vue3/src/components/CommentInfo.vue b/Yi.BBS.Vue3/src/components/CommentInfo.vue index 4df5fe33..67c98f99 100644 --- a/Yi.BBS.Vue3/src/components/CommentInfo.vue +++ b/Yi.BBS.Vue3/src/components/CommentInfo.vue @@ -32,21 +32,23 @@ 4 - 回复 + 回复 + 删除
回复 +
- +
- 回复@{{ children.commentedUser.nick }} + 回复@{{ children.commentedUser.nick }}
{{ children.content }} @@ -55,8 +57,8 @@ 0 - 回复 - + 回复 + 删除
@@ -74,7 +76,7 @@ diff --git a/Yi.BBS.Vue3/src/views/Article.vue b/Yi.BBS.Vue3/src/views/Article.vue index 48f70454..7b088198 100644 --- a/Yi.BBS.Vue3/src/views/Article.vue +++ b/Yi.BBS.Vue3/src/views/Article.vue @@ -58,7 +58,9 @@ + + @@ -126,7 +128,7 @@ import AvatarInfo from "@/components/AvatarInfo.vue"; import InfoCard from "@/components/InfoCard.vue"; import ArticleContentInfo from "@/components/ArticleContentInfo.vue"; import CommentInfo from "@/components/CommentInfo.vue"; - +import BottomInfo from '@/components/BottomInfo.vue' import TreeArticleInfo from "@/components/TreeArticleInfo.vue"; import { useRoute, useRouter } from "vue-router"; diff --git a/Yi.BBS.Vue3/src/views/Discuss.vue b/Yi.BBS.Vue3/src/views/Discuss.vue index 49647607..834d03e6 100644 --- a/Yi.BBS.Vue3/src/views/Discuss.vue +++ b/Yi.BBS.Vue3/src/views/Discuss.vue @@ -58,14 +58,14 @@
- +
- +
+
+ + + + @@ -90,7 +95,7 @@ import DisscussCard from '@/components/DisscussCard.vue' import {getList,getTopList} from '@/apis/discussApi.js' import { onMounted, ref,reactive } from 'vue' import { useRoute,useRouter } from 'vue-router' - +import BottomInfo from '@/components/BottomInfo.vue' //数据定义 const route=useRoute() const router=useRouter() diff --git a/Yi.BBS.Vue3/src/views/Index.vue b/Yi.BBS.Vue3/src/views/Index.vue index 61349f8a..1d45bced 100644 --- a/Yi.BBS.Vue3/src/views/Index.vue +++ b/Yi.BBS.Vue3/src/views/Index.vue @@ -10,11 +10,11 @@ - + - + diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/ApplicationContractsSwaggerDoc.xml b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/ApplicationContractsSwaggerDoc.xml index 12192b58..99ba1b06 100644 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/ApplicationContractsSwaggerDoc.xml +++ b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/ApplicationContractsSwaggerDoc.xml @@ -94,6 +94,11 @@ Discuss输入创建对象 + + + 是否已点赞 + + Label输入创建对象 diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/Exhibition/Dtos/Argee/ArgeeDto.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/Exhibition/Dtos/Argee/AgreeDto.cs similarity index 74% rename from Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/Exhibition/Dtos/Argee/ArgeeDto.cs rename to Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/Exhibition/Dtos/Argee/AgreeDto.cs index 25391e8f..a2a1465d 100644 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/Exhibition/Dtos/Argee/ArgeeDto.cs +++ b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/Exhibition/Dtos/Argee/AgreeDto.cs @@ -6,12 +6,12 @@ using System.Threading.Tasks; namespace Yi.BBS.Application.Contracts.Exhibition.Dtos.Argee { - public class ArgeeDto + public class AgreeDto { - public ArgeeDto(bool isArgee) + public AgreeDto(bool isAgree) { - IsArgee = isArgee; - if (isArgee) + IsAgree = isAgree; + if (isAgree) { Message = "点赞成功,点赞+1"; @@ -24,7 +24,7 @@ namespace Yi.BBS.Application.Contracts.Exhibition.Dtos.Argee } - public bool IsArgee { get; set; } + public bool IsAgree { get; set; } public string Message { get; set; } } } diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/Exhibition/AgreeService.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/Exhibition/AgreeService.cs index 75f4fa5f..fb41f751 100644 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/Exhibition/AgreeService.cs +++ b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/Exhibition/AgreeService.cs @@ -37,7 +37,7 @@ namespace Yi.BBS.Application.Exhibition /// 点赞,返回true为点赞+1,返回false为点赞-1 /// /// - public async Task PostOperateAsync(long discussId) + public async Task PostOperateAsync(long discussId) { var entity = await _repository.GetFirstAsync(x => x.DiscussId == discussId && x.CreatorId == _currentUser.Id); //判断是否已经点赞过 @@ -56,7 +56,7 @@ namespace Yi.BBS.Application.Exhibition await _discssRepository.UpdateAsync(discussEntity); uow.Commit(); } - return new ArgeeDto(true); + return new AgreeDto(true); } else @@ -75,7 +75,7 @@ namespace Yi.BBS.Application.Exhibition uow.Commit(); } - return new ArgeeDto(false); + return new AgreeDto(false); } } } diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/yi-sqlsugar-dev.db b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/yi-sqlsugar-dev.db index a88251c3..10ea2779 100644 Binary files a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/yi-sqlsugar-dev.db differ diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/ApplicationContractsSwaggerDoc.xml b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/ApplicationContractsSwaggerDoc.xml index 12192b58..99ba1b06 100644 --- a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/ApplicationContractsSwaggerDoc.xml +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/ApplicationContractsSwaggerDoc.xml @@ -94,6 +94,11 @@ Discuss输入创建对象 + + + 是否已点赞 + + Label输入创建对象 diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Argee/ArgeeDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Argee/ArgeeDto.cs deleted file mode 100644 index 25391e8f..00000000 --- a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Argee/ArgeeDto.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.BBS.Application.Contracts.Exhibition.Dtos.Argee -{ - public class ArgeeDto - { - public ArgeeDto(bool isArgee) - { - IsArgee = isArgee; - if (isArgee) - { - - Message = "点赞成功,点赞+1"; - } - else - { - - Message = "取消点赞,点赞-1"; - } - - } - - public bool IsArgee { get; set; } - public string Message { get; set; } - } -} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussGetListOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussGetListOutputDto.cs index 13acca07..c7f972d6 100644 --- a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussGetListOutputDto.cs +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussGetListOutputDto.cs @@ -11,7 +11,10 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss { public class DiscussGetListOutputDto : IEntityDto { - + /// + /// Ƿѵ + /// + public bool IsAgree { get; set; } public long Id { get; set; } public string Title { get; set; } public string Types { get; set; } diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Exhibition/AgreeService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Exhibition/AgreeService.cs index 75f4fa5f..fb41f751 100644 --- a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Exhibition/AgreeService.cs +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Exhibition/AgreeService.cs @@ -37,7 +37,7 @@ namespace Yi.BBS.Application.Exhibition /// 点赞,返回true为点赞+1,返回false为点赞-1 /// /// - public async Task PostOperateAsync(long discussId) + public async Task PostOperateAsync(long discussId) { var entity = await _repository.GetFirstAsync(x => x.DiscussId == discussId && x.CreatorId == _currentUser.Id); //判断是否已经点赞过 @@ -56,7 +56,7 @@ namespace Yi.BBS.Application.Exhibition await _discssRepository.UpdateAsync(discussEntity); uow.Commit(); } - return new ArgeeDto(true); + return new AgreeDto(true); } else @@ -75,7 +75,7 @@ namespace Yi.BBS.Application.Exhibition uow.Commit(); } - return new ArgeeDto(false); + return new AgreeDto(false); } } } diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/DiscussService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/DiscussService.cs index b86e9cf9..9bb79847 100644 --- a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/DiscussService.cs +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/DiscussService.cs @@ -17,6 +17,8 @@ using Yi.RBAC.Application.Contracts.Identity.Dtos; using Cike.EventBus.DistributedEvent; using Yi.BBS.Domain.Shared.Forum.Etos; using Yi.BBS.Domain.Shared.Forum.EnumClasses; +using Yi.Framework.Core.CurrentUsers; +using Yi.BBS.Domain.Exhibition.Entities; namespace Yi.BBS.Application.Forum { @@ -36,6 +38,8 @@ namespace Yi.BBS.Application.Forum [Autowired] private IDistributedEventBus _distributedEventBus { get; set; } + [Autowired] + private ICurrentUser _currentUser { get; set; } /// /// 单查 /// @@ -47,10 +51,13 @@ namespace Yi.BBS.Application.Forum var item = await _DbQueryable.LeftJoin((discuss, user) => discuss.CreatorId == user.Id) .Select((discuss, user) => new DiscussGetOutputDto { - User = new UserGetListOutputDto() { UserName = user.UserName, Nick = user.Nick,Icon=user.Icon } - }, true).SingleAsync(discuss => discuss.Id==id); - - _distributedEventBus.PublishAsync(new SeeDiscussEventArgs { DiscussId= item.Id, OldSeeNum= item .SeeNum}); + User = new UserGetListOutputDto() { UserName = user.UserName, Nick = user.Nick, Icon = user.Icon } + }, true).SingleAsync(discuss => discuss.Id == id); + if (item is not null) + { + _distributedEventBus.PublishAsync(new SeeDiscussEventArgs { DiscussId = item.Id, OldSeeNum = item.SeeNum }); + } + return item; } @@ -61,21 +68,24 @@ namespace Yi.BBS.Application.Forum /// /// - public override async Task> GetListAsync( [FromQuery] DiscussGetListInputVo input) + public override async Task> GetListAsync([FromQuery] DiscussGetListInputVo input) { //需要关联创建者用户 RefAsync total = 0; var items = await _DbQueryable .WhereIF(!string.IsNullOrEmpty(input.Title), x => x.Title.Contains(input.Title)) .WhereIF(input.PlateId is not null, x => x.PlateId == input.PlateId) - .Where(x=>x.IsTop==input.IsTop) - .OrderByIF(input.Type==QueryDiscussTypeEnum.New, x =>x.CreationTime,OrderByType.Desc ) + .Where(x => x.IsTop == input.IsTop) + .OrderByIF(input.Type == QueryDiscussTypeEnum.New, x => x.CreationTime, OrderByType.Desc) .OrderByIF(input.Type == QueryDiscussTypeEnum.Host, x => x.SeeNum, OrderByType.Desc) .OrderByIF(input.Type == QueryDiscussTypeEnum.Suggest, x => x.AgreeNum, OrderByType.Desc) - .LeftJoin((discuss, user) => discuss.CreatorId==user.Id) - .Select((discuss,user) =>new DiscussGetListOutputDto { - User=new UserGetListOutputDto() { UserName=user.UserName,Nick=user.Nick, Icon = user.Icon } - },true) + .LeftJoin((discuss, user) => discuss.CreatorId == user.Id) + .Select((discuss, user) => new DiscussGetListOutputDto + { + Id=discuss.Id, + IsAgree = SqlFunc.Subqueryable().Where(x => x.CreatorId == _currentUser.Id && x.DiscussId == discuss.Id).Any(), + User = new UserGetListOutputDto() { UserName = user.UserName, Nick = user.Nick, Icon = user.Icon } + }, true) .ToPageListAsync(input.PageNum, input.PageSize, total); return new PagedResultDto(total, items); } diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/yi-sqlsugar-dev.db b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/yi-sqlsugar-dev.db index a88251c3..10ea2779 100644 Binary files a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/yi-sqlsugar-dev.db differ