Browse Source

聊天界面

dgf 8 years ago
parent
commit
dd80036aa2

+ 10 - 4
talkview/src/js/controller/messageController.js

@@ -10,9 +10,9 @@ angular.module('appMessage').controller('MessageController', ['$scope', '$filter
             $scope.appContent = JSON.parse(appContentJson);
         };
 
-        // $scope.addMessage = function() {
-        //     scroll(document.body);
-        // };
+        $scope.addMessage = function() {
+            scroll(document.body);
+        };
 
         $scope.showMessage = function(jsonStr) {
             console.log(jsonStr);
@@ -40,7 +40,13 @@ angular.module('appMessage').controller('MessageController', ['$scope', '$filter
         };
 
         $scope.getTime = function(item) {
-            return $filter("date")(item.ts, "yyyy-MM-dd HH:mm:ss");
+            var myDate = new Date();
+            var nowDate = $filter("date")(myDate.getTime(), "yyyy-MM-dd");
+            var messageDate = $filter("date")(item.ts, "yyyy-MM-dd");
+            if (messageDate == nowDate)
+                return $filter("date")(item.ts, "HH:mm:ss");
+            else
+                return $filter("date")(item.ts, "yyyy-MM-dd HH:mm:ss");
         };
 
         $scope.getMore = function() {

+ 0 - 4
talkview/src/js/directive/currentmessage.js

@@ -47,10 +47,6 @@
                     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 fileInfo = new Array('您取消了' + file + '的发送,文件传输失败。', '您取消接收' + file + ',文件传输失败。', '对方取消了' + file + '的发送。', '对方取消接收' + file + ',文件发送失败。', '您终止了' + file + '的发送。', '您终止了' + file + '的接收。', '对方中断了' + file + '的发送。', '对方中断了' + file + '的接收。', '对方取消在线传输,转为发送离线文件' + file + '。');

+ 0 - 4
talkview/src/js/directive/historymessages.js

@@ -54,10 +54,6 @@
                     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 fileInfo = new Array('您取消了' + file + '的发送,文件传输失败。', '您取消接收' + file + ',文件传输失败。', '对方取消了' + file + '的发送。', '对方取消接收' + file + ',文件发送失败。', '您终止了' + file + '的发送。', '您终止了' + file + '的接收。', '对方中断了' + file + '的发送。', '对方中断了' + file + '的接收。', '对方取消在线传输,转为发送离线文件' + file + '。');

+ 9 - 9
talkview/src/less/app.main.less

@@ -44,7 +44,7 @@
     zoom: 1;
     p>strong {
         float: left;
-        margin-left: 2px;
+        margin-left: 3px;
         color: #336699;
     }
     p>small {
@@ -68,18 +68,18 @@
         border: none;
         box-shadow: none;
         outline: none;
-        margin-left: 10px;
+        margin-left: 8px;
         margin-top: -2px;
         margin-bottom: 0px;
         margin-right: 20px;
-        padding: 7px 12px;
+        padding: 7px 15px 7px 12px;
         font-size: 12px;
         line-height: 16px;
         .text-point {
             z-index: -99;
             position:absolute;
-            top:-18px;
-            left:8px;
+            top:-17px;
+            left:7px;
             width:0;
             height:0;
             font-size:0;
@@ -102,18 +102,18 @@
         border: none;
         box-shadow: none;
         outline: none;
-        margin-left: 10px;
+        margin-left: 8px;
         margin-top: -2px;
         margin-bottom: 0px;
         margin-right: 20px;
-        padding: 7px 12px;
+        padding: 7px 15px 7px 12px;
         font-size: 12px;
         line-height: 16px;
         .text-point {
             z-index: -99;
             position:absolute;
-            top:-18px;
-            left:8px;
+            top:-17px;
+            left:7px;
             width:0;
             height:0;
             font-size:0;