angular.module('push') .controller('myMessageListCategoryCtrl', function ($scope,$ionicScrollDelegate, $timeout,$ionicSlideBoxDelegate,MyCollectionService,$stateParams) { $scope.activity=[]; //TODO if($scope.app){ $scope.setStatusBar(0); } $scope.msgid = $stateParams.messageIndex; console.log($scope.msgid); //获取消息类型列表 var getMessageTypeContentList = function () { $scope.showLoadingToast(); MyCollectionService.getMessageTypeContent().then(function (response) { $scope.classNameStyle = response.data; //console.log($scope.classNameStyle); angular.forEach($scope.classNameStyle,function (value) { $scope.activity.push({ headerName:value.title, className:value.classType }); }); $timeout(function () { $ionicSlideBoxDelegate.$getByHandle("messageBanner").update(); }, 50); $timeout(function () { $scope.$watch($scope.msgid,function(){ commonChaneSlide($scope.msgid); $ionicSlideBoxDelegate.slide($scope.msgid); }); }, 55); $scope.hideLoadingToast(); }, function () { $scope.hideLoadingToast(); }) }; getMessageTypeContentList(); console.log($scope.activity); //TODO 放开注释 if($scope.app){ if (device.platform != "Android") { $scope.isIos=true; }else{ $scope.isIos=false; } } var commonChaneSlide=function (num) { //切换到对应页面 /*$scope.act = $scope.activity[num];*/ /************2018****************/ $ionicScrollDelegate.$getByHandle('mainScroll').scrollTop(); $timeout(function () { $("#orgname").prop("disabled", true); },50); /* $scope.act = $scope.activity[num].className;*/ var tablength = $scope.activity.length;//标题个数 var middlewidth = $(window).width() / 2;//获取当前手机屏幕宽度一般 var OffLeft = $(".main-select").eq(num).offset().left;//获取当前点击标题距离父容器左边框的距离 var SelfWidth = $(".main-select").eq(num).width();//获取当前点击标题宽度 var startTranform = $(".visitModule_header .scroll").offset().left+25; var movewidth = OffLeft - middlewidth + SelfWidth / 2; startTranform -= movewidth; if (startTranform <= 0) { if (num < tablength - 1) { $('.visitModule_header .scroll').css({ 'transform': 'translate3d(' + startTranform + 'px,0,0)' }); } } else if (num < 4) { $('.visitModule_header .scroll').css({ 'transform': 'translate3d(0,0,0)' }); } $(".main-select").eq(num).addClass("arrange_borderBottom").siblings().removeClass("arrange_borderBottom"); $ionicSlideBoxDelegate.slide(num); }; // 点击页头切换页面 $scope.changeAct = function (num) { commonChaneSlide(num); }; $scope.go_changed=function(index){ commonChaneSlide(index); }; });