From ca4e2b7dd5ba27ce3688c6859728ad620ae7d119 Mon Sep 17 00:00:00 2001 From: chuyang02 <208526470@qq.com> Date: Mon, 12 Jan 2026 16:44:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BE=A7=E6=A0=8F=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=81=94=E7=B3=BB=E4=BA=BA=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/web/src/views/Main.vue | 18 ++++++++++++++++-- frontend/web/src/views/contact/ContactList.vue | 4 ++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/frontend/web/src/views/Main.vue b/frontend/web/src/views/Main.vue index 0036541..0c0f47c 100644 --- a/frontend/web/src/views/Main.vue +++ b/frontend/web/src/views/Main.vue @@ -8,7 +8,7 @@ 👤 ⚙️ - + @@ -17,11 +17,25 @@ import { ref, watch } from 'vue' import { useAuthStore } from '@/stores/auth'; import defaultAvatar from '@/assets/default_avatar.png' +import { useRouter } from 'vue-router'; +const router = useRouter(); const authStore = useAuthStore(); const myInfo = authStore.userInfo; +// 监听用户信息变化(如头像更新) +watch(() => authStore.userInfo, (newInfo) => { + myInfo.value = newInfo; +}); +function handleStartChat(contact) { + if (contact && contact.id) { + // 导航到消息页面并传递联系人 ID + router.push(`/messages/chat/${contact.id}`); + } else { + console.error('Invalid contact object:', contact); + } +} \ 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 8a09534..231d4c5 100644 --- a/frontend/web/src/views/contact/ContactList.vue +++ b/frontend/web/src/views/contact/ContactList.vue @@ -94,7 +94,7 @@ const contacts1 = ref([]); // 模拟联系人数据 const contacts = ref([ - { id: 101, name: '南浔', wxid: 'nan_xun_99', region: '浙江 杭州', avatar: 'https://i.pravatar.cc/40?1', gender: 'f', signature: '山有木兮木有枝', alias: '南酱' }, + { 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: '铁面人' } @@ -205,7 +205,7 @@ onMounted(async () => { align-items: center; justify-content: center; color: #fff; - font-size: 18px; + font-size: 16px; } .icon-box.orange { background: #faad14; } .icon-box.green { background: #52c41a; }