2025-07-18 13:06:06 +08:00
"use strict" ;
const common _vendor = require ( "../../../common/vendor.js" ) ;
const components _ChatId = require ( "../../../components/ChatId.js" ) ;
const components _TimeFormatting = require ( "../../../components/TimeFormatting.js" ) ;
2025-07-21 22:10:59 +08:00
const components _request = require ( "../../../components/request.js" ) ;
2025-07-18 13:06:06 +08:00
const components _goEasyTool _tool = require ( "../../../components/goEasyTool/tool.js" ) ;
const textmessage = ( ) => "./messageComponent/textmessage.js" ;
2025-07-21 22:10:59 +08:00
const customPKMessage = ( ) => "./messageComponent/customPKMessage.js" ;
2025-07-25 16:39:52 +08:00
const imageMessage = ( ) => "./messageComponent/imageMessage.js" ;
const videoMessage = ( ) => "./messageComponent/videoMessage.js" ;
const voiceMessage = ( ) => "./messageComponent/voiceMessage.js" ;
2025-07-18 13:06:06 +08:00
const InvitationComponents = ( ) => "./moreMessageComponents/InvitationComponents.js" ;
const _sfc _main = {
data ( ) {
return {
userId : "" ,
// 对方用户id
nickname : "" ,
// 对方用户昵称
avatar : "" ,
// 对方用户头像
chatList : [ ] ,
// 聊天记录
userinfo : { } ,
// 自己用户信息
ButtonStatus : false ,
// 发送按钮状态
MoreStatus : false ,
// 更多消息类型弹窗状态
KeyboardHeight : 0 ,
// 键盘高度
content : "" ,
// 输入框内容
MoreItemStatus : null ,
// 更多消息类型弹窗点击属性
ioshide : 0 ,
// 隐藏ios键盘
ElementPositioning : null ,
// 元素定位
scrollviewheight : 0 ,
// 滚动视图高度
Elementheight : 0 ,
// 元素高度
Scrolling : false ,
// 滚动状态
scrollTop : 0 ,
// 滚动高度
judgescrollTop : false ,
// 判断滚动高度
onPage : false ,
// 是否在页面
timer : null ,
// 定时器
lastTimestamp : null ,
// 上一次刷新时间戳
2025-07-21 22:10:59 +08:00
LastTime : null ,
// 最后聊天记录的时间戳
MoreMessageList : [ ] ,
Record : null ,
// 定位记录
myitem : null ,
//直接发送自定义消息的我的选中主播
youritem : null ,
//直接发送自定义消息的对方选中主播
type : null ,
//直接发送自定义消息的消息类型
2025-07-25 16:39:52 +08:00
voiceStatus : false ,
// 语音状态
inputfocus : false ,
// 输入框焦点状态
voicepopUpstart : false ,
// 语音长按状态/false关闭/true开启
voiceCancelOrSend : false ,
// 语音取消/发送/false发送/true取消
recorderManager : common _vendor . index . getRecorderManager ( ) ,
playbackStatus : true ,
// 语音播放状态
2025-07-18 13:06:06 +08:00
popUpList : [
2025-07-21 22:10:59 +08:00
{
2025-07-25 16:39:52 +08:00
name : "图片" ,
2025-07-21 22:10:59 +08:00
icon : "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Album.png" ,
type : "Album"
} ,
2025-08-05 22:05:56 +08:00
// {
// name: "视频",
// icon: "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Video.png",
// type: "Video",
// },
2025-07-18 13:06:06 +08:00
{
name : "邀请" ,
icon : "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/chat_invite.png" ,
type : "Invitation"
}
]
/// 更多消息类型弹窗列表
} ;
} ,
onShow ( ) {
this . onPage = true ;
2025-07-21 22:10:59 +08:00
common _vendor . index . onKeyboardHeightChange ( ( res ) => {
this . KeyboardHeight = res . height * 2 - this . ioshide ;
} ) ;
2025-07-18 13:06:06 +08:00
} ,
onHide ( ) {
this . onPage = false ;
} ,
2025-07-29 14:23:27 +08:00
onUnload ( ) {
this . onPage = false ;
} ,
2025-07-18 13:06:06 +08:00
onLoad ( options ) {
2025-07-25 16:39:52 +08:00
this . recorderManager . onStop ( ( res ) => {
2025-07-29 14:23:27 +08:00
common _vendor . index . _ _f _ _ ( "log" , "at pages/index/chat/chat.vue:387" , "录音结束" , res ) ;
2025-07-25 16:39:52 +08:00
if ( this . ioshide != 0 ) {
if ( res . fileSize < 20 * 1024 ) {
common _vendor . index . showToast ( {
title : "您说话太短" ,
icon : "none" ,
duration : 2e3
} ) ;
} else {
if ( this . voiceCancelOrSend ) {
this . voiceCancelOrSend = false ;
} else {
this . sendVoice ( res ) ;
this . voiceCancelOrSend = false ;
}
}
} else {
if ( res . fileSize < 2 * 1024 ) {
common _vendor . index . showToast ( {
title : "您说话太短" ,
icon : "none" ,
duration : 2e3
} ) ;
} else {
if ( this . voiceCancelOrSend ) {
this . voiceCancelOrSend = false ;
} else {
this . sendVoice ( res ) ;
this . voiceCancelOrSend = false ;
}
}
}
} ) ;
2025-07-18 13:06:06 +08:00
common _vendor . index . getStorage ( {
key : "userinfo" ,
success : ( res ) => {
2025-07-21 22:10:59 +08:00
this . userinfo = res . data ;
2025-07-18 13:06:06 +08:00
}
} ) ;
this . userId = options . userId ;
this . nickname = options . nickname ;
this . avatar = options . avatar ;
2025-07-21 22:10:59 +08:00
this . type = options . type ;
try {
this . myitem = JSON . parse ( options . myitem ) ;
this . youritem = JSON . parse ( options . youritem ) ;
} catch ( e ) {
}
if ( this . type == "pk" ) {
setTimeout ( ( ) => {
this . sendCustomMessage ( ) ;
} , 500 ) ;
}
2025-07-18 13:06:06 +08:00
components _goEasyTool _tool . getConversationMessages ( this . $goeasy , this . userId , null ) . then ( ( res ) => {
this . chatList = res . map ( ( item ) => {
item . id = components _ChatId . generateId ( ) ;
2025-07-21 22:10:59 +08:00
item . timestampStatus = this . checkInterval ( item . timestamp ) ;
2025-07-18 13:06:06 +08:00
return item ;
} ) ;
setTimeout ( ( ) => {
2025-07-21 22:10:59 +08:00
if ( this . chatList . length > 0 ) {
this . ElementPositioning = this . chatList [ this . chatList . length - 1 ] . id ;
this . LastTime = this . chatList [ 0 ] . timestamp ;
} else {
common _vendor . index . showToast ( {
title : "您和对方暂无聊天记录,快去聊天吧" ,
icon : "none" ,
duration : 2e3
} ) ;
}
2025-07-18 13:06:06 +08:00
} , 300 ) ;
const query = common _vendor . index . createSelectorQuery ( ) . in ( this ) ;
query . select ( ".inputComponent" ) . boundingClientRect ( ( res2 ) => {
this . Elementheight = res2 . height * 2 ;
} ) . exec ( ) ;
} ) ;
components _goEasyTool _tool . messageRead ( this . $goeasy , this . userId ) . then ( ( res ) => {
2025-07-29 14:23:27 +08:00
common _vendor . index . _ _f _ _ ( "log" , "at pages/index/chat/chat.vue:469" , "已读对方的消息" ) ;
2025-07-18 13:06:06 +08:00
} ) ;
this . getIOSDeviceType ( ) ;
var im = this . $goeasy . im ;
im . on ( common _vendor . jo . IM _EVENT . PRIVATE _MESSAGE _RECEIVED , this . onPrivateMessageReceived ) ;
im . on ( common _vendor . jo . IM _EVENT . MESSAGE _READ , this . onMessageRead ) ;
this . getscrollviewheight ( ) ;
2025-09-29 20:48:31 +08:00
this . checkRecordPermission ( ) ;
2025-07-18 13:06:06 +08:00
} ,
methods : {
2025-07-25 16:39:52 +08:00
//暂停所有播放
notplayVoice ( type ) {
this . playbackStatus = type ;
} ,
//发送录音
sendVoice ( res ) {
const im = this . $goeasy . im ;
var message = im . createAudioMessage ( {
file : res ,
to : {
type : common _vendor . jo . IM _SCENE . PRIVATE ,
id : this . userId ,
//对方用户id
data : { avatar : this . avatar , nickname : this . nickname }
} ,
onProgress : function ( event ) {
2025-09-29 20:48:31 +08:00
common _vendor . index . _ _f _ _ ( "log" , "at pages/index/chat/chat.vue:496" , "file uploading:" , event ) ;
2025-07-25 16:39:52 +08:00
}
//获取上传进度
} ) ;
components _goEasyTool _tool . sendGroupMessage ( this . $goeasy , message ) . then ( ( ress ) => {
this . ElementPositioning = ress . id = components _ChatId . generateId ( ) ;
ress . timestampStatus = this . checkInterval ( ress . timestamp ) ;
this . chatList . push ( ress ) ;
this . judgescrollTop = false ;
} ) ;
} ,
//长按语音
voiceTouchstart ( ) {
2025-09-29 20:48:31 +08:00
common _vendor . index . _ _f _ _ ( "log" , "at pages/index/chat/chat.vue:508" , "长按语音" ) ;
2025-07-25 16:39:52 +08:00
this . voicepopUpstart = true ;
this . recorderManager . start ( ) ;
this . notplayVoice ( false ) ;
} ,
//松开语音
voiceTouchend ( ) {
setTimeout ( ( ) => {
this . recorderManager . stop ( ) ;
} , 100 ) ;
2025-09-29 20:48:31 +08:00
common _vendor . index . _ _f _ _ ( "log" , "at pages/index/chat/chat.vue:518" , "松开语音" ) ;
2025-07-25 16:39:52 +08:00
this . voicepopUpstart = false ;
} ,
//移动语音
voiceTouchmove ( event ) {
const threshold = common _vendor . index . getSystemInfoSync ( ) . windowHeight * 0.86 ;
try {
if ( event . touches [ 0 ] . clientY > threshold ) {
this . voiceCancelOrSend = false ;
} else {
this . voiceCancelOrSend = true ;
}
} catch ( e ) {
}
} ,
//中断语音
voiceTouchcancel ( ) {
2025-09-29 20:48:31 +08:00
common _vendor . index . _ _f _ _ ( "log" , "at pages/index/chat/chat.vue:534" , "中断语音" ) ;
2025-07-25 16:39:52 +08:00
this . voicepopUpstart = false ;
this . voiceCancelOrSend = false ;
} ,
//语音切换
onVoice ( status ) {
if ( status ) {
this . inputfocus = false ;
this . MoreStatus = false ;
} else {
this . inputfocus = true ;
}
this . voiceStatus = status ;
} ,
//录音权限
checkRecordPermission ( ) {
common _vendor . index . getSetting ( {
success : ( res ) => {
const hasPermission = res . authSetting [ "scope.record" ] ;
if ( hasPermission === void 0 ) {
this . requestPermission ( ) ;
} else if ( ! hasPermission ) {
this . voiceStatus = false ;
common _vendor . index . showModal ( {
title : "权限提示" ,
content : "需要录音权限才能正常使用功能,请在设置中开启" ,
confirmText : "去开启" ,
success : ( modalRes ) => {
if ( modalRes . confirm ) {
common _vendor . index . openSetting ( {
success : ( settingRes ) => {
if ( settingRes . authSetting [ "scope.record" ] === true ) {
this . checkRecordPermission ( ) ;
}
}
} ) ;
}
}
} ) ;
}
}
} ) ;
} ,
//请求录音权限
requestPermission ( ) {
common _vendor . index . authorize ( {
scope : "scope.record" ,
fail : ( err ) => {
this . voiceStatus = false ;
common _vendor . index . showToast ( {
title : "请授予麦克风权限,否则可能导致语音功能异常" ,
icon : "none"
} ) ;
}
} ) ;
} ,
2025-07-21 22:10:59 +08:00
//直接发送自定义消息
sendCustomMessage ( ) {
components _request . request ( {
url : "pk/createPkRecord" ,
method : "POST" ,
data : {
pkIdA : this . youritem . id ,
pkIdB : this . myitem . id ,
userIdA : this . userId ,
userIdB : this . userinfo . id ,
pkTime : this . youritem . pkTime ,
pkNumber : this . youritem . pkNumber ,
anchorIdA : this . youritem . anchorId ,
anchorIdB : this . myitem . anchorId ,
anchorIconA : this . youritem . anchorIcon ,
anchorIconB : this . myitem . anchorIcon ,
piIdA : this . youritem . id ,
piIdB : this . myitem . id
} ,
userInfo : true
} ) . then ( ( res ) => {
if ( res . code == 200 ) {
const customData = {
id : res . data . id ,
pkIdA : this . youritem . id ,
pkIdB : this . myitem . id
} ;
let order = {
customData ,
link : "https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/pk.png" ,
text : "PK邀请消息"
} ;
components _goEasyTool _tool . sendCustomMessage (
this . $goeasy ,
this . type ,
this . userId ,
order ,
this . avatar ,
this . nickname
) . then ( ( res2 ) => {
this . ElementPositioning = res2 . id = components _ChatId . generateId ( ) ;
res2 . timestampStatus = this . checkInterval ( res2 . timestamp ) ;
this . chatList . push ( res2 ) ;
common _vendor . index . showToast ( {
title : "发送成功" ,
icon : "none"
} ) ;
} ) ;
} else {
common _vendor . index . showToast ( {
title : res . msg ,
icon : "none"
} ) ;
}
} ) ;
} ,
2025-07-18 13:06:06 +08:00
//时间显示
checkInterval ( timestamp ) {
if ( ! this . lastTimestamp ) {
this . lastTimestamp = timestamp ;
return true ;
}
const timeDiff = timestamp - this . lastTimestamp ;
if ( timeDiff >= 3e5 ) {
this . lastTimestamp = timestamp ;
return true ;
}
return false ;
} ,
//时间格式化
TimeFormatting : components _TimeFormatting . TimeFormatting ,
//获取容器高度
getscrollviewheight ( ) {
const queryheight = common _vendor . index . createSelectorQuery ( ) . in ( this ) ;
queryheight . select ( ".scroll" ) . boundingClientRect ( ( res ) => {
this . scrollviewheight = res . height ;
} ) . exec ( ) ;
} ,
//滚动事件
onScroll ( event ) {
if ( ! this . judgescrollTop ) {
this . scrollTop = event . detail . scrollTop ;
this . judgescrollTop = true ;
} else if ( this . scrollTop - event . detail . scrollTop > this . scrollviewheight ) {
this . Scrolling = true ;
} else if ( this . scrollTop - event . detail . scrollTop < this . scrollviewheight ) {
this . Scrolling = false ;
}
} ,
2025-07-21 22:10:59 +08:00
//获取更多聊天记录
onScrollToUpper ( ) {
this . lastTimestamp = null ;
components _goEasyTool _tool . getConversationMessages ( this . $goeasy , this . userId , this . LastTime ) . then ( ( res ) => {
this . Record = this . chatList [ 0 ] . id ;
this . MoreMessageList = res . map ( ( item ) => {
item . id = components _ChatId . generateId ( ) ;
item . timestampStatus = this . checkInterval ( item . timestamp ) ;
return item ;
} ) ;
} ) ;
setTimeout ( ( ) => {
this . chatList = [ ... this . MoreMessageList , ... this . chatList ] ;
2025-09-29 20:48:31 +08:00
common _vendor . index . _ _f _ _ ( "log" , "at pages/index/chat/chat.vue:699" , "获取更多聊天记录" , this . chatList ) ;
2025-07-21 22:10:59 +08:00
this . LastTime = this . chatList [ 0 ] . timestamp ;
this . ElementPositioning = this . Record ;
} , 300 ) ;
} ,
2025-07-18 13:06:06 +08:00
//监听已读消息
onMessageRead ( message ) {
2025-09-29 20:48:31 +08:00
common _vendor . index . _ _f _ _ ( "log" , "at pages/index/chat/chat.vue:706" , "1已读消息" , message ) ;
2025-07-18 13:06:06 +08:00
} ,
//监听接受消息
onPrivateMessageReceived ( message ) {
if ( ! this . Scrolling ) {
this . ElementPositioning = message . id = components _ChatId . generateId ( ) ;
2025-07-21 22:10:59 +08:00
message . timestampStatus = this . checkInterval ( message . timestamp ) ;
2025-07-18 13:06:06 +08:00
this . judgescrollTop = false ;
} else {
message . id = components _ChatId . generateId ( ) ;
2025-07-21 22:10:59 +08:00
message . timestampStatus = this . checkInterval ( message . timestamp ) ;
2025-07-18 13:06:06 +08:00
}
this . chatList . push ( message ) ;
if ( this . onPage ) {
components _goEasyTool _tool . messageRead ( this . $goeasy , this . userId ) . then ( ( res ) => {
2025-09-29 20:48:31 +08:00
common _vendor . index . _ _f _ _ ( "log" , "at pages/index/chat/chat.vue:721" , "已读对方的消息" ) ;
2025-07-18 13:06:06 +08:00
} ) ;
}
} ,
//发送消息
onSend ( ) {
if ( this . content != "" ) {
components _goEasyTool _tool . sendMessage (
this . $goeasy ,
this . userId ,
this . content ,
this . avatar ,
this . nickname
) . then ( ( res ) => {
2025-09-29 20:48:31 +08:00
common _vendor . index . _ _f _ _ ( "log" , "at pages/index/chat/chat.vue:735" , "发送成功" , res ) ;
2025-07-18 13:06:06 +08:00
this . ElementPositioning = res . id = components _ChatId . generateId ( ) ;
2025-07-21 22:10:59 +08:00
res . timestampStatus = this . checkInterval ( res . timestamp ) ;
2025-07-18 13:06:06 +08:00
this . chatList . push ( res ) ;
this . judgescrollTop = false ;
} ) ;
this . content = "" ;
this . ButtonStatus = false ;
}
} ,
2025-07-21 22:10:59 +08:00
//自定义消息发送返回处理
refreshMessage ( message ) {
this . MoreItemStatus = null ;
this . ElementPositioning = message . message . id = components _ChatId . generateId ( ) ;
message . timestampStatus = this . checkInterval ( message . message . timestamp ) ;
this . chatList . push ( message . message ) ;
this . judgescrollTop = false ;
this . MoreStatus = false ;
} ,
2025-07-18 13:06:06 +08:00
//ios兼容
getIOSDeviceType ( ) {
const systemInfo = common _vendor . index . getSystemInfoSync ( ) ;
const model = systemInfo . model ;
2025-09-29 20:48:31 +08:00
if ( /iPhone X|iPhone11|iPhone12|iPhone13|iPhone14|iPhone15|iPhone16|iPhone15 Pro|iPhone15 Pro Max|iPhone14 Pro|iPhone14 Pro Max|iPhone13 Pro|iPhone13 Pro Max|iPhone12 Pro|iPhone12 Pro Max|iPhone11 Pro|iPhone11 Pro Max|iPhone13 mini|iPhone12 mini|iPhoneXS|iPhoneXS Max/i . test ( model ) ) {
if ( /iPhone X|iPhone XS|iPhone 11 Pro|iPhone 11 Pro Max|iPhone 12 Pro|iPhone 12 Pro Max|iPhone 13 Pro|iPhone 13 Pro Max|iPhone 14 Pro|iPhone 14 Pro Max|iPhone 15 Pro|iPhone 15 Pro Max|iPhone 16/i . test ( model ) ) {
2025-07-18 13:06:06 +08:00
this . ioshide = 88 ;
} else if ( /iPhone 12|iPhone 13|iPhone 14/i . test ( model ) ) {
this . ioshide = 94 ;
}
}
} ,
//更多消息类型弹窗事件
onMore ( Status ) {
if ( ! this . Scrolling ) {
this . ElementPositioning = null ;
setTimeout ( ( ) => {
this . ElementPositioning = this . chatList [ this . chatList . length - 1 ] . id ;
} , 100 ) ;
this . judgescrollTop = false ;
}
this . getscrollviewheight ( ) ;
2025-07-25 16:39:52 +08:00
if ( Status ) {
this . MoreStatus = Status ;
this . voiceStatus = false ;
} else {
this . MoreStatus = Status ;
}
2025-07-18 13:06:06 +08:00
const query = common _vendor . index . createSelectorQuery ( ) . in ( this ) ;
query . select ( ".inputComponent" ) . boundingClientRect ( ( res ) => {
this . Elementheight = res . height * 2 ;
} ) . exec ( ) ;
} ,
//更多消息类型弹窗点击事件
onMoreItem ( type ) {
2025-07-21 22:10:59 +08:00
if ( type == "Album" ) {
this . onSendMedia ( ) ;
2025-07-25 16:39:52 +08:00
} else if ( type == "Video" ) {
this . onSendVideo ( ) ;
2025-07-21 22:10:59 +08:00
} else {
this . MoreItemStatus = type ;
}
} ,
2025-07-25 16:39:52 +08:00
//发送视频
onSendVideo ( ) {
var im = this . $goeasy . im ;
common _vendor . index . chooseVideo ( {
sourceType : [ "album" , "camera" ] ,
success : ( res ) => {
var message = im . createVideoMessage ( {
file : res ,
//H5获得的视频file对象, Uniapp和小程序调用chooseVideo, success时得到的res对象
to : {
type : common _vendor . jo . IM _SCENE . PRIVATE ,
id : this . userId ,
//对方用户id
data : { avatar : this . avatar , nickname : this . nickname }
} ,
onProgress : function ( event ) {
2025-09-29 20:48:31 +08:00
common _vendor . index . _ _f _ _ ( "log" , "at pages/index/chat/chat.vue:815" , "file uploading:" , event ) ;
2025-07-25 16:39:52 +08:00
}
//获取上传进度
} ) ;
components _goEasyTool _tool . sendGroupMessage ( this . $goeasy , message ) . then ( ( res2 ) => {
this . ElementPositioning = res2 . id = components _ChatId . generateId ( ) ;
res2 . timestampStatus = this . checkInterval ( res2 . timestamp ) ;
this . chatList . push ( res2 ) ;
this . judgescrollTop = false ;
} ) ;
}
} ) ;
} ,
//发送图片
2025-07-21 22:10:59 +08:00
onSendMedia ( ) {
2025-07-25 16:39:52 +08:00
var im = this . $goeasy . im ;
common _vendor . index . chooseImage ( {
2025-07-21 22:10:59 +08:00
count : 9 ,
2025-07-25 16:39:52 +08:00
//默认9
sizeType : [ "original" , "compressed" ] ,
//可以指定是原图还是压缩图,默认二者都有
2025-07-21 22:10:59 +08:00
sourceType : [ "album" , "camera" ] ,
2025-07-25 16:39:52 +08:00
//从相册选择
success : ( res ) => {
const tempFiles = res . tempFiles ;
tempFiles . forEach ( ( item , index ) => {
var message = im . createImageMessage ( {
file : item ,
to : {
type : common _vendor . jo . IM _SCENE . PRIVATE ,
id : this . userId ,
data : { avatar : this . avatar , nickname : this . nickname }
} ,
onProgress : function ( event ) {
2025-09-29 20:48:31 +08:00
common _vendor . index . _ _f _ _ ( "log" , "at pages/index/chat/chat.vue:845" , "上传进度" , event ) ;
2025-07-25 16:39:52 +08:00
}
//获取上传进度
} ) ;
components _goEasyTool _tool . sendGroupMessage ( this . $goeasy , message ) . then ( ( res2 ) => {
this . ElementPositioning = res2 . id = components _ChatId . generateId ( ) ;
res2 . timestampStatus = this . checkInterval ( res2 . timestamp ) ;
this . chatList . push ( res2 ) ;
this . judgescrollTop = false ;
} ) ;
} ) ;
2025-07-21 22:10:59 +08:00
}
} ) ;
} ,
2025-07-18 13:06:06 +08:00
// 获取键盘高度
onFocus ( event ) {
if ( ! this . Scrolling ) {
this . ElementPositioning = null ;
setTimeout ( ( ) => {
this . ElementPositioning = this . chatList [ this . chatList . length - 1 ] . id ;
} , 100 ) ;
this . judgescrollTop = false ;
}
this . getscrollviewheight ( ) ;
const query = common _vendor . index . createSelectorQuery ( ) . in ( this ) ;
query . select ( ".inputComponent" ) . boundingClientRect ( ( res ) => {
this . Elementheight = res . height * 2 ;
} ) . exec ( ) ;
} ,
//键盘消失
onBlur ( event ) {
const query = common _vendor . index . createSelectorQuery ( ) . in ( this ) ;
query . select ( ".inputComponent" ) . boundingClientRect ( ( res ) => {
this . Elementheight = res . height * 2 ;
} ) . exec ( ) ;
this . getscrollviewheight ( ) ;
} ,
//按钮切换
SendInput ( event ) {
const query = common _vendor . index . createSelectorQuery ( ) . in ( this ) ;
query . select ( ".inputComponent" ) . boundingClientRect ( ( res ) => {
this . Elementheight = res . height * 2 ;
} ) . exec ( ) ;
if ( event . target . value != "" ) {
this . ButtonStatus = true ;
} else {
this . ButtonStatus = false ;
}
} ,
// 返回上一页
onBack ( ) {
this . onPage = false ;
common _vendor . wx$1 . navigateBack ( {
delta : 1
} ) ;
}
} ,
components : {
textmessage ,
2025-07-21 22:10:59 +08:00
InvitationComponents ,
2025-07-25 16:39:52 +08:00
customPKMessage ,
imageMessage ,
videoMessage ,
voiceMessage
2025-07-18 13:06:06 +08:00
}
} ;
if ( ! Array ) {
2025-07-21 22:10:59 +08:00
const _component _textmessage = common _vendor . resolveComponent ( "textmessage" ) ;
const _component _customPKMessage = common _vendor . resolveComponent ( "customPKMessage" ) ;
2025-07-25 16:39:52 +08:00
const _component _imageMessage = common _vendor . resolveComponent ( "imageMessage" ) ;
const _component _videoMessage = common _vendor . resolveComponent ( "videoMessage" ) ;
const _component _voiceMessage = common _vendor . resolveComponent ( "voiceMessage" ) ;
2025-07-18 13:06:06 +08:00
const _component _InvitationComponents = common _vendor . resolveComponent ( "InvitationComponents" ) ;
2025-07-25 16:39:52 +08:00
( _component _textmessage + _component _customPKMessage + _component _imageMessage + _component _videoMessage + _component _voiceMessage + _component _InvitationComponents ) ( ) ;
2025-07-18 13:06:06 +08:00
}
function _sfc _render ( _ctx , _cache , $props , $setup , $data , $options ) {
return common _vendor . e ( {
a : common _vendor . o ( ( $event ) => $options . onMore ( false ) ) ,
b : common _vendor . o ( ( ... args ) => $options . onBack && $options . onBack ( ... args ) ) ,
c : common _vendor . t ( $data . nickname ) ,
d : common _vendor . o ( ( $event ) => $options . onMore ( false ) ) ,
e : common _vendor . f ( $data . chatList , ( item , index , i0 ) => {
return common _vendor . e ( {
2025-07-21 22:10:59 +08:00
a : item . timestampStatus
} , item . timestampStatus ? {
2025-07-18 13:06:06 +08:00
b : common _vendor . t ( $options . TimeFormatting ( item . timestamp ) )
} : { } , {
2025-07-21 22:10:59 +08:00
c : item . senderId == $data . userId
} , item . senderId == $data . userId ? common _vendor . e ( {
d : $data . avatar ,
2025-07-25 16:39:52 +08:00
e : item . type == "text" || item . type == "audio"
} , item . type == "text" || item . type == "audio" ? { } : { } , {
f : item . type == "text"
2025-07-21 22:10:59 +08:00
} , item . type == "text" ? {
2025-07-25 16:39:52 +08:00
g : "f4b42ac4-0-" + i0 ,
h : common _vendor . p ( {
2025-07-21 22:10:59 +08:00
messagetext : item . payload . text
} )
} : { } , {
2025-07-25 16:39:52 +08:00
i : item . type == "pk"
2025-07-21 22:10:59 +08:00
} , item . type == "pk" ? {
2025-07-25 16:39:52 +08:00
j : "f4b42ac4-1-" + i0 ,
k : common _vendor . p ( {
2025-07-21 22:10:59 +08:00
message : item . payload
} )
2025-07-25 16:39:52 +08:00
} : { } , {
l : item . type == "image"
} , item . type == "image" ? {
m : "f4b42ac4-2-" + i0 ,
n : common _vendor . p ( {
message : item . payload
} )
} : { } , {
o : item . type == "video"
} , item . type == "video" ? {
p : "f4b42ac4-3-" + i0 ,
q : common _vendor . p ( {
message : item . payload
} )
} : { } , {
r : item . type == "audio"
} , item . type == "audio" ? {
s : "f4b42ac4-4-" + i0 ,
t : common _vendor . p ( {
message : item . payload ,
senderId : item . senderId ,
userId : $data . userinfo . id
} )
} : { } , {
v : item . type == "text" || item . type == "audio" ? "#7bbd0093" : "#ffffff"
} ) : { } , {
w : item . senderId == $data . userinfo . id
2025-07-21 22:10:59 +08:00
} , item . senderId == $data . userinfo . id ? common _vendor . e ( {
2025-07-25 16:39:52 +08:00
x : $data . userinfo . headerIcon ,
y : item . type == "text" || item . type == "audio"
} , item . type == "text" || item . type == "audio" ? { } : { } , {
z : item . type == "text"
2025-07-21 22:10:59 +08:00
} , item . type == "text" ? {
2025-07-25 16:39:52 +08:00
A : "f4b42ac4-5-" + i0 ,
B : common _vendor . p ( {
2025-07-21 22:10:59 +08:00
messagetext : item . payload . text
} )
} : { } , {
2025-07-25 16:39:52 +08:00
C : item . type == "pk"
2025-07-21 22:10:59 +08:00
} , item . type == "pk" ? {
2025-07-25 16:39:52 +08:00
D : "f4b42ac4-6-" + i0 ,
E : common _vendor . p ( {
message : item . payload
} )
} : { } , {
F : item . type == "image"
} , item . type == "image" ? {
G : "f4b42ac4-7-" + i0 ,
H : common _vendor . p ( {
2025-07-21 22:10:59 +08:00
message : item . payload
} )
2025-07-25 16:39:52 +08:00
} : { } , {
I : item . type == "video"
} , item . type == "video" ? {
J : "f4b42ac4-8-" + i0 ,
K : common _vendor . p ( {
message : item . payload
} )
} : { } , {
L : item . type == "audio"
} , item . type == "audio" ? {
M : common _vendor . o ( $options . notplayVoice , item . id ) ,
N : "f4b42ac4-9-" + i0 ,
O : common _vendor . p ( {
message : item . payload ,
senderId : item . senderId ,
userId : $data . userinfo . id ,
playbackStatus : $data . playbackStatus
} )
} : { } , {
P : item . type == "text" || item . type == "audio" ? "#7bbd0093" : "#ffffff"
} ) : { } , {
Q : item . id ,
R : item . id
2025-07-18 13:06:06 +08:00
} ) ;
} ) ,
2025-07-21 22:10:59 +08:00
f : common _vendor . o ( ( ... args ) => $options . onScrollToUpper && $options . onScrollToUpper ( ... args ) ) ,
g : $data . ElementPositioning ,
h : common _vendor . o ( ( ... args ) => $options . onScroll && $options . onScroll ( ... args ) ) ,
i : common _vendor . o ( ( $event ) => $options . onMore ( false ) ) ,
2025-07-25 16:39:52 +08:00
j : $data . MoreStatus || $data . KeyboardHeight != 0 ? $data . MoreStatus ? 650 + $data . Elementheight + "rpx" : $data . KeyboardHeight != 0 ? $data . KeyboardHeight + $data . Elementheight + "rpx" : "10vh" : "10vh" ,
k : ! $data . voiceStatus
} , ! $data . voiceStatus ? {
l : common _vendor . o ( ( $event ) => $options . onVoice ( ! $data . voiceStatus ) )
} : { } , {
m : $data . voiceStatus
} , $data . voiceStatus ? {
n : common _vendor . o ( ( $event ) => $options . onVoice ( ! $data . voiceStatus ) )
} : { } , {
o : $data . voiceStatus
} , $data . voiceStatus ? {
p : common _vendor . o ( ( ... args ) => $options . voiceTouchstart && $options . voiceTouchstart ( ... args ) ) ,
q : common _vendor . o ( ( ... args ) => $options . voiceTouchend && $options . voiceTouchend ( ... args ) ) ,
r : common _vendor . o ( ( ... args ) => $options . voiceTouchmove && $options . voiceTouchmove ( ... args ) ) ,
s : common _vendor . o ( ( ... args ) => $options . voiceTouchcancel && $options . voiceTouchcancel ( ... args ) )
} : { } , {
t : ! $data . voiceStatus
} , ! $data . voiceStatus ? {
v : common _vendor . o ( [ ( $event ) => $data . content = $event . detail . value , ( ... args ) => $options . SendInput && $options . SendInput ( ... args ) ] ) ,
w : common _vendor . o ( ( ... args ) => $options . onFocus && $options . onFocus ( ... args ) ) ,
x : $data . inputfocus ,
y : common _vendor . o ( ( ... args ) => $options . onBlur && $options . onBlur ( ... args ) ) ,
z : $data . content
} : { } , {
A : ! $data . ButtonStatus
2025-07-18 13:06:06 +08:00
} , ! $data . ButtonStatus ? {
2025-07-25 16:39:52 +08:00
B : common _vendor . o ( ( $event ) => $options . onMore ( ! $data . MoreStatus ) )
2025-07-18 13:06:06 +08:00
} : { } , {
2025-07-25 16:39:52 +08:00
C : $data . ButtonStatus
2025-07-18 13:06:06 +08:00
} , $data . ButtonStatus ? {
2025-07-25 16:39:52 +08:00
D : common _vendor . o ( ( ... args ) => $options . onSend && $options . onSend ( ... args ) )
2025-07-18 13:06:06 +08:00
} : { } , {
2025-07-25 16:39:52 +08:00
E : $data . MoreStatus || $data . KeyboardHeight > 300 ? $data . MoreStatus ? "650rpx" : $data . KeyboardHeight > 300 ? $data . KeyboardHeight + "rpx" : "0" : "0" ,
F : common _vendor . f ( $data . popUpList , ( item , index , i0 ) => {
2025-07-18 13:06:06 +08:00
return {
a : item . icon ,
b : common _vendor . t ( item . name ) ,
c : common _vendor . o ( ( $event ) => $options . onMoreItem ( item . type ) , index ) ,
d : index
} ;
} ) ,
2025-07-25 16:39:52 +08:00
G : $data . MoreStatus || $data . KeyboardHeight > 300 ? $data . MoreStatus ? "0" : $data . KeyboardHeight > 300 ? "0" : $data . KeyboardHeight + "rpx" : "-650rpx" ,
H : $data . MoreItemStatus == "Invitation"
2025-07-21 22:10:59 +08:00
} , $data . MoreItemStatus == "Invitation" ? {
2025-07-25 16:39:52 +08:00
I : common _vendor . o ( $options . refreshMessage ) ,
J : common _vendor . p ( {
2025-07-21 22:10:59 +08:00
oppositeId : $data . userId ,
myId : $data . userinfo . id ,
avatar : $data . avatar ,
nickname : $data . nickname
} )
} : { } , {
2025-07-25 16:39:52 +08:00
K : common _vendor . o ( ( ) => {
2025-07-18 13:06:06 +08:00
} ) ,
2025-07-25 16:39:52 +08:00
L : $data . MoreItemStatus == null ? "-1000rpx" : "0" ,
M : common _vendor . o ( ( $event ) => $options . onMoreItem ( null ) ) ,
N : $data . MoreItemStatus == null ? "100vh" : "0" ,
O : $data . voiceCancelOrSend ? "#ebebeb" : "#000000a9" ,
P : common _vendor . t ( $data . voiceCancelOrSend ? "取消" : "松手发送" ) ,
Q : ! $data . voiceCancelOrSend ? "#ebebeb" : "#000000a9" ,
R : $data . voicepopUpstart == false ? "-1000rpx" : "0" ,
S : $data . voicepopUpstart == false ? "100vh" : "0"
2025-07-18 13:06:06 +08:00
} ) ;
}
const MiniProgramPage = /* @__PURE__ */ common _vendor . _export _sfc ( _sfc _main , [ [ "render" , _sfc _render ] , [ "__scopeId" , "data-v-f4b42ac4" ] ] ) ;
wx . createPage ( MiniProgramPage ) ;
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/index/chat/chat.js.map