From 06502ebaa03729c18f02e797719aef6ad49833b1 Mon Sep 17 00:00:00 2001 From: yinkang Date: Wed, 2 Jul 2025 11:16:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B3=A8=E9=87=8A=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=A5=BD=E5=8F=8B=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/user/UserCardModal.vue | 51 ++++--- src/views/message/inner/IndexContent.vue | 32 ++--- src/views/message/inner/IndexSider.vue | 125 +++++++++--------- .../message/inner/panel/PanelContent.vue | 1 - 4 files changed, 110 insertions(+), 99 deletions(-) diff --git a/src/components/user/UserCardModal.vue b/src/components/user/UserCardModal.vue index 022a75b..58d414e 100644 --- a/src/components/user/UserCardModal.vue +++ b/src/components/user/UserCardModal.vue @@ -13,8 +13,8 @@ import { useUtil } from '@/hooks/useUtil' const { useMessage } = useUtil() -const isFriend = ref(false) // 是否是我的好友 -const showBtn = ref(false) +// const isFriend = ref(false) // 是否是我的好友 +// const showBtn = ref(false) const router = useRouter() const talkStore = useTalkStore() @@ -177,26 +177,26 @@ const onToTalk = () => { // } // 添加好友 -const addFriend = () => { - let params = { - receiver_id: props.uid, //聊天的用户id - talk_type: 1 - } - ServeAddFriend(params).then((res) => { - if (res?.code === 200) { - useMessage.success('添加成功') - isFriend.value = !isFriend.value - } - }) -} +// const addFriend = () => { +// let params = { +// receiver_id: props.uid, //聊天的用户id +// talk_type: 1 +// } +// ServeAddFriend(params).then((res) => { +// if (res?.code === 200) { +// useMessage.success('添加成功') +// isFriend.value = !isFriend.value +// } +// }) +// } const onAfterEnter = () => { onLoadData() - ServeCheckFriend({ receiver_id: props.uid, talk_type: 1 }).then((res) => { - if (res?.code === 200) { - showBtn.value = true - isFriend.value = res.data?.is_friend || false - } - }) + // ServeCheckFriend({ receiver_id: props.uid, talk_type: 1 }).then((res) => { + // if (res?.code === 200) { + // showBtn.value = true + // isFriend.value = res.data?.is_friend || false + // } + // }) } const onAfterLeave = () => { // loading.value = true @@ -293,7 +293,14 @@ const onAfterLeave = () => {
{{ userInfo.enter_date }}
-
+ + +
+ + 发送消息 +
+
+
diff --git a/src/views/message/inner/IndexContent.vue b/src/views/message/inner/IndexContent.vue index bbfb77f..4180522 100644 --- a/src/views/message/inner/IndexContent.vue +++ b/src/views/message/inner/IndexContent.vue @@ -124,20 +124,20 @@ const events = { } } -const isFriend = ref(true) // 是否为好友 -// 添加好友 -const AddFriends = () => { - let params = { - receiver_id: talkParams.receiver_id, //聊天的用户id - talk_type: 1 - } - ServeAddFriend(params).then((res) => { - if (res?.code === 200) { - isFriend.value = !isFriend.value - useMessage.success('添加成功') - } - }) -} +// const isFriend = ref(true) // 是否为好友 +// // 添加好友 +// const AddFriends = () => { +// let params = { +// receiver_id: talkParams.receiver_id, //聊天的用户id +// talk_type: 1 +// } +// ServeAddFriend(params).then((res) => { +// if (res?.code === 200) { +// isFriend.value = !isFriend.value +// useMessage.success('添加成功') +// } +// }) +// } watch( () => talkParams, (newValue, oldValue) => { @@ -534,7 +534,7 @@ const clearSelectedDateTime = () => {
-
@@ -553,7 +553,7 @@ const clearSelectedDateTime = () => { 添加好友
- + --> - // Array.isArray(dep.positions) ? dep.positions.map((pos) => pos.name) : [] - // ) - // : [] - return row.user_position.map((item) => item.position_name).join(' , ') + let positionNames = Array.isArray(row.depPositions) + ? row.depPositions.flatMap((dep) => + Array.isArray(dep.positions) ? dep.positions.map((pos) => pos.name) : [] + ) + : [] + return positionNames.join(' , ') + // return row.user_position.map((item) => item.position_name).join(' , ') } }, { @@ -455,7 +457,7 @@ const state = reactive({ myFriendListData: [], // 我的好友表格数据 addFriendList: [], // 搜索出来的可添加好友 addressBookTableHeight: 524, // 通讯录表格高度 - addressBookTableWidth: 1142, // 通讯录表格宽度 + addressBookTableWidth: 800, // 通讯录表格宽度 addressBookPage: 1, // 通讯录表格页码 addressBookPageSize: 10, // 通讯录表格每页条数 addressBookTotal: 0, // 通讯录表格总条数 @@ -520,7 +522,9 @@ const items = computed((): ISession[] => { return [...topItems, ...normalItems] }) -setTimeout(()=>{console.log('items',items)},2000) +setTimeout(() => { + console.log('items', items) +}, 2000) watch( () => state.addressBookSearchNickName, (newValue, oldValue) => { @@ -529,7 +533,7 @@ watch( state.addressBookTableWidth = 1142 state.addressBookPage = 1 } else { - // state.addressBookTableWidth = 800 + state.addressBookTableWidth = 800 state.clickKey = 3 state.treeRefreshCount++ state.addressBookPage = 1 @@ -594,8 +598,8 @@ const indexName = computed(() => dialogueStore.index_name) // 切换会话 const onTabTalk = (item: ISession, follow = false) => { -console.log('onTabTalk') -console.log('item.index_name === indexName.value',item.index_name === indexName.value) + console.log('onTabTalk') + console.log('item.index_name === indexName.value', item.index_name === indexName.value) if (item.index_name === indexName.value) return searchKeyword.value = '' @@ -640,7 +644,7 @@ const onReload = () => { // 初始化加载 const onInitialize = () => { let index_name = getCacheIndexName() - console.log('index_name',index_name) + console.log('index_name', index_name) index_name && onTabTalk(talkStore.findItem(index_name), true) } @@ -648,9 +652,9 @@ const onInitialize = () => { onBeforeRouteUpdate(onInitialize) onBeforeMount(() => { - // getTreeData() + getTreeData() getDepPoisUser() - getMyFriends() + // getMyFriends() getUserGroupChatList() }) @@ -749,36 +753,36 @@ const getMyFriends = () => { } // 获取部门下的人员 const getDepPoisUser = () => { - // let url = '/user/v2/list' + let url = '/user/v2/list' // let url = '/api/v1/contact/friend/list' - // let params = { - // departmentId: state.addressBookSearchNickName ? undefined : state.clickKey, - // page: state.addressBookPage, - // pageSize: state.addressBookPageSize, - // status: 'notactive', - // nickName: state.addressBookSearchNickName - // } - // $request.HTTP.components.postDataByParams(url, params).then((res) => { - // // console.log(res) - // if (res.status === 0 && Array.isArray(res.data.data)) { - // state.addressBookData = res.data.data || [] - // state.addressBookTotal = res.data.count - // } - // }) let params = { - type: 'addressBook', //查我的通讯录的时候写死addressBook + departmentId: state.addressBookSearchNickName ? undefined : state.clickKey, page: state.addressBookPage, - page_size: state.addressBookPageSize, - name: state.addressBookSearchNickName + pageSize: state.addressBookPageSize, + status: 'notactive', + nickName: state.addressBookSearchNickName } - GetContactFriendList(params).then((res) => { + $request.HTTP.components.postDataByParams(url, params).then((res) => { // console.log(res) - if (res.code === 200 && Array.isArray(res.data.user_list)) { - state.addressBookData = res.data.user_list || [] - state.company_name = res.data.company_name || '' + if (res.status === 0 && Array.isArray(res.data.data)) { + state.addressBookData = res.data.data || [] state.addressBookTotal = res.data.count } }) + // let params = { + // type: 'addressBook', //查我的通讯录的时候写死addressBook + // page: state.addressBookPage, + // page_size: state.addressBookPageSize, + // name: state.addressBookSearchNickName + // } + // GetContactFriendList(params).then((res) => { + // // console.log(res) + // if (res.code === 200 && Array.isArray(res.data.user_list)) { + // state.addressBookData = res.data.user_list || [] + // state.company_name = res.data.company_name || '' + // state.addressBookTotal = res.data.count + // } + // }) } // 搜索可添加好友 @@ -830,7 +834,7 @@ const resetAddressBookModal = () => { state.groupChatListPage = 1 state.groupChatListPageSize = 10 getDepPoisUser() - getMyFriends() + // getMyFriends() getUserGroupChatList() state.addFriendList = [] }) @@ -1095,15 +1099,15 @@ const handleEnterSearchResultChat = () => { --> - - + /> + @@ -1147,20 +1151,20 @@ const handleEnterSearchResultChat = () => {
@@ -1192,8 +1196,9 @@ const handleEnterSearchResultChat = () => { > - 组织架构 - 我的好友 + + 员工通讯录 + 群聊列表 { class="addressBook-content" v-if="state.addressBookCurrentTab == 'employeeAddressBook'" > - -
+ +
{ &.border { border-radius: 10px; border: 1px solid var(--im-primary-color); - background-color: red; } }