Ben 8 лет назад
Родитель
Сommit
d9cdad8dd1

BIN
.vs/miaomiao/v14/.suo


+ 10 - 1
info.txt

xqd
@@ -1,3 +1,12 @@
 http://i.9026.com/miao/index.html
 
-接口地址:q8.9026.com/apidoc/
+接口地址:q8.9026.com/apidoc/
+
+
+“{"status":true,"status_code":0,"message":"","data":{"file":"763f19b3a69ef9de9f2f2964b22f7303"}}”
+
+Failed to load resource: the server responded with a status of 404 (Not Found)
+91dce7deb1c4d7e44bad0eab7d8eb9af (0,0)
+
+
+http://q8.9026.com/web/attachment/91dce7deb1c4d7e44bad0eab7d8eb9af

+ 4 - 4
miaomiao/www/js/config/router.js

xqd
@@ -21,12 +21,12 @@
                 }
             }
         })
-            .state('app.home_userdetail', {
-                url: '/home/userdetail',
+            .state('app.home_dreamdetail', {
+                url: '/home/dreamdetail',
                 views: {
                     'app-home': {
-                        templateUrl: 'templates/home/user-detail.html',
-                        controller: 'userDetailCtrl'
+                        templateUrl: 'templates/home/dream-detail.html',
+                        controller: 'dreamDetailCtrl'
                     }
                 }
             })

+ 48 - 45
miaomiao/www/js/controllers/home.js

xqd xqd
@@ -1,41 +1,7 @@
 (function (app) {
-    app.controller('homeCtrl', ["$scope","$http", 'config', "$state", "msg", "$ionicPopover"
-        , function ($scope, $http, config, $state, msg, $ionicPopover) {
-            $scope.type = 1;//tab切换
-            $scope.changetype = function (type) {
-                $scope.type = type;
-                if(type == 1){
-                    $http({
-                        method:"get",
-                        url:config.server + "api/index/hot"
-                    }).then(function (result){
-
-                    },function(error){
-
-                    })
-                }
-                else if(type == 2){
-                    $http({
-                        method:"get",
-                        url:config.server + "api/index/trend"
-                    }).then(function (result){
-
-                    },function(error){
-
-                    })
-                }
-                else if(type == 3){
-                    $http({
-                        method:"get",
-                        url:config.server + "api/index/new"
-                    }).then(function (result){
-
-                    },function(error){
-
-                    })
-                }
-            }
-           
+    app.controller('homeCtrl', ["$scope", "$http", 'config', "$state", "msg", "$ionicPopover", "homeService"
+        , function ($scope, $http, config, $state, msg, $ionicPopover, homeService) {
+            $scope.type = 'hot';//tab切换
             $ionicPopover.fromTemplateUrl('my-popover.html', {
                 scope: $scope
             }).then(function (popover) {
@@ -47,15 +13,52 @@
             $scope.closePopover = function () {
                 $scope.popover.hide();
             };
-        $scope.$on('$ionicView.beforeEnter', function () {
-
-        });
-        $scope.todetail = function () {
-            $state.go('app.home_userdetail');
-        };
-
+            $scope.changetype = function (type) {
+                $scope.type = type;
+                $scope.load(true);
+            }
+            $scope.todetail = function () {
+                $state.go('app.home_dreamdetail');
+            };
+            $scope.filter = {
+                hasMore: false,
+                pageIndex: 1,
+                pageSize: 20,
+            }
+            $scope.index = {
+                banner: [],
+                users: [],
+                dreams:[]
+            };
+            $scope.load = function (init) {
+                if (init) {
+                    $scope.filter.pageIndex = 1;
+                    $scope.index.dreams = [];
+                }
+                homeService.index($scope.type, $scope.filter.pageIndex).then(function (result) {
+                    $scope.index.banner = result.data.data.banner;
+                    $scope.index.users = result.data.data.users;
+                    $scope.filter.pageIndex++;
+                    var more = (result.data.data.dreams.data.length >= $scope.filter.pageSize);
+                    $scope.filter.hasMore = more;
+                    $scope.index.dreams = $scope.index.dreams.concat(result.data.data.dreams.data);
+                    if (init) {
+                        $scope.$broadcast('scroll.refreshComplete');
+                    } else {
+                        $scope.$broadcast('scroll.infiniteScrollComplete');
+                    }
+                }, function (erro) {
+                    msg.error(erro.data.Message);
+                });
+            }
+            $scope.data = {};
+            $scope.load(true);
+            //$scope.$on('$ionicView.enter', function () {
+              
+          
+            //});
         }]);
-    app.controller('userDetailCtrl', ["$scope", "$state", "msg","homeService", "$ionicTabsDelegate"
+    app.controller('dreamDetailCtrl', ["$scope", "$state", "msg", "homeService", "$ionicTabsDelegate"
         , function ($scope, $state, msg, homeService, $ionicTabsDelegate) {
             $scope.type = 1;//tab切换
             $scope.tosupport = false;

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

xqd
@@ -19,7 +19,39 @@
                     url: config.server + 'api/index/search?' + data,
                     method:"get"
                 })
+            },
+            index: function (type, page) {
+                var url = util.format('{0}/api/index/index?type={1}&page={2}', config.server,type,page);
+                return $http({
+                    url: url,
+                    method: "get"
+                })
+            },
+            news_info: function (id) {
+                return $http({
+                    url: config.server + 'api/index/news_info?id='+id,
+                    method: "get"
+                })
+            },
+            news: function () {
+                return $http({
+                    url: config.server + 'api/index/new',
+                    method: "get"
+                })
+            },
+            trend: function () {
+                return $http({
+                    url: config.server + 'api/index/trend',
+                    method: "get"
+                })
+            },
+            user_search: function (keyword) {
+                return $http({
+                    url: config.server + 'api/index/user_search?keyword='+keywords,
+                    method: "get"
+                })
             }
+             
         };
     }]);
 })(angular.module('app.services'));

+ 0 - 0
miaomiao/www/templates/home/user-detail.html → miaomiao/www/templates/home/dream-detail.html


+ 19 - 79
miaomiao/www/templates/home/index.html

xqd xqd
@@ -8,31 +8,29 @@
         <button class="button button-clear icon ion-email-unread" style="padding-left:10px"></button>
     </ion-nav-buttons>
     <ion-content>
+        <!--下拉刷新-->
+        <ion-refresher pulling-text="下拉刷新" on-refresh="load(true)">
+        </ion-refresher>
         <div class="tabs-striped tabs-top">
             <div class="tabs" style="top:0">
-                <a  ng-class="type==1?'tab-item active':'tab-item'" ng-click="changetype(1)">
+                <a  ng-class="type=='hot'?'tab-item active':'tab-item'" ng-click="changetype('hot')">
                    热门
                 </a>
-                <a ng-class="type==2?'tab-item active':'tab-item'" ng-click="changetype(2)">
+                <a ng-class="type=='trend'?'tab-item active':'tab-item'" ng-click="changetype('trend')">
                     潮流
                 </a>
-                <a ng-class="type==3?'tab-item active':'tab-item'" ng-click="changetype(3)">
+                <a ng-class="type=='news'?'tab-item active':'tab-item'" ng-click="changetype('news')">
                     最新
                 </a>
             </div>
         </div>
         <div class="icontent">
-            <ion-slides slider="data.slider">
-                <ion-slide-page>
-                    <div class="box banner"><img ng-src="img/demo/banner1.jpg" /></div>  
-                </ion-slide-page>
-                <ion-slide-page>
-                    <div class="box banner"><img ng-src="img/demo/banner2.jpg" /></div>  
-                </ion-slide-page>
-                <ion-slide-page>
-                    <div class="box banner"><img ng-src="img/demo/banner3.jpg" /></div>  
+            <ion-slides   options="data.sliderOptions" slider="data.sliderDelegate">
+                <ion-slide-page ng-repeat="img in index.banner">
+                    <div class="box banner"><img ng-src="{{img.value}}" /></div>  
                 </ion-slide-page>
             </ion-slides>
+             
             <div class="item item-image" style="margin: 20px 0; border: none;">
                 <i class="icon ion-ios-arrow-left" style="font-size: 1.5rem;"></i>
                 <span class="subcontent">
@@ -45,88 +43,30 @@
                 <i class="icon ion-ios-arrow-right" style="font-size: 1.5rem"></i>
             </div>
             <div class="list">
-                <div class="item mainitem" ng-click="todetail()">
+                <div class="item mainitem" ng-click="todetail()" ng-repeat="item in index.dreams">
                     <div class="row">
                         <div class="col">
-                            <img ng-src="img/demo/head6.jpg" />
+                            <img ng-src="{{item.dream_find_user.pic}}" />
                             <div  class="myblock">
-                               <div>喵喵喵喵酱<span class="calm">20岁</span></div>
-                                <div class="mysecond">上海市></div>
-                            </div>
-                        </div>
-                        <div class="col" style="text-align:right">
-                            <div style="margin-top:8px">
-                                <img ng-src="img/heart.png" class="iheart" />
-                                <span class="calm">20123</span>
-                                <span>人关注</span>
-                            </div>
-                            <div class="mysecond">剩余5天</div>
-                        </div>
-                    </div>
-                        <img ng-src="img/demo/pict.png" />
-                    </div>
-                <div class="item mainitem" ng-click="todetail()">
-                    <div class="row">
-                        <div class="col">
-                            <img ng-src="img/demo/head6.jpg" />
-                            <div class="myblock">
-                                <div>喵喵喵喵酱<span class="calm">20岁</span></div>
-                                <div class="mysecond">上海市></div>
+                               <div>{{item.dream_find_user.nickname}}<span class="calm">20岁</span></div>
+                                <div class="mysecond">{{item.dream_find_user.address}}></div>
                             </div>
                         </div>
                         <div class="col" style="text-align:right">
                             <div style="margin-top:8px">
                                 <img ng-src="img/heart.png" class="iheart" />
-                                <span class="calm">20123</span>
+                                <span class="calm">{{item.care_num}}</span>
                                 <span>人关注</span>
                             </div>
-                            <div class="mysecond">剩余5天</div>
+                            <div class="mysecond">剩余{{item.time}}天</div>
                         </div>
                     </div>
-                    <img ng-src="img/demo/pict.png" />
-                </div>
-                <div class="item mainitem" ng-click="todetail()">
-                    <div class="row">
-                        <div class="col">
-                            <img ng-src="img/demo/head6.jpg" />
-                            <div class="myblock">
-                                <div>喵喵喵喵酱<span class="calm">20岁</span></div>
-                                <div class="mysecond">上海市></div>
-                            </div>
-                        </div>
-                        <div class="col" style="text-align:right">
-                            <div style="margin-top:8px">
-                                <img ng-src="img/heart.png" class="iheart" />
-                                <span class="calm">20123</span>
-                                <span>人关注</span>
-                            </div>
-                            <div class="mysecond">剩余5天</div>
-                        </div>
-                    </div>
-                    <img ng-src="img/demo/pict.png" />
-                </div>
-                <div class="item mainitem" ng-click="todetail()">
-                    <div class="row">
-                        <div class="col">
-                            <img ng-src="img/demo/head6.jpg" />
-                            <div class="myblock">
-                                <div>喵喵喵喵酱<span class="calm">20岁</span></div>
-                                <div class="mysecond">上海市></div>
-                            </div>
-                        </div>
-                        <div class="col" style="text-align:right">
-                            <div style="margin-top:8px">
-                                <img ng-src="img/heart.png" class="iheart" />
-                                <span class="calm">20123</span>
-                                <span>人关注</span>
-                            </div>
-                            <div class="mysecond">剩余5天</div>
-                        </div>
+                        <img ng-src="{{item.dream_first_pic.pic}}" />
                     </div>
-                    <img ng-src="img/demo/pict.png" />
-                </div>
             </div>
         </div>
+        <!--上拉更多-->
+        <ion-infinite-scroll ng-if="filter.hasMore" on-infinite="load(false)" distance="10%"></ion-infinite-scroll>
     </ion-content>
     <script id="my-popover.html" type="text/ng-template">
         <ion-popover-view class="pview">