authorityNameCtrl.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. angular.module('push')
  2. .controller('authorityNameCtrl', function ($scope, $ionicActionSheet, AuthorityService, AuthorityModelService, $stateParams, UserService, UtilService, $ionicHistory, ConfigService, $ionicScrollDelegate) {
  3. var authorityid = $stateParams.authorityid;
  4. var ccomefrom = $stateParams.ccomefrom;
  5. var invite_url = $stateParams.invite_url;
  6. $scope.qrcodeurl = ConfigService.server + "getCloudAutQRCode.action?url=" + invite_url;
  7. //获取权限详情及成员列表
  8. var getAuthorityDetail = function () {
  9. AuthorityService.getAuthorityDetail(authorityid, ccomefrom).then(function (response) {
  10. $scope.currentAuthority = response.cloaut;
  11. $scope.MemberList = response.userList;
  12. $scope.name = $scope.currentAuthority.name;
  13. }, function () {
  14. UtilService.showMess("网络不给力,请稍后重试");
  15. })
  16. };
  17. getAuthorityDetail();
  18. // $ionicHistory.currentView().stateParams = angular.copy($stateParams);
  19. //编辑权限(或添加成员)
  20. $scope.editAuthority = function () {
  21. AuthorityModelService.resetData();
  22. var buttons = [];
  23. if ($scope.currentAuthority.creator == UserService.id) {
  24. buttons = [{text: '<a class="action-sheet-push">编辑</a>'}];
  25. AuthorityModelService.setLocknum(0);
  26. } else {
  27. buttons = [{text: '<a class="action-sheet-push">添加成员</a>'}];
  28. AuthorityModelService.setLocknum($scope.MemberList.length);
  29. }
  30. AuthorityModelService.setAuthorityName($scope.currentAuthority.name);
  31. AuthorityModelService.setMemberList($scope.MemberList);
  32. AuthorityModelService.setCcomefrom(ccomefrom);
  33. AuthorityModelService.setAuthorityId(authorityid);
  34. AuthorityModelService.setInviteUrl(invite_url);
  35. $ionicActionSheet.show({
  36. buttons: buttons,
  37. cancelText: '取消',
  38. buttonClicked: function (index) {
  39. if (index == 0) {
  40. $scope.go('editAuthority')
  41. }
  42. return true;
  43. }
  44. });
  45. };
  46. /* $scope.getScrollPosition = function () {
  47. // var position = $ionicScrollDelegate.getScrollPosition().top;//取这个ion-content滑动TOP值
  48. var domScroll = $(".authorityName_h3").offset().top;//距离页面顶部的距离
  49. if (domScroll >= 100) {
  50. $(".fixedTwo").css("display","block");
  51. }
  52. $scope.$apply();//触发用以更新view
  53. };*/
  54. //隐藏二维码
  55. $scope.hiddenTwoCode = function () {
  56. $(".fixedTwo").css("display", "none");
  57. };
  58. $scope.doRefresh = function () {
  59. $(".fixedTwo").css("display", "block");
  60. $ionicScrollDelegate.$getByHandle('calenderContent').scrollTop();
  61. $scope.$broadcast('scroll.refreshComplete');
  62. };
  63. });