Compare commits
	
		
			3 Commits
		
	
	
		
			1f64ffd8aa
			...
			9e8e3aeba3
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 9e8e3aeba3 | |||
| 8034a303e7 | |||
| 92a7d74c6c | 
							
								
								
									
										2
									
								
								components.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								components.d.ts
									
									
									
									
										vendored
									
									
								
							| @ -30,6 +30,8 @@ declare module 'vue' { | ||||
|     LoginMessage: typeof import('./src/components/talk/message/LoginMessage.vue')['default'] | ||||
|     Message: typeof import('./src/components/x-message/message/index.vue')['default'] | ||||
|     MixedMessage: typeof import('./src/components/talk/message/MixedMessage.vue')['default'] | ||||
|     NButton: typeof import('naive-ui')['NButton'] | ||||
|     NIcon: typeof import('naive-ui')['NIcon'] | ||||
|     PageAnimation: typeof import('./src/components/page-animation/index.vue')['default'] | ||||
|     RevokeMessage: typeof import('./src/components/talk/message/RevokeMessage.vue')['default'] | ||||
|     RouterLink: typeof import('vue-router')['RouterLink'] | ||||
|  | ||||
							
								
								
									
										36
									
								
								src/main.js
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								src/main.js
									
									
									
									
									
								
							| @ -14,6 +14,7 @@ import { vLoading } from '@/components/x-loading/index.js' | ||||
| import messagePopup from '@/components/x-message/useMessagePopup' | ||||
| import pageAnimation from '@/components/page-animation/index.vue' | ||||
| import * as plugins from './plugins' | ||||
| import { useDialogueStore, useTalkStore } from '@/store' | ||||
| const { showMessage } = messagePopup() | ||||
| dayjs.locale('zh-cn') | ||||
| if (import.meta.env.VITE_SHOW_CONSOLE === 'true') { | ||||
| @ -40,6 +41,41 @@ export function createApp() { | ||||
|       }) | ||||
|     }, | ||||
|   }) | ||||
| 
 | ||||
|   //获取当前聊天页面所在页面,并通过当前的receiver_id判断是否要创建本地通知栏消息
 | ||||
|   window.getCurrentChatRoute = (msg) => { | ||||
|     let pushMsg = JSON.parse(decodeURIComponent(msg)) | ||||
|     //当前所在聊天会话的receiver_id
 | ||||
|     const receiver_id = pushMsg?.payload?.receiver_id | ||||
|     // 获取当前页面路径
 | ||||
|     const pages = getCurrentPages() | ||||
|     const page = pages[pages.length - 1] | ||||
|     console.log(page.route) | ||||
| 
 | ||||
|     const dialogueStore = useDialogueStore() | ||||
|     console.log(dialogueStore?.talk?.receiver_id) | ||||
|     if ( | ||||
|       page?.route === 'pages/dialog/index' && | ||||
|       receiver_id === dialogueStore?.talk?.receiver_id | ||||
|     ) { | ||||
|       return | ||||
|     } | ||||
|     let OAWebView = plus.webview.all() | ||||
|     //all里面第一个是入口webview
 | ||||
|     OAWebView[0].evalJS(`doCreatePushMessage('${msg}')`) | ||||
|   } | ||||
| 
 | ||||
|   //处理聊天推送弹窗点开
 | ||||
|   window.openUniPushMsg = (msg) => { | ||||
|     console.log("=====点击通知栏消息") | ||||
|     let pushMsg = JSON.parse(decodeURIComponent(msg)) | ||||
|     console.log("=====pushMsg",pushMsg) | ||||
|     //由于弹窗前处理了不该弹窗的场景,因此这里弹窗可以一并处理
 | ||||
|     //也就是都跳转到聊天页面
 | ||||
|     const talkStore = useTalkStore() | ||||
|     talkStore.toTalk(pushMsg?.payload?.talk_type, pushMsg?.payload?.receiver_id) | ||||
|   } | ||||
| 
 | ||||
|   window.message = ['success', 'error', 'warning'].reduce((acc, type) => { | ||||
|     acc[type] = (message) => { | ||||
|       if (typeof message === 'string') { | ||||
|  | ||||
| @ -381,7 +381,7 @@ const handleClickItem = (item) => { | ||||
|   } | ||||
|   if(props?.manageType === 'searchRecord'){ | ||||
|     uni.navigateTo({ | ||||
|       url: '/pages/search/searchByCondition/index?condition=member' | ||||
|       url: '/pages/search/searchByCondition/index?condition=member&groupMemberId=' + item.id | ||||
|     }) | ||||
|     return | ||||
|   } | ||||
|  | ||||
| @ -504,8 +504,7 @@ const toSearchByConditionPage = (flag) => { | ||||
|       condition = 'link' | ||||
|     } | ||||
|     uni.navigateTo({ | ||||
|       url: | ||||
|         '/pages/search/searchByCondition/index?condition=' + condition | ||||
|       url: '/pages/search/searchByCondition/index?condition=' + condition, | ||||
|     }) | ||||
|   } | ||||
| } | ||||
| @ -644,7 +643,8 @@ const toSearchPage = () => { | ||||
|       '/pages/search/moreResult/moreResultDetail?talk_type=' + | ||||
|       dialogueParams.type + | ||||
|       '&receiver_id=' + | ||||
|       dialogueParams.receiver_id, | ||||
|       dialogueParams.receiver_id + | ||||
|       '&hideFirstRecord=1', | ||||
|   }) | ||||
| } | ||||
| </script> | ||||
|  | ||||
| @ -561,13 +561,18 @@ const state = ref({ | ||||
|   useCustomLoadMore: false, //是否使用自定义加载更多事件(下拉刷新、上拉加载) | ||||
|   recordDate: "", //按日期查询聊天记录的开始日期 | ||||
|   serveFindRecord: [], //调用接口查找到的聊天记录 | ||||
| }); | ||||
|   middleMsg: {}, //缓存中没有时,调用接口初次使用的依据记录 | ||||
|   keepDialogInfo: false, //是否保存会话信息 | ||||
| }) | ||||
| 
 | ||||
