YanaDH 7 سال پیش
والد
کامیت
75657f980d

+ 1 - 0
miaomiao/www/img/blacklist.svg

xqd
@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1523952626441" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1553" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M513.199827 65.667605c-246.537999 0-446.399933 199.861934-446.399933 446.399933 0 246.553349 199.861934 446.399933 446.399933 446.399933 246.553349 0 446.399933-199.846584 446.399933-446.399933C959.599759 265.529539 759.753175 65.667605 513.199827 65.667605zM513.199827 894.697075c-211.320916 0-382.629537-171.322947-382.629537-382.628514 0-94.183056 34.029024-180.417069 90.461291-247.080352l165.389818 165.389818c4.320399 39.651069 26.816762 73.840752 58.981323 94.068446-72.189136 27.369348-123.517151 97.156784-123.517151 178.936345l337.541643 0 100.846826 100.846826C693.608709 860.664981 607.375719 894.697075 513.199827 894.697075zM805.362956 759.14175 697.264982 651.0448c-16.556071-58.332547-60.10082-105.306394-116.275213-126.601396 35.888372-22.570042 59.752896-62.511729 59.752896-108.032482 0-70.436212-57.108672-127.542838-127.542838-127.542838-48.218188 0-90.184999 26.765597-111.865787 66.245773L266.120498 219.900316c66.663282-56.432267 152.897296-90.461291 247.079328-90.461291 211.304544 0 382.628514 171.308621 382.628514 382.629537C895.82834 606.244454 861.796246 692.476421 805.362956 759.14175z" p-id="1554" fill="#00c3da"></path></svg>

+ 25 - 16
miaomiao/www/js/config/router.js

xqd
@@ -201,24 +201,33 @@
                 }
             }
         })
