| let _data = JSON.parse(res.data); | let _data = JSON.parse(res.data); | ||||
| console.log(_data, '_data'); | console.log(_data, '_data'); | ||||
| if (_data.readMessageCode) { | if (_data.readMessageCode) { | ||||
| // list.forEach(el=>{ | |||||
| // el.isRead = true; | |||||
| // }) | |||||
| // historyList.forEach(el=>{ | |||||
| // el.isRead = true; | |||||
| // }) | |||||
| // _this.setData({ | |||||
| // newsList: list, | |||||
| // historyList | |||||
| // }) | |||||
| list.forEach(el=>{ | |||||
| el.isRead = true; | |||||
| }) | |||||
| historyList.forEach(el=>{ | |||||
| el.isRead = true; | |||||
| }) | |||||
| _this.setData({ | |||||
| newsList: list, | |||||
| historyList | |||||
| }) | |||||
| } else { | } else { | ||||
| _data.chatRecord = JSON.parse(_data.chatRecord); | _data.chatRecord = JSON.parse(_data.chatRecord); | ||||
| let msgData = {}; | let msgData = {}; | ||||
| // type 0 自己 1 对方 | // type 0 自己 1 对方 | ||||
| if (_data.chatRecord.chatRecord.sender != _this.data.receiveMemberId) { | if (_data.chatRecord.chatRecord.sender != _this.data.receiveMemberId) { | ||||
| sendno: _this.data.receiveMemberId+'', | sendno: _this.data.receiveMemberId+'', | ||||
| userno: _this.data.sendMemberId+'', | userno: _this.data.sendMemberId+'', | ||||
| messageModule : "010", | messageModule : "010", | ||||
| readMessageCode: _this.data.currentGuid, | |||||
| readMessageCode: _data.chatRecord.chatRecord.chatRecordCode, | |||||
| }; | }; | ||||
| wx.sendSocketMessage({ | wx.sendSocketMessage({ | ||||
| data: JSON.stringify(d), | data: JSON.stringify(d), | ||||
| temp.messageType = msgType; | temp.messageType = msgType; | ||||
| temp.transactionId = transactionId; | temp.transactionId = transactionId; | ||||
| temp.isRead = false; | temp.isRead = false; | ||||
| let tempGuid = this.guid(); | |||||
| temp.code = tempGuid; | |||||
| if (msgType == 1) { | if (msgType == 1) { | ||||
| temp.object = {}; | temp.object = {}; | ||||
| temp.object.info = this.data.productInfo; | temp.object.info = this.data.productInfo; | ||||
| current: url, // 当前显示图片的http链接 | current: url, // 当前显示图片的http链接 | ||||
| urls: [url] // 需要预览的图片http链接列表 | urls: [url] // 需要预览的图片http链接列表 | ||||
| }) | }) | ||||
| }, | |||||
| guid() { | |||||
| return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { | |||||
| var r = Math.random() * 16 | 0, | |||||
| v = c == 'x' ? r : (r & 0x3 | 0x8); | |||||
| return v.toString(16); | |||||
| }); | |||||
| } | } | ||||
| }) | }) | ||||