@ -67,7 +67,17 @@
v - for = "item in virtualList"
: id = "`zp-id-${item.msg_id}`"
: key = "item.zp_index"
: data - msgid = "item.msg_id"
: data - msgtype = "item.msg_type"
: data - userid = "item.user_id"
: data - talktype = "talkParams.type"
: data - receiverid = "talkParams.receiver_id"
style = "transform: scaleY(-1);"
: ref = "
( el ) => {
if ( el ) messageRecordElementRefs [ item . zp _index ] = el
}
"
>
<!-- 系统消息 -- >
< div v-if ="item.msg_type >= 1000" class="message-box" >
@ -205,6 +215,17 @@
< / div > -- >
< / div >
< div
class = "talk-tools have_read_num"
v - if = "item.user_id === talkParams.uid"
@ click = "toShowMessageReadDetail(item)"
>
< span v-if ="talkParams.type === 1" > 未读 < / span >
< span v-if ="talkParams.type === 2" >
已读 ( 0 / { { talkParams . num } } )
< / span >
< / div >
< div
v - if = "item.extra.reply"
class = "talk-reply pointer"
@ -520,6 +541,102 @@
@ getMentionSelectLists = "getMentionSelectLists"
> < / selectMemberByAlphabet >
< / t m - d r a w e r >
< tm -drawer
placement = "bottom"
v - model : show = "state.isShowMessageReadDetail"
: hideHeader = "true"
: round = "5"
: height = "state.mentionSelectHeight"
: inContent = "true"
>
< div
class = "mention-select-drawer flex flex-row flex-1 flex-row flex-row-center-between"
>
< div
class = "cancel-btns flex-row flex flex-row-center-start"
style = "width: 210rpx;"
@ click = "hideMessageReadDetail"
>
< span
style = "flex-shrink: 0; display: block;"
class = "text-[32rpx] font-regular text-[#191919]"
>
{ { $t ( 'cancel' ) } }
< / span >
< / div >
< div
class = "flex flex-row-center-center flex-col"
style = "padding: 6rpx 0;"
>
< text > { { $t ( 'chat.msgRead.list' ) } } < / text >
< / div >
< div
class = "flex-row flex flex-row-center-end"
style = "width: 210rpx;"
> < / div >
< / div >
< div class = "msg-read-detail-tabs" >
< tm -sheet >
< tm -tabs
: list = "state.msgReadDetailTabs"
showTabsLineAni
activeFontColor = "#7A58DE"
tabsLineAniColor = "#7A58DE"
: item - width = "375"
: width = "750"
@ change = "msgReadDetailTabsChange"
: default - name = "state.msgReadDetailTabs[0].key"
> < / t m - t a b s >
< div class = "msg-read-detail" >
< ZPaging
ref = "zPagingReadDetails"
: show - scrollbar = "false"
: fixed = "false"
: height = "state.readDetailHeight"
: safe - area - inset - bottom = "true"
: inside - more = "true"
: hide - no - more - inside = "true"
@ scrolltolower = "loadMoreReadDetails"
>
< div
class = "msg-read-detail-each"
v - for = "(item, index) in state.msgReadOrNotDetail"
: key = "index"
>
< div class = "msg-read-detail-each-avatar" >
< avatarModule
: mode = "2"
: groupType = "item?.group_type"
: avatar = "item?.avatar"
: userName = "item?.nickName"
: customStyle = "{ width: '72rpx', height: '72rpx' }"
: customTextStyle = " {
fontSize : '24rpx' ,
fontWeight : 'bold' ,
color : '#fff' ,
lineHeight : '34rpx' ,
} "
> < / avatarModule >
< / div >
< div class = "msg-read-detail-each-info" >
< span > { { item . nickName } } < / span >
< span
style = "
font - size : 20 rpx ;
color : # 747474 ;
font - weight : 400 ;
line - height : 28 rpx ;
"
>
{ { item . jobNum } }
< / span >
< / div >
< / div >
< / ZPaging >
< / div >
< / t m - s h e e t >
< / div >
< / t m - d r a w e r >
< / div >
< / template >
< script setup >
@ -568,6 +685,8 @@ import {
detailGetRecordsContext ,
ServeClearTalkUnreadNum ,
ServeTalkRecords ,
ServeReadConditionList ,
ServeMessageReadDetail ,
} from '@/api/chat'
import copy07 from '@/static/image/chatList/copy07@2x.png'
import multipleChoices from '@/static/image/chatList/multipleChoices@2x.png'
@ -582,11 +701,17 @@ import deepBubble from '@/components/deep-bubble/deep-bubble.vue'
import { isRevoke } from './menu'
import useConfirm from '@/components/x-confirm/useConfirm.js'
import { onLoad as uniOnload , onUnload as uniOnUnload } from '@dcloudio/uni-app'
import ws from '@/connect'
Quill . register ( 'formats/emoji' , EmojiBlot )
import 'quill-mention'
const selectMemberByAlphabetRef = ref ( null )
/ / 观 察 者
let observer
/ / 获 取 聊 天 消 息 记 录 元 素
const messageRecordElementRefs = ref ( [ ] )
const {
getDialogueList ,
updateZpagingRef ,
@ -652,8 +777,63 @@ const state = ref({
lastSelection : 0 ,
canUseQuillEditor : true , / / 是 否 可 以 使 用 q u i l l 编 辑 器 , 如 果 版 本 不 支 持 , 则 使 用 普 通 输 入 框
textAreaValue : '' , / / 普 通 输 入 框 的 值
visibleElements : new Set ( ) , / / 当 前 需 要 发 送 已 读 回 执 的 可 见 元 素
lastUpdateTime : 0 , / / 用 于 节 流
setMessageReadInterval : null , / / 设 置 别 人 发 出 的 消 息 , 我 已 读 的 定 时 器
tempWaitDoRead : [ ] , / / 当 前 需 要 发 送 已 读 回 执 的 元 素
visibleOutElements : new Set ( ) , / / 当 前 需 要 获 取 别 人 发 送 的 已 读 回 执 列 表 的 可 见 元 素
setOutMessageReadInterval : null , / / 设 置 我 发 出 的 消 息 , 别 人 已 读 的 定 时 器
tempWaitDoCheck : [ ] , / / 当 前 获 取 别 人 发 送 已 读 回 执 的 元 素
isShowMessageReadDetail : false , / / 是 否 显 示 消 息 已 读 未 读 详 情
msgReadDetailTabs : [
{
key : '1' ,
title : '未读' ,
} ,
{
key : '0' ,
title : '已读' ,
} ,
] ,
msgReadOrNotDetail : [ ] , / / 消 息 已 读 未 读 详 情
currentMsgReadOrNotDetail : null , / / 当 前 消 息 已 读 未 读 详 情
readNumPage : 1 , / / 已 读 未 读 详 情 分 页
hasMoreReadDetail : true , / / 是 否 还 有 更 多 已 读 未 读 详 情
currentIsUnread : 1 , / / 当 前 已 读 未 读 状 态
readDetailHeight : 400 , / / 已 读 未 读 详 情 高 度
isFirstEnter : true , / / 是 否 是 第 一 次 进 入
} )
/ / 创 建 一 个 响 应 式 的 M a p 来 维 护 已 读 数 量
const recordReadsMap = ref ( new Map ( ) )
/ / 监 听 M a p 的 变 化 , 更 新 U I
watch (
recordReadsMap ,
( newMap ) => {
requestAnimationFrame ( ( ) => {
newMap . forEach ( ( readNum , msgId ) => {
const element = document . getElementById ( ` zp-id- ${ msgId } ` )
if ( element ) {
element . dataset . readNum = readNum
const readNumElement = element . querySelector ( '.have_read_num' )
if ( readNumElement ) {
if ( talkParams . type === 1 ) {
readNumElement . textContent = readNum > 0 ? '已读' : '未读'
} else {
readNumElement . textContent =
'已读 (' + readNum + '/' + talkParams . num + ')'
}
}
}
} )
} )
} ,
{
deep : true ,
} ,
)
uniOnload ( async ( options ) => {
console . log ( 'onLoad' + JSON . stringify ( options ) )
if ( options . sessionId ) {
@ -967,7 +1147,9 @@ const onEmoticonEvent = (data) => {
quill . insertText ( index , data . value )
}
quill . setSelection ( index + 1 , 0 , 'user' )
if ( index ) {
quill . setSelection ( index + 1 , 0 , 'user' )
}
} else {
let fn = emitCall ( 'emoticon_event' , data . value , ( ) => { } )
emit ( 'editor-event' , fn )
@ -975,21 +1157,25 @@ const onEmoticonEvent = (data) => {
}
let calcDelta = false
const onEditorChange = ( ) => {
if ( calcDelta ) {
if ( calcDelta ) {
calcDelta = false
return
}
/ / 以 下 逻 辑 是 光 标 与 @ 之 间 存 在 其 他 内 容 时 不 触 发 选 人 弹 窗
const qtext = getQuill ( ) . getText ( )
let selectIdx = getQuill ( ) . getSelection ( ) . index
let selectIdx = getQuill ( ) ? . getSelection ( ) ? . index
const textBeforeCursor = qtext . substring ( 0 , selectIdx )
if ( textBeforeCursor [ 0 ] ? . charCodeAt ( 0 ) === 10 ) {
const delta = getQuill ( ) . getContents ( )
const ops = delta . ops || [ ]
if ( ops [ 0 ] . insert === '\n' ) {
ops . splice ( 0 , 1 )
getQuill ( ) . setContents ( delta )
getQuill ( ) . setSelection ( getQuill ( ) . getText ( ) . length , 0 )
if ( ops . length > 0 ) {
nextTick ( ( ) => {
getQuill ( ) . setContents ( delta )
getQuill ( ) . setSelection ( getQuill ( ) . getText ( ) . length , 0 )
} )
}
}
/ / f o r ( l e t i = 0 ; i < o p s . l e n g t h ; i + + ) {
/ / i f ( o p s [ i ] . i n s e r t = = = ' \ n ' ) {
@ -1349,6 +1535,39 @@ watch(
state . value . localPageLoadDone = false
}
}
/ / 处 理 新 消 息
if ( oldValue && oldValue . length > 0 ) {
const lastOldMsgId = oldValue [ 0 ] . msg _id
const lastIndex = newValue . findIndex (
( msg ) => msg . msg _id === lastOldMsgId ,
)
console . error ( lastIndex , 'lastIndex' )
if ( lastIndex === - 1 ) {
/ / 没 找 到 l a s t O l d M s g I d , 说 明 都 是 新 消 息
newValue . forEach ( ( msg ) => {
nextTick ( ( ) => {
const element = document . getElementById ( ` zp-id- ${ msg . msg _id } ` )
if ( element ) {
messageRecordElementRefs . value . unshift ( element )
}
} )
} )
} else if ( lastIndex > 0 ) {
/ / 找 到 了 l a s t O l d M s g I d , 它 前 面 的 都 是 新 消 息
for ( let i = 0 ; i < lastIndex ; i ++ ) {
const msg = newValue [ i ]
console . error ( msg , '新消息msg' )
nextTick ( ( ) => {
const element = document . getElementById ( ` zp-id- ${ msg . msg _id } ` )
if ( element ) {
messageRecordElementRefs . value . unshift ( element )
}
} )
}
}
}
}
} ,
{
@ -1483,7 +1702,7 @@ const clearMultiSelect = () => {
const initData = async ( ) => {
const dialogueList = getDialogueList ( talkParams . index _name )
let doLocalPaging = false
if ( dialogueList ? . records ? . length > 0 ) {
if ( dialogueList ? . records ? . length > 0 ) {
doLocalPaging = true
}
console . error ( 'dialogueList' , dialogueList )
@ -1497,7 +1716,7 @@ const initData = async () => {
no _limit : dialogueList ? 1 : 0 ,
}
await onLoad ( { ... objT } )
if ( doLocalPaging ) {
if ( doLocalPaging ) {
zpagingRef . value ? . setLocalPaging ( records . value )
}
}
@ -1818,8 +2037,8 @@ const handleAvatarTouchEnd = () => {
onMounted ( async ( ) => {
if ( uni . getSystemInfoSync ( ) . osName === 'ios' ) {
let versions = uni . getSystemInfoSync ( ) . osVersion . split ( '.' )
if ( Number ( versions [ 0 ] ) < 1 7 ) {
console . error ( 'ios版本低于1 7 ')
if ( Number ( versions [ 0 ] ) < 1 6 ) {
console . error ( 'ios版本低于1 6 ')
state . value . canUseQuillEditor = false
}
}
@ -1843,9 +2062,246 @@ onMounted(async () => {
state . value . selectAreaHeight =
rpxToPx ( state . value . mentionSelectHeight ) - rpxToPx ( 90 ) + 'px'
state . value . readDetailHeight =
rpxToPx ( state . value . mentionSelectHeight ) - rpxToPx ( 300 ) + 'px'
} )
/ / 设 置 观 察 者 前 设 置 定 时 器
if ( state . value . setMessageReadInterval ) {
clearInterval ( state . value . setMessageReadInterval )
state . value . setMessageReadInterval = null
}
state . value . setMessageReadInterval = setInterval ( ( ) => {
checkVisibleElements ( )
} , 2000 )
if ( state . value . setOutMessageReadInterval ) {
clearInterval ( state . value . setOutMessageReadInterval )
state . value . setOutMessageReadInterval = null
}
state . value . setOutMessageReadInterval = setInterval ( ( ) => {
checkVisibleOutElements ( )
} , 2000 )
/ / 初 始 化 设 置 观 察 者
const options = {
root : null , / / 使 用 浏 览 器 窗 口 作 为 根 容 器
threshold : [ 0 , 0.1 , 0.2 , 0.3 , 0.4 , 0.5 , 0.6 , 0.7 , 0.8 , 0.9 , 1.0 ] , / / 设 置 多 个 阈 值 点
rootMargin : '50px 0px' , / / 增 加 观 察 范 围
}
observer = new IntersectionObserver ( handleIntersection , options )
nextTick ( ( ) => {
watch (
messageRecordElementRefs ,
( newMessageRecordElementRefs ) => {
if ( Array . isArray ( newMessageRecordElementRefs ) ) {
newMessageRecordElementRefs . forEach ( ( el , index ) => {
observeElement ( el , index )
} )
}
} ,
{
immediate : true ,
deep : true ,
} ,
)
if ( messageRecordElementRefs . value . length > 0 ) {
messageRecordElementRefs . value . forEach ( ( el , index ) =>
observeElement ( el , index ) ,
)
}
} )
} )
/ / 检 查 需 要 发 送 已 读 回 执 的 元 素
const checkVisibleElements = ( ) => {
if ( state . value . visibleElements . size > 0 ) {
/ / c o n s o l e . e r r o r ( ' 当 前 待 发 送 已 读 的 消 息 元 素 : ' , s t a t e . v a l u e . v i s i b l e E l e m e n t s )
let waitDoRead = [ ]
state . value . visibleElements . forEach ( ( el ) => {
/ / c o n s o l e . l o g ( e l )
const msgId = el . dataset . msgid
const talkType = Number ( el . dataset . talktype )
const receiverId = Number ( el . dataset . receiverid )
/ / c o n s o l e . l o g ( m s g I d , t a l k T y p e , r e c e i v e r I d )
if ( waitDoRead . length === 0 ) {
waitDoRead . push ( {
msg _ids : [ msgId ] ,
talk _type : talkType ,
receiver _id : receiverId ,
} )
} else {
const existingItem = waitDoRead . find (
( item ) =>
item . talk _type === talkType && item . receiver _id === receiverId ,
)
if ( existingItem ) {
existingItem . msg _ids . push ( msgId )
} else {
waitDoRead . push ( {
msg _ids : [ msgId ] ,
talk _type : talkType ,
receiver _id : receiverId ,
} )
}
}
} )
/ / c o n s o l e . e r r o r ( w a i t D o R e a d )
if ( waitDoRead . length > 0 ) {
waitDoRead . forEach ( ( doReadItem ) => {
/ / 查 找 上 一 次 存 储 的 对 应 项
const prevItem = state . value . tempWaitDoRead . find (
( prev ) =>
prev . talk _type === doReadItem . talk _type &&
prev . receiver _id === doReadItem . receiver _id ,
)
/ / 如 果 找 不 到 上 一 次 的 项 , 或 者 m s g _ i d s 不 一 致 , 则 发 送
if (
! prevItem ||
! doReadItem . msg _ids . every ( ( id ) => prevItem . msg _ids . includes ( id ) )
) {
console . error ( '====发送了已读回执=====' , doReadItem )
/ / 发 送 已 读 回 执
ws . emit ( 'im.message.read' , doReadItem )
}
} )
}
/ / 更 新 完 成 后 再 保 存 当 前 数 据
state . value . tempWaitDoRead = JSON . parse ( JSON . stringify ( waitDoRead ) )
}
}
/ / 检 查 需 要 获 取 别 人 发 送 的 已 读 回 执 列 表 的 元 素
const checkVisibleOutElements = ( ) => {
if ( state . value . visibleOutElements . size > 0 ) {
/ / c o n s o l e . e r r o r ( ' 当 前 待 获 取 已 读 回 执 列 表 的 消 息 元 素 : ' , s t a t e . v a l u e . v i s i b l e O u t E l e m e n t s )
let waitDoCheck = [ ]
state . value . visibleOutElements . forEach ( ( el ) => {
/ / c o n s o l e . l o g ( e l )
const msgId = el . dataset . msgid
const talkType = Number ( el . dataset . talktype )
const receiverId = Number ( el . dataset . receiverid )
if ( waitDoCheck . length === 0 ) {
waitDoCheck . push ( {
msg _ids : [ msgId ] ,
talk _type : talkType ,
receiver _id : receiverId ,
} )
} else {
const existingItem = waitDoCheck . find (
( item ) =>
item . talk _type === talkType && item . receiver _id === receiverId ,
)
if ( existingItem ) {
existingItem . msg _ids . push ( msgId )
} else {
waitDoCheck . push ( {
msg _ids : [ msgId ] ,
talk _type : talkType ,
receiver _id : receiverId ,
} )
}
}
} )
/ / c o n s o l e . e r r o r ( w a i t D o C h e c k )
if ( waitDoCheck . length > 0 ) {
waitDoCheck . forEach ( ( doCheckItem ) => {
/ / 查 找 上 一 次 存 储 的 对 应 项
/ / c o n s t p r e v I t e m = s t a t e . v a l u e . t e m p W a i t D o C h e c k . f i n d (
/ / ( p r e v ) = >
/ / p r e v . t a l k _ t y p e = = = d o C h e c k I t e m . t a l k _ t y p e & &
/ / p r e v . r e c e i v e r _ i d = = = d o C h e c k I t e m . r e c e i v e r _ i d ,
/ / )
/ / / / 如 果 找 不 到 上 一 次 的 项 , 或 者 m s g _ i d s 不 一 致 , 则 发 送
/ / i f (
/ / ! p r e v I t e m | |
/ / ! d o C h e c k I t e m . m s g _ i d s . e v e r y ( ( i d ) = > p r e v I t e m . m s g _ i d s . i n c l u d e s ( i d ) )
/ / ) {
console . error ( '====调用了已读回执查询接口=====' , doCheckItem )
let params = Object . assign ( { } , doCheckItem , {
talkType : doCheckItem . talk _type , / / 1 私 聊 2 群 聊
receiverId :
doCheckItem . talk _type === 1
? talkParams . uid
: talkParams . receiver _id , / / 私 聊 的 时 候 是 对 方 用 户 i d , 群 聊 的 时 候 是 对 方 群 i d
msgIds : doCheckItem . msg _ids ,
type : 'list' , / / l i s t 是 列 表 , d e t a i l 是 详 情
} )
const resp = ServeReadConditionList ( params )
/ / c o n s o l e . l o g ( r e s p )
resp
. then ( ( { code , data } ) => {
/ / c o n s o l e . l o g ( d a t a )
if ( code == 200 ) {
/ / 处 理 批 量 更 新
if ( Array . isArray ( data . data ) ) {
console . error ( '处理批量更新' , data . data )
data . data . forEach ( ( item ) => {
if ( item . msgId && item . readNum !== undefined ) {
recordReadsMap . value . set ( item . msgId , item . readNum )
}
} )
} else if ( data . data && data . data . readNum !== undefined ) {
console . error ( '处理单个更新' , data . data )
doCheckItem . msg _ids . forEach ( ( msgId ) => {
recordReadsMap . value . set ( msgId , data . data . readNum )
} )
}
}
} )
. catch ( ( ) => { } )
/ / }
} )
}
/ / 更 新 完 成 后 再 保 存 当 前 数 据
state . value . tempWaitDoCheck = JSON . parse ( JSON . stringify ( waitDoCheck ) )
}
}
/ / 观 察 元 素
const observeElement = ( el , index ) => {
if ( el && observer ) {
/ / 使 用 r e q u e s t A n i m a t i o n F r a m e 优 化 D O M 操 作
requestAnimationFrame ( ( ) => {
observer . unobserve ( el ) / / 先 取 消 观 察
observer . observe ( el ) / / 再 重 新 观 察
} )
}
}
/ / 观 察 者 函 数
const handleIntersection = ( entries ) => {
entries . forEach ( ( entry ) => {
if ( entry . isIntersecting && entry . intersectionRatio >= 0.5 ) {
/ / 确 保 元 素 有 足 够 比 例 可 见
/ / 元 素 进 入 视 口
let elData = entry . target . dataset
const msgType = elData . msgtype
const userId = elData . userid
if ( Number ( msgType ) < 1000 && Number ( userId ) !== Number ( talkParams . uid ) ) {
/ / 我 读 别 人 发 的 消 息 , 需 要 发 送 已 读 回 执
state . value . visibleElements . add ( entry . target )
}
if ( Number ( msgType ) < 1000 && Number ( userId ) === Number ( talkParams . uid ) ) {
/ / 我 发 的 消 息 , 需 要 获 取 别 人 发 送 的 已 读 回 执 列 表
state . value . visibleOutElements . add ( entry . target )
}
} else {
/ / 元 素 离 开 视 口 , 从 集 合 中 移 除
state . value . visibleElements . delete ( entry . target )
state . value . visibleOutElements . delete ( entry . target )
}
} )
if ( state . value . isFirstEnter ) {
state . value . isFirstEnter = false
/ / 立 即 执 行 一 次
/ / c h e c k V i s i b l e E l e m e n t s ( )
/ / c h e c k V i s i b l e O u t E l e m e n t s ( )
}
}
const pxTorPx = ( px ) => {
const sysInfo = uni . getSystemInfoSync ( )
const rpx = px / ( sysInfo . screenWidth / 750 )
@ -1873,6 +2329,19 @@ onUnmounted(() => {
if ( uploadsStore . isUploading ) {
uploadsStore . clearUpload ( )
}
if ( observer ) {
observer . disconnect ( )
}
if ( state . value . setMessageReadInterval ) {
clearInterval ( state . value . setMessageReadInterval )
state . value . setMessageReadInterval = null
checkVisibleElements ( )
}
if ( state . value . setOutMessageReadInterval ) {
clearInterval ( state . value . setOutMessageReadInterval )
state . value . setOutMessageReadInterval = null
checkVisibleOutElements ( )
}
} )
/ / 修 改 防 抖 函 数 的 实 现
@ -1936,6 +2405,82 @@ const onTextAreaMention = (user) => {
state . value . isShowMentionSelect = false
}
}
/ / 隐 藏 消 息 已 读 未 读 详 情
const hideMessageReadDetail = ( ) => {
state . value . isShowMessageReadDetail = false
}
/ / 显 示 消 息 已 读 未 读 详 情
const toShowMessageReadDetail = ( item ) => {
console . log ( item )
if ( talkParams . type === 1 ) {
return
}
state . value . isShowMessageReadDetail = true
state . value . currentMsgReadOrNotDetail = item
getMessageReadDetail ( 1 )
}
/ / 切 换 消 息 已 读 / 未 读 详 情
const msgReadDetailTabsChange = ( e ) => {
/ / c o n s o l e . l o g ( e )
if ( Number ( e ) !== Number ( state . value . currentIsUnread ) ) {
state . value . readNumPage = 1
}
state . value . currentIsUnread = Number ( e )
getMessageReadDetail ( e )
}
/ / 获 取 消 息 已 读 未 读 详 情
const getMessageReadDetail = ( isUnread ) => {
let params = {
page : state . value . readNumPage ,
pageSize : 10 ,
type : 'detail' , / / l i s t 是 列 表 , d e t a i l 是 详 情
talkType : state . value . currentMsgReadOrNotDetail . talk _type , / / 1 私 聊 2 群 聊
receiverId : state . value . currentMsgReadOrNotDetail . receiver _id , / / 私 聊 的 时 候 是 对 方 用 户 i d , 群 聊 的 时 候 是 对 方 群 i d
msgId : state . value . currentMsgReadOrNotDetail . msg _id ,
isUnread : Number ( isUnread ) , / / 不 送 或 者 送 0 代 表 看 已 读 , 送 1 看 未 读
}
const resp = ServeMessageReadDetail ( params )
/ / c o n s o l e . l o g ( r e s p )
resp
. then ( ( { code , data } ) => {
console . log ( data )
if ( code == 200 ) {
if ( Number ( isUnread ) === 0 ) {
state . value . msgReadDetailTabs [ 0 ] . title =
'未读 ( ' + ( talkParams . num - data . count ) + ') '
state . value . msgReadDetailTabs [ 1 ] . title = '已读 ( ' + data . count + ') '
} else if ( Number ( isUnread ) === 1 ) {
state . value . msgReadDetailTabs [ 0 ] . title = '未读 ( ' + data . count + ') '
state . value . msgReadDetailTabs [ 1 ] . title =
'已读 ( ' + ( talkParams . num - data . count ) + ') '
}
if ( state . value . readNumPage === 1 ) {
state . value . msgReadOrNotDetail = data . data
} else {
state . value . msgReadOrNotDetail = [
... state . value . msgReadOrNotDetail ,
... data . data ,
]
}
if ( ! data ? . data || data ? . data ? . length < 10 ) {
state . value . hasMoreReadDetail = false
} else {
state . value . hasMoreReadDetail = true
}
}
} )
. catch ( ( ) => { } )
}
/ / 滚 动 到 底 部 加 载 更 多 已 读 未 读 详 情
const loadMoreReadDetails = ( ) => {
if ( ! state . value . hasMoreReadDetail ) {
return
}
state . value . readNumPage += 1
getMessageReadDetail ( state . value . currentIsUnread )
}
< / script >
< style scoped lang = "less" >
. dialog - page {
@ -2125,6 +2670,15 @@ const onTextAreaMention = (user) => {
}
}
. have _read _num {
text - align : right ;
color : # 7 a58de ;
font - size : 22 rpx ;
font - weight : 400 ;
line - height : 34 rpx ;
margin : 5 rpx 0 0 ;
}
. talk - reply {
display : flex ;
align - items : flex - start ;
@ -2331,4 +2885,38 @@ const onTextAreaMention = (user) => {
: deep ( . mention ) {
color : # 1890 ff ;
}
. msg - read - detail - tabs {
padding : 32 rpx 0 0 ;
: deep ( . noNvueBorder ) {
padding : 0 ! important ;
margin : 0 ! important ;
}
. msg - read - detail {
padding : 28 rpx 32 rpx ;
. msg - read - detail - each {
display : flex ;
flex - direction : row ;
align - items : center ;
justify - content : flex - start ;
padding : 20 rpx 32 rpx ;
border - bottom : 1 rpx solid # f8f8f8 ;
. msg - read - detail - each - avatar {
margin : 0 20 rpx 0 0 ;
}
. msg - read - detail - each - info {
display : flex ;
flex - direction : column ;
align - items : flex - start ;
justify - content : center ;
span {
font - size : 28 rpx ;
color : # 191919 ;
font - weight : 500 ;
line - height : 40 rpx ;
}
}
}
}
}
< / style >