浏览代码

解决冲突

lqq 8 年之前
父节点
当前提交
59f13dec4e

+ 3 - 3
talkview/src/js/controller/transmitterController.js

@@ -18,9 +18,9 @@ angular.module('appMessage').controller('TransmitterController', ['$scope', '$in
         $timeout();
     };
 
-    $scope.toJson = function(item) {
-        return angular.toJson(item, true);
-    };
+    // $scope.toJson = function(item) {
+    //     return angular.toJson(item, true);
+    // };
 
     $scope.getSuffix = function(item) {
         var arr = item.fileName.split(".");

+ 34 - 39
talkview/src/js/directive/currentmessage.js

@@ -5,9 +5,9 @@
         .module('appMessage')
         .directive('ngCurrentMsg', CurrentMsg);
 
-    CurrentMsg.inject = ['$location', '$anchorScroll', '$compile'];
+    CurrentMsg.inject = ['$location', '$anchorScroll', '$compile', '$timeout'];
 
-    function CurrentMsg($location, $anchorScroll, $compile) {
+    function CurrentMsg($location, $anchorScroll, $compile, $timeout) {
         var directive = {
             link: link,
             restrict: 'A',
@@ -68,41 +68,37 @@
                         scope.imgWidth = 715;
                         scope.imgHeight = 395;
                         var html = '<a class="thumbnail"' + '>' +
-                            '<img onclick="javascript:window.open(this.src,\'\',\'height=' + scope.imgHeight + ',width=' + scope.imgWidth + ',top=200,left=200,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no\')" style="max-width:270px;max-height:250px;" src="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" onError= "this.src = \'../img/loading.gif\'" alt="截图缩略图" >' +
+                            // '<img img-load="gotoBottom(item)" img-error="errorImg()" onclick="javascript:window.open(this.src,\'\',\'height=' + scope.imgHeight + ',width=' + scope.imgWidth + ',top=200,left=200,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no\')" style="max-width:270px;max-height:250px;" src="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" onError= "this.src = \'../img/loading.gif\'" alt="截图缩略图" >' +
+                            '<img ng-click="gotoBottom()" onclick="javascript:window.open(this.src,\'\',\'height=600,width=800,top=200,left=200\')" class="lazy" style="max-width:270px;max-height:250px;" src="../img/loading.gif" data-original="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" alt="截图缩略图" >' +
                             '</a>';
                         // '<div class="bigImg">' +
                         // '<img ng-click="hover = false" ng-show="hover" src="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" alt="" >' +
                         // '</div>';
 
-                        var imgSize = loadImg("local://" + scope.appContent.directory.received + g[1] + ".JPG", addImg, errorImg);
-                        console.log(imgSize);
-
-                        function loadImg(url, callback, error) {
-                            var img = new Image();
-                            img.onload = function() {
-                                img.onload = null;
-                                callback(img);
-                                var imgSize = { height: img.height, width: img.width };
-                                console.log(imgSize);
-                                return imgSize;
-                            }
-                            img.onerror = function() {
-                                //alert("error!");
-                                img.onerror = null;
-                                error(img);
-                            }
-                            img.src = url;
-                            angular.element("img").attr("defaulturl", "../img/loading.jpg");
-                        }
-
-                        function errorImg(img) {
-                            gotoBottom();
-                        }
-
-                        function addImg(img) {
-                            //$(img).appendTo($(".image"));
-                            gotoBottom();
-                        }
+                        // loadImg("local://" + scope.appContent.directory.received + g[1] + ".JPG", addImg, errorImg);
+                        // function loadImg(url, callback, error) {
+                        //     var img = new Image();
+                        //     img.onload = function() {
+                        //         img.onload = null;
+                        //         callback(img);
+                        //     }
+                        //     img.onerror = function() {
+                        //         //alert("error!");
+                        //         img.onerror = null;
+                        //         error(img);
+                        //     }
+                        //     img.src = url;
+                        //     angular.element("img").attr("defaulturl", "../img/loading.jpg");
+                        // }
+
+                        // function errorImg() {
+                        //     gotoBottom();
+                        // }
+
+                        // function addImg() {
+                        //     //$(img).appendTo($(".image"));
+                        //     gotoBottom();
+                        // }
                         return html;
                     });
                     g = (/\[image\-src=\"([\w\W]+?)\"\]/i).exec(content);
@@ -235,11 +231,12 @@
             // 添加到文档中
             var newElement = angular.element($dom);
             element.append(newElement);
+            angular.element("img.lazy").lazyload();
             message.addEventListener('load', gotoBottom());
         }
     };
     /* @ngInject */
-    function ControllerController($scope) {
+    function ControllerController($scope, $timeout) {
         $scope.OpenFile = function(item) {
             var file = JSON.parse(item);
             return lxtalkClient.Invoke('{15180DEF-D508-45F7-BAEB-6486CD8752C8}', 'OpenFile', JSON.stringify(file), $scope);
@@ -250,11 +247,9 @@
             return lxtalkClient.Invoke('{15180DEF-D508-45F7-BAEB-6486CD8752C8}', 'OpenDirectory', JSON.stringify(file), $scope);
 
         };
-        // $scope.showBigImg = function(str) {
-        //     str = "local://E:\ZWT\Users\002682BECE10-kehu01\ReceivedFaces\55d8b2073fb83e2450eff0fccbb85ab4.JPG";
-        //     console.log(str);
-        //     var newwin = window.open();
-        //     newwin.document.write("<img src=" + str + " />");
-        // }
+        $scope.gotoBottom = function() {
+            console.log("11111111111111");
+            $scope.$apply();
+        };
     }
 })();

+ 18 - 10
talkview/src/js/directive/historymessages.js

@@ -71,8 +71,8 @@
                 while (g !== null) {
                     content = content.replace(g[0],
                         '<a class="thumbnail"' + '>' +
-                        '<img onclick="javascript:window.open(this.src,\'\',\'height=600,width=800,top=200,left=200\')" class="lazy" style="max-width:270px;max-height:250px;" src="../img/loading.gif" data-original="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" alt="截图缩略图" >' +
-                        // '<img onclick="javascript:window.open(this.src,\'\',\'height=600,width=800,top=200,left=200,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no\')" style="max-width:270px;max-height:250px;" src="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" alt="截图缩略图" >' +
+                        // '<img onclick="javascript:window.open(this.src,\'\',\'height=600,width=800,top=200,left=200\')" class="lazy" style="max-width:270px;max-height:250px;" src="../img/loading.gif" data-original="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" alt="截图缩略图" >' +
+                        '<img onclick="javascript:window.open(this.src,\'\',\'height=600,width=800,top=200,left=200,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no\')" style="max-width:270px;max-height:250px;" src="local://' + scope.appContent.directory.received + g[1] + '.JPG' + '" alt="截图缩略图" >' +
                         '</a>'
                     );
                     g = (/\[image\-src=\"([\w\W]+?)\"\]/i).exec(content);
@@ -212,15 +212,23 @@
             var $dom = compileFn(scope);
             // 添加到文档中
             angular.element("#loadmore").prepend($dom);
-            if (scope.count && angular.element("img").hasClass("lazy")) {
-                angular.element("img.lazy").lazyload();
+            if (scope.count) {
                 gotoBottom();
-                console.log("1");
-            } else if (scope.count) {
-                gotoBottom();
-                console.log("0");
-            } else
-                angular.element("img.lazy").lazyload();
+                window.scrollTo(0, document.body.scrollHeight);
+            }
+            // if (scope.count && angular.element("img").hasClass("lazy")) {
+            //     angular.element("img.lazy").lazyload({
+            //         event: "click"
+            //     });
+            //     gotoBottom();
+            //     window.scrollTo(0, document.body.scrollHeight);
+            // } else if (scope.count) {
+            //     gotoBottom();
+            //     window.scrollTo(0, document.body.scrollHeight);
+            // } else
+            //     angular.element("img.lazy").lazyload({
+            //         event: "click"
+            //     });
         }
     };
     /* @ngInject */

+ 9 - 8
talkview/src/js/directive/image.js

@@ -1,6 +1,6 @@
-(function () {
+(function() {
     angular
-        .module('appMessages')
+        .module('appMessage')
         .directive('imgLoad', imgLoad);
     imgLoad.inject = ['$parse', '$rootScope', '$event'];
     function imgLoad($parse, $rootScope, $event) {
@@ -13,8 +13,9 @@
         function compile($element, attr) {
             var fn = $parse(attr['img-load'], null, true);
             return function ngEventHandler(scope, element) {
-                element.on('load', function (event) {
-                    var callback = function () {
+                element.on('load', function(event) {
+                    var callback = function() {
+                        console.log('sssssssss');
                         fn(scope, {
                             $event: event
                         });
@@ -27,9 +28,9 @@
 })();
 
 
-(function () {
+(function() {
     angular
-        .module('appMessages')
+        .module('appMessage')
         .directive('imgError', imgError);
 
     imgError.inject = ['$parse', '$rootScope'];
@@ -44,8 +45,8 @@
         function compile($element, attr) {
             var fn = $parse(attr['img-error'], null, true);
             return function ngEventHandler(scope, element) {
-                element.on('error', function (event) {
-                    var callback = function () {
+                element.on('error', function(event) {
+                    var callback = function() {
                         fn(scope, {
                             $event: event
                         });

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

@@ -13,8 +13,8 @@
             </div>-->
     </div>
     <div class="feed-activity-list p-l-xs p-t-xs p-r-xs" id="sendmessage">
-        <div class="feed-element animate" ng-repeat="item in sendmessages track by $index" ng-current-msg="item" ng-app-content="appContent" id="message">
-            <div class="media-body">
+        <div class="feed-element animate" ng-repeat="item in sendmessages track by $index">
+            <div class="media-body" ng-current-msg="item" ng-app-content="appContent" id="message">
                 <p>
                     <strong>{{item.senderDisplayName === undefined || item.senderDisplayName == ''? item.sender : item.senderDisplayName}}</strong><small class="text-muted">-{{getTime(item)}}</small>
                 </p>