YanaDH преди 7 години
родител
ревизия
17f1995346

+ 2 - 2
miaomiao/www/js/config/config.js

xqd
@@ -1,11 +1,11 @@
 (function (app) {
     //全局配置 
     app.constant("config", {
-    //     server: 'http://q8.9026.com/',
+        server: 'http://q8.9026.com/',
     //     imgServer: 'http://q8.9026.com/attachment/'
         //server: 'http://localhost:8092/',
         //imgServer: 'http://localhost:8092/attachment/',
-        server: 'http://miao.beiyuesi.com/',
+        // server: 'http://miao.beiyuesi.com/',
         imgServer: 'http://miao.beiyuesi.com/attachment/'
     });
 })(angular.module('app'));

+ 10 - 0
miaomiao/www/js/config/router.js

xqd
@@ -444,6 +444,16 @@
                     }
                 }
             })
+            // 举报
+            .state('app.homeContact', {
+                url: '/home/contact',
+                views: {
+                    'app-home': {
+                        templateUrl: 'templates/my/contact.html',
+                        controller: 'contactCtrl'
+                    }
+                }
+            })
             .state('app.shareDream', {
                 url: '/home/shareDream',
                 params:{

+ 29 - 0
miaomiao/www/js/controllers/home.js

xqd xqd
@@ -330,6 +330,34 @@
                 });
             };
 
+            // 举报或拉黑
+            $scope.report = function(ev,dream_id,interaction_id,user_id){
+                ev.stopPropagation();
+                msg.confirm('举报或拉黑','','举报','拉黑').then(function(result){
+                    if(result==true){
+                        msg.confirm('确定拉黑?').then(function(result){
+                            if(result==true){
+                                homeService.report(dream_id,interaction_id,user_id).then(function(result){
+                                    if(result.data.status_code==0){
+                                        msg.text('已拉黑');
+                                        $scope.load(dream_id);
+                                    }
+                                },function(error){
+                                    
+                                })
+                            }
+                        })
+                    }
+                    else {
+                        msg.confirm('确定举报?').then(function(result){
+                            if(result==true){
+                                $state.go('app.homeContact');
+                            }
+                        })
+                    }
+                })
+            };
+
         $scope.load = function (id,dream_user_id,interaction_id) {
             homeService.dreamDetail(id,dream_user_id,interaction_id).then(function (result) {
                 console.log(result);
@@ -607,6 +635,7 @@
             $scope.vm.comment='';
         };
         $scope.replayOther = function ($event, name, to_userid, index,currentindex) {
+            debugger;
             $event.stopPropagation();
             if($scope.dream.interactions[index].comments[currentindex].user_id!=$scope.user.id){
                 $scope.input.focus = true;

+ 12 - 3
miaomiao/www/js/controllers/my.js

xqd xqd
@@ -239,8 +239,8 @@
                 $ionicHistory.goBack();
             }
         }]);
-    app.controller('contactCtrl', ["$scope","$ionicTabsDelegate", "$timeout","$state", "myService", "msg","storage"
-        , function ($scope,$ionicTabsDelegate, $timeout,$state,myService, msg, storage) {
+    app.controller('contactCtrl', ["$scope","$ionicTabsDelegate","$location", "$ionicHistory","$timeout","$state", "myService", "msg","storage"
+        , function ($scope,$ionicTabsDelegate,$location,$ionicHistory, $timeout,$state,myService, msg, storage) {
             $scope.vm={
                 content:"",
                 email:""
@@ -255,8 +255,17 @@
                 myService.contact(data).then(function(result){
                     msg.text("发送成功");
                     $timeout(function(){
-                        $state.go("app.my");
+                        if($location.path()=='/app/home/contact'){
+                            $ionicHistory.goBack();
+                        }
+                        else{
+                            $state.go("app.my");
+                        }
                     },1000);
+                    $scope.vm={
+                        content:"",
+                        email:""
+                    }
                 },function(error){
                     msg.error(error.data.message);
                 })

+ 6 - 0
miaomiao/www/js/services/homeservice.js

xqd
@@ -131,6 +131,12 @@
                     url:config.server + "api/my/step",
                     method:"get"
                 })
+            },
+            report:function(dream_id,interaction_id,user_id){
+                return $http({
+                    url:config.server + "api/interaction/add_comment_blackList?dream_id=" + dream_id + '&interaction_id=' + interaction_id + '&user_id=' + user_id,
+                    method:"get"
+                })
             }
         };
     }]);

+ 2 - 2
miaomiao/www/js/services/msgservice.js

xqd xqd
@@ -5,7 +5,7 @@
                 template = template || "";
                 var n = {
                     template: template,
-                    duration:1000
+                    duration:2000
                 };
                 if (noBackdrop) n["noBackdrop"] = true;
                 $ionicLoading.show(n);
@@ -14,7 +14,7 @@
                 template = template || "";
                 var n = {
                     template: '<i class="icon ion-ios-checkmark-outline pop-msg"></i><br>' + template,
-                    duration: 1000
+                    duration: 2000
                 };
                 if (noBackdrop) n["noBackdrop"] = true;
                 $ionicLoading.show(n);

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

xqd
@@ -187,11 +187,12 @@
                                     <video ng-src="{{ interaction.video | trustUrl}}" poster="{{ interaction.video+'.jpg' | videoPoster | trustUrl}}" width="100%" style="max-height: 400px;" class="centerme" controls="controls"></video>
                                 </div>
                             </div>
+                            <div style="font-size: 12px; text-align: right; padding-right: 10px; color: #999999;" ng-if="interaction.showmore||$index<4">点击用户头像举报或拉黑该用户</div>
                             <div class="list">
                                 <div class="item" ng-repeat="c in interaction.comments" ng-click="replayOther($event,c.user_nickname,c.user_id,$parent.$parent.$index,$index)" ng-if="interaction.showmore||$index<4">
                                     <div class="row">
                                         <div class="col-20" style="text-align: right">
-                                            <img class="head" ng-src="{{c.user_avatar | avator}}" />
+                                            <img ng-click="report($event,dream.id,interaction.id,c.user_id)" class="head" ng-src="{{c.user_avatar | avator}}" />
                                         </div>
                                         <div class="col-80" style="border-bottom: 1px solid #E6E6E6">
                                             <span style="margin-top: 10px; display: inline-block;font-size: 12px">{{c.user_nickname}}</span>