-            .state('app.attention', {
-                url: '/my/attention',
-                views: {
-                    'app-my': {
-                        templateUrl: 'templates/my/attention.html',
-                        controller: 'attentionCtrl'
-                    }
+        .state('app.attention', {
+            url: '/my/attention',
+            views: {
+                'app-my': {
+                    templateUrl: 'templates/my/attention.html',
+                    controller: 'attentionCtrl'
                 }
-            })
-            .state('app.care', {
-                url: '/my/care',
-                views: {
-                    'app-my': {
-                        templateUrl: 'templates/my/care.html',
-                        controller: 'careCtrl'
-                    }
+            }
+        })
+        .state('app.care', {
+            url: '/my/care',
+            views: {
+                'app-my': {
+                    templateUrl: 'templates/my/care.html',
+                    controller: 'careCtrl'
                 }
-            })
+            }
+        })
+        .state('app.blacklist', {
+            url: '/my/blacklist',
+            views: {
+                'app-my': {
+                    templateUrl: 'templates/my/blacklist.html',
+                    controller: 'blacklistCtrl'
+                }
+            }
+        })
         .state('app.my_dream', {
             url: '/my/dream',
             views: {

+ 40 - 16
miaomiao/www/js/controllers/home.js

xqd xqd xqd xqd xqd xqd
@@ -74,8 +74,8 @@
             $scope.load(true);
         };
 
-        $scope.toDetail = function (id) {
-            $state.go('app.home_dreamdetail',{id:id});
+        $scope.toDetail = function (id, user_id) {
+            $state.go('app.home_dreamdetail',{id:id, user_id: user_id});
         };
         $scope.toUserDetail = function (id) {
             homeService.toUserDetail(id).then(function(result){
@@ -184,9 +184,12 @@
                 var result = [];
                 for(var i = 0; i < reportUser.length; i++){
                     for(var j = 0; j < dreams_before.length ; j++){
-                        if(reportUser[i] == dreams_before[j].user_id){
-                            dreams_before.splice(j,1,undefined);
+                        if(dreams_before[j] != undefined){
+                            if(reportUser[i] == dreams_before[j].user_id){
+                                dreams_before.splice(j,1,undefined);
+                            }
                         }
+                        
                     }
                 }
                 for(var i = 0; i < dreams_before.length; i++){
@@ -423,19 +426,40 @@
                 $scope.toshare  = false;
                 msg.confirm('确定拉黑?').then(function(result){
                     if(result==true){
-                        var res = typeof(storage.getObject('reportUser'));
-                        if(res != 'object'){
-                            var reportUser = storage.getObject('reportUser');
-                        }
-                        else{
-                            var reportUser = [];
-                        }
-                        reportUser.push($scope.dream.user_id);
-                        storage.setObject('reportUser',reportUser);
-                        msg.text('已拉黑');
+                        $scope.toUserDetail($scope.blackUser_id);
                     }
                 })
             }
+            $scope.toUserDetail = function(blackUser_id){
+                homeService.toUserDetail(blackUser_id).then(function(result){
+                    var blackUser = result.data.data;
+                    var res = storage.getObject('reportUser');
+                    if(res.length != undefined){
+                        var reportUser = storage.getObject('reportUser');
+                        var blackUsers = storage.getObject('blackUsers');
+                    }
+                    else{
+                        var reportUser = [];
+                        var blackUsers = [];
+                    }
+                    var blackUser = {
+                        id: $scope.dream.user_id,
+                        nickname: blackUser.user.nickname,
+                        avatar: blackUser.user.avatar,
+                        city: blackUser.user.city,
+                        signture: blackUser.user.signture
+                    }
+                    reportUser.push($scope.dream.user_id);
+                    storage.setObject('reportUser',reportUser);
+                    blackUsers.push(blackUser);
+                    storage.setObject('blackUsers',blackUsers);
+                    msg.text('已拉黑');
+                    $ionicHistory.goBack();
+                    
+                },function(error){
+
+                })
+            };
             // $scope.reportUser = function(ev,user_id){
             //     ev.stopPropagation();
             //     msg.confirm('举报或拉黑该用户','','举报','拉黑').then(function(result){
@@ -468,6 +492,7 @@
             $scope.load = function (id,dream_user_id,interaction_id) {
                 homeService.dreamDetail(id,dream_user_id,interaction_id).then(function (result) {
                     console.log(result);
+                    $scope.blackUser_id = result.data.data.user_id;
                     $scope.showCode  = function(codeName){
                         $scope.url = codeName;
                         $scope.code = true;
@@ -563,7 +588,6 @@
             $scope.share = function (type,$event) {
                 $scope.toshare = true;
                 var desc = $scope.dream.about.substring(0,100);
-                debugger;
                 if (type==0) {
                     //分享给朋友
                     Wechat.share({
@@ -1064,7 +1088,7 @@
         , function ($scope,$location, $state,$ionicModal, storage , msg, common, config, homeService, $ionicTabsDelegate, $stateParams, $timeout, $ionicScrollDelegate, $interval) {
             var id = $stateParams.id;
             $scope.items = $stateParams.items;
-                $scope.$on('$ionicView.beforeEnter', function () {
+            $scope.$on('$ionicView.beforeEnter', function () {
                 $ionicTabsDelegate.showBar(false);
             });
             $scope.attentionUser = function(is_care){

+ 28 - 0
miaomiao/www/js/controllers/my.js

xqd xqd xqd
@@ -274,6 +274,7 @@
     app.controller('attentionCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
         , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
             $scope.$on('$ionicView.beforeEnter', function () {
+                $ionicTabsDelegate.showBar(false);
                 myService.attention().then(function(result){
                     $scope.users = result.data.data;
                 },function(error){
@@ -293,6 +294,7 @@
     app.controller('careCtrl', ["$scope","$ionicTabsDelegate",'$ionicModal',"$state", "myService", "msg","storage"
         , function ($scope,$ionicTabsDelegate,$ionicModal, $state,myService, msg, storage) {
             $scope.$on('$ionicView.beforeEnter', function () {
+                $ionicTabsDelegate.showBar(false);
                 myService.careMe().then(function(result){
                     $scope.users = result.data.data;
                 },function(error){
@@ -341,6 +343,32 @@
                 $scope.modal.show();
             }
         }]);
+        app.controller('blacklistCtrl', ["$scope","$ionicTabsDelegate",'$ionicModal',"$state", "myService", "msg","storage"
+            , function ($scope,$ionicTabsDelegate,$ionicModal, $state,myService, msg, storage) {
+                $scope.$on('$ionicView.beforeEnter', function () {
+                    $ionicTabsDelegate.showBar(false);
+                    $scope.users = storage.getObject("blackUsers");
+                    // $scope.reportUser = storage.getObject("reportUser");
+                });
+                $scope.cancelReport = function(id){
+                    var reportUser = storage.getObject("reportUser");
+                    var blackUsers = storage.getObject("blackUsers");
+                    for(var i = 0; i < reportUser.length; i++){
+                        if(reportUser[i] == id){
+                            reportUser.splice(i,1);
+                        }
+                    }
+                    for(var j = 0; j < blackUsers.length; j++){
+                        if(blackUsers[j].id == id){
+                            blackUsers.splice(j,1);
+                        }
+                    }
+                    msg.text('已取消');
+                    $scope.users = blackUsers;
+                    storage.setObject('reportUser',reportUser);
+                    storage.setObject('blackUsers',blackUsers);
+                }
+            }]);
 
     app.controller('mySupportDreamCtrl', ["$scope","homeService", "$stateParams","$state", "msg"
         , function ($scope,homeService,$stateParams, $state, msg) {

+ 1 - 1
miaomiao/www/templates/home/index.html

xqd
@@ -61,7 +61,7 @@
                                 </ion-slide>
                             </ion-slide-box>
                             <!-- end 轮播图-->
-                            <div class="row" sho ng-if="index.users.length>0" style="background: #FAFAFA;height:80px;padding: 0 5px;">
+                            <div class="row" ng-if="index.users.length>0" style="background: #FAFAFA;height:80px;padding: 0 5px;">
                                 <div class="col col-10" style="margin-top: 7%" ng-click="next(1)">
                                     <i class="icon ion-ios-arrow-left" style="font-size: 1.5rem; color: #00C3DA; line-height: 100%"></i>
                                 </div>

+ 27 - 0
miaomiao/www/templates/my/blacklist.html

xqd
@@ -0,0 +1,27 @@
+<ion-view view-title="瞄喵">
+    <ion-content>
+        <div ng-if="users.length==0" class="padding" style="color: #BEBEBE; font-size: 15px">
+            心慈手软的你,还没有拉黑过用户
+        </div>
+        <div class="list">
+            <div class="item reply-item" >
+                <div ng-repeat="user in users" class="item" style="height:90px; border-bottom: 2px solid #EFEFEF" ng-click="toMyUserDetail(user.id)">
+                    <div style="float:left;">
+                        <img style="width: 45px; height: 45px;border-radius: 100%; border: 1px solid #D8D8D8" ng-src="{{ user.avatar | avator }}" />
+                    </div>
+                    <div style="float:left; width: 50%; margin-left: 10px; margin-right: 10px; height: 60px; overflow: hidden">
+                        <h2> {{user.nickname}} </h2>
+                        <p> {{user.city}} </p>
+                        <p ng-if="user.signture==''"> 这个人很懒,什么都没留下 </p>
+                        <p ng-if="user.signture!=''"> {{user.signture}} </p>
+                    </div>
+                    <div style="float: right">
+                        <button ng-click="cancelReport(user.id)" class="button button-calm">
+                            取消拉黑
+                        </button>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </ion-content>
+</ion-view>

+ 4 - 0
miaomiao/www/templates/my/index.html

xqd
@@ -65,6 +65,10 @@
                 <img class="fl" src="img/icon_care.svg">
                 <em style="line-height: 30px">关注我的</em>
             </a>
+            <a class="item" ui-sref="app.blacklist">
+                <img class="fl" src="img/blacklist.svg">
+                <em style="line-height: 30px">黑名单</em>
+            </a>
             <a class="item" ui-sref="app.my_setting">
                 <img class="fl" src="img/icon_setting.svg">
                 <em style="line-height: 30px">设置</em>