home.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. (function (app) {
  2. app.controller('homeCtrl', ["$scope", "$state", "msg", "$ionicPopover"
  3. , function ($scope, $state, msg, $ionicPopover) {
  4. $scope.type = 1;//tab切换
  5. $scope.changetype = function (type) {
  6. $scope.type = type;
  7. }
  8. $ionicPopover.fromTemplateUrl('my-popover.html', {
  9. scope: $scope
  10. }).then(function (popover) {
  11. $scope.popover = popover;
  12. });
  13. $scope.openPopover = function ($event) {
  14. $scope.popover.show($event);
  15. };
  16. $scope.closePopover = function () {
  17. $scope.popover.hide();
  18. };
  19. $scope.$on('$ionicView.beforeEnter', function () {
  20. });
  21. $scope.todetail = function () {
  22. $state.go('app.home_userdetail');
  23. };
  24. }]);
  25. app.controller('userDetailCtrl', ["$scope", "$state", "msg","homeService", "$ionicTabsDelegate"
  26. , function ($scope, $state, msg, homeService, $ionicTabsDelegate) {
  27. $scope.type = 1;//tab切换
  28. $scope.tosupport = false;
  29. $scope.support = function ($event) {
  30. $event.stopPropagation();
  31. $scope.tosupport = true;
  32. }
  33. $scope.cancelsupport = function () {
  34. $scope.tosupport = false;
  35. }
  36. $scope.changetype = function (type) {
  37. $scope.type = type;
  38. }
  39. $scope.index = 0;
  40. $scope.changeindex = function (index) {
  41. $scope.index = index;
  42. }
  43. $scope.$on('$ionicView.beforeEnter', function () {
  44. $ionicTabsDelegate.showBar(false);
  45. });
  46. $scope.$on('$ionicView.leave', function () {
  47. $ionicTabsDelegate.showBar(true);
  48. });
  49. $scope.vm = {
  50. coin:""
  51. }
  52. $scope.supportDream = function(data){
  53. var data = {
  54. dream_id:"11",
  55. coin:$scope.vm.coin
  56. };
  57. homeService.supportDream(data).then(function(result){
  58. },function(erro){
  59. })
  60. }
  61. }]);
  62. app.controller('searchCtrl', ["$scope","homeService", "$state", "msg", "$ionicTabsDelegate", "$ionicNavBarDelegate"
  63. , function ($scope,homeService, $state, msg, $ionicTabsDelegate, $ionicNavBarDelegate) {
  64. $scope.index = 0;
  65. $scope.index1 = 0;
  66. $scope.vm = {
  67. keywords : ""
  68. }
  69. $scope.ismore = true;
  70. $scope.selectHot = function (index) {
  71. $scope.index = index;
  72. }
  73. $scope.selectHistory = function (index) {
  74. $scope.index1 = index;
  75. }
  76. $scope.showmore = function () {
  77. $scope.ismore = true;
  78. }
  79. $scope.keychange = function () {
  80. $scope.ismore = false;
  81. }
  82. $scope.type = 1;
  83. $scope.changetype = function (type) {
  84. $scope.type = type;
  85. }
  86. $scope.$on('$ionicView.beforeEnter', function () {
  87. $ionicTabsDelegate.showBar(false);
  88. $ionicNavBarDelegate.showBackButton(false);
  89. });
  90. $scope.$on('$ionicView.leave', function () {
  91. $ionicTabsDelegate.showBar(true);
  92. });
  93. $scope.searchContent=function ()
  94. {
  95. var data={
  96. keyword:$scope.vm.keyword
  97. };
  98. homeService.searchContent($scope.vm.keyword).then(function(result){
  99. },function(erro){
  100. });
  101. }
  102. }]);
  103. })(angular.module('app.controllers'));