dgf 8 éve
szülő
commit
1cc46e0509

+ 28 - 18
talkview/src/js/directive/currentmessage.js

@@ -21,11 +21,6 @@
 
         function link(scope, element, attrs) {
 
-            // var gotoBottom = function() {
-            //     $location.hash("bottom");
-            //     $anchorScroll();
-            // };
-
             var getFileName = function(item) {
                 var arr = item.fileName.split("\\");
                 return arr[arr.length - 1];
@@ -62,6 +57,10 @@
                 return fileInfo;
             };
 
+            var ifSelf = function(item) {
+                return item.operatorName == scope.msg.sender;
+            };
+
             var replaceSystemFace = function(content) {
                 //匹配表情
                 var g = (/\/\:([\w]+)/).exec(content);
@@ -86,7 +85,6 @@
                 //匹配网址
                 var i = 0;
                 var m = content.match(/(((((http|ftp|https|HTTP|FTP|HTTPS):\/\/)[\w\-_]+)|www|WWW|[0-9]+)(\.(?!gif|jpg|png|mp3)[\w\-_]+)+([\w\-\.,@?^=%:/~\+#]*[\w\-\@?^=%/~\+#\r\n]))/ig);
-                console.log(m);
                 if (m == null)
                     return content;
                 content = content.replace(/(((((http|ftp|https|HTTP|FTP|HTTPS):\/\/)[\w\-_]+)|www|WWW|[0-9]+)(\.(?!gif|jpg|png|mp3)[\w\-_]+)+([\w\-\.,@?^=%:/~\+#]*[\w\-\@?^=%/~\+#\r\n]))/ig, function() {
@@ -120,7 +118,7 @@
 
             var replaceImage = function(content) {}
             var html = '';
-            console.log(scope.appContent.font);
+            //console.log(scope.appContent.font);
             //var message = document.getElementById("sendmessage");
             if (scope.msg.senderDisplayName === undefined || scope.msg.senderDisplayName == '')
                 scope.msg.senderDisplayName = scope.msg.sender;
@@ -182,28 +180,30 @@
                     '<a class="text-primary" role="button"><span ng-click="OpenDirectory(msg.content)">打开文件夹</span></a>' +
                     '</div>' +
                     '</div>';
-                else if (content.way == 0 && content.status == 0 && content.direction == 0) {
+                else if (ifSelf(content) && content.way == 0 && content.status == 0) {
                     if (getUserID())
                         html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[0] + '</span></div>';
                     else
-                        html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[1] + '</span></div>';
-                } else if (content.way == 0 && content.status == 0 && content.direction == 1) {
+                        html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[2] + '</span></div>';
+                } else if (!ifSelf(content) && content.way == 0 && content.status == 0) {
                     if (getUserID())
                         html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[3] + '</span></div>';
                     else
-                        html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[2] + '</span></div>';
-                } else if (content.way == 0 && content.status == 1 && content.direction == 0) {
+                        html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[1] + '</span></div>';
+                } else if (ifSelf(content) && content.way == 0 && content.status == 1) {
                     if (getUserID())
                         html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[4] + '</span></div>';
                     else
-                        html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[5] + '</span></div>';
-                } else if (content.way == 0 && content.status == 1 && content.direction == 1) {
+                        html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[6] + '</span></div>';
+                } else if (!ifSelf(content) && content.way == 0 && content.status == 1) {
                     if (getUserID())
                         html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[7] + '</span></div>';
                     else
-                        html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[6] + '</span></div>';
-                } else if (content.way == 1) {
-                    if (!getUserID())
+                        html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[5] + '</span></div>';
+                } else if (ifSelf(content) && content.way == 1) {
+                    if (getUserID())
+                        html = '';
+                    else
                         html = '<div class="well m-l-xs m-t-xs fit-content" id="file-info"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[8] + '</span></div>';
                 }
             } else if (scope.msg.contentType == 4) {
@@ -239,7 +239,6 @@
                 }
             }
             console.log(html_g);
-
             var compileFn = $compile(html_g);
             // 传入scope,得到编译好的dom对象(已封装为jqlite对象)
             // 也可以用$scope.$new()创建继承的作用域
@@ -252,21 +251,32 @@
     };
     /* @ngInject */
     function ControllerController($scope, $timeout, $location, $anchorScroll, $sce) {
+
         $scope.$on('font_changed', function(event, data) {
             $scope.appContent.font = JSON.parse(data);
         });
+
         $scope.OpenFile = function(item) {
             var file = JSON.parse(item);
             return lxtalkClient.Invoke('{15180DEF-D508-45F7-BAEB-6486CD8752C8}', 'OpenFile', JSON.stringify(file), $scope);
         };
+
         $scope.OpenDirectory = function(item) {
             var file = JSON.parse(item);
             return lxtalkClient.Invoke('{15180DEF-D508-45F7-BAEB-6486CD8752C8}', 'OpenDirectory', JSON.stringify(file), $scope);
         };
+
+        $scope.showImage = function(md5) {
+            var imgSrc = $scope.appContent.directory.received + md5 + ".JPG";
+            var img = { fileName: imgSrc };
+            return lxtalkClient.Invoke('{15180DEF-D508-45F7-BAEB-6486CD8752C8}', 'OpenFile', JSON.stringify(img), $scope);
+        };
+
         $scope.onLoad = function() {
             $location.hash("bottom");
             $anchorScroll();
         };
+
         $scope.onFaceLoadError = function(md5) {
             $scope["img_" + md5] = "local://" + $scope.appContent.directory.base + "Images\\" + "Loading.gif";
             $timeout();

+ 28 - 13
talkview/src/js/directive/historymessages.js

@@ -64,6 +64,10 @@
                 return fileInfo;
             };
 
+            var ifSelf = function(item) {
+                return item.operatorName == scope.msg.sender;
+            };
+
             var replaceSystemFace = function(content) {
                 //匹配表情
                 var g = (/\/\:([\w]+)/).exec(content);
@@ -88,7 +92,6 @@
                 //匹配网址
                 var i = 0;
                 var m = content.match(/(((((http|ftp|https|HTTP|FTP|HTTPS):\/\/)[\w\-_]+)|www|WWW|[0-9]+)(\.(?!gif|jpg|png|mp3)[\w\-_]+)+([\w\-\.,@?^=%:/~\+#]*[\w\-\@?^=%/~\+#\r\n]))/ig);
-                console.log(m);
                 if (m == null)
                     return content;
                 content = content.replace(/(((((http|ftp|https|HTTP|FTP|HTTPS):\/\/)[\w\-_]+)|www|WWW|[0-9]+)(\.(?!gif|jpg|png|mp3)[\w\-_]+)+([\w\-\.,@?^=%:/~\+#]*[\w\-\@?^=%/~\+#\r\n]))/ig, function() {
@@ -122,7 +125,7 @@
             var replaceImage = function(content) {}
             var html = '';
             //var message = document.getElementById("loadmore");
-            console.log(scope.appContent.font);
+            //console.log(scope.appContent.font);
             if (scope.msg.senderDisplayName === undefined || scope.msg.senderDisplayName == '')
                 scope.msg.senderDisplayName = scope.msg.sender;
             // 消息类型([1,文本消息],[2,图片消息],[3,文件消息], [4,位置消息],[5,语音消息])
@@ -183,28 +186,30 @@
                     '<a class="text-primary" role="button"><span ng-click="OpenDirectory(msg.content)">打开文件夹</span></a>' +
                     '</div>' +
                     '</div>';
-                else if (content.way == 0 && content.status == 0 && content.direction == 0) {
+                else if (ifSelf(content) && content.way == 0 && content.status == 0) {
                     if (getUserID())
                         html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[0] + '</span></div>';
                     else
-                        html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[1] + '</span></div>';
-                } else if (content.way == 0 && content.status == 0 && content.direction == 1) {
+                        html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[2] + '</span></div>';
+                } else if (!ifSelf(content) && content.way == 0 && content.status == 0) {
                     if (getUserID())
                         html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[3] + '</span></div>';
                     else
-                        html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[2] + '</span></div>';
-                } else if (content.way == 0 && content.status == 1 && content.direction == 0) {
+                        html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[1] + '</span></div>';
+                } else if (ifSelf(content) && content.way == 0 && content.status == 1) {
                     if (getUserID())
                         html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[4] + '</span></div>';
                     else
-                        html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[5] + '</span></div>';
-                } else if (content.way == 0 && content.status == 1 && content.direction == 1) {
+                        html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[6] + '</span></div>';
+                } else if (!ifSelf(content) && content.way == 0 && content.status == 1) {
                     if (getUserID())
                         html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[7] + '</span></div>';
                     else
-                        html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[6] + '</span></div>';
-                } else if (content.way == 1) {
-                    if (!getUserID())
+                        html = '<div class="well m-l-xs m-t-xs fit-content" id="file-error"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[5] + '</span></div>';
+                } else if (ifSelf(content) && content.way == 1) {
+                    if (getUserID())
+                        html = '';
+                    else
                         html = '<div class="well m-l-xs m-t-xs fit-content" id="file-info"><span class="glyphicon glyphicon-remove-sign"></span><span>' + getFileInfo(content)[8] + '</span></div>';
                 }
             } else if (scope.msg.contentType == 4) {
@@ -240,7 +245,6 @@
                 }
             }
             console.log(html_g);
-
             var compileFn = $compile(html_g);
             // 传入scope,得到编译好的dom对象(已封装为jqlite对象)
             // 也可以用$scope.$new()创建继承的作用域
@@ -258,23 +262,34 @@
     };
     /* @ngInject */
     function ControllerController($scope, $timeout, $location, $anchorScroll, $sce) {
+
         $scope.$on('font_changed', function(event, data) {
             $scope.appContent.font = JSON.parse(data);
         });
+
         $scope.OpenFile = function(item) {
             var file = JSON.parse(item);
             return lxtalkClient.Invoke('{15180DEF-D508-45F7-BAEB-6486CD8752C8}', 'OpenFile', JSON.stringify(file), $scope);
         };
+
         $scope.OpenDirectory = function(item) {
             var file = JSON.parse(item);
             return lxtalkClient.Invoke('{15180DEF-D508-45F7-BAEB-6486CD8752C8}', 'OpenDirectory', JSON.stringify(file), $scope);
         };
+
+        $scope.showImage = function(md5) {
+            var imgSrc = $scope.appContent.directory.received + md5 + ".JPG";
+            var img = { fileName: imgSrc };
+            return lxtalkClient.Invoke('{15180DEF-D508-45F7-BAEB-6486CD8752C8}', 'OpenFile', JSON.stringify(img), $scope);
+        };
+
         $scope.scrollController = function() {
             if ($scope.count) {
                 window.scrollTo(0, document.body.scrollHeight);
             } else
                 window.scrollTo(0, document.body.scrollHeight - $scope.height);
         };
+
         $scope.onFaceLoadError = function(md5) {
             $scope["img_" + md5] = "local://" + $scope.appContent.directory.base + "Images\\" + "Loading.gif";
             $timeout();

+ 7 - 6
talkview/src/less/app.main.less

@@ -63,7 +63,7 @@
         margin-top: -2px;
         margin-bottom: 0px;
         margin-right: 20px;
-        padding: 7px 14px 7px 12px;
+        padding: 7px 12px;
         font-size: 12px;
         line-height: 16px;
         .text-point {
@@ -97,7 +97,7 @@
         margin-top: -2px;
         margin-bottom: 0px;
         margin-right: 20px;
-        padding: 7px 14px 7px 12px;
+        padding: 7px 12px;
         font-size: 12px;
         line-height: 16px;
         .text-point {
@@ -122,6 +122,7 @@
 .text-message{
     vertical-align: bottom;
     .thumbnail {
+        cursor:pointer;
         margin-top: 5px;
         margin-bottom: 5px;
         max-width: 360px;
@@ -195,8 +196,8 @@
 }
 
 #file-error {
-    margin: 10px 10px 5px 10px;
-    padding: 5px 7px;
+    margin: 5px 10px 2px 10px;
+    padding: 3px 5px 3px 7px;
     color: #555;
     .glyphicon {
         margin-right: 3px;
@@ -204,8 +205,8 @@
     }
 }
 #file-info {
-    margin: 10px 10px 5px 10px;
-    padding: 5px 7px;
+    margin: 5px 10px 2px 10px;
+    padding: 3px 5px 3px 7px;
     color: #555;
     .glyphicon {
         margin-right: 3px;