Authored by 李奇

图片链接协议去除

... ... @@ -13,6 +13,7 @@ var $ = require('yoho-jquery'),
editArea = require('./edit-area'),
serviceApi = require('./service-api'),
broswer = require('./broswer'),
utility = require('./utility'),
socketChat = require('./socket-chat'),
socketConf = require('./socket-config');
... ... @@ -393,6 +394,7 @@ function pageInit() {
// 图片添加标签
if (msgType === 2) {
message.content = utility.autoProtocol(message.content);
message.newContent = '<img class="img-msg" src="' + message.content + '">';
dom = cusTpl({
userHead: rec.userHead,
... ... @@ -446,6 +448,7 @@ function pageInit() {
message.newContent = emojiPrefix(message.newContent);
if (msgType === 2) {
message.content = utility.autoProtocol(message.content);
message.newContent = '<img class="img-msg" src="' + message.content + '">';
dom = csTpl({
... ... @@ -503,7 +506,6 @@ function pageInit() {
$evalModal.find('.discontent').empty().append(dom);
}
// todo
// 拉取评价原因
serviceApi.reason({
conversationId: socketConfCM.conversationId
... ... @@ -944,7 +946,6 @@ function pageInit() {
// 发送图片
$sendImgInput.fileupload({
dataType: 'json',
acceptFileTypes: /(\.|\/)(bmp|gif|jpe?g|png)$/i,
maxFileSize: 5000000, // 5M
url: configDomains.imCs + '/fileManage/uploadFile',
... ... @@ -961,7 +962,7 @@ function pageInit() {
// 上传成功后发送图片消息
socketConfCM.type = allRTs.CU_SEND;
socketConfCM.chatMessage.content = res.data.filePath;
socketConfCM.chatMessage.content = utility.autoProtocol(res.data.filePath);
socketConfCM.chatMessage.type = 2;
socketConfCM.uuid = uuid.v4();
socketChat.send(socketConfCM);
... ...
/**
* 链接自适应协议
* @author: lq <qi.li@yoho.cn>
* @date: 2017/04/06
*/
exports.autoProtocol = function (src) {
return (src || '').replace(/^(http:|https:)/, '')
};
... ...