|
@@ -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, " ");
|
|
|
+ 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);
|
|
|
+ };
|
|
|
+
|
|
|
}]);
|