YanaDH %!s(int64=7) %!d(string=hai) anos
pai
achega
7a97e22bb7

+ 28 - 28
miaomiao/www/js/controllers/account.js

xqd
@@ -3,34 +3,34 @@
         function ($scope,userService,$ionicNavBarDelegate, storage, $state, msg, $http, util) {
             //$ionicNavBarDelegate.showBackButton(false);
             $scope.wechat_login = function(){
-                var scope = "snsapi_userinfo", state = "_" + (+new Date());
-                 Wechat.auth(scope, state, function (response) {
-                     // alert("response:"+JSON.stringify(response));
-                     // var response={code:1231};
-                    if(response.code){
-                        //msg.loading('登录中...');
-                        msg.loading();
-                        userService.wechat_login(response.code).then(function(result){
-                            msg.hide();
-                             // alert("wechat_login success: " + JSON.stringify(result));
-                            if(result.data.data){
-                                storage.setObject('user', result.data.data.user);
-                                storage.set('token', result.data.data.token);
-                                $http.defaults.headers.common["Authorization"] = 'Bearer ' + result.data.data.token;
-                                $scope.user=storage.getObject('user');
-                                $state.go('app.home');
-                            }else{
-                                $state.go("loginAccount",{wechat:response.code})
-                            }
-                        },function(error){
-                             console.log("loginbywx Failed: " + JSON.stringify(error));
-                            $state.go("loginAccount",{wechat:$scope.wecaht});
-                        });
-                    }
-                 }, function (error) {
-                    console.log("Failed: " + JSON.stringify(error));
-                 })
-                //$state.go("loginAccount",{wechat:1231});
+                //var scope = "snsapi_userinfo", state = "_" + (+new Date());
+                // Wechat.auth(scope, state, function (response) {
+                //     // alert("response:"+JSON.stringify(response));
+                //     // var response={code:1231};
+                //    if(response.code){
+                //        //msg.loading('登录中...');
+                //        msg.loading();
+                //        userService.wechat_login(response.code).then(function(result){
+                //            msg.hide();
+                //             // alert("wechat_login success: " + JSON.stringify(result));
+                //            if(result.data.data){
+                //                storage.setObject('user', result.data.data.user);
+                //                storage.set('token', result.data.data.token);
+                //                $http.defaults.headers.common["Authorization"] = 'Bearer ' + result.data.data.token;
+                //                $scope.user=storage.getObject('user');
+                //                $state.go('app.home');
+                //            }else{
+                //                $state.go("loginAccount",{wechat:response.code})
+                //            }
+                //        },function(error){
+                //             console.log("loginbywx Failed: " + JSON.stringify(error));
+                //            $state.go("loginAccount",{wechat:$scope.wecaht});
+                //        });
+                //    }
+                // }, function (error) {
+                //    console.log("Failed: " + JSON.stringify(error));
+                // })
+                $state.go("loginAccount",{wechat:1231});
             }
     }]);
     app.controller('loginCtrl', ["$scope", "userService","$stateParams","$ionicNavBarDelegate", "storage", "$state", "msg", "$http", "util","$timeout",

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

xqd xqd xqd xqd xqd xqd xqd
@@ -20,17 +20,9 @@
             //收到新消息
             alert('收到新消息,改变样式');
             $scope.showMessage = 1;
-        })
+        });
         $scope.type = 'hot';//tab切换
 
-            //$scope.chosedIndex = 0;
-           $scope.clickAvatar = function(id){
-               homeService.toUserDetail(id).then(function(result){
-                   $state.go('app.home_dreamdetail',{id:id,type:2});
-               },function(error){
-                       //msg.error(msg.data.error)
-               });
-           };
         $ionicPopover.fromTemplateUrl('my-popover.html', {
             scope: $scope
         }).then(function (popover) {
@@ -106,6 +98,7 @@
                 for(var i=0; i<obj.length; i++){
                     if(obj[i].checked){
                         $scope.filter.age+=obj[i].value+',';
+                        obj[i].checked=false;
                     }
                 };
                 debugger;
@@ -160,6 +153,15 @@
                 msg.hide();
             });
         };
+            $scope.clickAvatar = function(id){
+                if($scope.index.users.dream_number<1){
+                    $state.go('app.home_dreamdetail',{id:id,type:2});
+                }
+                else {
+                    $scope.toUserDetail(id);
+                }
+
+            };
         $scope.qrscan = function () {
             cordova.plugins.barcodeScanner.scan(
                     function (result) {
@@ -235,6 +237,14 @@
 
                 });
             });
+            $scope.toUserDetail = function (id) {
+                homeService.toUserDetail(id).then(function(result){
+                    $scope.items = result.data.data;
+                    $state.go('app.home_userDetail',{id:id,items:$scope.items});
+                },function(error){
+                    //msg.error(msg.data.error)
+                })
+            };
             $scope.$on('$ionicView.leave', function () {
                 if($scope.multi.promise)$interval.cancel($scope.multi.promise);
                 if($scope.leftTimer)$interval.cancel($scope.leftTimer);
@@ -491,20 +501,20 @@
             } else {
                 $scope.dream.interactions[index].showmore = true;
             }
-        }
+        };
         $scope.replay = function ($event, name, index) {
             $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.dream.interactions[index].focus = true;
             $scope.input.placeholder = "评论" + name+":";
             $scope.vm.title='';
             $scope.vm.comment='';
-        }
+        };
         $scope.replayOther = function ($event, name, index,currentindex) {
             $event.stopPropagation();
             if($scope.dream.interactions[index].comments[currentindex].user_id!=$scope.user.id){
@@ -549,7 +559,7 @@
                         $scope.user = result.data.data;
                     });
                 })
