Mike 7 years ago
parent
commit
8106665a15
2 changed files with 39 additions and 5 deletions
  1. 36 5
      miaomiao/www/js/controllers/home.js
  2. 3 0
      miaomiao/www/templates/home/index.html

+ 36 - 5
miaomiao/www/js/controllers/home.js

@@ -1,6 +1,6 @@
 (function (app) {
 (function (app) {
-    app.controller('homeCtrl', ["$scope", "$ionicTabsDelegate","$http", 'config', "$state", "msg", "$ionicPopover", "homeService"
-        , function ($scope, $ionicTabsDelegate,$http, config, $state, msg, $ionicPopover, homeService) {
+    app.controller('homeCtrl', ["$scope", "$ionicTabsDelegate","$http", 'config', "$state", "msg", "$ionicPopover", "homeService","$ionicPopup"
+        , function ($scope, $ionicTabsDelegate,$http, config, $state, msg, $ionicPopover, homeService,$ionicPopup) {
             $scope.$on('$ionicView.beforeEnter', function (viewResult) {
             $scope.$on('$ionicView.beforeEnter', function (viewResult) {
                 $ionicTabsDelegate.showBar(true);
                 $ionicTabsDelegate.showBar(true);
             });
             });
@@ -16,6 +16,36 @@
         }).then(function (popover) {
         }).then(function (popover) {
             $scope.popover = popover;
             $scope.popover = popover;
         });
         });
+
+        $scope.openFilter = function ($event) {
+             // 一个精心制作的自定义弹窗
+           var myPopup = $ionicPopup.show({
+             template: '请选择<select><option value="opel">性别</option><option value="audi">Audi</option></select>  <br>请选择<select><option value="opel">地区</option><option value="audi">Audi</option></select>',
+             title: '筛选',
+             scope: $scope,
+             buttons: [
+               { text: '取消' },
+               {
+                 text: '<b>提交</b>',
+                 type: 'button-positive',
+                 onTap: function(e) {
+                   if (!$scope.data.wifi) {
+                     //不允许用户关闭,除非他键入wifi密码
+                     e.preventDefault();
+                   } else {
+                     return $scope.data.wifi;
+                   }
+                 }
+               },
+             ]
+           });
+           myPopup.then(function(res) {
+             console.log('Tapped!', res);
+           });
+           $timeout(function() {
+              myPopup.close(); //由于某种原因3秒后关闭弹出
+           }, 3000);
+        };
         $scope.openPopover = function ($event) {
         $scope.openPopover = function ($event) {
             $scope.popover.show($event);
             $scope.popover.show($event);
         };
         };
@@ -114,6 +144,7 @@
         $scope.load(true);
         $scope.load(true);
         $scope.$on('$ionicView.beforeLeave', function () {
         $scope.$on('$ionicView.beforeLeave', function () {
             $scope.popover.hide();
             $scope.popover.hide();
+            $scope.load(true);
         });
         });
     }]);
     }]);
 
 
@@ -478,9 +509,9 @@
             // $scope.closeSupportmodal = function() {
             // $scope.closeSupportmodal = function() {
             //     $scope.supportmodal.hide();
             //     $scope.supportmodal.hide();
             // };
             // };
-        $scope.openSupport = function () {
-            msg.alert("支持乘数","支持乘数支持乘数支持乘数支持乘数");
-        };
+            $scope.openSupport = function () {
+                msg.alert("支持乘数","支持乘数支持乘数支持乘数支持乘数");
+            };
             $scope.multi = {
             $scope.multi = {
                 a: '',
                 a: '',
                 b: '',
                 b: '',

+ 3 - 0
miaomiao/www/templates/home/index.html

@@ -3,6 +3,9 @@
         <button class="button button-clear homeIcon" ng-click="openPopover($event)">
         <button class="button button-clear homeIcon" ng-click="openPopover($event)">
             <img src="img/icon_menu.svg" style="height: 60%; width: 100%; margin-top: 7px">
             <img src="img/icon_menu.svg" style="height: 60%; width: 100%; margin-top: 7px">
         </button>
         </button>
+        <button class="button button-clear homeIcon" ng-click="openFilter()">
+            <img src="img/icon_menu.svg" style="height: 60%; width: 100%; margin-top: 7px">
+        </button>
     </ion-nav-buttons>
     </ion-nav-buttons>
     <ion-nav-buttons side="right">
     <ion-nav-buttons side="right">
         <button class="button button-clear homeIcon" ui-sref="app.home_search" style="margin: 4px 10px 0 0">
         <button class="button button-clear homeIcon" ui-sref="app.home_search" style="margin: 4px 10px 0 0">