yink #17
| @ -109,3 +109,13 @@ export const ServeAddFriend = (data) => { | ||||
| export const ServeCheckFriend = (data) => { | ||||
|   return post('/api/v1/contact/friend/check', data) | ||||
| } | ||||
| 
 | ||||
| // 检测是否需要加好友
 | ||||
| export const GetContactFriendList = (data) => { | ||||
|   return post('/api/v1/contact/friend/list', data) | ||||
| } | ||||
| 
 | ||||
| // 搜索好友
 | ||||
| export const GetFriendList = (data) => { | ||||
|   return post('/api/v1/contact/friend/search', data) | ||||
| } | ||||
| @ -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 = () => { | ||||
|             <div class="text-#747474 text-12px">{{ userInfo.enter_date }}</div> | ||||
|           </div> | ||||
|         </div> | ||||
|         <div v-if="showBtn"> | ||||
| 
 | ||||
|         <n-button block color="#EEE9F8" text-color="#46299D" @click="onToTalk"> | ||||
|           <div class="flex items-center justify-center py-11px"> | ||||
|             <img class="w-19.8px h-20px mr-15px" src="@/assets/image/faxi@2x.png" alt="" /> | ||||
|             <span>发送消息</span> | ||||
|           </div> | ||||
|         </n-button> | ||||
|         <!-- <div v-if="showBtn"> | ||||
|           <n-button block color="#EEE9F8" text-color="#46299D" @click="onToTalk" v-if="isFriend"> | ||||
|             <div class="flex items-center justify-center py-11px"> | ||||
|               <img class="w-19.8px h-20px mr-15px" src="@/assets/image/faxi@2x.png" alt="" /> | ||||
| @ -318,7 +325,7 @@ const onAfterLeave = () => { | ||||
|               <span>添加好友</span> | ||||
|             </div> | ||||
|           </n-button> | ||||
|         </div> | ||||
|         </div> --> | ||||
|       </template> | ||||
|     </div> | ||||
|   </x-n-modal> | ||||
|  | ||||
| @ -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 = () => { | ||||
| 
 | ||||
|     <!-- 聊天区域 --> | ||||
|     <main class="el-main relative"> | ||||
|       <div | ||||
|       <!-- <div | ||||
|         class="p-[15px] pt-[10px] w-[100%] z-99 absolute" | ||||
|         v-if="!isFriend && talkParams.type !== 2" | ||||
|       > | ||||
| @ -553,7 +553,7 @@ const clearSelectedDateTime = () => { | ||||
|             <span>添加好友</span> | ||||
|           </n-button> | ||||
|         </div> | ||||
|       </div> | ||||
|       </div> --> | ||||
|       <PanelContent | ||||
|         :uid="talkParams.uid" | ||||
|         :talk_type="talkParams.type" | ||||
|  | ||||
| @ -26,7 +26,7 @@ import { | ||||
| import { Search, Plus, Right, AddOne, PeoplePlusOne } from '@icon-park/vue-next' | ||||
| import TalkItem from './TalkItem.vue' | ||||
| import Skeleton from './Skeleton.vue' | ||||
| import { ServeClearTalkUnreadNum, ServeAddFriend } from '@/api/chat' | ||||
| import { ServeClearTalkUnreadNum, ServeAddFriend, GetFriendList } from '@/api/chat' | ||||
| import GroupLaunch from '@/components/group/GroupLaunch.vue' | ||||
| import { getCacheIndexName } from '@/utils/talk' | ||||
| import { ISession } from '@/types/chat' | ||||
| @ -38,6 +38,7 @@ import flTree from '@/components/flnlayout/tree/flnindex.vue' | ||||
| import { processError, processSuccess } from '@/utils/helper/message.js' | ||||
| import chatAppSearchList from '@/components/search/searchList.vue' | ||||
| import { ServeSeachQueryAll, ServeQueryTalkRecord, ServeUserGroupChatList } from '@/api/search' | ||||
| import { GetContactFriendList } from '@/api/chat' | ||||
| import { getUserInfoByERPUserId } from '@/api/user' | ||||
| import HighlightText from '@/components/search/highLightText.vue' | ||||
| import { useRouter } from 'vue-router' | ||||
| @ -246,7 +247,8 @@ const state = reactive({ | ||||
|         tooltip: true | ||||
|       }, | ||||
|       render(row, index) { | ||||
|         return row.nickname + '【' + row.job_num + '】' | ||||
|         // return row.nickname + '【' + row.job_num + '】' | ||||
|         return row.nickName + '【' + row.jobNum + '】' | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
| @ -257,12 +259,13 @@ const state = reactive({ | ||||
|         tooltip: true | ||||
|       }, | ||||
|       render(row, index) { | ||||
|         // let positionNames = Array.isArray(row.user_position) | ||||
|         //   ? row.depPositions.flatMap((dep) => | ||||
|         //       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(' , ') | ||||
|       } | ||||
|     }, | ||||
|     { | ||||
| @ -454,7 +457,7 @@ const state = reactive({ | ||||
|   myFriendListData: [], // 我的好友表格数据 | ||||
|   addFriendList: [], // 搜索出来的可添加好友 | ||||
|   addressBookTableHeight: 524, // 通讯录表格高度 | ||||
|   addressBookTableWidth: 1142, // 通讯录表格宽度 | ||||
|   addressBookTableWidth: 800, // 通讯录表格宽度 | ||||
|   addressBookPage: 1, // 通讯录表格页码 | ||||
|   addressBookPageSize: 10, // 通讯录表格每页条数 | ||||
|   addressBookTotal: 0, // 通讯录表格总条数 | ||||
| @ -519,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) => { | ||||
| @ -528,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 | ||||
| @ -647,9 +652,9 @@ const onInitialize = () => { | ||||
| onBeforeRouteUpdate(onInitialize) | ||||
| 
 | ||||
| onBeforeMount(() => { | ||||
|   // getTreeData() | ||||
|   getTreeData() | ||||
|   getDepPoisUser() | ||||
|   getMyFriends() | ||||
|   // getMyFriends() | ||||
|   getUserGroupChatList() | ||||
| }) | ||||
| 
 | ||||
| @ -736,8 +741,8 @@ const getMyFriends = () => { | ||||
|     page_size: state.myFriendListPageSize, | ||||
|     name: state.myFriendListSearchName | ||||
|   } | ||||
|   let url = '/api/v1/contact/friend/list' | ||||
|   $request.HTTP.components.postDataByParams(url, params).then((res) => { | ||||
|   // let url = '/api/v1/contact/friend/list' | ||||
|   GetContactFriendList(params).then((res) => { | ||||
|     // console.log(res) | ||||
|     if (res.code === 200 && Array.isArray(res.data.user_list)) { | ||||
|       state.myFriendListData = res.data.user_list || [] | ||||
| @ -748,36 +753,36 @@ const getMyFriends = () => { | ||||
| } | ||||
| // 获取部门下的人员 | ||||
| const getDepPoisUser = () => { | ||||
|   // 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 url = '/user/v2/list' | ||||
|   // let url = '/api/v1/contact/friend/list' | ||||
|   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 | ||||
|   } | ||||
|   $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 | ||||
|   //   } | ||||
|   // }) | ||||
| } | ||||
| 
 | ||||
| // 搜索可添加好友 | ||||
| @ -829,7 +834,7 @@ const resetAddressBookModal = () => { | ||||
|     state.groupChatListPage = 1 | ||||
|     state.groupChatListPageSize = 10 | ||||
|     getDepPoisUser() | ||||
|     getMyFriends() | ||||
|     // getMyFriends() | ||||
|     getUserGroupChatList() | ||||
|     state.addFriendList = [] | ||||
|   }) | ||||
| @ -884,8 +889,8 @@ const changeAddFriendSearch = (value) => { | ||||
|     let params = { | ||||
|       name: value.friendName | ||||
|     } | ||||
|     let url = '/api/v1/contact/friend/search' | ||||
|     $request.HTTP.components.postDataByParams(url, params).then((res) => { | ||||
|     // let url = '/api/v1/contact/friend/search' | ||||
|     GetFriendList(params).then((res) => { | ||||
|       // console.log(res) | ||||
|       if (res.code === 200) { | ||||
|         state.addFriendList = res.data?.user_list || [] | ||||
| @ -1094,15 +1099,15 @@ const handleEnterSearchResultChat = () => { | ||||
|           <n-icon :component="Plus" /> | ||||
|         </template> | ||||
|       </n-button> --> | ||||
|       <!-- <img | ||||
|       <img | ||||
|         style="width: 19px; height: 20px; cursor: pointer" | ||||
|         src="@/assets/image/chatList/addressBook.png" | ||||
|         alt="" | ||||
|         @click="showAddressBookModal" | ||||
|       /> --> | ||||
|       <n-dropdown :options="option" @select="handleSelect"> | ||||
|       /> | ||||
|       <!-- <n-dropdown :options="option" @select="handleSelect"> | ||||
|         <n-button> <n-icon :component="AddOne" /></n-button> | ||||
|       </n-dropdown> | ||||
|       </n-dropdown> --> | ||||
|     </header> | ||||
| 
 | ||||
|     <!-- 置顶栏目 --> | ||||
| @ -1191,8 +1196,9 @@ const handleEnterSearchResultChat = () => { | ||||
|           > | ||||
|             <!-- <n-tab name="employeeAddressBook">组织架构</n-tab> | ||||
|             <n-tab name="employeeAddressBook">我的好友</n-tab> --> | ||||
|             <n-tab name="employeeAddressBook">组织架构</n-tab> | ||||
|             <n-tab name="myFriend">我的好友</n-tab> | ||||
|             <!-- <n-tab name="employeeAddressBook">组织架构</n-tab> --> | ||||
|             <n-tab name="employeeAddressBook">员工通讯录</n-tab> | ||||
|             <!-- <n-tab name="myFriend">我的好友</n-tab> --> | ||||
|             <n-tab name="groupChatList">群聊列表</n-tab> | ||||
|           </n-tabs> | ||||
|           <xSearchForm | ||||
| @ -1226,8 +1232,8 @@ const handleEnterSearchResultChat = () => { | ||||
|             class="addressBook-content" | ||||
|             v-if="state.addressBookCurrentTab == 'employeeAddressBook'" | ||||
|           > | ||||
|             <!-- 隐藏组织架构树 --> | ||||
|             <div class="addressBook-tree" v-if="!state.addressBookSearchNickName && 0"> | ||||
|             <!-- 隐藏组织架构树  v-if="!state.addressBookSearchNickName && 0"--> | ||||
|             <div class="addressBook-tree" v-if="!state.addressBookSearchNickName"> | ||||
|               <fl-tree | ||||
|                 :data="state.treeData" | ||||
|                 :expandedKeys="state.expandedKeys" | ||||
|  | ||||
| @ -1075,7 +1075,6 @@ const onCustomSkipBottomEvent = () => { | ||||
|     &.border { | ||||
|       border-radius: 10px; | ||||
|       border: 1px solid var(--im-primary-color); | ||||
|       background-color: red; | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user