瀏覽代碼

新加获取微信头像

release/210823_需求对对碰
王饶冀 3 年之前
父節點
當前提交
af3d1ac2b9
共有 2 個檔案被更改,包括 23 行新增18 行删除
  1. 1
    1
      components/listItem/listItem.js
  2. 22
    17
      pages/msgModule/wechat2/wechat2.js

+ 1
- 1
components/listItem/listItem.js 查看文件

@@ -80,7 +80,7 @@ Component({
url:"/pages/msgModule/wechat2/wechat2",
success: function (res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('customerid', { customerid:item.customerId,businessCommunicationDemandId:item.businessCommunicationDemandId })
res.eventChannel.emit('customerid', { customerid:item.customerId,businessCommunicationDemandId:item.businessCommunicationDemandId,chatHeads:item.chatHeads })
}
})
},

+ 22
- 17
pages/msgModule/wechat2/wechat2.js 查看文件

@@ -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
})

Loading…
取消
儲存