|
@@ -25,6 +25,22 @@
|
|
|
$location.hash("bottom");
|
|
|
$anchorScroll();
|
|
|
};
|
|
|
+
|
|
|
+ var getFileName = function(item) {
|
|
|
+ var arr = item.fileName.split("\\");
|
|
|
+ return arr[arr.length - 1];
|
|
|
+ };
|
|
|
+
|
|
|
+ var getFileSize = function(item) {
|
|
|
+ var fileSize = item.length;
|
|
|
+ if (fileSize > 1024 * 1024 * 1024)
|
|
|
+ return (Math.round(fileSize * 100 / (1024 * 1024 * 1024)) / 100).toString() + 'GB';
|
|
|
+ else if (fileSize > 1024 * 1024)
|
|
|
+ return (Math.round(fileSize * 100 / (1024 * 1024)) / 100).toString() + 'MB';
|
|
|
+ else
|
|
|
+ return (Math.round(fileSize * 100 / 1024) / 100).toString() + 'KB';
|
|
|
+ };
|
|
|
+
|
|
|
var replaceSystemFace = function(content) {
|
|
|
//匹配表情
|
|
|
var g = (/\/\:([\w]+)/).exec(content);
|
|
@@ -98,17 +114,14 @@
|
|
|
'</a>' +
|
|
|
'</span>';
|
|
|
} else if (scope.msg.contentType == 3) {
|
|
|
- // element.css({
|
|
|
- // width: '300px'
|
|
|
- // });
|
|
|
- //element.addClass('file-message');
|
|
|
- var reg = /\?[\W\w]*/;
|
|
|
- var fileName = decodeURIComponent(reg.exec(scope.msg.content).toString().substr(1));
|
|
|
-
|
|
|
- html = '<div class="file-message" style="width:250px">' +
|
|
|
+ var content = JSON.parse(scope.msg.content);
|
|
|
+ console.log(content);
|
|
|
+ html = '<div class="file-message" style="width:265px">' +
|
|
|
'<img src="../img/unkown.png" onError= "this.src = \'../img/file/unkown.png\'">' +
|
|
|
- '<span style="float:left; margin:5px 0px 0px 0px">文件名:' + fileName + '<br/>大小:' + scope.msg.length + '</span>' +
|
|
|
+ '<p><input type="text" readonly="readonly" value="' + getFileName(content) + '"></p>' +
|
|
|
+ '<span>大小:' + getFileSize(content) + '</span>' +
|
|
|
'<div class="p-t-sm text-right">' +
|
|
|
+ '<span id="transinfo"><span style="color:green;" class="glyphicon glyphicon-ok"></span><span>传输完成</span></span>' +
|
|
|
'<a class="text-primary" role="button"><span>打开</span></a>  ' +
|
|
|
'<a class="text-primary" role="button"><span>打开文件夹</span></a>' +
|
|
|
'</div>' +
|