Authored by 姜枫

图片消息加载

... ... @@ -8,6 +8,7 @@
'use strict';
const Promise = require('bluebird');
const _ = require('lodash');
const clientAPI = require('./client-api');
/**
... ...
... ... @@ -417,19 +417,31 @@ function pageInit() {
rec.userHead = assetsPrefix + socketConf.defaultUserHead;
}
// 图片添加标签
if (msgType === 2) {
message.newContent = '<img class="img-msg" src="' + message.content + '">';
}
dom = cusTpl({
userHead: rec.userHead,
userName: rec.userName,
sendTimeShort: rec.sendTimeShort,
newContent: message.newContent
});
dom = cusTpl({
userHead: rec.userHead,
userName: rec.userName,
sendTimeShort: rec.sendTimeShort,
newContent: message.newContent
});
msgAppend(dom);
var image = new Image();
image.src = message.content;
image.onload = function() {
msgAppend(dom);
};
} else {
dom = cusTpl({
userHead: rec.userHead,
userName: rec.userName,
sendTimeShort: rec.sendTimeShort,
newContent: message.newContent
});
msgAppend(dom);
}
}
/**
... ... @@ -461,16 +473,29 @@ function pageInit() {
message.newContent = emojiPrefix(message.newContent);
if (msgType === 2) {
message.newContent = '<img class="img-msg" src="' + message.content + '">';
}
dom = csTpl({
csHead: rec.csHead,
csName: rec.csName,
sendTimeShort: rec.sendTimeShort,
newContent: message.newContent
});
dom = cusTpl({
userHead: rec.userHead,
userName: rec.userName,
sendTimeShort: rec.sendTimeShort,
newContent: message.newContent
});
msgAppend(dom);
var image = new Image();
image.src = message.content;
image.onload = function() {
msgAppend(dom);
};
} else {
dom = csTpl({
csHead: rec.csHead,
csName: rec.csName,
sendTimeShort: rec.sendTimeShort,
newContent: message.newContent
});
msgAppend(dom);
}
}
/**
... ...