|
|
@@ -12,16 +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.19", |
|
|
|
message: '哈喽,好久不见', |
|
|
|
type: 0 |
|
|
|
}, |
|
|
|
{ |
|
|
|
date: "2020.10.20", |
|
|
|
message: '是呀,好久不见', |
|
|
|
type: 1 |
|
|
|
}, |
|
|
|
],//消息列表 |
|
|
|
historyList: [], |
|
|
|
input: null, |
|
|
@@ -52,23 +52,28 @@ Page({ |
|
|
|
onLoad: function (options) { |
|
|
|
const eventChannel = this.getOpenerEventChannel() |
|
|
|
// 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据 |
|
|
|
|
|
|
|
eventChannel.on('customerid', data => { |
|
|
|
this.setData({ |
|
|
|
sendMemberId: data.customerid, |
|
|
|
businessCommunicationDemandId:data.businessCommunicationDemandId, |
|
|
|
receivebaseInfo:{ |
|
|
|
avatar:data.chatHeads |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
// 获取历史记录 |
|
|
|
this.getHistory() |
|
|
|
}) |
|
|
|
var sendAvatar = app.globalData.sendAvatar |
|
|
|
let customerId = app.globalData.customerId; |
|
|
|
let sendAvatar = app.globalData.businessCommunicationCustomer.chatHeads; |
|
|
|
console.log(customerId, 'customerId'); |
|
|
|
var _this = this; |
|
|
|
_this.setData({ |
|
|
|
receiveMemberId: customerId, |
|
|
|
sendAvatar, |
|
|
|
sendAvatar |
|
|
|
}) |
|
|
|
console.log(app.globalData.sendAvatar, 'hahha') |
|
|
|
console.log(this.data.sendAvatar, 'hahha') |
|
|
|
// 获取内存中的数据 |
|
|
|
this.getStorageBaseInfo() |
|
|
|
// 设置滚动区域的高度 |
|
|
@@ -93,7 +98,7 @@ Page({ |
|
|
|
// console.log() |
|
|
|
//建立连接 |
|
|
|
wx.connectSocket({ |
|
|
|
url: `ws://192.168.18.138/webSocket/{"userno":${receiveMemberId},"messageModule":"008"}`,//本地 |
|
|
|
url: `ws://192.168.18.138/webSocket/{"userno":${receiveMemberId},"messageModule":"010"}`,//本地 |
|
|
|
success: function () { |
|
|
|
console.log('websocket连接成功~') |
|
|
|
}, |
|
|
@@ -134,8 +139,8 @@ Page({ |
|
|
|
|
|
|
|
// 获取历史记录 |
|
|
|
getHistory() { |
|
|
|
var { sendMemberId } = this.data; |
|
|
|
$request.get('/businessCommunicationDemand/getChatRecordById/' + sendMemberId + '.action').then(res => { |
|
|
|
var { sendMemberId,businessCommunicationDemandId } = this.data; |
|
|
|
$request.get('/businessCommunicationDemand/getChatRecordById/' + businessCommunicationDemandId + '/' + sendMemberId + '.action').then(res => { |
|
|
|
console.log(`------------聊一聊获取历史记录-----------------`) |
|
|
|
console.log(res); |
|
|
|
console.log(`------------聊一聊获取历史记录-----------------`) |
|
|
@@ -223,7 +228,7 @@ Page({ |
|
|
|
// 设置滚动区域的高度 |
|
|
|
setScrollHeight: function () { |
|
|
|
const client = wx.getSystemInfoSync().windowHeight // 获取当前窗口的高度 |
|
|
|
var scrollHeight = (client - 236) + 'px' |
|
|
|
var scrollHeight = (client - 36) + 'px' |
|
|
|
this.setData({ |
|
|
|
scrollHeight |
|
|
|
}) |