|
|
@ -50,7 +50,8 @@ |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="chat-tab-bar"> |
|
|
<view class="chat-tab-bar"> |
|
|
<view v-if="chatTabBox == 'tools'" class="chat-tools" :style="{height: keyboardHeight+'px'}"> |
|
|
<scroll-view v-if="chatTabBox == 'tools'" class="chat-tools" :style="{height: keyboardHeight+'px'}"> |
|
|
|
|
|
<view class="chat-tools-list"> |
|
|
<view class="chat-tools-item"> |
|
|
<view class="chat-tools-item"> |
|
|
<file-upload ref="fileUpload" :onBefore="onUploadFileBefore" :onSuccess="onUploadFileSuccess" |
|
|
<file-upload ref="fileUpload" :onBefore="onUploadFileBefore" :onSuccess="onUploadFileSuccess" |
|
|
:onError="onUploadFileFail"> |
|
|
:onError="onUploadFileFail"> |
|
|
@ -66,8 +67,8 @@ |
|
|
<view class="tool-name">相册</view> |
|
|
<view class="tool-name">相册</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="chat-tools-item"> |
|
|
<view class="chat-tools-item"> |
|
|
<image-upload sourceType="camera" :onBefore="onUploadImageBefore" :onSuccess="onUploadImageSuccess" |
|
|
<image-upload sourceType="camera" :onBefore="onUploadImageBefore" |
|
|
:onError="onUploadImageFail"> |
|
|
:onSuccess="onUploadImageSuccess" :onError="onUploadImageFail"> |
|
|
<view class="tool-icon iconfont icon-camera"></view> |
|
|
<view class="tool-icon iconfont icon-camera"></view> |
|
|
</image-upload> |
|
|
</image-upload> |
|
|
<view class="tool-name">拍摄</view> |
|
|
<view class="tool-name">拍摄</view> |
|
|
@ -76,7 +77,8 @@ |
|
|
<view class="tool-icon iconfont icon-microphone"></view> |
|
|
<view class="tool-icon iconfont icon-microphone"></view> |
|
|
<view class="tool-name">语音消息</view> |
|
|
<view class="tool-name">语音消息</view> |
|
|
</view> |
|
|
</view> |
|
|
<view v-if="chat.type == 'GROUP' && memberSize<=500" class="chat-tools-item" @click="switchReceipt()"> |
|
|
<view v-if="chat.type == 'GROUP' && memberSize<=500" class="chat-tools-item" |
|
|
|
|
|
@click="switchReceipt()"> |
|
|
<view class="tool-icon iconfont icon-receipt" :class="isReceipt ? 'active' : ''"></view> |
|
|
<view class="tool-icon iconfont icon-receipt" :class="isReceipt ? 'active' : ''"></view> |
|
|
<view class="tool-name">回执消息</view> |
|
|
<view class="tool-name">回执消息</view> |
|
|
</view> |
|
|
</view> |
|
|
@ -96,6 +98,7 @@ |
|
|
</view> |
|
|
</view> |
|
|
<!-- #endif --> |
|
|
<!-- #endif --> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
</scroll-view> |
|
|
<scroll-view v-if="chatTabBox === 'emo'" class="chat-emotion" scroll-y="true" |
|
|
<scroll-view v-if="chatTabBox === 'emo'" class="chat-emotion" scroll-y="true" |
|
|
:style="{height: keyboardHeight+'px'}"> |
|
|
:style="{height: keyboardHeight+'px'}"> |
|
|
<view class="emotion-item-list"> |
|
|
<view class="emotion-item-list"> |
|
|
@ -133,6 +136,7 @@ export default { |
|
|
showRecord: false, |
|
|
showRecord: false, |
|
|
chatMainHeight: 800, // 聊天窗口高度 |
|
|
chatMainHeight: 800, // 聊天窗口高度 |
|
|
keyboardHeight: 290, // 键盘高度 |
|
|
keyboardHeight: 290, // 键盘高度 |
|
|
|
|
|
screenHeight: 1000, // 屏幕高度 |
|
|
windowHeight: 1000, // 窗口高度 |
|
|
windowHeight: 1000, // 窗口高度 |
|
|
initHeight: 1000, // h5初始高度 |
|
|
initHeight: 1000, // h5初始高度 |
|
|
atUserIds: [], |
|
|
atUserIds: [], |
|
|
@ -393,11 +397,13 @@ export default { |
|
|
this.switchChatTabBox('tools') |
|
|
this.switchChatTabBox('tools') |
|
|
}, |
|
|
}, |
|
|
switchChatTabBox(chatTabBox) { |
|
|
switchChatTabBox(chatTabBox) { |
|
|
|
|
|
if (this.chatTabBox != chatTabBox) { |
|
|
this.chatTabBox = chatTabBox; |
|
|
this.chatTabBox = chatTabBox; |
|
|
this.reCalChatMainHeight(); |
|
|
|
|
|
if (chatTabBox != 'tools' && this.$refs.fileUpload) { |
|
|
if (chatTabBox != 'tools' && this.$refs.fileUpload) { |
|
|
this.$refs.fileUpload.hide() |
|
|
this.$refs.fileUpload.hide() |
|
|
} |
|
|
} |
|
|
|
|
|
setTimeout(() => this.reCalChatMainHeight(), 30); |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
selectEmoji(emoText) { |
|
|
selectEmoji(emoText) { |
|
|
let path = this.$emo.textToPath(emoText) |
|
|
let path = this.$emo.textToPath(emoText) |
|
|
@ -815,25 +821,29 @@ export default { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
reCalChatMainHeight() { |
|
|
reCalChatMainHeight() { |
|
|
setTimeout(() => { |
|
|
let sysInfo = uni.getSystemInfoSync(); |
|
|
let h = this.windowHeight; |
|
|
let h = this.windowHeight; |
|
|
// 减去标题栏高度 |
|
|
// 减去标题栏高度 |
|
|
h -= 50; |
|
|
h -= 50; |
|
|
// 减去键盘高度 |
|
|
// 减去键盘高度 |
|
|
if (this.isShowKeyBoard || this.chatTabBox != 'none') { |
|
|
if (this.isShowKeyBoard || this.chatTabBox != 'none') { |
|
|
|
|
|
// ios app的键盘高度不准,需要减去屏幕和窗口差 |
|
|
|
|
|
// #ifdef APP-PLUS |
|
|
|
|
|
if (sysInfo.platform == 'ios') { |
|
|
|
|
|
h += this.screenHeight - this.windowHeight; |
|
|
|
|
|
} |
|
|
|
|
|
// #endif |
|
|
h -= this.keyboardHeight; |
|
|
h -= this.keyboardHeight; |
|
|
this.scrollToBottom(); |
|
|
this.scrollToBottom(); |
|
|
} |
|
|
} |
|
|
// #ifndef H5 |
|
|
|
|
|
// h5需要减去状态栏高度 |
|
|
// APP需要减去状态栏高度 |
|
|
h -= uni.getSystemInfoSync().statusBarHeight; |
|
|
// #ifdef APP-PLUS |
|
|
|
|
|
h -= sysInfo.statusBarHeight; |
|
|
// #endif |
|
|
// #endif |
|
|
this.chatMainHeight = h; |
|
|
this.chatMainHeight = h; |
|
|
if (this.isShowKeyBoard || this.chatTabBox != 'none') { |
|
|
// #ifndef APP |
|
|
this.scrollToBottom(); |
|
|
|
|
|
} |
|
|
|
|
|
// ios浏览器键盘把页面顶起后,页面长度不会变化,这里把页面拉到顶部适配一下 |
|
|
// ios浏览器键盘把页面顶起后,页面长度不会变化,这里把页面拉到顶部适配一下 |
|
|
// #ifdef H5 |
|
|
|
|
|
if (uni.getSystemInfoSync().platform == 'ios') { |
|
|
if (uni.getSystemInfoSync().platform == 'ios') { |
|
|
// 不同手机需要的延时时间不一致,采用分段延时的方式处理 |
|
|
// 不同手机需要的延时时间不一致,采用分段延时的方式处理 |
|
|
const delays = [50, 100, 500]; |
|
|
const delays = [50, 100, 500]; |
|
|
@ -847,7 +857,6 @@ export default { |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
// #endif |
|
|
// #endif |
|
|
}, 30) |
|
|
|
|
|
}, |
|
|
}, |
|
|
listenKeyBoard() { |
|
|
listenKeyBoard() { |
|
|
// #ifdef H5 |
|
|
// #ifdef H5 |
|
|
@ -889,7 +898,7 @@ export default { |
|
|
if (this.isShowKeyBoard) { |
|
|
if (this.isShowKeyBoard) { |
|
|
this.keyboardHeight = res.height; // 获取并保存键盘高度 |
|
|
this.keyboardHeight = res.height; // 获取并保存键盘高度 |
|
|
} |
|
|
} |
|
|
this.reCalChatMainHeight(); |
|
|
setTimeout(() => this.reCalChatMainHeight(), 30); |
|
|
}, |
|
|
}, |
|
|
resizeListener() { |
|
|
resizeListener() { |
|
|
let keyboardHeight = this.initHeight - window.innerHeight; |
|
|
let keyboardHeight = this.initHeight - window.innerHeight; |
|
|
@ -902,15 +911,15 @@ export default { |
|
|
if (this.isShowKeyBoard) { |
|
|
if (this.isShowKeyBoard) { |
|
|
this.keyboardHeight = keyboardHeight; |
|
|
this.keyboardHeight = keyboardHeight; |
|
|
} |
|
|
} |
|
|
this.reCalChatMainHeight(); |
|
|
setTimeout(() => this.reCalChatMainHeight(), 30); |
|
|
}, |
|
|
}, |
|
|
focusInListener() { |
|
|
focusInListener() { |
|
|
this.isShowKeyBoard = true; |
|
|
this.isShowKeyBoard = true; |
|
|
this.reCalChatMainHeight(); |
|
|
setTimeout(() => this.reCalChatMainHeight(), 30); |
|
|
}, |
|
|
}, |
|
|
focusOutListener() { |
|
|
focusOutListener() { |
|
|
this.isShowKeyBoard = false; |
|
|
this.isShowKeyBoard = false; |
|
|
this.reCalChatMainHeight(); |
|
|
setTimeout(() => this.reCalChatMainHeight(), 30); |
|
|
}, |
|
|
}, |
|
|
showBannedTip() { |
|
|
showBannedTip() { |
|
|
let msgInfo = { |
|
|
let msgInfo = { |
|
|
@ -1082,7 +1091,11 @@ export default { |
|
|
// 监听键盘高度 |
|
|
// 监听键盘高度 |
|
|
this.listenKeyBoard(); |
|
|
this.listenKeyBoard(); |
|
|
// 计算聊天窗口高度 |
|
|
// 计算聊天窗口高度 |
|
|
|
|
|
this.windowHeight = uni.getSystemInfoSync().windowHeight; |
|
|
|
|
|
this.screenHeight = uni.getSystemInfoSync().screenHeight; |
|
|
|
|
|
this.reCalChatMainHeight(); |
|
|
this.$nextTick(() => { |
|
|
this.$nextTick(() => { |
|
|
|
|
|
// 上面获取的windowHeight可能不准,重新计算一次聊天窗口高度 |
|
|
this.windowHeight = uni.getSystemInfoSync().windowHeight; |
|
|
this.windowHeight = uni.getSystemInfoSync().windowHeight; |
|
|
this.reCalChatMainHeight(); |
|
|
this.reCalChatMainHeight(); |
|
|
this.scrollToBottom(); |
|
|
this.scrollToBottom(); |
|
|
@ -1132,10 +1145,10 @@ export default { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.chat-main-box { |
|
|
.chat-main-box { |
|
|
// #ifdef H5 |
|
|
// #ifndef APP-PLUS |
|
|
top: $im-nav-bar-height; |
|
|
top: $im-nav-bar-height; |
|
|
// #endif |
|
|
// #endif |
|
|
// #ifndef H5 |
|
|
// #ifdef APP-PLUS |
|
|
top: calc($im-nav-bar-height + var(--status-bar-height)); |
|
|
top: calc($im-nav-bar-height + var(--status-bar-height)); |
|
|
// #endif |
|
|
// #endif |
|
|
position: fixed; |
|
|
position: fixed; |
|
|
@ -1206,7 +1219,7 @@ export default { |
|
|
border-top: $im-border solid 1px; |
|
|
border-top: $im-border solid 1px; |
|
|
background-color: $im-bg; |
|
|
background-color: $im-bg; |
|
|
min-height: 80rpx; |
|
|
min-height: 80rpx; |
|
|
margin-bottom: 14rpx; |
|
|
padding-bottom: 14rpx; |
|
|
|
|
|
|
|
|
.iconfont { |
|
|
.iconfont { |
|
|
font-size: 60rpx; |
|
|
font-size: 60rpx; |
|
|
@ -1250,13 +1263,14 @@ export default { |
|
|
background-color: $im-bg; |
|
|
background-color: $im-bg; |
|
|
|
|
|
|
|
|
.chat-tools { |
|
|
.chat-tools { |
|
|
display: flex; |
|
|
|
|
|
flex-wrap: wrap; |
|
|
|
|
|
align-items: top; |
|
|
|
|
|
height: 310px; |
|
|
|
|
|
padding: 40rpx; |
|
|
padding: 40rpx; |
|
|
box-sizing: border-box; |
|
|
box-sizing: border-box; |
|
|
|
|
|
|
|
|
|
|
|
.chat-tools-list { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
flex-wrap: wrap; |
|
|
|
|
|
align-content: center; |
|
|
|
|
|
|
|
|
.chat-tools-item { |
|
|
.chat-tools-item { |
|
|
width: 25%; |
|
|
width: 25%; |
|
|
padding: 16rpx; |
|
|
padding: 16rpx; |
|
|
@ -1284,10 +1298,10 @@ export default { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.chat-emotion { |
|
|
.chat-emotion { |
|
|
height: 310px; |
|
|
padding: 40rpx; |
|
|
padding: 20rpx; |
|
|
|
|
|
box-sizing: border-box; |
|
|
box-sizing: border-box; |
|
|
|
|
|
|
|
|
.emotion-item-list { |
|
|
.emotion-item-list { |
|
|
|