myMessageListCategoryCtrl.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. angular.module('push')
  2. .controller('myMessageListCategoryCtrl', function ($scope,$ionicScrollDelegate, $timeout,$ionicSlideBoxDelegate,MyCollectionService,$stateParams) {
  3. $scope.activity=[];
  4. //TODO
  5. if($scope.app){
  6. $scope.setStatusBar(0);
  7. }
  8. $scope.msgid = $stateParams.messageIndex;
  9. console.log($scope.msgid);
  10. //获取消息类型列表
  11. var getMessageTypeContentList = function () {
  12. $scope.showLoadingToast();
  13. MyCollectionService.getMessageTypeContent().then(function (response) {
  14. $scope.classNameStyle = response.data;
  15. //console.log($scope.classNameStyle);
  16. angular.forEach($scope.classNameStyle,function (value) {
  17. $scope.activity.push({
  18. headerName:value.title,
  19. className:value.classType
  20. });
  21. });
  22. $timeout(function () {
  23. $ionicSlideBoxDelegate.$getByHandle("messageBanner").update();
  24. }, 50);
  25. $timeout(function () {
  26. $scope.$watch($scope.msgid,function(){
  27. commonChaneSlide($scope.msgid);
  28. $ionicSlideBoxDelegate.slide($scope.msgid);
  29. });
  30. }, 55);
  31. $scope.hideLoadingToast();
  32. }, function () {
  33. $scope.hideLoadingToast();
  34. })
  35. };
  36. getMessageTypeContentList();
  37. console.log($scope.activity);
  38. //TODO 放开注释
  39. if($scope.app){
  40. if (device.platform != "Android") {
  41. $scope.isIos=true;
  42. }else{
  43. $scope.isIos=false;
  44. }
  45. }
  46. var commonChaneSlide=function (num) {
  47. //切换到对应页面
  48. /*$scope.act = $scope.activity[num];*/
  49. /************2018****************/
  50. $ionicScrollDelegate.$getByHandle('mainScroll').scrollTop();
  51. $timeout(function () {
  52. $("#orgname").prop("disabled", true);
  53. },50);
  54. /* $scope.act = $scope.activity[num].className;*/
  55. var tablength = $scope.activity.length;//标题个数
  56. var middlewidth = $(window).width() / 2;//获取当前手机屏幕宽度一般
  57. var OffLeft = $(".main-select").eq(num).offset().left;//获取当前点击标题距离父容器左边框的距离
  58. var SelfWidth = $(".main-select").eq(num).width();//获取当前点击标题宽度
  59. var startTranform = $(".visitModule_header .scroll").offset().left+25;
  60. var movewidth = OffLeft - middlewidth + SelfWidth / 2;
  61. startTranform -= movewidth;
  62. if (startTranform <= 0) {
  63. if (num < tablength - 1) {
  64. $('.visitModule_header .scroll').css({
  65. 'transform': 'translate3d(' + startTranform + 'px,0,0)'
  66. });
  67. }
  68. } else if (num < 4) {
  69. $('.visitModule_header .scroll').css({
  70. 'transform': 'translate3d(0,0,0)'
  71. });
  72. }
  73. $(".main-select").eq(num).addClass("arrange_borderBottom").siblings().removeClass("arrange_borderBottom");
  74. $ionicSlideBoxDelegate.slide(num);
  75. };
  76. // 点击页头切换页面
  77. $scope.changeAct = function (num) {
  78. commonChaneSlide(num);
  79. };
  80. $scope.go_changed=function(index){
  81. commonChaneSlide(index);
  82. };
  83. });