瀏覽代碼

历史消息

dgf 8 年之前
父節點
當前提交
5d6ffcd39e

+ 76 - 3
talkview/src/js/controller/historyMsgController.js

@@ -1,7 +1,80 @@
 'use strict';
 
-angular.module('appMessage').controller('HistoryMsgController', ['$scope', '$filter', function($scope, $filter) {
-
-    //lxtalkClient.Invoke('{FB60F992-A0FD-47B3-AAA7-E80DF209C5A4}', '_Register', '', $scope);
+angular.module('appMessage').controller('HistoryMsgController', ['$scope', '$filter', '$timeout', function($scope, $filter, $timeout) {
+    //lxtalkClient.Invoke('{15180DEF-D508-45F7-BAEB-6486CD8752C8}', '_Register', '', $scope);
+    $scope.count = true;
+    $scope.appContent = {};
+    $scope.historymessages = [];
     $scope.selectName = "全部"
+
+    $scope.initAppContent = function(appContentJson) {
+        $scope.appContent = JSON.parse(appContentJson);
+    };
+
+    $scope.voicePlay = function($event) {
+        var audio = $($event.target.parentElement.nextElementSibling)[0];
+        var unread = $($event.target.nextElementSibling);
+        var audioAll = $('audio');
+        console.log($($event.target));
+        console.log(audioAll);
+        if (audio !== null) {
+            if (audio.paused) {
+                for (var i = 0, len = audioAll.length; i < len; i++) {
+                    if (!audioAll[i].paused) {
+                        $(audioAll[i].previousElementSibling.firstElementChild).removeClass("app-voice-play");
+                        $(audioAll[i].previousElementSibling.firstElementChild).addClass("app-voice-pause");
+                        audioAll[i].load();
+                    }
+                }
+                unread.removeClass("app-voice-unread");
+                $($event.target).removeClass("app-voice-pause");
+                $($event.target).addClass("app-voice-play");
+                $timeout(function() {
+                    $($event.target).removeClass("app-voice-play");
+                    $($event.target).addClass("app-voice-pause");
+                }, 1000 * audio.duration);
+                audio.play();
+            } else {
+                $($event.target).removeClass("app-voice-play");
+                $($event.target).addClass("app-voice-pause");
+                audio.pause();
+                audio.load();
+            }
+        }
+    };
+
+    $scope.showHistoryMessage = function(jsonStr) {
+        console.log(jsonStr);
+        jsonStr = jsonStr.replace(/ /g, "&nbsp");
+        jsonStr = jsonStr.replace(/\r\n/g, "<br>");
+        jsonStr = jsonStr.replace(/\r/g, "\\r");
+        jsonStr = jsonStr.replace(/\n/g, "\\n");
+        jsonStr = jsonStr.replace(/\t/g, "\\t");
+        jsonStr = jsonStr.replace(/\f/g, "\\f");
+        var msg = JSON.parse(jsonStr);
+        $scope.historymessages.push(msg);
+    };
+
+    $scope.getHisTime = function(item) {
+        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.scrollWheel = function() {
+        if (document.body.scrollTop == 0) {
+            $scope.height = document.body.scrollHeight + 200;
+            lxtalkClient.Invoke('{15180DEF-D508-45F7-BAEB-6486CD8752C8}', 'LoadHistoryMessages', '', $scope);
+            $scope.count = false;
+        }
+    };
+
+    $scope.loadImages = function(data) {
+        lxtalkClient.Invoke('{15180DEF-D508-45F7-BAEB-6486CD8752C8}', 'LoadImages', JSON.stringify(data), $scope);
+    };
+
 }]);

+ 67 - 4
talkview/src/less/app.main.less

@@ -758,12 +758,13 @@ body {
 }
 
 .historymsg {
-    width:100%;
+    width:800px;
     height: 100%;
     margin: 0px auto;
-    background: #F5FAFE;
+    background: #F5F5F5;
     font-size: 12px;
     font-family: "微软雅黑","宋体";
+    border-bottom: 1px solid #ddd;
     #head{
         height: 45px;
         .selectData {
@@ -791,7 +792,7 @@ body {
             width: 300px;
             .form-control {
                 height: 30px;
-                padding-left: 3px;
+                padding-left: 5px;
                 font-size: 12px;
             }
             .btn-default{
@@ -824,11 +825,73 @@ body {
                 }
             }
         }
+        .glyphicon-refresh {
+            margin:12px -630px 0px 0px;
+            float: right;
+            font-size:12px;
+            height: 2em;
+            width: 30px;
+            border-radius: 3px;
+            color: white;
+            background: #3CB371;
+            border: none;
+            outline: none;
+            &:hover{
+                background: #2E8B57;
+            }
+        }
     }
     #leftList {
+        background: #F5F5F5;
+        float: left;
+        width: 180px;
+        height: 550px;
+        border-right: 1px solid #ddd;
+        font-size: 12px;
+        font-family: "微软雅黑","宋体";
+        .panel-group {
+            #first {
+                border-top: none;
+            }
+            .panel-default {
+                margin-bottom: -10px;
+                border-radius: 0px;
+                border-right: none;
+                .panel-heading {
+                    background: #F5F5F5;
+                    a {
+                        text-decoration: none;
+                        span {
+                            color: #333;
+                        }
+                        .lt {
+                            font-size: 15px;
+                        }
+                        .rt {
+                            font-size: 15px;
+                            margin-left: -11px;
+                            margin-top: -10px;
+                        }
+                    }
+                }
+                .panel-collapse {
+                
+                }
+            }
+        }
 
     }
     #media {
-
+        overflow-y: auto;
+        margin-left: 180px;
+        height: 550px;
+        width: 620px;
+        background: #FFF;
+        .well {
+            background: #FFF;
+            padding-left: 11px;
+            margin-top: 2px;
+            margin-bottom: -8px;
+        }
     }
 }

文件差異過大導致無法顯示
+ 133 - 1
talkview/src/templates/historyMsg.html


+ 1 - 1
talkview/src/templates/messages.html

@@ -1,4 +1,4 @@
-<div class="full-client" ng-cloak ng-mouseover="scrollShow()" infinite-scroll="scrollWheel()" infinite-scroll-distance="250" infinite-scroll-immediate-check="false">
+<div class="full-client" ng-cloak infinite-scroll="scrollWheel()" infinite-scroll-distance="250" infinite-scroll-immediate-check="false">
     <div class="getMore"><a role="button" class="i-More"><small ng-click="getMore()">加载更多消息</small></a><small class="n-More hide">当前没有更多消息</small></div>
     <div class="feed-activity-list p-l-xs p-t-xs p-r-xs loadmore" ng-cloak>
         <div class="feed-element" ng-repeat="item in historymessages | orderBy:item.index:'desc'">