YanaDH 7 years ago
parent
commit
7ccc02130e
2 changed files with 18 additions and 12 deletions
  1. 15 10
      miaomiao/www/js/controllers/home.js
  2. 3 2
      miaomiao/www/templates/home/dream-detail.html

+ 15 - 10
miaomiao/www/js/controllers/home.js

xqd
@@ -467,17 +467,22 @@
                 $scope.dream.interactions[index].showmore = true;
             }
         }
-        $scope.replay = function ($event, name, index) {
-           
+        $scope.replay = function ($event, name, index,currentindex) {
             $event.stopPropagation();
-            $scope.input.focus = true;
-            $scope.input.show = true;
-            angular.forEach($scope.dream.interactions, function (item) {
-                item.show = false;
-            })
-            $scope.dream.interactions[index].show = true;
-            $scope.input.placeholder = "评论" + name+":";
-            $scope.vm.title='';
+            if($scope.dream.interactions[index].comments[currentindex].user_id!=$scope.user.id){
+                $scope.input.focus = true;
+                $scope.input.show = true;
+                angular.forEach($scope.dream.interactions, function (item) {
+                    item.show = false;
+                })
+                $scope.dream.interactions[index].show = true;
+                $scope.input.placeholder = "评论" + name+":";
+                $scope.vm.title='';
+            }
+            else {
+                msg.alert("评论","是否删除评论");
+            }
+
         };
       
         $scope.submitComment = function (index) {

+ 3 - 2
miaomiao/www/templates/home/dream-detail.html

xqd xqd xqd
@@ -159,6 +159,7 @@
                     </div>
                     <div class="item" style="border-bottom:15px solid #F2F2F2;" ng-click="add_comment()" ng-repeat="interaction in dream.interactions">
                         <div>
+                        <!--<div ng-click="replay($event,dream.user.nickname,$index)">-->
                             <img class="head" ng-src="{{dream.user.avatar | avator}}" />
                             <span class="utitle">{{dream.user.nickname}}</span>
                             <!--<span class="utitle kz">{{dream.end_time | lastDate}}</span>-->
@@ -179,7 +180,7 @@
                             </div>
                         </div>
                         <div class="list" style="margin-left:50px">
-                            <div class="item" ng-repeat="c in interaction.comments" ng-click="replay($event,c.user_nickname,$parent.$parent.$index)" ng-if="interaction.showmore||$index<4">
+                            <div class="item" ng-repeat="c in interaction.comments" ng-click="replay($event,c.user_nickname,$parent.$parent.$index,$index)" ng-if="interaction.showmore||$index<4">
                                 <img class="head" ng-src="{{c.user_avatar | avator}}" />
                                 <span>{{c.content}}</span>                                
                                 <span class="utitle">{{c.user_nickname}}</span>
@@ -506,7 +507,7 @@
             </ion-header-bar>
             <ion-content>
                 <div style="margin: 0 auto">
-                    <img ng-src="{{commentPicUrl}}" style="width: 100%; height: 100%; padding: 10px; margin-top: 10%">
+                    <img ng-src="{{commentPicUrl}}" style="width: 100%; height: 100%; padding: 10px; margin-top:10%;">
                 </div>
             </ion-content>
         </div>