From aaba03d0010b6b72f8fb8ce2f93128e42c6684ab Mon Sep 17 00:00:00 2001
From: dylanmay <670374839@qq.com>
Date: Fri, 22 Sep 2023 16:30:43 +0800
Subject: [PATCH] update friend
---
src/views/chat/ChatPage/Index.vue | 4 ++-
.../chat/components/FriendDetail/Index.vue | 29 +++++++++++++++++++
.../chat/components/FriendItem/Index.vue | 16 ++++------
src/views/chat/components/Friends/Index.vue | 11 +++++--
.../chat/components/ToolSection/Index.vue | 2 +-
src/views/chat/store/friendstore.ts | 9 ++++--
6 files changed, 55 insertions(+), 16 deletions(-)
create mode 100644 src/views/chat/components/FriendDetail/Index.vue
diff --git a/src/views/chat/ChatPage/Index.vue b/src/views/chat/ChatPage/Index.vue
index e81604a5..47a4bc0c 100644
--- a/src/views/chat/ChatPage/Index.vue
+++ b/src/views/chat/ChatPage/Index.vue
@@ -3,11 +3,12 @@
-
+
+
@@ -22,6 +23,7 @@ import Friends from '../components/Friends/Index.vue'
import ChatHeader from '../components/ChatHeader/Index.vue'
import ChatMessage from '../components/ChatMessage/Index.vue'
import InputSection from '../components/InputSection/index.vue'
+import FriendDetail from '../components/FriendDetail/Index.vue'
import { MENU_LIST_ENUM } from '../types/index.d.ts'
defineOptions({ name: 'ChatPage' })
diff --git a/src/views/chat/components/FriendDetail/Index.vue b/src/views/chat/components/FriendDetail/Index.vue
new file mode 100644
index 00000000..474ebfcd
--- /dev/null
+++ b/src/views/chat/components/FriendDetail/Index.vue
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/chat/components/FriendItem/Index.vue b/src/views/chat/components/FriendItem/Index.vue
index 0cd5d841..9f3eaea7 100644
--- a/src/views/chat/components/FriendItem/Index.vue
+++ b/src/views/chat/components/FriendItem/Index.vue
@@ -7,26 +7,22 @@
diff --git a/src/views/chat/components/Friends/Index.vue b/src/views/chat/components/Friends/Index.vue
index 80cf8113..55df4e29 100644
--- a/src/views/chat/components/Friends/Index.vue
+++ b/src/views/chat/components/Friends/Index.vue
@@ -5,10 +5,11 @@
>
onFriendClick(item)"
/>
@@ -18,11 +19,17 @@
import FriendItem from '../FriendItem/Index.vue'
import { useFriendStore } from '../../store/friendstore'
import { onMounted } from 'vue'
+import Friend from '../../model/Friend'
defineOptions({ name: 'Friends' })
-const { friendList } = useFriendStore()
+const friendStore = useFriendStore()
onMounted(() => {
// set default conversation
})
+
+const onFriendClick = (friend: Friend) => {
+ console.log('====>', friend)
+ friendStore.setCurrentFriend(friend)
+}
diff --git a/src/views/chat/components/ToolSection/Index.vue b/src/views/chat/components/ToolSection/Index.vue
index 405fdbfe..769e6639 100644
--- a/src/views/chat/components/ToolSection/Index.vue
+++ b/src/views/chat/components/ToolSection/Index.vue
@@ -1,5 +1,5 @@
-
+
+ currentFriend: Friend | null
}
export const useFriendStore = defineStore('friendStore', {
@@ -25,7 +26,8 @@ export const useFriendStore = defineStore('friendStore', {
description: 'hero',
createTime: 1695201147622
}
- ]
+ ],
+ currentFriend: null
}),
getters: {
@@ -35,8 +37,11 @@ export const useFriendStore = defineStore('friendStore', {
},
actions: {
- addSession(session: BaseConversation) {
+ addFriend(session: BaseConversation) {
this.friendList.push(session)
+ },
+ setCurrentFriend(friend: Friend) {
+ this.currentFriend = friend
}
}
})