...
|
...
|
@@ -175,19 +175,6 @@ var chat = { |
|
|
* data: object //消息数据
|
|
|
* }
|
|
|
*
|
|
|
* 测试数据:
|
|
|
chat.sendMSG({
|
|
|
type: 'order',
|
|
|
data: {
|
|
|
data: '123123',
|
|
|
imgSrc: '123123123123',
|
|
|
orderCode: '123123123123',
|
|
|
cost: '123123123123',
|
|
|
createTime: '123123123123',
|
|
|
orderStatus: '123123123123'
|
|
|
}
|
|
|
})
|
|
|
*
|
|
|
*/
|
|
|
sendMSG: function(msg) {
|
|
|
if (!msg || !msg.data) {
|
...
|
...
|
@@ -198,6 +185,7 @@ var chat = { |
|
|
let arr;
|
|
|
|
|
|
msg.type = msg.type || 'text';
|
|
|
msg.from = msg.from || 'customer';
|
|
|
|
|
|
msg.uid = uuid;
|
|
|
cmEntity.uuid = uuid;
|
...
|
...
|
@@ -300,9 +288,23 @@ var chat = { |
|
|
allTypes = socketConf.recType;
|
|
|
|
|
|
var uuid = rec.uuid;
|
|
|
var viewData;
|
|
|
|
|
|
switch (recType) {
|
|
|
|
|
|
// 客服消息
|
|
|
case allTypes.CS_SEND:
|
|
|
case allTypes.ROBOT_SEND:
|
|
|
viewData = this.buildViewData(rec);
|
|
|
viewData && this._drawMSG(viewData);
|
|
|
break;
|
|
|
|
|
|
// 系统消息
|
|
|
case allTypes.OFFLINE: break;
|
|
|
case allTypes.TRANSFER: break;
|
|
|
case allTypes.MANUAL_SERVICE: break;
|
|
|
case allTypes.CS_CHANGE_STATE: break;
|
|
|
|
|
|
}
|
|
|
|
|
|
return this;
|
...
|
...
|
@@ -314,6 +316,11 @@ var chat = { |
|
|
*/
|
|
|
_drawMSG: function(viewData) {
|
|
|
let chatWin = this.$chatWin[0];
|
|
|
|
|
|
if (!$.isArray(viewData)) {
|
|
|
viewData = [viewData];
|
|
|
}
|
|
|
|
|
|
let $html = $(this.messageT(viewData));
|
|
|
|
|
|
$html.appendTo(this.$chatWin);
|
...
|
...
|
@@ -361,6 +368,10 @@ var chat = { |
|
|
});
|
|
|
},
|
|
|
|
|
|
switchService: function(type) {
|
|
|
this.renderHeader(type);
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* method: 渲染头部
|
|
|
* @param {string} type ["robot", "human"]
|
...
|
...
|
|