(),
{
height: 50,
active: false,
- clickable: false
+ clickable: false,
+ groupName: ''
}
)
diff --git a/src/views/im/home/components/group/GroupMemberGrid.vue b/src/views/im/home/components/group/GroupMemberGrid.vue
index 5d304741a..20d2c30bc 100644
--- a/src/views/im/home/components/group/GroupMemberGrid.vue
+++ b/src/views/im/home/components/group/GroupMemberGrid.vue
@@ -8,12 +8,15 @@
class="relative flex flex-col items-center px-0.5 py-1"
:style="{ width: `${size! + 16}px` }"
>
+
(),
{
clickable: false,
- size: 38
+ size: 38,
+ groupName: ''
}
)
diff --git a/src/views/im/home/components/user/UserAvatar.vue b/src/views/im/home/components/user/UserAvatar.vue
index ed2cf0daf..4be0aed77 100644
--- a/src/views/im/home/components/user/UserAvatar.vue
+++ b/src/views/im/home/components/user/UserAvatar.vue
@@ -60,13 +60,16 @@ const props = withDefaults(
previewable?: boolean // 是否点头像直接放大预览;开启后忽略 clickable,不再弹名片
previewZIndex?: number // 预览层 z-index;放在高 z-index 弹层(如 UserInfoCard)里时需手动抬高
user?: User // 额外的用户信息,传了点击就不用现拉接口(弹名片用)
+ addSource?: number // 加好友来源;点头像弹 UserInfoCard 时透传给 FriendAddDialog(默认 1=搜索)
+ addSourceExtra?: string // 加好友来源附加:addSource=2(群聊)时传群名,话术拼为「我是 XX 群的 YY」
}>(),
{
size: 42,
radius: '15%',
clickable: true,
previewable: false,
- previewZIndex: 2000
+ previewZIndex: 2000,
+ addSource: 1 // @AI:是不是枚举下;
}
)
@@ -126,7 +129,12 @@ function handleClick(e: MouseEvent) {
}
// 情况一:有预传 user 信息:就直接用,省一次接口
if (props.user) {
- uiStore.openUserInfoCard(props.user, { x: e.clientX + 20, y: e.clientY })
+ uiStore.openUserInfoCard(
+ props.user,
+ { x: e.clientX + 20, y: e.clientY },
+ props.addSource,
+ props.addSourceExtra
+ )
return
}
// 情况二:无预传 user 信息:打开名片,传最小必要信息(id + 昵称 + 头像),位置在鼠标右侧
@@ -140,7 +148,9 @@ function handleClick(e: MouseEvent) {
nickname: props.name,
avatar: props.url
},
- { x: e.clientX + 20, y: e.clientY }
+ { x: e.clientX + 20, y: e.clientY },
+ props.addSource,
+ props.addSourceExtra
)
}
diff --git a/src/views/im/home/components/user/UserInfo.vue b/src/views/im/home/components/user/UserInfo.vue
index a9535dc46..237b176e1 100644
--- a/src/views/im/home/components/user/UserInfo.vue
+++ b/src/views/im/home/components/user/UserInfo.vue
@@ -139,6 +139,14 @@
加为好友
+
+
+
@@ -149,7 +157,8 @@ import Icon from '@/components/Icon/src/Icon.vue'
import { useMessage } from '@/hooks/web/useMessage'
import UserAvatar from './UserAvatar.vue'
-import { getSimpleUser } from '@/api/system/user'
+import FriendAddDialog from '../friend/FriendAddDialog.vue'
+import { getSimpleUser, type UserVO } from '@/api/system/user'
import { useFriendStore } from '../../store/friendStore'
import { getGenderColor, getGenderIcon } from '../../../utils/user'
import type { User } from '../../types'
@@ -174,10 +183,15 @@ const props = withDefaults(
displayName?: string
/** UserAvatar 预览层 z-index;放在高 z-index 浮层(如 UserInfoCard)里需手动抬高 */
previewZIndex?: number
+ /** 加好友来源:1=搜索 2=群聊 3=扫码 4=名片;默认 1(搜索);参见 ImFriendAddSourceEnum */
+ addSource?: number
+ /** 来源附带信息:addSource=2(群聊)时传群名,用于「我是 XX 群的 YY」预填话术 */
+ addSourceExtra?: string
}>(),
{
relation: 'readonly',
- previewZIndex: 2000
+ previewZIndex: 2000,
+ addSource: 1
}
)
@@ -281,16 +295,26 @@ function handleChat() {
emit('chat', props.user)
}
-/** 加为好友:成功后 friendStore 反应到 isFriend,父级的 relation 自然翻 friend,本组件随之换装到 3 图标 */
-async function handleAddFriend() {
+// TODO @AI:添加好友、删除好友,作为一个 ==== 栏目,这样好理解点;
+
+// 加好友弹窗显隐 + 预填用户(点「加为好友」时把 props.user 传给 FriendAddDialog 跳过搜索)
+const addFriendVisible = ref(false)
+const presetUserForAdd = ref