update 群聊消息未读数处理
This commit is contained in:
parent
a67f082939
commit
02354ddb59
@ -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'}}">
|
||||
<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 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'}">
|
||||
<view class="ui-vide-poster">
|
||||
<image class="ui-video_play_icon" src="https://image.fulllinkai.com/202308/17/42c88bf039bb56f85cfcb9af0392ffb6.png"></image>
|
||||
</view>
|
||||
</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>
|
||||
</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}`)">
|
||||
@ -388,13 +388,12 @@ scroll-view {
|
||||
return
|
||||
}
|
||||
vm.videoIndex = index
|
||||
vm.videoContext = wx.createVideoContext('video', vm.$wx)
|
||||
vm.videoContext = wx.createVideoContext(`video-${index}`, vm.$wx)
|
||||
vm.videoContext.requestFullScreen()
|
||||
setTimeout(function() {
|
||||
// 将点击视频进行播放
|
||||
vm.videoContext = wx.createVideoContext('video', vm.$wx)
|
||||
vm.videoContext.play()
|
||||
}, 1200)
|
||||
}, 500)
|
||||
},
|
||||
// 关闭视频
|
||||
leaveVideo(e) {
|
||||
|
||||
@ -112,7 +112,7 @@ wepy.component({
|
||||
console.log(filePathUrl, '上传成功')
|
||||
let dataV2 = {
|
||||
filePath: filePathUrl,
|
||||
type: type
|
||||
type: filePath.split('.').pop().toLowerCase()
|
||||
}
|
||||
|
||||
vm.uploadVideo = [dataV2]
|
||||
|
||||
@ -283,7 +283,7 @@ page {
|
||||
</block>
|
||||
<block v-if="uploadType == 'video'">
|
||||
<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>
|
||||
</block>
|
||||
|
||||
@ -95,10 +95,10 @@ page {
|
||||
</style>
|
||||
<template>
|
||||
<view class="ui-singleSquare">
|
||||
<view class="m_rec font_26 f-fbc" v-if="recommendData.apply_state.has_apply_area != 1 && type != 'marriage'">
|
||||
<view>上专区推荐,还可进入群聊,更容易脱单哦~</view>
|
||||
<view class="u_rec_bu" bindtap="getRecommend">去申请</view>
|
||||
</view>
|
||||
<!-- <view class="m_rec font_26 f-fbc" v-if="recommendData.apply_state.has_apply_area != 1 && type != 'marriage'">-->
|
||||
<!-- <view>上专区推荐,还可进入群聊,更容易脱单哦~</view>-->
|
||||
<!-- <view class="u_rec_bu" bindtap="getRecommend">去申请</view>-->
|
||||
<!-- </view>-->
|
||||
<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>
|
||||
</view>
|
||||
|
||||
@ -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}}">
|
||||
<view class="ui-top-placeholder"></view>
|
||||
<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="font_28 color333 bold">
|
||||
<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>
|
||||
<!--视频信息-->
|
||||
<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'}">
|
||||
<view class="ui-vide-poster">
|
||||
<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>
|
||||
</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>
|
||||
</view>
|
||||
</view>
|
||||
@ -710,7 +710,6 @@ wepy.page({
|
||||
otherUserName: '',
|
||||
otherUserReal: 0, // 对方是否真人认证
|
||||
|
||||
chatInfoData: {},
|
||||
reportShow: false, // 举报
|
||||
throttle: true,
|
||||
|
||||
@ -765,20 +764,6 @@ wepy.page({
|
||||
msg: ''
|
||||
},
|
||||
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() {
|
||||
let vm = this
|
||||
@ -885,7 +870,6 @@ wepy.page({
|
||||
vm.openShow = false
|
||||
vm.uploadState = true
|
||||
vm.progressValue = 5
|
||||
try {
|
||||
app.globalData.nim.msg.sendVideoMsg({
|
||||
scene: 'p2p',
|
||||
to: vm.otherUserId,
|
||||
@ -925,9 +909,6 @@ wepy.page({
|
||||
})
|
||||
}
|
||||
})
|
||||
} catch (err) {
|
||||
vm.sendFileError()
|
||||
}
|
||||
},
|
||||
// 发送语音
|
||||
sendAudio(file) {
|
||||
@ -1026,7 +1007,6 @@ wepy.page({
|
||||
reception(e) {
|
||||
let vm = this
|
||||
vm.sendMsgReceipt(e)
|
||||
// vm.getChatInfo()
|
||||
if (e.type == 'text' && /\[[^\]]+\]/.test(e.body)) {
|
||||
e.body = vm.transitionMsg(e.body)
|
||||
}
|
||||
@ -1098,9 +1078,9 @@ wepy.page({
|
||||
showTime: item.showTime,
|
||||
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) : '',
|
||||
name: item.fromNick,
|
||||
name: item.is_mine == 0 ? vm.otherUserName : vm.myName,
|
||||
isSend: 1,
|
||||
userId: item.from,
|
||||
userId: item.user_id,
|
||||
msgType: item.content_type
|
||||
})
|
||||
})
|
||||
@ -1406,7 +1386,6 @@ wepy.page({
|
||||
e.w = e.w / wRatio
|
||||
e.h = 200
|
||||
}
|
||||
console.log(e, '8988888')
|
||||
return e
|
||||
},
|
||||
// 更多操作
|
||||
@ -1451,17 +1430,16 @@ wepy.page({
|
||||
})
|
||||
},
|
||||
// 播放视频
|
||||
playVideo(index, e) {
|
||||
playVideo(index) {
|
||||
let vm = this
|
||||
vm.videoState = true
|
||||
vm.videoIndex = index
|
||||
vm.videoContext = wx.createVideoContext(`${e}`)
|
||||
vm.videoContext.requestFullScreen()
|
||||
setTimeout(function() {
|
||||
vm.videoContext = wx.createVideoContext('chatVideo-' + index, vm)
|
||||
vm.videoContext.requestFullScreen({direction: 0})
|
||||
setTimeout(() => {
|
||||
// 将点击视频进行播放
|
||||
vm.videoContext = wx.createVideoContext(`${e}`)
|
||||
vm.videoContext.play()
|
||||
}, 1200)
|
||||
}, 500)
|
||||
},
|
||||
// 关闭视频
|
||||
leaveVideo(e, row) {
|
||||
@ -1510,7 +1488,7 @@ wepy.page({
|
||||
let vm = this
|
||||
let imageArr = []
|
||||
vm.msgList.forEach((item) => {
|
||||
if (item.msgType == 'image') {
|
||||
if (item.msgType == 'image' || item.msgType == 'PICTURE') {
|
||||
imageArr.push(item.attach.url)
|
||||
}
|
||||
})
|
||||
@ -1526,7 +1504,6 @@ wepy.page({
|
||||
vm.myType = wx.getStorageSync('userInfo').type
|
||||
vm.myName = wx.getStorageSync('userInfo').name
|
||||
vm.myAvatar = wx.getStorageSync('userInfo').avatar
|
||||
// vm.getChatInfo()
|
||||
},
|
||||
onLoad(e) {
|
||||
let vm = this
|
||||
|
||||
@ -567,14 +567,14 @@ page {
|
||||
<view v-else>{{audioTime + '"'}}</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'}">
|
||||
<view class="ui-vide-poster">
|
||||
<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>
|
||||
</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>
|
||||
</view>
|
||||
</view>
|
||||
@ -982,6 +982,8 @@ wepy.page({
|
||||
let vm = this
|
||||
app.globalData.nim.session.resetSessionUnreadCount({
|
||||
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}) => {
|
||||
if (code === 0) {
|
||||
console.log(data, '-------------------')
|
||||
vm.sendMsgReceipt()
|
||||
if (data && data.length > 0) {
|
||||
// if (vm.msgList && vm.msgList.length == 0) {
|
||||
// vm.sendMsgReceipt(data[0])
|
||||
// }
|
||||
data.forEach((item, index) => {
|
||||
item.time = new Date(item.create_time.replace(/[-]/g, '/').replace(/[-]/, '')).getTime()
|
||||
item.avatar = 'https://image.fulllinkai.com/202307/18/449c3253ca2bbed9314d39977a486d0e.png'
|
||||
@ -1384,17 +1384,16 @@ wepy.page({
|
||||
})
|
||||
},
|
||||
// 播放视频
|
||||
playVideo(index, e) {
|
||||
playVideo(index) {
|
||||
let vm = this
|
||||
vm.videoState = true
|
||||
vm.videoIndex = index
|
||||
vm.videoContext = wx.createVideoContext(`${e}`)
|
||||
vm.videoContext.requestFullScreen()
|
||||
vm.videoContext = wx.createVideoContext('groupChatVideo-' + index, vm)
|
||||
vm.videoContext.requestFullScreen({direction: 0})
|
||||
setTimeout(function() {
|
||||
// 将点击视频进行播放
|
||||
vm.videoContext = wx.createVideoContext(`${e}`)
|
||||
vm.videoContext.play()
|
||||
}, 1200)
|
||||
}, 500)
|
||||
},
|
||||
// 关闭视频
|
||||
leaveVideo(e, row) {
|
||||
@ -1481,7 +1480,6 @@ wepy.page({
|
||||
// 底部输入框高度
|
||||
vm.changeInputHeight(true)
|
||||
// 标记消息已读
|
||||
// vm.groupIsRead()
|
||||
vm.teamsSessions()
|
||||
wx.setNavigationBarTitle({
|
||||
title: vm.otherUserName,
|
||||
|
||||
@ -10,7 +10,6 @@ page {
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 100rpx;
|
||||
padding: 0 22rpx;
|
||||
margin-left: 30rpx;
|
||||
|
||||
.m_search_icon {
|
||||
width: 28rpx;
|
||||
@ -60,59 +59,7 @@ page {
|
||||
margin-top: 2rpx;
|
||||
margin-left: 16rpx;
|
||||
|
||||
.ui-is-top{
|
||||
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;
|
||||
}
|
||||
.ui-nickname-box{}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -121,6 +68,8 @@ page {
|
||||
<template>
|
||||
<view class="cu-custom">
|
||||
<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">
|
||||
<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>
|
||||
@ -128,6 +77,7 @@ page {
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view :style="{height: navHeight + 'px'}"></view>
|
||||
<view class="ui-newsSearch">
|
||||
<view class="ui-container">
|
||||
@ -137,23 +87,10 @@ page {
|
||||
</view>
|
||||
<block v-else>
|
||||
<view class="ui-touch-item" v-for="(item,index) in list" :key="index" @tap="jumpChatPath(item, 'chat')">
|
||||
<view class="ui-content">
|
||||
<image class="cu-avatar round lg flo_l" :src="item.icon" mode="aspectFit" @tap.stop="jumpChatPath(item, 'user')"></image>
|
||||
<view class="ui-messageBox flo_l">
|
||||
<view class="font_30 color333 ui-name ellipsis_1 f-fcl">
|
||||
{{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 class="ui-content f-fcl">
|
||||
<image class="cu-avatar round lg" :src="item.pic" mode="aspectFit" @tap.stop="jumpChatPath(item, 'user')"></image>
|
||||
<view class="ui-messageBox">
|
||||
<rich-text nodes="{{item.nodes}}"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -191,54 +128,15 @@ wepy.page({
|
||||
keyword: vm.inputVal
|
||||
}
|
||||
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) {
|
||||
let arrList = []
|
||||
if (data.data && data.data.length > 0) {
|
||||
data.data.forEach((item) => {
|
||||
if (item.chat_type == 'group_chat') {
|
||||
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
|
||||
})
|
||||
} 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
|
||||
}
|
||||
})
|
||||
let nickname = item.name.replace(new RegExp('(' + vm.inputVal + ')', 'ig'), "<div class='color-theme'>" + vm.inputVal + '</div>')
|
||||
item.nodes = `<div class="f-fc font_32 color333">${nickname}</div>`
|
||||
})
|
||||
}
|
||||
vm.list = [...data.data]
|
||||
console.log(vm.list, '777')
|
||||
if (vm.list.length < 15 || data.data.length < 15) {
|
||||
vm.no_more = true
|
||||
@ -262,9 +160,9 @@ wepy.page({
|
||||
if (type === 'user') {
|
||||
url = `/pages/home/information?id=${e.id}`
|
||||
} 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 {
|
||||
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})
|
||||
}
|
||||
@ -274,10 +172,9 @@ wepy.page({
|
||||
let vm = this
|
||||
clearTimeout(vm.timer)
|
||||
vm.timer = setTimeout(() => {
|
||||
console.log('2222')
|
||||
// vm.page = 1
|
||||
// vm.no_more = false
|
||||
// vm.getList()
|
||||
vm.page = 1
|
||||
vm.no_more = false
|
||||
vm.getList()
|
||||
}, 800)
|
||||
}
|
||||
},
|
||||
|
||||
@ -38,6 +38,7 @@ page {
|
||||
}
|
||||
|
||||
.ui-container{
|
||||
padding-bottom: 60rpx;
|
||||
.ui-no-data-box {
|
||||
text-align: center;
|
||||
.ui-no-data-icon {
|
||||
@ -166,19 +167,19 @@ page {
|
||||
<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-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="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>
|
||||
<view class="ui-message ellipsis_1 font_24 color666">
|
||||
<span v-if="item.at_show" class="red">[有人@你]</span>
|
||||
{{item.content}}
|
||||
{{item.content ? item.content : item.chat_type == 'group_chat' ? '欢迎加入群聊' : ''}}
|
||||
</view>
|
||||
</view>
|
||||
<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">
|
||||
<image class="ui-no-disturbing" src="https://image.fulllinkai.com/202406/29/c682c95e835831195a5af75c303a9720.png" mode="widthFix"></image>
|
||||
</block>
|
||||
@ -239,6 +240,7 @@ wepy.page({
|
||||
index: null, // 滑动删除聊天消息下标
|
||||
groupSessionsCount: [], // 群聊消息未读数
|
||||
teamAtList: [], // 群聊@
|
||||
cachePage: 0, // 记录跳转前的页数
|
||||
page: 1,
|
||||
no_more: false,
|
||||
list: [] // 消息列表数据
|
||||
@ -254,64 +256,41 @@ wepy.page({
|
||||
if (code === 0) {
|
||||
vm.teamAtList = wx.getStorageSync('teamAtList') || []
|
||||
vm.groupSessionsCount = wx.getStorageSync('teamsSessionsCount') || []
|
||||
let arrList = []
|
||||
if (data.data && data.data.length > 0) {
|
||||
data.data.forEach((item) => {
|
||||
if (item.chat_type == 'group_chat') {
|
||||
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)
|
||||
item.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,
|
||||
new_count: item.new_count
|
||||
if (vm.list.length === 0 || vm.page === 1) {
|
||||
vm.list = data.data
|
||||
} else if (vm.cachePage != vm.page) {
|
||||
data.data.map(function (item) {
|
||||
vm.list.push(item)
|
||||
})
|
||||
}
|
||||
})
|
||||
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) {
|
||||
let arr = wx.getStorageSync('muteNotList')
|
||||
arr.forEach((i) => {
|
||||
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.muteTeam = i.muteTeam
|
||||
j.muteState = true
|
||||
} 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(() => {
|
||||
vm.loading = true
|
||||
vm.cachePage = vm.page
|
||||
}, 500)
|
||||
wx.hideLoading()
|
||||
}).catch(err => {
|
||||
@ -356,11 +335,11 @@ wepy.page({
|
||||
let vm = this
|
||||
wx.showModal({
|
||||
title: '温馨提示',
|
||||
content: `是否确认退出${e.title}群聊?`,
|
||||
content: `是否确认退出${e.other_nickname}群聊?`,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
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) {
|
||||
vm.$showToast(`已退出群聊`)
|
||||
vm.list.splice(index, 1)
|
||||
@ -385,7 +364,7 @@ wepy.page({
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
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) {
|
||||
vm.$showToast(`已删除`)
|
||||
vm.list.splice(index, 1)
|
||||
@ -413,8 +392,9 @@ wepy.page({
|
||||
},
|
||||
|
||||
touchstart (e) {
|
||||
console.log(e, '7777')
|
||||
let vm = this
|
||||
vm.list.forEach(function (v, i) {
|
||||
vm.list.forEach(function (v) {
|
||||
if (v.isTouchMove) { v.isTouchMove = false }
|
||||
})
|
||||
vm.startX = e.changedTouches[0].clientX
|
||||
@ -454,11 +434,11 @@ wepy.page({
|
||||
}
|
||||
let url = ``
|
||||
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') {
|
||||
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 {
|
||||
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})
|
||||
},
|
||||
@ -488,6 +468,7 @@ wepy.page({
|
||||
onPullDownRefresh() {
|
||||
let vm = this
|
||||
vm.page = 1
|
||||
vm.cachePage = 0
|
||||
vm.no_more = false
|
||||
vm.getList()
|
||||
},
|
||||
|
||||
@ -64,12 +64,12 @@ const IM = (account, token) => {
|
||||
}
|
||||
if (groupCount > 0) {
|
||||
wx.setTabBarBadge({
|
||||
index: 0,
|
||||
index: 2,
|
||||
text: `${groupCount}`
|
||||
})
|
||||
} else {
|
||||
wx.removeTabBarBadge({
|
||||
index: 0
|
||||
index: 2
|
||||
})
|
||||
}
|
||||
})
|
||||
@ -79,24 +79,9 @@ const IM = (account, token) => {
|
||||
let pages = getCurrentPages()
|
||||
let currentPage = pages[pages.length - 1]
|
||||
let notiTypeData = { muteTeam: false }
|
||||
if (wx.getStorageSync('nuteNotList') && wx.getStorageSync('nuteNotList').length > 0) {
|
||||
notiTypeData = wx.getStorageSync('nuteNotList').find((item) => item.teamId == e.to)
|
||||
if (wx.getStorageSync('muteNotList') && wx.getStorageSync('muteNotList').length > 0) {
|
||||
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.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')) {
|
||||
} else {
|
||||
if (newTeamCount.length > 0) {
|
||||
console.log(newTeamCount, '2222')
|
||||
console.log(newTeamCount, notiTypeData, '2222')
|
||||
teamCount = teamCount.map(item => {
|
||||
if (item.id == newTeamCount[0].id && !notiTypeData.muteTeam) {
|
||||
item.unread += 1
|
||||
|
||||
@ -74,7 +74,7 @@ const wx_login = () => {
|
||||
resolve(res)
|
||||
break
|
||||
case 1:
|
||||
reject(res.messag)
|
||||
reject(res.message)
|
||||
break
|
||||
case 2:
|
||||
break
|
||||
|
||||
Loading…
Reference in New Issue
Block a user