Эх сурвалжийг харах

项目详情H5展开全文修改。

dongbw 8 жил өмнө
parent
commit
854b6c6f27

+ 46 - 2
donate-service/src/main/webapp/resources/js/mobile/controllers/MobileProjectDetailCtrl.js

@@ -17,10 +17,26 @@ define([ 'app/app' ], function(app) {
                 $scope.project = data;
                 $scope.styCode = $scope.project.introduction;
                 $scope.introduction = $sce.trustAsHtml($scope.styCode);
-                alert($scope.introduction.length());
                 $scope.organization = data.organization;
                 $scope.percentage = data.totalAmount / data.target;
-                // document.write('<script type="text/javascript" src="static/js/mobile/detail.js"></script>');
+
+                // 展开全文
+                var $showAll = $('#activityIntroduction');
+                $showAll.html(data.introduction);
+                alert('获取成功');
+                var $height = $showAll.height();
+                alert($showAll.height());
+                if ($height > 700) {
+                    $showAll.css({
+                        'height': '6rem',
+                        'overflow': 'hidden'
+                    }).next().css('display','block');
+                } else {
+                    $showAll.css({
+                        'height': 'auto',
+                        'overflow': 'visible'
+                    }).next().css('display','none');
+                }
             }, function (error) {
                 console.log(error);
             });
@@ -65,6 +81,34 @@ define([ 'app/app' ], function(app) {
             Project.getCarousels({useFor: useFor}, {}, function(data) {
                 $scope.carousels = data;
             });
+
+            // 活动内容获取
+            // $.ajax({
+            //     url: '/project/detail/' + id,
+            //     type: 'GET',
+            //     data: {id : id},
+            //     success:function(data){
+            //         var $showAll = $('#activityIntroduction');
+            //         $showAll.html(data.introduction);
+            //         alert('获取成功');
+            //         var $height = $showAll.height();
+            //         alert($showAll.height());
+            //         if ($height > 700) {
+            //             $showAll.css({
+            //                 'height': '6rem',
+            //                 'overflow': 'hidden'
+            //             }).next().css('display','block');
+            //         } else {
+            //             $showAll.css({
+            //                 'height': 'auto',
+            //                 'overflow': 'visible'
+            //             }).next().css('display','none');
+            //         }
+            //     },
+            //     error:function(){
+            //         alert('获取内容失败');
+            //     }
+            // });
         };
         init();
 

+ 6 - 17
donate-service/src/main/webapp/resources/view/mobile/mobile_project_detail.html

@@ -783,7 +783,11 @@
                 </div>
                 <div class="bottom">
                     <div class="list-show">
-                        <div class="show-all" ng-bind-html="introduction">
+                        <!-- TODO 介绍修改 -->
+                        <!--<div class="show-all" ng-bind-html="introduction">-->
+
+                        <!--</div>-->
+                        <div class="show-all" id="activityIntroduction">
 
                         </div>
                         <div class="btnClick btnDown" style="display:none">
@@ -1078,23 +1082,8 @@
     });
     //    展开全文
     $(document).ready(function() {
-//        debugger
-        var $showAll = $('.show-all');
 
-        var $height = document.documentElement.clientHeight;
-//        alert($height);
-//        alert($showAll.height());
-        if ($height > 700) {
-            $showAll.css({
-                'height': '6rem',
-                'overflow': 'hidden'
-            }).next().css('display','block');
-        } else {
-            $showAll.css({
-                'height': 'auto',
-                'overflow': 'visible'
-            }).next().css('display','none');
-        }
+
     });
     $('.btnDown').on('click',function(){
 //        debugger