update 群聊消息未读数处理

This commit is contained in:
zengBin 2024-10-09 14:27:11 +08:00
parent a67f082939
commit 02354ddb59
10 changed files with 138 additions and 301 deletions

View File

@ -242,13 +242,13 @@ scroll-view {
<view v-if="item.photos.length > 0" class="~ui-wrap ui-dynamic-pic-box {{item.photos.length == 2 ? '~f-fl' : '~f-fb'}}"> <view v-if="item.photos.length > 0" class="~ui-wrap ui-dynamic-pic-box {{item.photos.length == 2 ? '~f-fl' : '~f-fb'}}">
<image v-for="(itemV2,indexV2) in item.photos" :key="indexV2" @tap.stop="$previewImages(itemV2, item.photos)" class="{{item.photos.length == 1 ? 'ui-only-img':''}} {{item.photos.length > 1 ? 'ui-grid-square' : ''}} {{item.photos.length == 2 ? '~ui-mr-10' : ''}}" :src="itemV2" mode="aspectFill"></image> <image v-for="(itemV2,indexV2) in item.photos" :key="indexV2" @tap.stop="$previewImages(itemV2, item.photos)" class="{{item.photos.length == 1 ? 'ui-only-img':''}} {{item.photos.length > 1 ? 'ui-grid-square' : ''}} {{item.photos.length == 2 ? '~ui-mr-10' : ''}}" :src="itemV2" mode="aspectFill"></image>
</view> </view>
<view v-if="item.play_url" :style="{width: item.video_width > item.video_height ? '480rpx' : '320rpx', height: item.video_width > item.video_height ? '270rpx' : '480rpx', display: videoIndex == index ? 'none' : 'block'}" class="liveImg" mode="widthFix" @tap.stop="playVideo(index, item.id)"> <view v-if="item.play_url" :style="{width: item.video_width > item.video_height ? '480rpx' : '320rpx', height: item.video_width > item.video_height ? '270rpx' : '480rpx'}" class="liveImg" mode="widthFix" @tap.stop="playVideo(index, item.id)">
<image v-if="videoIndex != index" class="ui-video-box" :src="item.cover_url" :style="{width: item.video_width > item.video_height ? '480rpx' : '320rpx', height: item.video_width > item.video_height ? '270rpx' : '480rpx'}"> <image v-if="videoIndex != index" class="ui-video-box" :src="item.cover_url" :style="{width: item.video_width > item.video_height ? '480rpx' : '320rpx', height: item.video_width > item.video_height ? '270rpx' : '480rpx'}">
<view class="ui-vide-poster"> <view class="ui-vide-poster">
<image class="ui-video_play_icon" src="https://image.fulllinkai.com/202308/17/42c88bf039bb56f85cfcb9af0392ffb6.png"></image> <image class="ui-video_play_icon" src="https://image.fulllinkai.com/202308/17/42c88bf039bb56f85cfcb9af0392ffb6.png"></image>
</view> </view>
</image> </image>
<video id="video" :src="item.play_url" v-if="videoIndex == index" play-btn-position="center" show-fullscreen-btn="{{false}}" controls direction="0" object-fit="{{videoIndex == index ? 'contain' : 'cover'}}" referrer-policy="origin" bindfullscreenchange="leaveVideo" class="videoCenter ui-video-r-box" :style="{width: item.video_width > item.video_height ? '480rpx' : '320rpx', height: item.video_width > item.video_height ? '270rpx' : '480rpx'}" :key="item.id"> <video :id="'video-' + index" :src="item.play_url" v-if="videoIndex == index" play-btn-position="center" show-fullscreen-btn="{{false}}" controls direction="0" object-fit="{{videoIndex == index ? 'contain' : 'cover'}}" referrer-policy="origin" bindfullscreenchange="leaveVideo" class="videoCenter ui-video-r-box" :style="{width: item.video_width > item.video_height ? '480rpx' : '320rpx', height: item.video_width > item.video_height ? '270rpx' : '480rpx'}" :key="item.id">
</video> </video>
</view> </view>
<view class="~font_24 ~f-fb ~ui-mt-10" v-if="item.topic && item.topic.name" @tap="jumpPath(`/pages/dynamic/hotTopic?id=${item.topic.id}`)"> <view class="~font_24 ~f-fb ~ui-mt-10" v-if="item.topic && item.topic.name" @tap="jumpPath(`/pages/dynamic/hotTopic?id=${item.topic.id}`)">
@ -388,13 +388,12 @@ scroll-view {
return return
} }
vm.videoIndex = index vm.videoIndex = index
vm.videoContext = wx.createVideoContext('video', vm.$wx) vm.videoContext = wx.createVideoContext(`video-${index}`, vm.$wx)
vm.videoContext.requestFullScreen() vm.videoContext.requestFullScreen()
setTimeout(function() { setTimeout(function() {
// 将点击视频进行播放 // 将点击视频进行播放
vm.videoContext = wx.createVideoContext('video', vm.$wx)
vm.videoContext.play() vm.videoContext.play()
}, 1200) }, 500)
}, },
// 关闭视频 // 关闭视频
leaveVideo(e) { leaveVideo(e) {

View File

@ -112,7 +112,7 @@ wepy.component({
console.log(filePathUrl, '上传成功') console.log(filePathUrl, '上传成功')
let dataV2 = { let dataV2 = {
filePath: filePathUrl, filePath: filePathUrl,
type: type type: filePath.split('.').pop().toLowerCase()
} }
vm.uploadVideo = [dataV2] vm.uploadVideo = [dataV2]

View File

@ -283,7 +283,7 @@ page {
</block> </block>
<block v-if="uploadType == 'video'"> <block v-if="uploadType == 'video'">
<view class="relative_bot"> <view class="relative_bot">
<video id="video" referrer-policy="origin" src="{{play_url}}" direction="0" controls="{{true}}" class="videoCenter"></video> <!-- <video id="video" referrer-policy="origin" src="{{play_url}}" direction="0" controls="{{true}}" class="videoCenter"></video>-->
<view class="close_icon" @tap="closeFn"></view> <view class="close_icon" @tap="closeFn"></view>
</view> </view>
</block> </block>

View File

@ -95,10 +95,10 @@ page {
</style> </style>
<template> <template>
<view class="ui-singleSquare"> <view class="ui-singleSquare">
<view class="m_rec font_26 f-fbc" v-if="recommendData.apply_state.has_apply_area != 1 && type != 'marriage'"> <!-- <view class="m_rec font_26 f-fbc" v-if="recommendData.apply_state.has_apply_area != 1 && type != 'marriage'">-->
<view>上专区推荐,还可进入群聊,更容易脱单哦~</view> <!-- <view>上专区推荐,还可进入群聊,更容易脱单哦~</view>-->
<view class="u_rec_bu" bindtap="getRecommend">去申请</view> <!-- <view class="u_rec_bu" bindtap="getRecommend">去申请</view>-->
</view> <!-- </view>-->
<view v-if="list.length == 0 && loading" class="text-center"> <view v-if="list.length == 0 && loading" class="text-center">
<image class="ui-no-data-icon" src="https://images.ufutx.com/202104/13/1737964f7c98cbf65d728137dc2792eb.png" mode="aspectFill"></image> <image class="ui-no-data-icon" src="https://images.ufutx.com/202104/13/1737964f7c98cbf65d728137dc2792eb.png" mode="aspectFill"></image>
</view> </view>

View File

@ -563,7 +563,7 @@ page {
<scroll-view class="ui-scroll-view" style="height: {{windowHeight - bottomBoxH}}rpx;" :scroll-y="scrollY" upper-threshold="50" bindscrolltoupper="getHistoryMsg" scroll-into-view="{{toView}}" enable-flex="{{true}}"> <scroll-view class="ui-scroll-view" style="height: {{windowHeight - bottomBoxH}}rpx;" :scroll-y="scrollY" upper-threshold="50" bindscrolltoupper="getHistoryMsg" scroll-into-view="{{toView}}" enable-flex="{{true}}">
<view class="ui-top-placeholder"></view> <view class="ui-top-placeholder"></view>
<block v-show="loading"> <block v-show="loading">
<image v-if="chatInfoData.other_real_approved != 1" class="ui-tips-pic" src="https://image.fulllinkai.com/202203/22/2a0d6bba0289f28b8d816e4deb1efa4c.png" mode="widthFix"></image> <image v-if="otherUserReal != 1" class="ui-tips-pic" src="https://image.fulllinkai.com/202203/22/2a0d6bba0289f28b8d816e4deb1efa4c.png" mode="widthFix"></image>
<view class="ui-tips-box"> <view class="ui-tips-box">
<view class="font_28 color333 bold"> <view class="font_28 color333 bold">
<image src="https://images.ufutx.com/202012/24/dcf6c6454e7bb280c07346dcdceef767.png" mode="widthFix" class="ui-tips_icon"></image> <image src="https://images.ufutx.com/202012/24/dcf6c6454e7bb280c07346dcdceef767.png" mode="widthFix" class="ui-tips_icon"></image>
@ -598,14 +598,14 @@ page {
<view v-else>{{audioTime + '"'}}</view> <view v-else>{{audioTime + '"'}}</view>
</view> </view>
<!--视频信息--> <!--视频信息-->
<view v-if="item.msgType == 'video' || item.msgType == 'VIDEO'" :style="{width: item.attach.w + 'rpx', height: item.attach.h + 'rpx', display: videoIndex == index ? 'none' : 'block'}" class="liveImg" mode="widthFix" @tap.stop="playVideo(index, item.id)"> <view v-if="item.msgType == 'video' || item.msgType == 'VIDEO'" :style="{width: item.attach.w + 'rpx', height: item.attach.h + 'rpx'}" class="liveImg" mode="widthFix" @tap.stop="playVideo(index)">
<image v-if="videoIndex != index" class="ui-video-box" :src="item.attach.poster" :style="{width: item.attach.w + 'rpx', height: item.attach.h + 'rpx'}"> <image v-if="videoIndex != index" class="ui-video-box" :src="item.attach.poster" :style="{width: item.attach.w + 'rpx', height: item.attach.h + 'rpx'}">
<view class="ui-vide-poster"> <view class="ui-vide-poster">
<image class="ui-video_play_icon" src="https://image.fulllinkai.com/202308/17/42c88bf039bb56f85cfcb9af0392ffb6.png"></image> <image class="ui-video_play_icon" src="https://image.fulllinkai.com/202308/17/42c88bf039bb56f85cfcb9af0392ffb6.png"></image>
<view class="ui-video_play-text font_20 white">{{item.videoDur}}</view> <view class="ui-video_play-text font_20 white">{{item.videoDur}}</view>
</view> </view>
</image> </image>
<video :id="item.id" :src="item.attach.url" v-if="videoIndex == index" play-btn-position="center" show-fullscreen-btn="{{false}}" controls custom-cache="{{true}}" direction="0" object-fit="{{videoIndex == index ? 'contain' : 'cover'}}" referrer-policy="origin" bindfullscreenchange="leaveVideo" class="videoCenter ui-video-r-box" :style="{width: item.attach.w + 'rpx', height: item.attach.h + 'rpx'}" :key="item.id"> <video id="chatVideo-{{index}}" :src="item.attach.url" v-if="videoIndex == index" play-btn-position="center" show-fullscreen-btn="{{false}}" controls custom-cache="{{true}}" direction="0" object-fit="{{videoIndex == index ? 'contain' : 'cover'}}" referrer-policy="origin" bindfullscreenchange="leaveVideo" class="videoCenter ui-video-r-box" :style="{width: item.attach.w + 'rpx', height: item.attach.h + 'rpx'}" :key="index">
</video> </video>
</view> </view>
</view> </view>
@ -710,7 +710,6 @@ wepy.page({
otherUserName: '', otherUserName: '',
otherUserReal: 0, // 对方是否真人认证 otherUserReal: 0, // 对方是否真人认证
chatInfoData: {},
reportShow: false, // 举报 reportShow: false, // 举报
throttle: true, throttle: true,
@ -765,20 +764,6 @@ wepy.page({
msg: '' msg: ''
}, },
methods: { methods: {
// 获取对方是否认证,并且标记消息已读
getChatInfo() {
let vm = this
let data = {user_id: `${vm.otherUserId}`}
vm.$get({url: `${service.host}/app/chat/info`, data}).then(({code, data}) => {
if (code === 0) {
vm.chatInfoData = data
}
}).catch(err => {
wx.hideLoading()
console.log(err)
})
},
// 发送文本和表情包消息 // 发送文本和表情包消息
send() { send() {
let vm = this let vm = this
@ -885,7 +870,6 @@ wepy.page({
vm.openShow = false vm.openShow = false
vm.uploadState = true vm.uploadState = true
vm.progressValue = 5 vm.progressValue = 5
try {
app.globalData.nim.msg.sendVideoMsg({ app.globalData.nim.msg.sendVideoMsg({
scene: 'p2p', scene: 'p2p',
to: vm.otherUserId, to: vm.otherUserId,
@ -925,9 +909,6 @@ wepy.page({
}) })
} }
}) })
} catch (err) {
vm.sendFileError()
}
}, },
// 发送语音 // 发送语音
sendAudio(file) { sendAudio(file) {
@ -1026,7 +1007,6 @@ wepy.page({
reception(e) { reception(e) {
let vm = this let vm = this
vm.sendMsgReceipt(e) vm.sendMsgReceipt(e)
// vm.getChatInfo()
if (e.type == 'text' && /\[[^\]]+\]/.test(e.body)) { if (e.type == 'text' && /\[[^\]]+\]/.test(e.body)) {
e.body = vm.transitionMsg(e.body) e.body = vm.transitionMsg(e.body)
} }
@ -1098,9 +1078,9 @@ wepy.page({
showTime: item.showTime, showTime: item.showTime,
videoDur: item.content_type == 'video' || item.content_type == 'VIDEO' ? getVideoTime(item.attach.dur) : '', videoDur: item.content_type == 'video' || item.content_type == 'VIDEO' ? getVideoTime(item.attach.dur) : '',
audioDur: item.content_type == 'audio' || item.content_type == 'AUDIO' ? (item.attach.dur / 1000).toFixed(0) : '', audioDur: item.content_type == 'audio' || item.content_type == 'AUDIO' ? (item.attach.dur / 1000).toFixed(0) : '',
name: item.fromNick, name: item.is_mine == 0 ? vm.otherUserName : vm.myName,
isSend: 1, isSend: 1,
userId: item.from, userId: item.user_id,
msgType: item.content_type msgType: item.content_type
}) })
}) })
@ -1406,7 +1386,6 @@ wepy.page({
e.w = e.w / wRatio e.w = e.w / wRatio
e.h = 200 e.h = 200
} }
console.log(e, '8988888')
return e return e
}, },
// 更多操作 // 更多操作
@ -1451,17 +1430,16 @@ wepy.page({
}) })
}, },
// 播放视频 // 播放视频
playVideo(index, e) { playVideo(index) {
let vm = this let vm = this
vm.videoState = true vm.videoState = true
vm.videoIndex = index vm.videoIndex = index
vm.videoContext = wx.createVideoContext(`${e}`) vm.videoContext = wx.createVideoContext('chatVideo-' + index, vm)
vm.videoContext.requestFullScreen() vm.videoContext.requestFullScreen({direction: 0})
setTimeout(function() { setTimeout(() => {
// 将点击视频进行播放 // 将点击视频进行播放
vm.videoContext = wx.createVideoContext(`${e}`)
vm.videoContext.play() vm.videoContext.play()
}, 1200) }, 500)
}, },
// 关闭视频 // 关闭视频
leaveVideo(e, row) { leaveVideo(e, row) {
@ -1510,7 +1488,7 @@ wepy.page({
let vm = this let vm = this
let imageArr = [] let imageArr = []
vm.msgList.forEach((item) => { vm.msgList.forEach((item) => {
if (item.msgType == 'image') { if (item.msgType == 'image' || item.msgType == 'PICTURE') {
imageArr.push(item.attach.url) imageArr.push(item.attach.url)
} }
}) })
@ -1526,7 +1504,6 @@ wepy.page({
vm.myType = wx.getStorageSync('userInfo').type vm.myType = wx.getStorageSync('userInfo').type
vm.myName = wx.getStorageSync('userInfo').name vm.myName = wx.getStorageSync('userInfo').name
vm.myAvatar = wx.getStorageSync('userInfo').avatar vm.myAvatar = wx.getStorageSync('userInfo').avatar
// vm.getChatInfo()
}, },
onLoad(e) { onLoad(e) {
let vm = this let vm = this

View File

@ -567,14 +567,14 @@ page {
<view v-else>{{audioTime + '"'}}</view> <view v-else>{{audioTime + '"'}}</view>
</view> </view>
<!--视频信息--> <!--视频信息-->
<view v-if="item.msgType == '3' || item.msgType == 'video'" :style="{width: item.attach.w + 'rpx', height: item.attach.h + 'rpx', display: videoIndex == index ? 'none' : 'block'}" class="liveImg" mode="widthFix" @tap.stop="playVideo(index, item.id)"> <view v-if="item.msgType == '3' || item.msgType == 'video'" :style="{width: item.attach.w + 'rpx', height: item.attach.h + 'rpx'}" class="liveImg" mode="widthFix" @tap.stop="playVideo(index)">
<image v-if="videoIndex != index" class="ui-video-box" :src="item.attach.poster" :style="{width: item.attach.w + 'rpx', height: item.attach.h + 'rpx'}"> <image v-if="videoIndex != index" class="ui-video-box" :src="item.attach.poster" :style="{width: item.attach.w + 'rpx', height: item.attach.h + 'rpx'}">
<view class="ui-vide-poster"> <view class="ui-vide-poster">
<image class="ui-video_play_icon" src="https://image.fulllinkai.com/202308/17/42c88bf039bb56f85cfcb9af0392ffb6.png"></image> <image class="ui-video_play_icon" src="https://image.fulllinkai.com/202308/17/42c88bf039bb56f85cfcb9af0392ffb6.png"></image>
<view class="ui-video_play-text font_20 white">{{item.videoDur}}</view> <view class="ui-video_play-text font_20 white">{{item.videoDur}}</view>
</view> </view>
</image> </image>
<video :id="item.id" :src="item.attach.url" v-if="videoIndex == index" play-btn-position="center" show-fullscreen-btn="{{false}}" controls custom-cache="{{true}}" direction="0" object-fit="{{videoIndex == index ? 'contain' : 'cover'}}" referrer-policy="origin" bindfullscreenchange="leaveVideo" class="videoCenter ui-video-r-box" :style="{width: item.attach.w + 'rpx', height: item.attach.h + 'rpx'}" :key="item.id"> <video id="groupChatVideo-{{index}}" :src="item.attach.url" v-if="videoIndex == index" play-btn-position="center" show-fullscreen-btn="{{false}}" controls custom-cache="{{true}}" direction="0" object-fit="{{videoIndex == index ? 'contain' : 'cover'}}" referrer-policy="origin" bindfullscreenchange="leaveVideo" class="videoCenter ui-video-r-box" :style="{width: item.attach.w + 'rpx', height: item.attach.h + 'rpx'}" :key="index">
</video> </video>
</view> </view>
</view> </view>
@ -982,6 +982,8 @@ wepy.page({
let vm = this let vm = this
app.globalData.nim.session.resetSessionUnreadCount({ app.globalData.nim.session.resetSessionUnreadCount({
id: `team-${vm.otherUserId}` id: `team-${vm.otherUserId}`
}).then((res) => {
console.log(res, '///////////---------')
}) })
}, },
// 在当前页面接收到别人发送过来的消息 // 在当前页面接收到别人发送过来的消息
@ -1036,10 +1038,8 @@ wepy.page({
vm.$get({url: `${service.host}/chat/team/${vm.otherUserId}/message/list`, data}).then(({code, data}) => { vm.$get({url: `${service.host}/chat/team/${vm.otherUserId}/message/list`, data}).then(({code, data}) => {
if (code === 0) { if (code === 0) {
console.log(data, '-------------------') console.log(data, '-------------------')
vm.sendMsgReceipt()
if (data && data.length > 0) { if (data && data.length > 0) {
// if (vm.msgList && vm.msgList.length == 0) {
// vm.sendMsgReceipt(data[0])
// }
data.forEach((item, index) => { data.forEach((item, index) => {
item.time = new Date(item.create_time.replace(/[-]/g, '/').replace(/[-]/, '')).getTime() item.time = new Date(item.create_time.replace(/[-]/g, '/').replace(/[-]/, '')).getTime()
item.avatar = 'https://image.fulllinkai.com/202307/18/449c3253ca2bbed9314d39977a486d0e.png' item.avatar = 'https://image.fulllinkai.com/202307/18/449c3253ca2bbed9314d39977a486d0e.png'
@ -1384,17 +1384,16 @@ wepy.page({
}) })
}, },
// 播放视频 // 播放视频
playVideo(index, e) { playVideo(index) {
let vm = this let vm = this
vm.videoState = true vm.videoState = true
vm.videoIndex = index vm.videoIndex = index
vm.videoContext = wx.createVideoContext(`${e}`) vm.videoContext = wx.createVideoContext('groupChatVideo-' + index, vm)
vm.videoContext.requestFullScreen() vm.videoContext.requestFullScreen({direction: 0})
setTimeout(function() { setTimeout(function() {
// 将点击视频进行播放 // 将点击视频进行播放
vm.videoContext = wx.createVideoContext(`${e}`)
vm.videoContext.play() vm.videoContext.play()
}, 1200) }, 500)
}, },
// 关闭视频 // 关闭视频
leaveVideo(e, row) { leaveVideo(e, row) {
@ -1481,7 +1480,6 @@ wepy.page({
// 底部输入框高度 // 底部输入框高度
vm.changeInputHeight(true) vm.changeInputHeight(true)
// 标记消息已读 // 标记消息已读
// vm.groupIsRead()
vm.teamsSessions() vm.teamsSessions()
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: vm.otherUserName, title: vm.otherUserName,

View File

@ -10,7 +10,6 @@ page {
background-color: #f8f8f8; background-color: #f8f8f8;
border-radius: 100rpx; border-radius: 100rpx;
padding: 0 22rpx; padding: 0 22rpx;
margin-left: 30rpx;
.m_search_icon { .m_search_icon {
width: 28rpx; width: 28rpx;
@ -60,59 +59,7 @@ page {
margin-top: 2rpx; margin-top: 2rpx;
margin-left: 16rpx; margin-left: 16rpx;
.ui-is-top{ .ui-nickname-box{}
margin-left: 16rpx;
padding-left: 8rpx;
width: 76rpx;
height: 32rpx;
background: linear-gradient(90deg, #FFD18D 0%, #FFA564 100%);
border-radius: 8rpx;
line-height: 32rpx;
}
.ui-name {
width: 400rpx;
}
.ui-message {
width: 524rpx;
}
}
.ui-unreadBox {
position: absolute;
right: 30rpx;
top: 0;
overflow: hidden;
.ui-lastTime {
margin-top: 10rpx;
}
.ui-no-disturbing {
width: 32rpx;
height: 32rpx;
margin-top: 12rpx;
}
.ui-unreadNum, .ui-unreadNum_1 {
float: right;
width: 28rpx;
height: 28rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 50%;
font-size: 20rpx;
background: #f1013D;
color: #fff;
margin-top: 12rpx;
}
.ui-unreadNum_1 {
width: 44rpx;
border-radius: 14rpx;
}
} }
} }
} }
@ -121,6 +68,8 @@ page {
<template> <template>
<view class="cu-custom"> <view class="cu-custom">
<view class="cu-bar fixed" :style="{height: CustomBar + 'px', paddingTop: StatusBar + 'px', background: bgColor, zIndex: 999}"> <view class="cu-bar fixed" :style="{height: CustomBar + 'px', paddingTop: StatusBar + 'px', background: bgColor, zIndex: 999}">
<view class="f-fcl">
<text class="cuIcon-back ui-pl-28 ui-pr-30" @tap="$gotoBack(-1)"></text>
<view class="m_search f-fcl ui-relative"> <view class="m_search f-fcl ui-relative">
<image class="m_search_icon" src="https://images.ufutx.com/202106/19/c607aaf49440b0df3308d6e048fd9ad7.png" mode="aspectFit" lazy-load="false"></image> <image class="m_search_icon" src="https://images.ufutx.com/202106/19/c607aaf49440b0df3308d6e048fd9ad7.png" mode="aspectFit" lazy-load="false"></image>
<image v-if="inputVal" class="ui-close-search-icon" src="https://image.fulllinkai.com/202307/04/a7f548083c45667843828e7fccef7d8c.png" mode="widthFix" @tap="inputVal = ''"></image> <image v-if="inputVal" class="ui-close-search-icon" src="https://image.fulllinkai.com/202307/04/a7f548083c45667843828e7fccef7d8c.png" mode="widthFix" @tap="inputVal = ''"></image>
@ -128,6 +77,7 @@ page {
</view> </view>
</view> </view>
</view> </view>
</view>
<view :style="{height: navHeight + 'px'}"></view> <view :style="{height: navHeight + 'px'}"></view>
<view class="ui-newsSearch"> <view class="ui-newsSearch">
<view class="ui-container"> <view class="ui-container">
@ -137,23 +87,10 @@ page {
</view> </view>
<block v-else> <block v-else>
<view class="ui-touch-item" v-for="(item,index) in list" :key="index" @tap="jumpChatPath(item, 'chat')"> <view class="ui-touch-item" v-for="(item,index) in list" :key="index" @tap="jumpChatPath(item, 'chat')">
<view class="ui-content"> <view class="ui-content f-fcl">
<image class="cu-avatar round lg flo_l" :src="item.icon" mode="aspectFit" @tap.stop="jumpChatPath(item, 'user')"></image> <image class="cu-avatar round lg" :src="item.pic" mode="aspectFit" @tap.stop="jumpChatPath(item, 'user')"></image>
<view class="ui-messageBox flo_l"> <view class="ui-messageBox">
<view class="font_30 color333 ui-name ellipsis_1 f-fcl"> <rich-text nodes="{{item.nodes}}"></rich-text>
{{item.title}}
<view v-if="item.is_top == 1" class="ui-is-top font_20 white">已置顶</view>
</view>
<view class="ui-message ellipsis_1 font_24 color666">
<span v-if="item.at_show" class="red">[有人@你]</span>
{{item.content}}
</view>
</view>
<view class="ui-unreadBox color999 text-right">
<view class="ui-lastTime font_22">{{item.last_time}}</view>
<block v-if="item.muteTeam">
<image class="ui-no-disturbing" src="https://image.fulllinkai.com/202406/29/c682c95e835831195a5af75c303a9720.png" mode="widthFix"></image>
</block>
</view> </view>
</view> </view>
</view> </view>
@ -191,54 +128,15 @@ wepy.page({
keyword: vm.inputVal keyword: vm.inputVal
} }
vm.$showLoading('') vm.$showLoading('')
vm.$get({url: `${service.host}/chat/linkmen`, data}).then(({code, data}) => { vm.$get({url: `${service.host}/chat/linkmen/search`, data}).then(({code, data}) => {
if (code === 0) { if (code === 0) {
let arrList = []
if (data.data && data.data.length > 0) { if (data.data && data.data.length > 0) {
data.data.forEach((item) => { data.data.forEach((item) => {
if (item.chat_type == 'group_chat') { let nickname = item.name.replace(new RegExp('(' + vm.inputVal + ')', 'ig'), "<div class='color-theme'>" + vm.inputVal + '</div>')
arrList.push({ item.nodes = `<div class="f-fc font_32 color333">${nickname}</div>`
chat_type: item.chat_type,
icon: item.other_photo,
title: item.other_nickname,
is_top: item.is_top,
content: item.last_user_nickname + '' + item.content,
last_time: item.last_time_str,
id: item.join_to_id,
hidden_profile: 'NONE',
msgId: item.id,
isTouchMove: false
})
} else {
arrList.push({
chat_type: item.chat_type,
icon: item.other_photo,
title: item.other_nickname,
is_top: item.is_top,
content: item.content,
last_time: item.last_time_str,
id: item.join_to_id,
hidden_profile: '',
type: item.other_type,
msgId: item.last_id,
isTouchMove: false
})
}
})
}
vm.list = [...arrList]
// 赋值所在群组已开启消息免打扰字段
if (wx.getStorageSync('muteNotList') && wx.getStorageSync('muteNotList').length > 0) {
let arr = wx.getStorageSync('muteNotList')
arr.forEach((i) => {
vm.list.forEach((j) => {
if (j.chat_type == 'group_chat' && i.teamId == j.id && !j.muteState) {
j.muteTeam = i.muteTeam
j.muteState = true
}
})
}) })
} }
vm.list = [...data.data]
console.log(vm.list, '777') console.log(vm.list, '777')
if (vm.list.length < 15 || data.data.length < 15) { if (vm.list.length < 15 || data.data.length < 15) {
vm.no_more = true vm.no_more = true
@ -262,9 +160,9 @@ wepy.page({
if (type === 'user') { if (type === 'user') {
url = `/pages/home/information?id=${e.id}` url = `/pages/home/information?id=${e.id}`
} else if (e.chat_type === 'group_chat') { } else if (e.chat_type === 'group_chat') {
url = `/pages/news/groupChitchat?id=${e.id}&name=${encodeURIComponent(e.title)}&pic=${e.icon}` url = `/pages/news/groupChitchat?id=${e.id}&name=${encodeURIComponent(e.name)}&pic=${e.pic}`
} else { } else {
url = `/pages/news/chitchat?id=${e.id}&name=${encodeURIComponent(e.title)}&type=${e.type}&pic=${e.icon}&real=${e.is_real_approved}` url = `/pages/news/chitchat?id=${e.id}&name=${encodeURIComponent(e.name)}&type=${e.type}&pic=${e.pic}&real=${e.is_real_approved}`
} }
wx.navigateTo({url: url}) wx.navigateTo({url: url})
} }
@ -274,10 +172,9 @@ wepy.page({
let vm = this let vm = this
clearTimeout(vm.timer) clearTimeout(vm.timer)
vm.timer = setTimeout(() => { vm.timer = setTimeout(() => {
console.log('2222') vm.page = 1
// vm.page = 1 vm.no_more = false
// vm.no_more = false vm.getList()
// vm.getList()
}, 800) }, 800)
} }
}, },

View File

@ -38,6 +38,7 @@ page {
} }
.ui-container{ .ui-container{
padding-bottom: 60rpx;
.ui-no-data-box { .ui-no-data-box {
text-align: center; text-align: center;
.ui-no-data-icon { .ui-no-data-icon {
@ -166,19 +167,19 @@ page {
<block v-else> <block v-else>
<view class="ui-touch-item" :class="{'touch-move-active' : item.isTouchMove}" data-index="{{index}}" bindtouchstart="touchstart" bindtouchmove="touchmove" v-for="(item,index) in list" :key="index" @tap="jumpChatPath(item, 'chat')"> <view class="ui-touch-item" :class="{'touch-move-active' : item.isTouchMove}" data-index="{{index}}" bindtouchstart="touchstart" bindtouchmove="touchmove" v-for="(item,index) in list" :key="index" @tap="jumpChatPath(item, 'chat')">
<view class="ui-content"> <view class="ui-content">
<image class="cu-avatar round lg flo_l" :src="item.icon" mode="aspectFit" @tap.stop="jumpChatPath(item, 'user')"></image> <image class="cu-avatar round lg flo_l" :src="item.other_photo" mode="aspectFit" @tap.stop="jumpChatPath(item, 'user')"></image>
<view class="ui-messageBox flo_l"> <view class="ui-messageBox flo_l">
<view class="font_30 color333 ui-name ellipsis_1 f-fcl"> <view class="font_30 color333 ui-name ellipsis_1 f-fcl">
{{item.title}} {{item.other_nickname}}
<view v-if="item.is_top == 1" class="ui-is-top font_20 white">已置顶</view> <view v-if="item.is_top == 1" class="ui-is-top font_20 white">已置顶</view>
</view> </view>
<view class="ui-message ellipsis_1 font_24 color666"> <view class="ui-message ellipsis_1 font_24 color666">
<span v-if="item.at_show" class="red">[有人@你]</span> <span v-if="item.at_show" class="red">[有人@你]</span>
{{item.content}} {{item.content ? item.content : item.chat_type == 'group_chat' ? '欢迎加入群聊' : ''}}
</view> </view>
</view> </view>
<view class="ui-unreadBox color999 text-right"> <view class="ui-unreadBox color999 text-right">
<view class="ui-lastTime font_22">{{item.last_time}}</view> <view class="ui-lastTime font_22">{{item.last_time_str}}</view>
<block v-if="item.muteTeam"> <block v-if="item.muteTeam">
<image class="ui-no-disturbing" src="https://image.fulllinkai.com/202406/29/c682c95e835831195a5af75c303a9720.png" mode="widthFix"></image> <image class="ui-no-disturbing" src="https://image.fulllinkai.com/202406/29/c682c95e835831195a5af75c303a9720.png" mode="widthFix"></image>
</block> </block>
@ -239,6 +240,7 @@ wepy.page({
index: null, // 滑动删除聊天消息下标 index: null, // 滑动删除聊天消息下标
groupSessionsCount: [], // 群聊消息未读数 groupSessionsCount: [], // 群聊消息未读数
teamAtList: [], // 群聊@ teamAtList: [], // 群聊@
cachePage: 0, // 记录跳转前的页数
page: 1, page: 1,
no_more: false, no_more: false,
list: [] // 消息列表数据 list: [] // 消息列表数据
@ -254,64 +256,41 @@ wepy.page({
if (code === 0) { if (code === 0) {
vm.teamAtList = wx.getStorageSync('teamAtList') || [] vm.teamAtList = wx.getStorageSync('teamAtList') || []
vm.groupSessionsCount = wx.getStorageSync('teamsSessionsCount') || [] vm.groupSessionsCount = wx.getStorageSync('teamsSessionsCount') || []
let arrList = []
if (data.data && data.data.length > 0) { if (data.data && data.data.length > 0) {
data.data.forEach((item) => { data.data.forEach((item) => {
if (item.chat_type == 'group_chat') { item.isTouchMove = false
arrList.push({
chat_type: item.chat_type,
icon: item.other_photo,
title: item.other_nickname,
is_top: item.is_top,
content: item.last_user_nickname + '' + item.content,
last_time: item.last_time_str,
id: item.join_to_id,
hidden_profile: 'NONE',
msgId: item.id,
isTouchMove: false,
new_count: wx.getStorageSync('muteNotList') && wx.getStorageSync('muteNotList').length > 0 ? 0 : vm.getGroupCount(item.join_to_id)
}) })
} else { if (vm.list.length === 0 || vm.page === 1) {
arrList.push({ vm.list = data.data
chat_type: item.chat_type, } else if (vm.cachePage != vm.page) {
icon: item.other_photo, data.data.map(function (item) {
title: item.other_nickname, vm.list.push(item)
is_top: item.is_top,
content: item.content,
last_time: item.last_time_str,
id: item.join_to_id,
hidden_profile: '',
type: item.other_type,
msgId: item.last_id,
isTouchMove: false,
new_count: item.new_count
}) })
} }
}) if (vm.list.length < 15 || data.data.length < 15) {
vm.no_more = true
} }
vm.list = [...arrList] console.log(vm.list, '777')
// 赋值所在群组已开启消息免打扰字段 // 赋值所在群组已开启消息免打扰字段
if (wx.getStorageSync('muteNotList') && wx.getStorageSync('muteNotList').length > 0) { if (wx.getStorageSync('muteNotList') && wx.getStorageSync('muteNotList').length > 0) {
let arr = wx.getStorageSync('muteNotList') let arr = wx.getStorageSync('muteNotList')
arr.forEach((i) => { arr.forEach((i) => {
vm.list.forEach((j) => { vm.list.forEach((j) => {
if (j.chat_type == 'group_chat' && i.teamId == j.id && !j.muteState) { if (j.chat_type == 'group_chat' && i.teamId == j.join_to_id && !j.muteTeam) {
j.new_count = 0 j.new_count = 0
j.muteTeam = i.muteTeam j.muteTeam = i.muteTeam
j.muteState = true j.muteState = true
} else if (j.chat_type == 'group_chat') { } else if (j.chat_type == 'group_chat') {
j.new_count = vm.getGroupCount(j.id) j.new_count = vm.getGroupCount(j.join_to_id)
} }
}) })
}) })
} }
console.log(vm.list, '777')
if (vm.list.length < 15 || data.data.length < 15) {
vm.no_more = true
} }
} }
setTimeout(() => { setTimeout(() => {
vm.loading = true vm.loading = true
vm.cachePage = vm.page
}, 500) }, 500)
wx.hideLoading() wx.hideLoading()
}).catch(err => { }).catch(err => {
@ -356,11 +335,11 @@ wepy.page({
let vm = this let vm = this
wx.showModal({ wx.showModal({
title: '温馨提示', title: '温馨提示',
content: `是否确认退出${e.title}群聊?`, content: `是否确认退出${e.other_nickname}群聊?`,
success: function (res) { success: function (res) {
if (res.confirm) { if (res.confirm) {
vm.$showLoading('') vm.$showLoading('')
vm.$post({url: `${service.host}/team/${e.id}/leave`}).then(({code, data}) => { vm.$post({url: `${service.host}/team/${e.join_to_id}/leave`}).then(({code, data}) => {
if (code == 0) { if (code == 0) {
vm.$showToast(`已退出群聊`) vm.$showToast(`已退出群聊`)
vm.list.splice(index, 1) vm.list.splice(index, 1)
@ -385,7 +364,7 @@ wepy.page({
success: function (res) { success: function (res) {
if (res.confirm) { if (res.confirm) {
vm.$showLoading('') vm.$showLoading('')
vm.$delete({url: `${service.host}/chat/linkmen/${e.id}`}).then(({code, data}) => { vm.$delete({url: `${service.host}/chat/linkmen/${e.join_to_id}`}).then(({code, data}) => {
if (code == 0) { if (code == 0) {
vm.$showToast(`已删除`) vm.$showToast(`已删除`)
vm.list.splice(index, 1) vm.list.splice(index, 1)
@ -413,8 +392,9 @@ wepy.page({
}, },
touchstart (e) { touchstart (e) {
console.log(e, '7777')
let vm = this let vm = this
vm.list.forEach(function (v, i) { vm.list.forEach(function (v) {
if (v.isTouchMove) { v.isTouchMove = false } if (v.isTouchMove) { v.isTouchMove = false }
}) })
vm.startX = e.changedTouches[0].clientX vm.startX = e.changedTouches[0].clientX
@ -454,11 +434,11 @@ wepy.page({
} }
let url = `` let url = ``
if (type === 'user') { if (type === 'user') {
url = `/pages/home/information?id=${e.id}` url = `/pages/home/information?id=${e.join_to_id}`
} else if (e.chat_type === 'group_chat') { } else if (e.chat_type === 'group_chat') {
url = `/pages/news/groupChitchat?id=${e.id}&name=${encodeURIComponent(e.title)}&pic=${e.icon}` url = `/pages/news/groupChitchat?id=${e.join_to_id}&name=${encodeURIComponent(e.other_nickname)}&pic=${e.other_photo}`
} else { } else {
url = `/pages/news/chitchat?id=${e.id}&name=${encodeURIComponent(e.title)}&type=${e.type}&pic=${e.icon}&real=${e.is_real_approved}` url = `/pages/news/chitchat?id=${e.join_to_id}&name=${encodeURIComponent(e.other_nickname)}&type=${e.other_type}&pic=${e.other_photo}&real=${e.is_real_approved}`
} }
wx.navigateTo({url: url}) wx.navigateTo({url: url})
}, },
@ -488,6 +468,7 @@ wepy.page({
onPullDownRefresh() { onPullDownRefresh() {
let vm = this let vm = this
vm.page = 1 vm.page = 1
vm.cachePage = 0
vm.no_more = false vm.no_more = false
vm.getList() vm.getList()
}, },

View File

@ -64,12 +64,12 @@ const IM = (account, token) => {
} }
if (groupCount > 0) { if (groupCount > 0) {
wx.setTabBarBadge({ wx.setTabBarBadge({
index: 0, index: 2,
text: `${groupCount}` text: `${groupCount}`
}) })
} else { } else {
wx.removeTabBarBadge({ wx.removeTabBarBadge({
index: 0 index: 2
}) })
} }
}) })
@ -79,24 +79,9 @@ const IM = (account, token) => {
let pages = getCurrentPages() let pages = getCurrentPages()
let currentPage = pages[pages.length - 1] let currentPage = pages[pages.length - 1]
let notiTypeData = { muteTeam: false } let notiTypeData = { muteTeam: false }
if (wx.getStorageSync('nuteNotList') && wx.getStorageSync('nuteNotList').length > 0) { if (wx.getStorageSync('muteNotList') && wx.getStorageSync('muteNotList').length > 0) {
notiTypeData = wx.getStorageSync('nuteNotList').find((item) => item.teamId == e.to) notiTypeData = wx.getStorageSync('muteNotList').find((item) => item.teamId == e.to)
} }
// 如果是开启了免打扰的群消息,自动调用群消息已读接口
// if (notiTypeData.muteTeam) {
// wx.request({
// url: `${service.host}/chat/group/read`,
// header: {
// 'Authorization': 'Bearer ' + wx.getStorageSync('token'),
// 'X-Requested-With': 'XMLHttpRequest'
// },
// method: 'post',
// data: {team_id: notiTypeData.teamId},
// success: ({data}) => {
// console.log(data, '已读')
// }
// })
// }
if (e.scene == 'team') { if (e.scene == 'team') {
// 判断是否是@功能 // 判断是否是@功能
if (e.apns) { if (e.apns) {
@ -115,7 +100,7 @@ const IM = (account, token) => {
if (e.attach && (e.attach.type === 'leaveTeam' || e.attach.type === 'dismissTeam' || e.attach.type === 'removeTeamMembers' || e.attach.type === 'addTeamMembers')) { if (e.attach && (e.attach.type === 'leaveTeam' || e.attach.type === 'dismissTeam' || e.attach.type === 'removeTeamMembers' || e.attach.type === 'addTeamMembers')) {
} else { } else {
if (newTeamCount.length > 0) { if (newTeamCount.length > 0) {
console.log(newTeamCount, '2222') console.log(newTeamCount, notiTypeData, '2222')
teamCount = teamCount.map(item => { teamCount = teamCount.map(item => {
if (item.id == newTeamCount[0].id && !notiTypeData.muteTeam) { if (item.id == newTeamCount[0].id && !notiTypeData.muteTeam) {
item.unread += 1 item.unread += 1

View File

@ -74,7 +74,7 @@ const wx_login = () => {
resolve(res) resolve(res)
break break
case 1: case 1:
reject(res.messag) reject(res.message)
break break
case 2: case 2:
break break