Authored by 李奇

socket配置修改,客服设置修改

... ... @@ -15,7 +15,8 @@ const clientService = require('../models/client-service');
const index = (req, res) => {
let type = 2;
let imgSize = '400x400';
let encryptedUid = aes.encryptionUid(req.user.uid);
// let encryptedUid = aes.encryptionUid(req.user.uid);
let encryptedUid = aes.encryptionUid(8040155);
let data = {
encryptedUid,
layout: false
... ...
... ... @@ -17,7 +17,7 @@
<div class="header">
<div class="chat"></div>
<img class="logo" src="{{csSetting.windowLogo}}" alt="客服logo">
<div class="page-desc">有货在线客服</div>
<div class="page-desc">{{csSetting.windowTitle}}</div>
<div class="close"></div>
</div>
<div class="main">
... ... @@ -41,7 +41,7 @@
<!-- 消息图片放大显示 -->
{{> img-zoom-in}}
<input name="encryptuid" type="text" type="hidden" value={{encryptedUid}}>
<input name="encryptedUid" type="text" type="hidden" value={{encryptedUid}}>
{{#if devEnv}}
<script src="//localhost:5002/libs.js"></script>
<script src="//localhost:5002/{{module}}.{{page}}.js"></script>
... ...
... ... @@ -20,8 +20,8 @@
<div class="util">
<span class="icon emoji">表情</span>
<span class="icon">图片<label for="sendImg"></label></span>
<span class="icon">评价</span>
<span class="icon">人工客服</span>
<span class="icon evaluate">评价</span>
<span class="icon manual-service">人工客服</span>
</div>
<textarea class="text msg-area" placeholder="请描述您遇到的问题" spellcheck="false" maxlength="500"></textarea>
</div>
... ...
... ... @@ -20,7 +20,7 @@ module.exports = {
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
search: 'http://192.168.102.216:8080/yohosearch/',
bjSocket: 'http://socket.yohobuy.com',
bjSocket: 'ws://socket.yohobuy.com:10000',
bjIm: 'http://im.yohobuy.com/api',
bjImUploadImg: 'http://im.yohobuy.com/server'
},
... ...
... ... @@ -24,10 +24,11 @@ var cmEntity,
$leaveMsg = $('#leaveMsg'),
$sendOrder = $('.send-order'),
$sendImgInput = $('#sendImg'),
$history = $('.about-his.has-his'),
$msgArea = $('.msg-edit .msg-area'),
$makeEvalModal = $('#makeEvaluation'),
$rightHeadTab = $('.right-head .tab'),
$encryptedUid = $('input[name=encryptuid]'),
$encryptedUid = $('input[name=encryptedUid]'),
$panelMainBody = $('.panel-main .main-body');
var processInfo = {
... ... @@ -350,8 +351,6 @@ function _emojiPrefix(text) {
* @private
*/
function _handleCusMsg(rec, msgType, message) {
var liHtml;
message.newContent = _emojiPrefix(message.newContent);
... ... @@ -372,6 +371,8 @@ function _handleCusMsg(rec, msgType, message) {
</div>
</div>`;
// targetItem.replaceWith(liHtml);
$msgList.append(liHtml);
$panelMainBody.scrollTop($panelMainBody[0].scrollHeight);
... ... @@ -396,6 +397,7 @@ function _breakCountdown(message) {
$msgList.append(liHtml);
$panelMainBody.scrollTop($panelMainBody[0].scrollHeight);
// 倒计时信息
countdown(message.newContent, $('.tip .countdown'));
... ... @@ -607,7 +609,6 @@ function msgResolve(msgList) {
msgList = msgList.reverse();
if (endTime === msgList[0].sendTime) {
hasMore = false;
}
... ... @@ -675,7 +676,7 @@ function fetchHistoryMsg() {
success: function(res) {
if (res && res.code === 200) {
hasMore && msgResolve(res.data);
$('.about-his.has-his').hide();
$history.hide();
}
}
});
... ... @@ -1026,13 +1027,13 @@ $('.img-zoom-in').on('click', function(e) {
});
// 显示历史记录
$('.about-his.has-his').click(fetchHistoryMsg);
$history.click(fetchHistoryMsg);
// 滚动加载更多
$panelMainBody.scroll(function() {
var atTop = $panelMainBody.scrollTop() === 0;
var loading = $panelMainBody.scrollTop() === 0;
atTop && hasMore && fetchHistoryMsg();
loading && hasMore && fetchHistoryMsg();
});
... ...
... ... @@ -30,11 +30,9 @@ function socketInit(options) {
param = JSON.stringify(conversationMessage);
socket = new WebSocket('ws://' + server.host + ':' + server.port + '/im?param=' + param);
socket.onmessage = options.onMessage || function(event) {
var jsonString = event.data;
var received = JSON.parse(jsonString);
console.log(received);
socket = new WebSocket(server + '/im?param=' + param);
socket.onmessage = options.onMessage || function() {
console.log('received msg');
};
socket.onopen = options.onOpen || function() {
console.log('websocket is open');
... ...
... ... @@ -5,8 +5,10 @@
* @date: 2016/11/8
*/
var common = require('../../../config/common');
var config = {
servers: [{host: '192.168.102.18', port: 10240}],
servers: [common.domains.bjSocket],
recType: {
ENTER: 1, // 用户进入
LINK_SUCCESS: 2, // 连线客服成功
... ...
... ... @@ -438,6 +438,9 @@ $color-3a3a3a: #3a3a3a;
line-height: 13px;
cursor: pointer;
&.evaluate {
display: none;
}
&:nth-child(2) {
position: relative;
... ...