This commit is contained in:
2023-12-02 18:44:35 +08:00
parent 460ede57d2
commit 3688c421dc
16 changed files with 251 additions and 128 deletions

View File

@@ -6,7 +6,7 @@
:class="[{ 'zfb-tk-msgleft': item.type == 1 }, { 'zfb-tk-msgright': item.type == 2 }, { 'zfb-tk-msgcenter': item.type == 3 }]">
<openTool :class="[{ 'openTool-msgleft': item.type == 1 }, { 'openTool-msgright': item.type == 2 }]"
:talkTo="talkTo" :ref="'toolx'+itemKey" :data="item" :itemKey="itemKey"></openTool>
<image class="zfb-tk-avatar" @click="gochatOne(item)" v-if="item.type !== 3" :src="item.portrait"
<image class="zfb-tk-avatar" v-if="item.type !== 3" :src="item.portrait"
mode="aspectFill"></image>
<view class="zfb-tk-item-contentx" @longpress="longpressItem($event,itemKey,item)">
<view class="zfb-tk-item-contentx-c">
@@ -730,6 +730,7 @@
.zfb-tk-item-contentx-c-tool {
display: flex;
flex-direction: column;
justify-content: center;
}
.zfb-tk-msgleft .zfb-tk-item-contentx-c-tool {

View File

@@ -1,5 +1,10 @@
<template>
<view>
<view class="chatNavBar">
<uni-nav-bar :leftIcon="isMobile==true?'left':''"
@clickLeft="clickLeftHandler">
<view class="navBarTitle">{{title}}</view></uni-nav-bar>
</view>
<watermark></watermark>
<uni-popup ref="popup" type="center">
<view class="popsendCard" :style="'height:' + windowHeight + 'px'">
@@ -43,7 +48,7 @@
:style="{ background: msg !== '' ? '#1BC418' : '#F7F7F7', color: msg !== '' ? '#fff' : '#ddd', 'border-color': msg !== '' ? '#1BC418' : '#ddd' }">
发送</view>
</template>
<view v-else @click="changeTool" class="zfb-tk-send-tool-more wxfont gengduo"></view>
</view>
<view v-if="showtool" class="zfb-tk-send-tools">
@@ -93,6 +98,7 @@
},
data() {
return {
title: "聊天窗口",
isBottomHeight: '',
clickToSubmitSure: null,
autodown: true,
@@ -147,7 +153,7 @@
localData: {},
showtitleNViewBtns: true,
list: [],
isMobile:false,
isMobile: false,
};
},
computed: {
@@ -216,6 +222,7 @@
console.log(res.data)
if (e.windowType == 'SINGLE') {
this.title = this.localData.fromInfo.nickName
uni.setNavigationBarTitle({
title: this.localData.fromInfo.nickName
});
@@ -270,21 +277,45 @@
},
onShow() {
const hd_gps_location = localStorage.getItem("hd_gps_location")
if(hd_gps_location!=null){
this.isMobile=true
if (hd_gps_location != null) {
this.isMobile = true
}
if (this.chatListInfo && this.chatListInfo.nickName) {
uni.setNavigationBarTitle({
title: this.chatListInfo.nickName
});
}
this.$store.dispatch('updateChartHistoryFromServer', {
userId: this.talkTo.userId,
data: this.chatListInfo
});
var times = 0
var timer = null
console.log("开始定时拉取最新聊天记录")
timer = setInterval(() => {
times = times + 1
if (times > 2) {
clearInterval(timer);
timer = null
return;
}
console.log("开始定时拉取最新聊天记录:", times)
this.$store.dispatch('updateChartHistoryFromServer', {
userId: this.talkTo.userId,
data: this.chatListInfo
});
setTimeout(() => {
this.$store.dispatch('getchatDatalist');
this.$store.dispatch('getChatList');
}, 1000)
this.scrolltoBottom();
}, 2000)
},
mounted() {
// #ifdef APP-PLUS
@@ -306,6 +337,11 @@
}
},
methods: {
clickLeftHandler() {
if (this.isMobile) {
uni.navigateBack()
}
},
onMessage(message) {
//判断当前是单聊还是群聊
if (this.talkTo.windowType != 'SINGLE') {
@@ -463,9 +499,9 @@
uni.showLoading({
title: '发起通话'
});
var formdata = null;
if (hasVideo == 1) {
formdata = {
userId: this.talkTo.userId,
@@ -479,7 +515,7 @@
content: 'TRTC_VOICE_START'
}
}
// this.sendMsg(formdata,formdata.msgType)
@@ -487,8 +523,8 @@
const roomId = userId
const userInfo = uni.getStorageSync("userInfo")
const userInfo = uni.getStorageSync("userInfo")
const roomInfo = {
roomId: userId, //后面改成发起人的手机号或者id
roomName: `${userInfo.nickName}发起的视频聊天`,
@@ -501,8 +537,8 @@
type: "webrtc",
offline: 0,
invitedUserList: [this.talkTo.userId],
hasVideo:hasVideo,
isForce:0
hasVideo: hasVideo,
isForce: 0
}
this.$store
@@ -519,7 +555,8 @@
target: "znzq"
},
}).then((res1) => {
location.href = config.getVideoRoomUrl(roomInfo.roomId, roomInfo.creatorId, 1, 1,hasVideo,userInfo.nickName,this.talkTo.userId)
location.href = config.getVideoRoomUrl(roomInfo.roomId, roomInfo.creatorId, 1, 1,
hasVideo, userInfo.nickName, this.talkTo.userId)
})
})
if (1 > 0) {
@@ -920,6 +957,25 @@
</script>
<style lang="scss" scoped>
.navBarTitle{
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
font-size: 16px !important;
font-weight: bold !important;
}
.chatNavBar {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 100;
background-color: #fff;
}
.autodownView {
height: 1px;
width: 100%;
@@ -931,7 +987,7 @@
}
.zfb-tk-main {
padding: 0 12px;
padding: 55rpx 12px;
padding-bottom: 112rpx;
}