|
@@ -5,9 +5,9 @@
|
|
|
.module('appMessage')
|
|
|
.directive('ngCurrentMsg', CurrentMsg);
|
|
|
|
|
|
- CurrentMsg.inject = ['$location', '$anchorScroll', '$compile', '$timeout'];
|
|
|
+ CurrentMsg.inject = ['$location', '$anchorScroll', '$filter', '$compile', '$timeout'];
|
|
|
|
|
|
- function CurrentMsg($location, $anchorScroll, $compile, $timeout) {
|
|
|
+ function CurrentMsg($location, $anchorScroll, $filter, $compile, $timeout) {
|
|
|
var directive = {
|
|
|
link: link,
|
|
|
restrict: 'A',
|
|
@@ -52,6 +52,15 @@
|
|
|
return (Math.round(fileSize * 100 / 1024) / 100).toString() + 'KB';
|
|
|
};
|
|
|
|
|
|
+ var getTime = function(item) {
|
|
|
+ return $filter("date")(item.ts, "yyyy-MM-dd HH:mm:ss");
|
|
|
+ };
|
|
|
+
|
|
|
+ var getFileInfo = function(item) {
|
|
|
+ var file = '“' + getFileName(item) + '”' + '(' + getFileSize(item) + ')';
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
var replaceSystemFace = function(content) {
|
|
|
//匹配表情
|
|
|
var g = (/\/\:([\w]+)/).exec(content);
|
|
@@ -67,7 +76,7 @@
|
|
|
content = content.replace(g[0], function() {
|
|
|
var html = '<a class="thumbnail"' + '>' +
|
|
|
// '<img img-load="gotoBottom()" img-error="errorImg()" onclick="javascript:window.open(this.src,\'\',\'height=' + scope.imgHeight + ',width=' + scope.imgWidth + ',top=200,left=200\')" style="max-width:270px;max-height:250px;" src="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" onError= "this.src = \'../img/loading.gif\'" alt="截图缩略图" >' +
|
|
|
- '<img ng-load="gotoBottom()" ng-error="gotoBottom()" onclick="javascript:window.open(this.src,\'\',\'height=600,width=800,top=200,left=200\')" class="lazy" style="max-width:300px;max-height:250px;" src="../img/loading.gif" data-original="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" alt="截图缩略图" >' +
|
|
|
+ '<img ng-load="gotoBottom()" ng-error="gotoBottom()" onclick="javascript:window.open(this.src,\'\',\'height=600,width=800,top=200,left=200\')" style="max-width:300px;max-height:250px;" src="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" alt="截图缩略图" >' +
|
|
|
'</a>';
|
|
|
// '<div class="bigImg">' +
|
|
|
// '<img ng-click="hover = false" ng-show="hover" src="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" alt="" >' +
|
|
@@ -139,6 +148,8 @@
|
|
|
var replaceImage = function(content) {}
|
|
|
var html = '';
|
|
|
var message = document.getElementById("message");
|
|
|
+ if (scope.msg.senderDisplayName === undefined || scope.msg.senderDisplayName == '')
|
|
|
+ scope.msg.senderDisplayName = scope.msg.sender;
|
|
|
// 消息类型([1,文本消息],[2,图片消息],[3,文件消息], [4,位置消息],[5,语音消息])
|
|
|
if (scope.appContent === undefined || scope.appContent.faceConfig === undefined || scope.appContent.faceConfig.sys === undefined) {
|
|
|
html = '<span class="text-message">' + scope.msg.content + '</span>';
|
|
@@ -209,14 +220,28 @@
|
|
|
'<audio src="' + scope.msg.content + '" controls="controls">' +
|
|
|
'</audio>' +
|
|
|
'</span>';
|
|
|
+ } else if (scope.msg.contentType == 6) {
|
|
|
+ var content = JSON.parse(scope.msg.content);
|
|
|
+ html = getFileInfo(content);
|
|
|
+ // html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error">' +
|
|
|
+ // '<div><span class="glyphicon glyphicon-remove-sign"></span><span>您取消了“办公微助引导页.rar”(22.72MB)的发送,文件传输失败。</span>' +
|
|
|
+ // '</div></div>';
|
|
|
}
|
|
|
|
|
|
if (getUserID()) {
|
|
|
- var html_g = '<div class="wellself m-l-xs m-t-xs fit-content" >' +
|
|
|
+ var html_g = '<p><strong>' +
|
|
|
+ scope.msg.senderDisplayName +
|
|
|
+ '</strong><small class="text-muted">-' +
|
|
|
+ getTime(scope.msg) + '</small></p>' +
|
|
|
+ '<div class="wellself m-l-xs m-t-xs fit-content" >' +
|
|
|
'<div class="text-point"></div>' + html +
|
|
|
'</div>';
|
|
|
} else {
|
|
|
- var html_g = '<div class="well m-l-xs m-t-xs fit-content" >' +
|
|
|
+ var html_g = '<p><strong>' +
|
|
|
+ scope.msg.senderDisplayName +
|
|
|
+ '</strong><small class="text-muted">-' +
|
|
|
+ getTime(scope.msg) + '</small></p>' +
|
|
|
+ '<div class="well m-l-xs m-t-xs fit-content" >' +
|
|
|
'<div class="text-point"></div>' + html +
|
|
|
'</div>';
|
|
|
}
|
|
@@ -229,7 +254,6 @@
|
|
|
// 添加到文档中
|
|
|
var newElement = angular.element($dom);
|
|
|
element.append(newElement);
|
|
|
- angular.element("img.lazy").lazyload();
|
|
|
message.addEventListener('load', gotoBottom());
|
|
|
}
|
|
|
};
|