angular.module('push')
.controller('authorityNameCtrl', function ($scope, $ionicActionSheet, AuthorityService, AuthorityModelService, $stateParams, UserService, UtilService, $ionicHistory, ConfigService, $ionicScrollDelegate) {
var authorityid = $stateParams.authorityid;
var ccomefrom = $stateParams.ccomefrom;
var invite_url = $stateParams.invite_url;
$scope.qrcodeurl = ConfigService.server + "getCloudAutQRCode.action?url=" + invite_url;
//获取权限详情及成员列表
var getAuthorityDetail = function () {
AuthorityService.getAuthorityDetail(authorityid, ccomefrom).then(function (response) {
$scope.currentAuthority = response.cloaut;
$scope.MemberList = response.userList;
$scope.name = $scope.currentAuthority.name;
}, function () {
UtilService.showMess("网络不给力,请稍后重试");
})
};
getAuthorityDetail();
// $ionicHistory.currentView().stateParams = angular.copy($stateParams);
//编辑权限(或添加成员)
$scope.editAuthority = function () {
AuthorityModelService.resetData();
var buttons = [];
if ($scope.currentAuthority.creator == UserService.id) {
buttons = [{text: '编辑'}];
AuthorityModelService.setLocknum(0);
} else {
buttons = [{text: '添加成员'}];
AuthorityModelService.setLocknum($scope.MemberList.length);
}
AuthorityModelService.setAuthorityName($scope.currentAuthority.name);
AuthorityModelService.setMemberList($scope.MemberList);
AuthorityModelService.setCcomefrom(ccomefrom);
AuthorityModelService.setAuthorityId(authorityid);
AuthorityModelService.setInviteUrl(invite_url);
$ionicActionSheet.show({
buttons: buttons,
cancelText: '取消',
buttonClicked: function (index) {
if (index == 0) {
$scope.go('editAuthority')
}
return true;
}
});
};
/* $scope.getScrollPosition = function () {
// var position = $ionicScrollDelegate.getScrollPosition().top;//取这个ion-content滑动TOP值
var domScroll = $(".authorityName_h3").offset().top;//距离页面顶部的距离
if (domScroll >= 100) {
$(".fixedTwo").css("display","block");
}
$scope.$apply();//触发用以更新view
};*/
//隐藏二维码
$scope.hiddenTwoCode = function () {
$(".fixedTwo").css("display", "none");
};
$scope.doRefresh = function () {
$(".fixedTwo").css("display", "block");
$ionicScrollDelegate.$getByHandle('calenderContent').scrollTop();
$scope.$broadcast('scroll.refreshComplete');
};
});