@@ -75,12 +75,12 @@ Component({ | |||
return | |||
} | |||
console.log(`点击了聊一聊`) | |||
let customerid = e.currentTarget.dataset.customerid; | |||
let item = e.currentTarget.dataset.item; | |||
wx.navigateTo({ | |||
url:"/pages/msgModule/wechat2/wechat2", | |||
success: function (res) { | |||
// 通过eventChannel向被打开页面传送数据 | |||
res.eventChannel.emit('customerid', { customerid }) | |||
res.eventChannel.emit('customerid', { customerid:item.customerId,businessCommunicationDemandId:item.businessCommunicationDemandId }) | |||
} | |||
}) | |||
}, |
@@ -51,7 +51,7 @@ | |||
<image class="collect-img" src="/images/home/not-collect.png" wx:else /> | |||
收藏 | |||
</view> | |||
<view class="fr list-foot-text-chat" wx:if="{{ pageStatus != 'myRelease' && isOther }}" bindtap="goToChat" data-customerid="{{ item.customerId }}"> | |||
<view class="fr list-foot-text-chat" wx:if="{{ pageStatus != 'myRelease' && isOther }}" bindtap="goToChat" data-item="{{ item }}"> | |||
<image class="chat-img" src="/images/home/chat-icon.png" /> | |||
聊一聊 | |||
</view> |
@@ -12,31 +12,16 @@ Page({ | |||
}, | |||
sendAvatar: 'http://wx.qlogo.cn/mmopen/ajNVdqHZLLAIliaZvz5B1ibTzTehYzXdfBZ9hXTL7yuhuCUQGyzbuHeYS2yr8rO5PkbUBbHuWb5h9SibpRQkj3GTw/0', | |||
newsList: [ | |||
{ | |||
date: "2020.10.19", | |||
message: '哈喽,好久不见', | |||
type: 0 | |||
}, | |||
{ | |||
date: "2020.10.20", | |||
message: '是呀,好久不见', | |||
type: 1 | |||
}, | |||
{ | |||
date: "2020.10.20", | |||
message: '是呀,好久不见', | |||
type: 1 | |||
}, | |||
{ | |||
date: "2020.10.20", | |||
message: 'sad加撒恐龙当家撒了框架到拉喀什就科利达杀伤力肯定会萨克雷号地块了撒接口连接达萨罗凯撒将到拉萨就来的就是sad就卡了😘', | |||
type: 1 | |||
}, | |||
{ | |||
date: "2020.10.19", | |||
message: '自行车金坷垃上架了靠的就是卡旅行者沉默现在你沙雕萨比许昌办是撒娇登记卡数据库大数据库写注册表你现在从现在是阿斯顿撒多😄', | |||
type: 0 | |||
}, | |||
// { | |||
// date: "2020.10.19", | |||
// message: '哈喽,好久不见', | |||
// type: 0 | |||
// }, | |||
// { | |||
// date: "2020.10.20", | |||
// message: '是呀,好久不见', | |||
// type: 1 | |||
// }, | |||
],//消息列表 | |||
historyList: [], | |||
input: null, | |||
@@ -57,6 +42,8 @@ Page({ | |||
triggered: true, | |||
// 历史记录当前页 | |||
pageNo: 1, | |||
// 当前产品ID | |||
businessCommunicationDemandId:null, | |||
}, | |||
/** | |||
@@ -68,6 +55,7 @@ Page({ | |||
eventChannel.on('customerid', data => { | |||
this.setData({ | |||
sendMemberId: data.customerid, | |||
businessCommunicationDemandId:data.businessCommunicationDemandId, | |||
}) | |||
// 获取历史记录 | |||
this.getHistory() | |||
@@ -155,11 +143,12 @@ Page({ | |||
var historyList = [...res.data.chatRecordList, ...this.data.historyList] | |||
if (historyList && historyList.length > 0) { | |||
historyList.forEach(item => { | |||
if (item.send_member_id == sendMemberId) { | |||
if (item.sender != sendMemberId) { | |||
item.type = 0 | |||
} else { | |||
item.type = 1 | |||
} | |||
item.date = utils.formatTime(new Date(item.sendTime)) | |||
}); | |||
this.setData({ | |||
historyList | |||
@@ -318,7 +307,20 @@ Page({ | |||
wx.sendSocketMessage({ | |||
data: _this.data.input, | |||
success: (res) => { | |||
console.log(res) | |||
let { sendMemberId ,receiveMemberId ,businessCommunicationDemandId} = _this.data; | |||
let params = { | |||
sender: receiveMemberId, // 发件人Id | |||
addressee: sendMemberId, // 收件人Id | |||
transactionId: businessCommunicationDemandId, // 产品ID | |||
content: _this.data.input | |||
}; | |||
$request.post('/businessCommunicationDemand/addChatRecord.action',params).then(res => { | |||
console.log(`------------聊一聊保存记录-----------------`) | |||
console.log(res); | |||
console.log(`------------聊一聊保存记录-----------------`) | |||
}).catch(err => { | |||
console.log(err) | |||
}) | |||
}, | |||
fail: (err) => { | |||
console.log('sendSocketMessage', '失败') | |||
@@ -368,8 +370,8 @@ Page({ | |||
input = input + connectemoji[e.currentTarget.dataset.index]; | |||
} else { | |||
input = connectemoji[e.currentTarget.dataset.index] | |||
} | |||
} | |||
console.log(input, '输入框额值') | |||
this.setData({ | |||
input |
@@ -1,15 +1,4 @@ | |||
<!-- pages/wechat2/wechat2.wxml --> | |||
<view class="chat-header"> | |||
<view class="header-image-box"> | |||
<image class="header-image" src="{{receivebaseInfo.avatar}}"></image> | |||
</view> | |||
<view> | |||
<view class="chat-name">{{receivebaseInfo.nickname}}</view> | |||
<view class="chat-company"> | |||
{{receivebaseInfo.company_name}} - {{receivebaseInfo.department_name}} | |||
</view> | |||
</view> | |||
</view> | |||
<view class='news'> | |||
<view class="historycon"> | |||
<scroll-view scroll-y="true" scroll-into-view="{{scrollid}}" scroll-with-animation="{{true}}" style="height:{{scrollHeight}}" class="history" refresher-enabled="true" bindrefresherrefresh="refresh" refresher-triggered="{{triggered}}"> | |||
@@ -23,9 +12,9 @@ | |||
<text class='chat-time' style="display:none;">{{item.date}}</text> | |||
</view> | |||
<view class='other-record'> | |||
<image class='other-head-img' src='{{receivebaseInfo.avatar}}'></image> | |||
<image class='other-head-img' src='{{item.addresseeHeadPortrait}}'></image> | |||
<view class='other-record-content-triangle'></view> | |||
<view class='other-record-content'>{{item.content_msg}}</view> | |||
<view class='other-record-content'>{{item.content}}</view> | |||
</view> | |||
</view> | |||
<!-- 此处为结尾 --> | |||
@@ -35,9 +24,9 @@ | |||
<text class='chat-time' style="display:none;">{{item.date}}</text> | |||
</view> | |||
<view class='own-record'> | |||
<view class='own-record-content'>{{item.content_msg}}</view> | |||
<view class='own-record-content'>{{item.content}}</view> | |||
<view class='own-record-content-triangle'></view> | |||
<image class='own-head-img' src='{{sendAvatar}}'></image> | |||
<image class='own-head-img' src='{{item.senderHeadPortrait}}'></image> | |||
</view> | |||
</view> | |||
<!-- own结尾 --> |
@@ -3,40 +3,11 @@ page { | |||
background-color: #f3f3f4; | |||
} | |||
/* 新增样式 */ | |||
.chat-header { | |||
display: flex; | |||
align-items: center; | |||
justify-content: flex-start; | |||
height: 88px; | |||
padding: 0 12px; | |||
background-color: #fff; | |||
border-radius: 0px 0px 10px 10px; | |||
} | |||
.header-image-box { | |||
width: 64px; | |||
height: 64px; | |||
border-radius: 50%; | |||
margin-right: 12px; | |||
} | |||
.header-image { | |||
width: 100%; | |||
height: 100%; | |||
border-radius: 50%; | |||
} | |||
.chat-name { | |||
color: #333; | |||
font-size: 16px; | |||
font-weight: 700; | |||
} | |||
.chat-company { | |||
font-size: 14px; | |||
color: rgba(81, 81, 81, 100); | |||
} | |||
.tab { | |||
padding: 20rpx 20rpx 40rpx 50rpx; |