topShow: false | topShow: false | ||||
}) | }) | ||||
}, | }, | ||||
// 聊一聊 | |||||
goToChat(e) { | |||||
let item = e.currentTarget.dataset.item; | |||||
wx.navigateTo({ | |||||
url: "/pages/msgModule/wechat2/wechat2", | |||||
success: function (res) { | |||||
// 通过eventChannel向被打开页面传送数据 | |||||
res.eventChannel.emit('customerid', { customerid: item.businessCommunicationCustomerVO.customerId, chatHeads: item.businessCommunicationCustomerVO.chatHeads }) | |||||
} | |||||
}) | |||||
}, | |||||
getMsgData() { | getMsgData() { | ||||
let { page, size } = this.data; | let { page, size } = this.data; | ||||
$request.get('/businessCommunicationDemand/getChatRecordTable.action', { page, size }).then(res => { | $request.get('/businessCommunicationDemand/getChatRecordTable.action', { page, size }).then(res => { | ||||
console.log(res); | |||||
let tempListData = this.data.msgData; | let tempListData = this.data.msgData; | ||||
if (res.status == 0) { | if (res.status == 0) { | ||||
let datas = res.data; | let datas = res.data; | ||||
console.log(datas, 'datas') | |||||
// 先push数据 | // 先push数据 | ||||
tempListData.push(...datas.chatRecordTable); | tempListData.push(...datas.chatRecordTable); | ||||
tempListData.forEach(el => { | tempListData.forEach(el => { | ||||
el.createdOn = $util.formatTime(new Date(el.createdOn), true); | |||||
el.lastContentDate = $util.formatTime(new Date(el.lastContentDate)); | |||||
el.lastContentDate = el.lastContentDate.replaceAll('/', '-'); | |||||
if (typeof el.type == 'string') { | if (typeof el.type == 'string') { | ||||
el.type = el.type.split(','); | el.type = el.type.split(','); | ||||
} | } |
<image class="not-msg-data-img " src="/images/home/not-msg-data.png"/> | <image class="not-msg-data-img " src="/images/home/not-msg-data.png"/> | ||||
<view class="not-data-msg-info">暂无消息记录</view> | <view class="not-data-msg-info">暂无消息记录</view> | ||||
</view> | </view> | ||||
<view wx:else class="msg-box-view {{ topShow ? 'topShow' : '' }}"></view> | |||||
<view wx:else class="msg-box-view {{ topShow ? 'topShow' : '' }}"> | |||||
<view class="msg-li-item" wx:for="{{msgData}}" wx:key="index" bindtap="goToChat" data-item="{{ item }}"> | |||||
<view class="chatheads-view fl"> | |||||
<image class='other-head-img' src='{{item.businessCommunicationCustomerVO.chatHeads }}'></image> | |||||
</view> | |||||
<view class="msg-content fl"> | |||||
<view class="msg-nickName fl yichu">{{ item.businessCommunicationCustomerVO.nickName }}</view> | |||||
<view class="msg-last-content fl yichu">{{ item.lastContent }}</view> | |||||
<view class="msg-last-content-date fr yichu">{{ item.lastContentDate }}</view> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
</view> | </view> | ||||
<tabBar currentIndex="{{currentIndex}}"></tabBar> | <tabBar currentIndex="{{currentIndex}}"></tabBar> | ||||
</view> | </view> |
font-size: 24rpx; | font-size: 24rpx; | ||||
color: #b3bfcb; | color: #b3bfcb; | ||||
margin-top: 20rpx; | margin-top: 20rpx; | ||||
} | |||||
.msg-li-item { | |||||
height: 140rpx; | |||||
border-bottom: 1rpx solid #d9dde5; | |||||
box-sizing: border-box; | |||||
/* padding: 26rpx 0; */ | |||||
padding-top: 20rpx; | |||||
} | |||||
.msg-li-item .chatheads-view{ | |||||
width: 88rpx; | |||||
height: 88rpx; | |||||
margin: 0 20rpx; | |||||
border-radius: 50%; | |||||
margin-top: 7rpx; | |||||
} | |||||
.msg-li-item .chatheads-view .other-head-img{ | |||||
width: 100%; | |||||
height: 100%; | |||||
border-radius: 50%; | |||||
} | |||||
.msg-li-item .msg-content { | |||||
width: calc(100% - 140rpx); | |||||
} | |||||
.msg-li-item .msg-content .msg-nickName{ | |||||
font-size: 30rpx; | |||||
line-height: 56rpx; | |||||
width: 100%; | |||||
} | |||||
.msg-li-item .msg-content .msg-last-content, | |||||
.msg-li-item .msg-content .msg-last-content-date{ | |||||
font-size: 24rpx; | |||||
color: #999; | |||||
} | |||||
.msg-li-item .msg-content .msg-last-content-date { | |||||
margin-right: 20rpx; | |||||
} | |||||
.msg-li-item .msg-content .msg-last-content { | |||||
max-width: calc(100% - 270rpx); | |||||
} | } |
// 获取历史记录 | // 获取历史记录 | ||||
getHistory() { | getHistory() { | ||||
var { sendMemberId,businessCommunicationDemandId } = this.data; | var { sendMemberId,businessCommunicationDemandId } = this.data; | ||||
$request.get('/businessCommunicationDemand/getChatRecordById/' + businessCommunicationDemandId + '/' + sendMemberId + '.action').then(res => { | |||||
let url = ""; | |||||
if(businessCommunicationDemandId){ | |||||
url = '/businessCommunicationDemand/getChatRecordById/' + businessCommunicationDemandId + '/' + sendMemberId + '.action' | |||||
}else{ | |||||
url = '/businessCommunicationDemand/getChatRecordById/' + sendMemberId + '.action' | |||||
} | |||||
$request.get(url).then(res => { | |||||
console.log(`------------聊一聊获取历史记录-----------------`) | console.log(`------------聊一聊获取历史记录-----------------`) | ||||
console.log(res); | console.log(res); | ||||
console.log(`------------聊一聊获取历史记录-----------------`) | console.log(`------------聊一聊获取历史记录-----------------`) | ||||
// 设置滚动区域的高度 | // 设置滚动区域的高度 | ||||
setScrollHeight: function () { | setScrollHeight: function () { | ||||
const client = wx.getSystemInfoSync().windowHeight // 获取当前窗口的高度 | const client = wx.getSystemInfoSync().windowHeight // 获取当前窗口的高度 | ||||
var scrollHeight = (client - 36) + 'px' | |||||
var scrollHeight = (client - 136) + 'px' | |||||
this.setData({ | this.setData({ | ||||
scrollHeight | scrollHeight | ||||
}) | }) |