diff --git a/backend/IM_API/Controllers/AuthController.cs b/backend/IM_API/Controllers/AuthController.cs index 7e15bcc..612e647 100644 --- a/backend/IM_API/Controllers/AuthController.cs +++ b/backend/IM_API/Controllers/AuthController.cs @@ -53,6 +53,7 @@ namespace IM_API.Controllers return Ok(res); } [HttpPost] + [ProducesResponseType(typeof(BaseResponse),StatusCodes.Status200OK)] public async Task Refresh(RefreshDto dto) { (bool ok,int userId) = await _refreshTokenService.ValidateRefreshTokenAsync(dto.refreshToken); diff --git a/frontend/web/src/services/auth.js b/frontend/web/src/services/auth.js index e3f62e5..8654008 100644 --- a/frontend/web/src/services/auth.js +++ b/frontend/web/src/services/auth.js @@ -13,5 +13,11 @@ export const authService = { * @param {*} data * @returns */ - register: (data) => request.post('/auth/register', data) + register: (data) => request.post('/auth/register', data), + /** + * 刷新用户凭证 + * @param {*} data + * @returns + */ + refresh: (refreshToken) => request.post('/auth/refresh', { refreshToken }) } \ No newline at end of file diff --git a/frontend/web/src/views/contact/ContactList.vue b/frontend/web/src/views/contact/ContactList.vue index 0e7f2df..e9ebd99 100644 --- a/frontend/web/src/views/contact/ContactList.vue +++ b/frontend/web/src/views/contact/ContactList.vue @@ -30,9 +30,9 @@ class="list-item" :class="{active: activeContactId === c.id}" @click="activeContactId = c.id"> - +
-
{{ c.name }}
+
{{ c.remarkName }}
@@ -43,21 +43,21 @@

- {{ currentContact.name }} - - {{ currentContact.gender === 'm' ? '♂' : '♀' }} + {{ currentContact.remarkName }} + + {{ '♂' }}

-

微信号:{{ currentContact.wxid }}

-

地区:{{ currentContact.region }}

+

账号:{{ currentContact.userInfo.username }}

+

地区:{{ '未知' }}

- +
- 备注名 - {{ currentContact.alias || '未设置' }} + 昵称 + {{ currentContact.userInfo.nickName }}
个性签名 @@ -65,7 +65,7 @@
来源 - 通过搜索微信号添加 + 通过搜索账号添加
@@ -91,20 +91,24 @@ import { friendService } from '@/services/friend' const searchQuery = ref('') const activeContactId = ref(null) -const contacts1 = ref([]); +const contacts = ref([]); -// 模拟联系人数据 -const contacts = ref([ - { id: 1, name: '南浔', wxid: 'nan_xun_99', region: '浙江 杭州', avatar: 'https://i.pravatar.cc/40?1', gender: 'f', signature: '山有木兮木有枝', alias: '南酱' }, - { id: 102, name: '老张', wxid: 'zhang_boss', region: '广东 深圳', avatar: 'https://i.pravatar.cc/40?10', gender: 'm', signature: '搞钱要紧', alias: '张总' }, - { id: 103, name: 'UI小王', wxid: 'wang_design', region: '上海 黄浦', avatar: 'https://i.pravatar.cc/40?5', gender: 'f', signature: '不改了,真的不改了', alias: '' }, - { id: 104, name: '测试组长', wxid: 'test_pro', region: '北京', avatar: 'https://i.pravatar.cc/40?8', gender: 'm', signature: 'Bug 哪里跑', alias: '铁面人' } -]) const filteredContacts = computed(() => { - return contacts.value.filter(c => - c.name.includes(searchQuery.value) || c.wxid.includes(searchQuery.value) - ) + const searchKey = searchQuery.value.toString().trim(); + if(!searchKey){ + return contacts.value; + } + + + return contacts.value.filter(c => { + if (!c) return false + + const remark = c.remarkName || '' + const username = c.userInfo.username || '' + + return remark.includes(searchKey) || username.includes(searchKey) + }) }) const currentContact = computed(() => { @@ -121,15 +125,14 @@ function handleGoToChat() { const loadContactList = async (page = 1,limit = 100) => { const res = await friendService.getFriendList(page,limit); - contacts1.value = res.data; + contacts.value = res.data; + console.log(contacts.value) } onMounted(async () => { await loadContactList(); - const contacts = await friendService.getFriendList(); - console.log(contacts) })