-            }
+            };
             //充值
             $scope.charge = function(number){
                 if (!number) {
@@ -623,8 +633,7 @@
                 $scope.vm.comment = '' ;
                 $scope.load(id);
                 $scope.closeModal();
-            })
-            debugger;
+            });
         };
             $scope.bigImage = false;
             $scope.showBigImage = function ($event, imageName) {

+ 5 - 5
miaomiao/www/templates/home/dream-detail.html

xqd xqd
@@ -215,13 +215,13 @@
             <div class="detail-head" style="height: 180px" ng-if="dream.top3user.length>0">
                 <div class="row" ng-if="dream.top3user.length<3">
                     <div class="col top1" ng-if="dream.top3user.length>0" style="background: url('img/img_No1.svg') no-repeat; background-size: 100% 100%;">
-                        <img style="width: 75px; height: 75px; margin: 25px 0 8px 0; border-radius: 100%; background: #C6D3E2;" ng-src="{{ dream.top3user[0].avatar | avator }}" /><br>
+                        <img ng-click="toUserDetail(dream.top3user[0].id)" style="width: 75px; height: 75px; margin: 25px 0 8px 0; border-radius: 100%; background: #C6D3E2;" ng-src="{{ dream.top3user[0].avatar | avator }}" /><br>
                         {{ dream.top3user[0].nickname }}<br>
                         <img ng-src="img/icon_gongxian.svg" style="height: 18px; width: 18px; margin-top: 5px" />
                         <em style="font-size: 15px;">{{ dream.top3user[0].score }}</em>
                     </div>
                     <div class="col top2" ng-if="dream.top3user.length>1" style="background: url('img/img_No2.svg') no-repeat; background-size: 100% 100%;">
-                        <img style="width: 67px; margin: 20px 0 6px 0; border-radius: 100%; background: #C6D3E2;" ng-src="{{ dream.top3user[1].avatar | avator }}" /><br>
+                        <img ng-click="toUserDetail(dream.top3user[1].id)" style="width: 67px; margin: 20px 0 6px 0; border-radius: 100%; background: #C6D3E2;" ng-src="{{ dream.top3user[1].avatar | avator }}" /><br>
                         {{ dream.top3user[1].nickname }}<br>
                         <img ng-src="img/icon_gongxian.svg" style="height: 18px; width: 18px; margin-top: 5px" />
                         <em style="font-size: 15px;">{{ dream.top3user[1].score }}</em>
@@ -229,19 +229,19 @@
                 </div>
                 <div class="row" ng-if="dream.top3user.length>2">
                     <div class="col top2" ng-if="dream.top3user.length>1" style="background: url('img/img_No2.svg') no-repeat; background-size: 100% 100%; margin-top: 10px">
-                        <img style="width: 67px; margin: 22px 0 8px 0; border-radius: 100%; background: #C6D3E2;" ng-src="{{ dream.top3user[1].avatar | avator }}" /><br>
+                        <img ng-click="toUserDetail(dream.top3user[1].id)" style="width: 67px; margin: 22px 0 8px 0; border-radius: 100%; background: #C6D3E2;" ng-src="{{ dream.top3user[1].avatar | avator }}" /><br>
                         {{ dream.top3user[1].nickname }}<br>
                         <img ng-src="img/icon_gongxian.svg" style="height: 18px; width: 18px; margin-top: 5px" />
                         <em style="font-size: 16px">{{ dream.top3user[1].score }}</em>
                     </div>
                     <div class="col top1" ng-if="dream.top3user.length>0" style="background: url('img/img_No1.svg') no-repeat; background-size: 100% 100%;">
-                        <img style="width: 75px; height: 75px; margin: 25px 0 8px 0; border-radius: 100%; background: #C6D3E2;" ng-src="{{ dream.top3user[0].avatar | avator }}" /><br>
+                        <img ng-click="toUserDetail(dream.top3user[0].id)" style="width: 75px; height: 75px; margin: 25px 0 8px 0; border-radius: 100%; background: #C6D3E2;" ng-src="{{ dream.top3user[0].avatar | avator }}" /><br>
                         {{ dream.top3user[0].nickname }}<br>
                         <img ng-src="img/icon_gongxian.svg" style="height: 18px; width: 18px; margin-top: 5px" />
                         <em style="font-size: 16px">{{ dream.top3user[0].score }}</em>
                     </div>
                     <div class="col top2" ng-if="dream.top3user.length>2" style="background: url('img/img_No3.svg') no-repeat; background-size: 100% 100%; margin-top: 10px">
-                        <img style="width: 67px; margin: 22px 0 8px 0; border-radius: 100%; background: #C6D3E2;" ng-src="{{ dream.top3user[2].avatar | avator }}" /><br>
+                        <img ng-click="toUserDetail(dream.top3user[2].id)" style="width: 67px; margin: 22px 0 8px 0; border-radius: 100%; background: #C6D3E2;" ng-src="{{ dream.top3user[2].avatar | avator }}" /><br>
                         {{ dream.top3user[2].nickname }}<br>
                         <img ng-src="img/icon_gongxian.svg" style="height: 18px; width: 18px; margin-top: 5px" />
                         <em style="font-size: 16px">{{ dream.top3user[2].score }}</em>