feature-nxdev #41
@@ -26,7 +26,9 @@ namespace IM_API.Configs
|
|||||||
.ForMember(dest => dest.IsDeleted,opt => opt.MapFrom(src => 0))
|
.ForMember(dest => dest.IsDeleted,opt => opt.MapFrom(src => 0))
|
||||||
;
|
;
|
||||||
//好友信息模型转换
|
//好友信息模型转换
|
||||||
CreateMap<Friend, FriendInfoDto>();
|
CreateMap<Friend, FriendInfoDto>()
|
||||||
|
.ForMember(dest => dest.UserInfo, opt => opt.MapFrom(src => src.FriendNavigation))
|
||||||
|
;
|
||||||
//好友请求通过后新增好友关系
|
//好友请求通过后新增好友关系
|
||||||
CreateMap<FriendRequest, Friend>()
|
CreateMap<FriendRequest, Friend>()
|
||||||
.ForMember(dest => dest.UserId , opt => opt.MapFrom(src => src.RequestUser))
|
.ForMember(dest => dest.UserId , opt => opt.MapFrom(src => src.RequestUser))
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace IM_API.Dtos
|
|||||||
public string RemarkName { get; init; } = string.Empty;
|
public string RemarkName { get; init; } = string.Empty;
|
||||||
|
|
||||||
public string? Avatar { get; init; }
|
public string? Avatar { get; init; }
|
||||||
|
public UserInfoDto UserInfo { get; init; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public record FriendRequestHandleDto
|
public record FriendRequestHandleDto
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace IM_API.Services
|
|||||||
|
|
||||||
public async Task<List<FriendInfoDto>> GetFriendListAsync(int userId, int page, int limit, bool desc)
|
public async Task<List<FriendInfoDto>> GetFriendListAsync(int userId, int page, int limit, bool desc)
|
||||||
{
|
{
|
||||||
var query = _context.Friends.Where(x => x.UserId == userId && x.Status == (sbyte)FriendStatus.Added);
|
var query = _context.Friends.Include(u => u.FriendNavigation).Where(x => x.UserId == userId && x.Status == (sbyte)FriendStatus.Added);
|
||||||
if (desc)
|
if (desc)
|
||||||
{
|
{
|
||||||
query = query.OrderByDescending(x => x.UserId);
|
query = query.OrderByDescending(x => x.UserId);
|
||||||
|
|||||||
@@ -87,6 +87,7 @@
|
|||||||
import { ref, computed, onMounted } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
import { friendService } from '@/services/friend'
|
import { friendService } from '@/services/friend'
|
||||||
|
|
||||||
|
|
||||||
const searchQuery = ref('')
|
const searchQuery = ref('')
|
||||||
const activeContactId = ref(null)
|
const activeContactId = ref(null)
|
||||||
|
|
||||||
@@ -123,8 +124,12 @@ const loadContactList = async (page = 1,limit = 100) => {
|
|||||||
contacts1.value = res.data;
|
contacts1.value = res.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await loadContactList();
|
await loadContactList();
|
||||||
|
const contacts = await friendService.getFriendList();
|
||||||
|
console.log(contacts)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user