| uniOnload(async (options) => { | ||||
|   console.log("onLoad" + options); | ||||
|   console.log('onLoad' + JSON.stringify(options)) | ||||
|   if (options.sessionId) { | ||||
|     state.value.sessionId = options.sessionId; | ||||
|   } | ||||
|   if (options.keepDialogInfo) { | ||||
|     state.value.keepDialogInfo = options.keepDialogInfo === '1' ? true : false | ||||
|   } | ||||
|   if (options.msgInfo) { | ||||
|     const msgInfo = JSON.parse(decodeURIComponent(options.msgInfo)); | ||||
|     queryRecordsByMsgInfo(msgInfo); | ||||
| @ -970,11 +975,11 @@ const withdrawerConfirm = () => { | ||||
| 
 | ||||
| // 添加检查是否可以重新编辑撤回消息的函数 | ||||
| const canEditRevokedMessage = (item) => { | ||||
|   console.log(item); | ||||
|   // console.log(item) | ||||
|   if (item.is_revoke === 1 && item.msg_type === 1) { | ||||
|     const now = new Date().getTime(); | ||||
|     const revokeTime = new Date(item.created_at).getTime(); | ||||
|     console.log(now); | ||||
|     const now = new Date().getTime() | ||||
|     const revokeTime = new Date(item.created_at).getTime() | ||||
|     // console.log(now) | ||||
|     // 检查是否在5分钟内 | ||||
|     return now - revokeTime <= 5 * 60 * 1000; | ||||
|   } | ||||
| @ -1095,14 +1100,17 @@ watch( | ||||
|         state.value.localPageLoadDone = true; | ||||
|         return; | ||||
|       } | ||||
|       if ( | ||||
|         newValue[newValue.length - 1]?.sequence === | ||||
|         dialogueList?.records?.[0]?.sequence | ||||
|       ) { | ||||
|         //相同意味着分页加载缓存中的聊天记录完毕 | ||||
|         state.value.localPageLoadDone = true; | ||||
|       } else { | ||||
|         state.value.localPageLoadDone = false; | ||||
|       // 只在正常加载模式下检查是否加载完缓存数据 | ||||
|       if (!state.value.useCustomLoadMore) { | ||||
|         if ( | ||||
|           newValue[newValue.length - 1]?.sequence === | ||||
|           dialogueList?.records?.[0]?.sequence | ||||
|         ) { | ||||
|           //相同意味着分页加载缓存中的聊天记录完毕 | ||||
|           state.value.localPageLoadDone = true | ||||
|         } else { | ||||
|           state.value.localPageLoadDone = false | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
| @ -1130,7 +1138,13 @@ const onScrollToLower = async () => { | ||||
|       ); | ||||
|       console.log(moreRecords); | ||||
| 
 | ||||
|       virtualList.value = moreRecords.concat(tempVirtualList).reverse(); | ||||
|       // 格式化新加载的消息 | ||||
|       const formattedMoreRecords = moreRecords.map((item) => ({ | ||||
|         ...item, | ||||
|         float: item.user_id === talkParams.uid ? 'right' : 'left', | ||||
|       })) | ||||
| 
 | ||||
|       virtualList.value = formattedMoreRecords.concat(tempVirtualList).reverse() | ||||
| 
 | ||||
|       console.log(virtualList.value); | ||||
|     } else { | ||||
| @ -1174,12 +1188,19 @@ const onScrollToUpper = async () => { | ||||
|       const moreRecords = await findTalkRecords( | ||||
|         "", | ||||
|         false, | ||||
|         tempVirtualList[tempVirtualList.length - 1].sequence | ||||
|       ); | ||||
|       console.log(moreRecords); | ||||
|         tempVirtualList[tempVirtualList.length - 1].sequence, | ||||
|       ) | ||||
|       console.log(moreRecords) | ||||
| 
 | ||||
|       // 格式化新加载的消息 | ||||
|       const formattedMoreRecords = moreRecords.map((item) => ({ | ||||
|         ...item, | ||||
|         float: item.user_id === talkParams.uid ? 'right' : 'left', | ||||
|       })) | ||||
| 
 | ||||
|       virtualList.value = tempVirtualList | ||||
|         .concat(moreRecords.reverse()) | ||||
|         .reverse(); | ||||
|         .concat(formattedMoreRecords.reverse()) | ||||
|         .reverse() | ||||
| 
 | ||||
|       console.log(virtualList.value); | ||||
| 
 | ||||
| @ -1307,8 +1328,9 @@ const getMentionSelectLists = (mentionSelectList) => { | ||||
| 
 | ||||
| //根据msg信息找到对应的聊天记录,并根据sequence等查看上下文 | ||||
| const queryRecordsByMsgInfo = async (msgInfo) => { | ||||
|   console.log(msgInfo); | ||||
|   const dialogueList = getDialogueList(talkParams.index_name); | ||||
|   console.log(msgInfo) | ||||
|   state.value.middleMsg = msgInfo | ||||
|   const dialogueList = getDialogueList(talkParams.index_name) | ||||
|   const recordIndex = dialogueList?.records?.findIndex( | ||||
|     (record) => record.msg_id === msgInfo.msg_id | ||||
|   ); | ||||
| @ -1324,6 +1346,15 @@ const queryRecordsByMsgInfo = async (msgInfo) => { | ||||
|     // console.log(recordIndex-startRecordIndex) | ||||
|     recordsList = dialogueList.records.slice(startRecordIndex, endRecordIndex); | ||||
|   } | ||||
| 
 | ||||
|   // 格式化消息,确保每条消息都有正确的 float | ||||
|   recordsList = recordsList.map((item) => { | ||||
|     return { | ||||
|       ...item, | ||||
|       float: item.user_id === talkParams.uid ? 'right' : 'left', | ||||
|     } | ||||
|   }) | ||||
| 
 | ||||
|   nextTick(() => { | ||||
|     zpagingRef.value.complete(recordsList.reverse()); | ||||
|     loadConfig.status = dialogueList?.records?.[0]?.sequence > 1 ? 1 : 2; | ||||
| @ -1374,8 +1405,9 @@ const findTalkRecords = (record, isMiddle, sequence, appointParams) => { | ||||
|       start_time: "", | ||||
|       end_time: "", | ||||
|       group_member_user_id: 0, //群成员id,当查询群历史消息的时候,需要指定群成员的时候送 | ||||
|       sort_sequence: "asc", | ||||
|     }; | ||||
|       sort_sequence: 'asc', | ||||
|       create_time: state.value.middleMsg.created_at, | ||||
|     } | ||||
|     if (record) { | ||||
|       params = Object.assign({}, params, { | ||||
|         start_time: record, | ||||
| @ -1473,8 +1505,8 @@ const rpxToPx = (rpx) => { | ||||
| }; | ||||
| 
 | ||||
| onUnmounted(() => { | ||||
|   if (!state.value.recordDate) { | ||||
|     dialogueStore.setDialogue({}); | ||||
|   if (!state.value.keepDialogInfo) { | ||||
|     dialogueStore.setDialogue({}) | ||||
|   } | ||||
|   clearMultiSelect(); | ||||
| }); | ||||
|  | ||||
| @ -1,43 +1,50 @@ | ||||
| <template> | ||||
| 	<div> | ||||
| 		<wd-swipe-action class="swipe_action"> | ||||
| 			<div | ||||
| 				@click="cellClick" | ||||
| 				:class="['chatItem', props.data.is_top === 1 ? 'isTop' : '']" | ||||
| 			> | ||||
| 				<div class="avatarImg"> | ||||
| 					<tm-badge | ||||
| 						:count="props.data.is_disturb === 1 ? props.data.unread_num : ''" | ||||
|             :dot="props.data.is_disturb === 0 && props.data.unread_num" | ||||
| 						:maxCount="99" | ||||
| 						class="badge" | ||||
| 						color="#D03050" | ||||
| 					> | ||||
| 						<avatarModule | ||||
| 							:mode="props?.data?.group_type === 0 ? 1 : 2" | ||||
| 							:avatar="props?.data?.avatar" | ||||
| 							:groupType="props?.data?.group_type" | ||||
| 							:userName="props?.data?.name" | ||||
| 							:customStyle="{ | ||||
| 								width: '96rpx', | ||||
| 								height: '96rpx', | ||||
| 							}" | ||||
| 							:customTextStyle="{ | ||||
| 								fontSize: '32rpx', | ||||
| 								fontWeight: 'bold', | ||||
| 								color: '#fff', | ||||
| 								lineHeight: '44rpx', | ||||
| 							}" | ||||
| 						></avatarModule> | ||||
| 					</tm-badge> | ||||
| 				</div> | ||||
| 				<div class="chatInfo"> | ||||
| 					<div class="chatInfo_1"> | ||||
| 						<div class="name_center"> | ||||
| 							<div class="text-[#000000] text-[32rpx] | ||||
|               font-bold opacity-90 name_text"> | ||||
|   <div> | ||||
|     <wd-swipe-action class="swipe_action"> | ||||
|       <div | ||||
|         @click="cellClick" | ||||
|         :class="['chatItem', props.data.is_top === 1 ? 'isTop' : '']" | ||||
|       > | ||||
|         <div class="avatarImg"> | ||||
|           <tm-badge | ||||
|             :count="props.data.is_disturb === 1 ? props.data.unread_num : ''" | ||||
|             :dot=" | ||||
|               props.data.is_disturb === 0 && props.data.unread_num | ||||
|                 ? true | ||||
|                 : false | ||||
|             " | ||||
|             :maxCount="99" | ||||
|             class="badge" | ||||
|             color="#D03050" | ||||
|           > | ||||
|             <avatarModule | ||||
|               :mode="props?.data?.group_type === 0 ? 1 : 2" | ||||
|               :avatar="props?.data?.avatar" | ||||
|               :groupType="props?.data?.group_type" | ||||
|               :userName="props?.data?.name" | ||||
|               :customStyle="{ | ||||
|                 width: '96rpx', | ||||
|                 height: '96rpx', | ||||
|               }" | ||||
|               :customTextStyle="{ | ||||
|                 fontSize: '32rpx', | ||||
|                 fontWeight: 'bold', | ||||
|                 color: '#fff', | ||||
|                 lineHeight: '44rpx', | ||||
|               }" | ||||
|             ></avatarModule> | ||||
|           </tm-badge> | ||||
|         </div> | ||||
|         <div class="chatInfo"> | ||||
|           <div class="chatInfo_1"> | ||||
|             <div class="name_center"> | ||||
|               <div | ||||
|                 class="text-[#000000] text-[32rpx] font-bold opacity-90 name_text" | ||||
|               > | ||||
|                 {{ formatNameText(props.data.name) }} | ||||
|                 <span v-if="props.data.talk_type === 2">({{props.data.group_member_num}})</span> | ||||
|                 <span v-if="props.data.talk_type === 2"> | ||||
|                   ({{ props.data.group_member_num }}) | ||||
|                 </span> | ||||
|                 <span v-if="props.data.group_type === 2" class="depTag tag"> | ||||
|                   部门 | ||||
|                 </span> | ||||
| @ -48,153 +55,153 @@ | ||||
|                   公司 | ||||
|                 </span> | ||||
|               </div> | ||||
| 
 | ||||
| 						</div> | ||||
| 						<div style="flex-shrink: 0;" | ||||
| 							class="text-[#000000] text-[28rpx] font-medium opacity-26 ml-[24rpx] time_right" | ||||
| 						> | ||||
| 							{{ beautifyTime(props.data.updated_at) }} | ||||
| 						</div> | ||||
| 					</div> | ||||
| 					<div class="chatInfo_2 w-full mr-[6rpx]"> | ||||
| 						<div class="w-full chatInfo_2_1 textEllipsis"> | ||||
| 							{{ props.data.msg_text }} | ||||
| 						</div> | ||||
| 					</div> | ||||
| 				</div> | ||||
| 			</div> | ||||
| 			<template #right> | ||||
| 				<div class="flex flex-row flex-row-center-end"> | ||||
| 					<!-- 样式占位 --> | ||||
| 					<div style="width: 1px"></div> | ||||
| 					<div | ||||
| 						@click="handleTop" | ||||
| 						class="w-[156rpx] h-[154rpx] text-[#ffffff] bg-[#F09F1F] flex items-center justify-center" | ||||
| 					> | ||||
| 						{{ props.data.is_top === 1 ? "取消置顶" : "置顶" }} | ||||
| 					</div> | ||||
| 					<div | ||||
| 						@click="handleDelete" | ||||
| 						class="w-[156rpx] h-[154rpx] text-[#ffffff] bg-[#CF3050] flex items-center justify-center" | ||||
| 					> | ||||
| 						删除 | ||||
| 					</div> | ||||
| 				</div> | ||||
| 			</template> | ||||
| 		</wd-swipe-action> | ||||
| 		<div | ||||
| 			v-if="props.index !== talkStore.talkItems.length - 1" | ||||
| 			class="divider" | ||||
| 		></div> | ||||
| 	</div> | ||||
|             </div> | ||||
|             <div | ||||
|               style="flex-shrink: 0;" | ||||
|               class="text-[#000000] text-[28rpx] font-medium opacity-26 ml-[24rpx] time_right" | ||||
|             > | ||||
|               {{ beautifyTime(props.data.updated_at) }} | ||||
|             </div> | ||||
|           </div> | ||||
|           <div class="chatInfo_2 w-full mr-[6rpx]"> | ||||
|             <div class="w-full chatInfo_2_1 textEllipsis"> | ||||
|               {{ props.data.msg_text }} | ||||
|             </div> | ||||
|           </div> | ||||
|         </div> | ||||
|       </div> | ||||
|       <template #right> | ||||
|         <div class="flex flex-row flex-row-center-end"> | ||||
|           <!-- 样式占位 --> | ||||
|           <div style="width: 1px;"></div> | ||||
|           <div | ||||
|             @click="handleTop" | ||||
|             class="w-[156rpx] h-[154rpx] text-[#ffffff] bg-[#F09F1F] flex items-center justify-center" | ||||
|           > | ||||
|             {{ props.data.is_top === 1 ? '取消置顶' : '置顶' }} | ||||
|           </div> | ||||
|           <div | ||||
|             @click="handleDelete" | ||||
|             class="w-[156rpx] h-[154rpx] text-[#ffffff] bg-[#CF3050] flex items-center justify-center" | ||||
|           > | ||||
|             删除 | ||||
|           </div> | ||||
|         </div> | ||||
|       </template> | ||||
|     </wd-swipe-action> | ||||
|     <div | ||||
|       v-if="props.index !== talkStore.talkItems.length - 1" | ||||
|       class="divider" | ||||
|     ></div> | ||||
|   </div> | ||||
| </template> | ||||
| <script setup> | ||||
| import avatarModule from "@/components/avatar-module/index.vue"; | ||||
| import { ref, reactive, defineProps, computed } from "vue"; | ||||
| import dayjs from "dayjs"; | ||||
| import { beautifyTime } from "@/utils/datetime"; | ||||
| import { ServeClearTalkUnreadNum } from "@/api/chat"; | ||||
| import { useTalkStore, useDialogueStore } from "@/store"; | ||||
| import { useSessionMenu } from "@/hooks"; | ||||
| import avatarModule from '@/components/avatar-module/index.vue' | ||||
| import { ref, reactive, defineProps, computed } from 'vue' | ||||
| import dayjs from 'dayjs' | ||||
| import { beautifyTime } from '@/utils/datetime' | ||||
| import { ServeClearTalkUnreadNum } from '@/api/chat' | ||||
| import { useTalkStore, useDialogueStore } from '@/store' | ||||
| import { useSessionMenu } from '@/hooks' | ||||
| 
 | ||||
| const talkStore = useTalkStore(); | ||||
| const { onToTopTalk, onRemoveTalk } = useSessionMenu(); | ||||
| const dialogueStore = useDialogueStore(); | ||||
| const talkStore = useTalkStore() | ||||
| const { onToTopTalk, onRemoveTalk } = useSessionMenu() | ||||
| const dialogueStore = useDialogueStore() | ||||
| const props = defineProps({ | ||||
| 	data: { | ||||
| 		type: Object, | ||||
| 		default: {}, | ||||
| 		required: true, | ||||
| 	}, | ||||
| 	index: { | ||||
| 		type: Number, | ||||
| 		default: -1, | ||||
| 		required: true, | ||||
| 	}, | ||||
| }); | ||||
|   data: { | ||||
|     type: Object, | ||||
|     default: {}, | ||||
|     required: true, | ||||
|   }, | ||||
|   index: { | ||||
|     type: Number, | ||||
|     default: -1, | ||||
|     required: true, | ||||
|   }, | ||||
| }) | ||||
| 
 | ||||
| // 添加格式化方法 | ||||
| const formatNameText = (text, maxLength = 16) => { | ||||
|   return text.length > maxLength ? `${text.slice(0, maxLength - 1)}...` : text; | ||||
| }; | ||||
|   return text.length > maxLength ? `${text.slice(0, maxLength - 1)}...` : text | ||||
| } | ||||
| 
 | ||||
| const cellClick = () => { | ||||
| 	console.log(props.data); | ||||
| 	// 更新编辑信息 | ||||
| 	dialogueStore.setDialogue(props.data); | ||||
|   console.log(props.data) | ||||
|   // 更新编辑信息 | ||||
|   dialogueStore.setDialogue(props.data) | ||||
| 
 | ||||
| 	// 清空消息未读数 | ||||
| 	if (props.data.unread_num > 0) { | ||||
| 		ServeClearTalkUnreadNum({ | ||||
| 			talk_type: props.data.talk_type, | ||||
| 			receiver_id: props.data.receiver_id, | ||||
| 		}).then(() => { | ||||
| 			talkStore.updateItem({ | ||||
| 				index_name: props.data.index_name, | ||||
| 				unread_num: 0, | ||||
| 			}); | ||||
| 		}); | ||||
| 	} | ||||
| 	uni.navigateTo({ | ||||
| 		url: `/pages/dialog/index?sessionId=${props.data.id}`, | ||||
| 	}); | ||||
| }; | ||||
|   // 清空消息未读数 | ||||
|   if (props.data.unread_num > 0) { | ||||
|     ServeClearTalkUnreadNum({ | ||||
|       talk_type: props.data.talk_type, | ||||
|       receiver_id: props.data.receiver_id, | ||||
|     }).then(() => { | ||||
|       talkStore.updateItem({ | ||||
|         index_name: props.data.index_name, | ||||
|         unread_num: 0, | ||||
|       }) | ||||
|     }) | ||||
|   } | ||||
|   uni.navigateTo({ | ||||
|     url: `/pages/dialog/index?sessionId=${props.data.id}`, | ||||
|   }) | ||||
| } | ||||
| 
 | ||||
| const handleTop = () => { | ||||
| 	console.log(props.data, 1); | ||||
| 	onToTopTalk(props.data); | ||||
| }; | ||||
|   console.log(props.data, 1) | ||||
|   onToTopTalk(props.data) | ||||
| } | ||||
| 
 | ||||
| //点击删除会话 | ||||
| const handleDelete = () => { | ||||
| 	console.log(props.data); | ||||
| 	onRemoveTalk(props.data); | ||||
| }; | ||||
|   console.log(props.data) | ||||
|   onRemoveTalk(props.data) | ||||
| } | ||||
| </script> | ||||
| <style lang="scss" scoped> | ||||
| ::v-deep .swipe_action { | ||||
| 	// border: 1px solid #fff; | ||||
| 	// transform: translate3d(1px, 0px, 0px) !important; | ||||
|   // border: 1px solid #fff; | ||||
|   // transform: translate3d(1px, 0px, 0px) !important; | ||||
| } | ||||
| ::v-deep .badge .round-6{ | ||||
| ::v-deep .badge .round-6 { | ||||
|   min-width: 22rpx; | ||||
|   min-height: 22rpx; | ||||
| } | ||||
| .chatItem { | ||||
| 	width: 100%; | ||||
| 	height: 154rpx; | ||||
| 	padding: 30rpx 16rpx; | ||||
| 	display: flex; | ||||
| 	align-items: center; | ||||
|   width: 100%; | ||||
|   height: 154rpx; | ||||
|   padding: 30rpx 16rpx; | ||||
|   display: flex; | ||||
|   align-items: center; | ||||
| 
 | ||||
| 	&.isTop { | ||||
| 		background-color: #f3f3f3; | ||||
| 	} | ||||
|   &.isTop { | ||||
|     background-color: #f3f3f3; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| .chatInfo { | ||||
| 	flex: 1; | ||||
| 	margin-left: 20rpx; | ||||
|   flex: 1; | ||||
|   margin-left: 20rpx; | ||||
| } | ||||
| 
 | ||||
| .chatInfo_1 { | ||||
| 	display: flex; | ||||
| 	align-items: center; | ||||
| 	justify-content: space-between; | ||||
|   display: flex; | ||||
|   align-items: center; | ||||
|   justify-content: space-between; | ||||
| } | ||||
| 
 | ||||
| .chatInfo_2 { | ||||
| 	display: flex; | ||||
| 	align-items: center; | ||||
| 	justify-content: space-between; | ||||
| 	margin-top: 6rpx; | ||||
|   display: flex; | ||||
|   align-items: center; | ||||
|   justify-content: space-between; | ||||
|   margin-top: 6rpx; | ||||
| } | ||||
| 
 | ||||
| .chatInfo_2_1 { | ||||
| 	font-size: 28rpx; | ||||
| 	color: rgba($color: #000000, $alpha: 0.4); | ||||
|   font-size: 28rpx; | ||||
|   color: rgba($color: #000000, $alpha: 0.4); | ||||
| } | ||||
| .tag{ | ||||
| .tag { | ||||
|   display: inline-flex; | ||||
|   align-items: center; | ||||
|   text-align: center; | ||||
| @ -209,22 +216,22 @@ const handleDelete = () => { | ||||
|   font-weight: bold; | ||||
| } | ||||
| .companyTag { | ||||
| 	border: 1px solid #7a58de; | ||||
| 	color: #7a58de; | ||||
|   border: 1px solid #7a58de; | ||||
|   color: #7a58de; | ||||
| } | ||||
| .depTag { | ||||
| 	border: 1px solid #377ec6; | ||||
| 	color: #377ec6; | ||||
|   border: 1px solid #377ec6; | ||||
|   color: #377ec6; | ||||
| } | ||||
| .projectTag { | ||||
| 	border: 1px solid #c1681c; | ||||
| 	color: #c1681c; | ||||
|   border: 1px solid #c1681c; | ||||
|   color: #c1681c; | ||||
| } | ||||
| .name_center{ | ||||
| .name_center { | ||||
|   flex: 1; | ||||
|   min-width: 0; | ||||
| } | ||||
| .name_text{ | ||||
| .name_text { | ||||
|   display: inline-block; | ||||
|   max-height: 88rpx; // 两行文字的高度 | ||||
|   line-height: 44rpx; | ||||
| @ -236,23 +243,23 @@ const handleDelete = () => { | ||||
|   word-break: break-all; | ||||
| } | ||||
| .time_right { | ||||
| 	/* white-space: nowrap; | ||||
|   /* white-space: nowrap; | ||||
| 	max-width: 146rpx; */ | ||||
|   flex: 0 0 auto; /* 不伸缩,保持内容宽度 */ | ||||
|   white-space: nowrap; | ||||
| } | ||||
| 
 | ||||
| .textEllipsis { | ||||
| 	overflow: hidden; | ||||
| 	text-overflow: ellipsis; | ||||
| 	display: -webkit-box; | ||||
| 	-webkit-line-clamp: 1; | ||||
| 	-webkit-box-orient: vertical; | ||||
|   overflow: hidden; | ||||
|   text-overflow: ellipsis; | ||||
|   display: -webkit-box; | ||||
|   -webkit-line-clamp: 1; | ||||
|   -webkit-box-orient: vertical; | ||||
| } | ||||
| 
 | ||||
| .divider { | ||||
| 	background-color: rgba(243, 243, 243, 1); | ||||
| 	height: 1rpx; | ||||
| 	margin: 0 18rpx; | ||||
|   background-color: rgba(243, 243, 243, 1); | ||||
|   height: 1rpx; | ||||
|   margin: 0 18rpx; | ||||
| } | ||||
| </style> | ||||
|  | ||||
| @ -125,6 +125,7 @@ import { ref, watch, computed } from 'vue' | ||||
| import { onShow, onLoad } from '@dcloudio/uni-app' | ||||
| import { useChatList } from '@/store/chatList/index.js' | ||||
| import { useAuth } from '@/store/auth' | ||||
| import { ServeClearTalkUnreadNum } from '@/api/chat' | ||||
| import { useTalkStore, useUserStore, useDialogueStore } from '@/store' | ||||
| import chatItem from './components/chatItem.vue' | ||||
| import addCircle from '@/static/image/chatList/addCircle.png' | ||||
| @ -237,21 +238,23 @@ onLoad((options) => { | ||||
|     if (items?.value?.length > 0) { | ||||
|       items.value.forEach((openSession) => { | ||||
|         if (openSession.index_name === options?.openSessionIndexName) { | ||||
|           dialogueStore.setDialogue(openSession) | ||||
|           if (openSession.unread_num > 0) { | ||||
|             ServeClearTalkUnreadNum({ | ||||
|               talk_type: openSession.talk_type, | ||||
|               receiver_id: openSession.receiver_id, | ||||
|             }).then(() => { | ||||
|               talkStore.updateItem({ | ||||
|                 index_name: openSession.index_name, | ||||
|                 unread_num: 0, | ||||
|           setTimeout(() => { | ||||
|             dialogueStore.setDialogue(openSession) | ||||
|             if (openSession.unread_num > 0) { | ||||
|               ServeClearTalkUnreadNum({ | ||||
|                 talk_type: openSession.talk_type, | ||||
|                 receiver_id: openSession.receiver_id, | ||||
|               }).then(() => { | ||||
|                 talkStore.updateItem({ | ||||
|                   index_name: openSession.index_name, | ||||
|                   unread_num: 0, | ||||
|                 }) | ||||
|               }) | ||||
|             } | ||||
|             uni.navigateTo({ | ||||
|               url: `/pages/dialog/index?sessionId=${openSession.id}`, | ||||
|             }) | ||||
|           } | ||||
|           uni.navigateTo({ | ||||
|             url: `/pages/dialog/index?sessionId=${openSession.id}`, | ||||
|           }) | ||||
|           }, 500) | ||||
|         } | ||||
|       }) | ||||
|     } | ||||
|  | ||||
| @ -96,6 +96,7 @@ import { | ||||
| import HighlightText from './highLightText.vue' | ||||
| import { useI18n } from 'vue-i18n' | ||||
| import { beautifyTime } from '@/utils/datetime' | ||||
| import { ChatMsgTypeMapping } from '@/constant/message' | ||||
| const { t } = useI18n() | ||||
| const props = defineProps({ | ||||
|   searchItem: Object | Number, | ||||
| @ -175,6 +176,13 @@ const keyMapping = { | ||||
|     name: 'receiver_name', | ||||
|     group_num: 'group_num', | ||||
|   }, | ||||
|   search_by_member_condition: { | ||||
|     avatar: 'avatar', | ||||
|     name: 'nickname', | ||||
|     created_at: 'created_at', | ||||
|     msg_type: 'msg_type', | ||||
|     detailKey: 'chatMessageType', | ||||
|   }, | ||||
| } | ||||
| //获取key对应值 | ||||
| const getKeyValue = (keys) => { | ||||
| @ -254,6 +262,12 @@ const resultDetail = computed(() => { | ||||
|     case 'extra': | ||||
|       result_detail = props.searchItem?.extra | ||||
|       break | ||||
|     case 'chatMessageType': | ||||
|       result_detail = | ||||
|         props.searchItem?.msg_type === 1 | ||||
|           ? props.searchItem?.extra?.content | ||||
|           : ChatMsgTypeMapping[props.searchItem?.msg_type] | ||||
|       break | ||||
|     default: | ||||
|       result_detail = '' | ||||
|   } | ||||
|  | ||||
| @ -36,7 +36,10 @@ | ||||
|           </span> | ||||
|         </div> | ||||
|       </template> | ||||
|       <div class="search-record-detail" v-if="props.searchRecordDetail"> | ||||
|       <div | ||||
|         class="search-record-detail" | ||||
|         v-if="props.searchRecordDetail && !props?.hideFirstRecord" | ||||
|       > | ||||
|         <searchItem | ||||
|           @click=" | ||||
|             clickSearchItem( | ||||
| @ -171,6 +174,10 @@ const props = defineProps({ | ||||
|       return {} | ||||
|     }, | ||||
|   }, //接受者信息 | ||||
|   hideFirstRecord: { | ||||
|     type: Boolean, | ||||
|     default: false, | ||||
|   }, //是否隐藏前缀及搜索群/用户主体信息 | ||||
| }) | ||||
| 
 | ||||
| const { t } = useI18n() | ||||
| @ -300,9 +307,9 @@ const queryAllSearch = (pageNum, searchResultPageSize) => { | ||||
|           ) | ||||
|           let total = data.count | ||||
|           if (props.searchRecordDetail) { | ||||
|             if(state?.first_talk_record_infos?.talk_type === 1){ | ||||
|             if (state?.first_talk_record_infos?.talk_type === 1) { | ||||
|               total = data.user_record_count | ||||
|             } else if (state?.first_talk_record_infos?.talk_type === 2){ | ||||
|             } else if (state?.first_talk_record_infos?.talk_type === 2) { | ||||
|               total = data.group_record_count | ||||
|             } | ||||
|           } | ||||
| @ -394,7 +401,7 @@ const getHasMoreResult = (searchResultKey) => { | ||||
|       } | ||||
|       break | ||||
|     case 'general_infos': | ||||
|     if ( | ||||
|       if ( | ||||
|         state.searchResult['record_count'] && | ||||
|         state.searchResult['record_count'] > 3 | ||||
|       ) { | ||||
|  | ||||
| @ -7,6 +7,7 @@ | ||||
|         :apiRequest="ServeTalkRecord" | ||||
|         :apiParams="state.apiParams" | ||||
|         :searchText="state.searchText" | ||||
|         :hideFirstRecord="state.hideFirstRecord" | ||||
|         :isPagination="true" | ||||
|         :searchRecordDetail="true" | ||||
|         @lastIdChange="lastIdChange" | ||||
| @ -30,6 +31,7 @@ const state = reactive({ | ||||
|   apiParams: '', | ||||
|   searchText: '', | ||||
|   uid: computed(() => userStore.uid), //当前用户id | ||||
|   hideFirstRecord: false, //是否隐藏前缀及搜索群/用户主体信息 | ||||
| }) | ||||
| 
 | ||||
| onLoad((options) => { | ||||
| @ -55,6 +57,10 @@ onLoad((options) => { | ||||
|   } | ||||
| 
 | ||||
|   console.log(JSON.parse(decodeURIComponent(state.apiParams))) | ||||
| 
 | ||||
|   if (options.hideFirstRecord) { | ||||
|     state.hideFirstRecord = options.hideFirstRecord === '1' ? true : false | ||||
|   } | ||||
| }) | ||||
| 
 | ||||
| //分页查询时,最后一条id变化 | ||||
| @ -116,7 +122,7 @@ const clickSearchItem = ( | ||||
|     }) | ||||
|   } else { | ||||
|     uni.navigateTo({ | ||||
|       url: '/pages/dialog/index?msgInfo=' + res, | ||||
|       url: '/pages/dialog/index?msgInfo=' + res + '&keepDialogInfo=1', | ||||
|     }) | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -9,6 +9,7 @@ | ||||
|         :auto="false" | ||||
|         :loading-more-default-as-loading="true" | ||||
|         :inside-more="true" | ||||
|         v-model="state.flatList" | ||||
|       > | ||||
|         <template #top v-if="state.showPageTitle"> | ||||
|           <customNavbar :title="state.pageTitle"></customNavbar> | ||||
| @ -73,11 +74,7 @@ | ||||
|         > | ||||
|           <div | ||||
|             class="search-by-condition-input" | ||||
|             v-if=" | ||||
|               state.condition === 'file' || | ||||
|               state.condition === 'link' || | ||||
|               state.condition === 'member' | ||||
|             " | ||||
|             v-if="state.condition === 'file' || state.condition === 'link'" | ||||
|           > | ||||
|             <customInput | ||||
|               :searchText="state.searchText" | ||||
| @ -117,11 +114,24 @@ | ||||
|                     v-for="(item, index) in conditionItem.monthResultList" | ||||
|                     :key="index" | ||||
|                     :style="{ | ||||
|                       border: state.condition === 'imgAndVideo' ? '0' : '', | ||||
|                       border: | ||||
|                         state.condition === 'imgAndVideo' || | ||||
|                         state.condition === 'member' | ||||
|                           ? '0' | ||||
|                           : '', | ||||
|                       padding: | ||||
|                         state.condition === 'imgAndVideo' ? '0 0 10rpx' : '', | ||||
|                     }" | ||||
|                   > | ||||
|                     <div class="condition-result-member"> | ||||
|                       <searchItem | ||||
|                         @click="toDialogueByMember(item)" | ||||
|                         :searchResultKey="'search_by_member_condition'" | ||||
|                         :searchItem="item" | ||||
|                         :searchText="state.searchText" | ||||
|                         :searchRecordDetail="true" | ||||
|                       ></searchItem> | ||||
|                     </div> | ||||
|                     <div | ||||
|                       class="condition-result-imgAndVideo" | ||||
|                       v-if="state.condition === 'imgAndVideo'" | ||||
| @ -295,6 +305,7 @@ const state = reactive({ | ||||
|   cursor: 0, //上次查询的游标 | ||||
|   msg_type: 0, //查询的消息类型 | ||||
|   group_member_id: 0, //群成员id | ||||
|   flatList: [], // 用于存储扁平化的数据 | ||||
| }) | ||||
| 
 | ||||
| onLoad((options) => { | ||||
| @ -302,7 +313,10 @@ onLoad((options) => { | ||||
|   if (options.condition) { | ||||
|     state.condition = options.condition | ||||
|     if (options.condition === 'member') { | ||||
|       // queryAllSearch() | ||||
|       state.showPageTitle = true | ||||
|       state.pageTitle = t('search.condition.member') | ||||
|       state.group_member_id = options.groupMemberId | ||||
|       queryAllSearch() | ||||
|     } else if (options.condition === 'date') { | ||||
|       state.showPageTitle = true | ||||
|       state.pageTitle = t('search.condition.date') | ||||
| @ -426,6 +440,7 @@ const selectDate = async (e) => { | ||||
|     url: | ||||
|       '/pages/dialog/index?sessionId=' + | ||||
|       sessionId + | ||||
|       '&keepDialogInfo=1' + | ||||
|       '&recordDate=' + | ||||
|       parseTime(e, '{y}-{m}-{d}'), | ||||
|   }) | ||||
| @ -557,18 +572,25 @@ const queryAllSearch = () => { | ||||
|       } else { | ||||
|         noMore = true | ||||
|       } | ||||
|       console.log(dateList) | ||||
| 
 | ||||
|       // 保存分组数据用于显示 | ||||
|       state.searchResultList = dateList | ||||
| 
 | ||||
|       // 将分组数据扁平化,用于z-paging分页 | ||||
|       state.flatList = dateList.reduce((acc, group) => { | ||||
|         return acc.concat(group.monthResultList) | ||||
|       }, []) | ||||
| 
 | ||||
|       if (state.cursor === 0) { | ||||
|         state.searchResultList = dateList | ||||
|         zPaging.value?.complete(dateList) | ||||
|         zPaging.value?.complete(state.flatList) | ||||
|       } else { | ||||
|         state.searchResultList = dateList | ||||
|         zPaging.value?.completeByNoMore(dateList, noMore) | ||||
|         zPaging.value?.completeByNoMore(state.flatList, noMore) | ||||
|       } | ||||
|       state.cursor = data?.cursor | ||||
|     } else { | ||||
|       if (state.cursor === 0) { | ||||
|         state.searchResultList = [] | ||||
|         state.flatList = [] | ||||
|       } | ||||
|       zPaging.value?.complete([]) | ||||
|     } | ||||
| @ -577,6 +599,7 @@ const queryAllSearch = () => { | ||||
|   resp.catch(() => { | ||||
|     if (state.cursor === 0) { | ||||
|       state.searchResultList = [] | ||||
|       state.flatList = [] | ||||
|     } | ||||
|     zPaging.value?.complete([]) | ||||
|   }) | ||||
| @ -637,6 +660,22 @@ const downloadAndOpenFile = (item) => { | ||||
|   }) | ||||
|   dtask.start() | ||||
| } | ||||
| 
 | ||||
| //跳转到对应的记录位置 | ||||
| const toDialogueByMember = async (msgInfo) => { | ||||
|   const sessionId = await getSessionId( | ||||
|     dialogueParams.talk_type, | ||||
|     dialogueParams.receiver_id, | ||||
|   ) | ||||
|   uni.navigateTo({ | ||||
|     url: | ||||
|       '/pages/dialog/index?sessionId=' + | ||||
|       sessionId + | ||||
|       '&keepDialogInfo=1' + | ||||
|       '&msgInfo=' + | ||||
|       encodeURIComponent(JSON.stringify(msgInfo)), | ||||
|   }) | ||||
| } | ||||
| </script> | ||||
| <style scoped lang="scss"> | ||||
| .search-by-date { | ||||
|  | ||||
| @ -144,6 +144,7 @@ export const useTalkStore = defineStore('talk', { | ||||
| 
 | ||||
|       ServeCreateTalkList({ | ||||
|         talk_type, | ||||
|         receiver_id, | ||||
|         erp_user_id, | ||||
|       }).then(({ code, data, message }) => { | ||||
|         if (code == 200) { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user