123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- angular.module('push')
- .controller('authorityAddMemberCtrl', function ($scope, $stateParams, UserService, UtilService, CommentService, AuthorityService,
- AuthorityModelService, AuthorityModel, ShareService, $timeout, ConfigService) {
- //切换关注、权限
- $scope.act = true;
- $scope.changeTab = function () {
- $scope.act = !$scope.act;
- };
- var authorityid = $stateParams.authid;
- var authoritycomefrom = $stateParams.authcomefrom;
- var useridlist = [];
- $scope.qrcodeurl = ConfigService.server + "getCloudAutQRCode.action?url=" + AuthorityModel.invite_url;
- var initData = function () {
- //获取关注用户列表
- CommentService.getMyAttentionList(0, authorityid, authoritycomefrom).then(function (response) {
- // console.log(response);
- $scope.userList = response.userList;
- }, function () {
- });
- //获取权限列表
- AuthorityService.getAuthorityList(authorityid, authoritycomefrom).then(function (response) {
- // console.log(response);
- $scope.AuthorityList = response.cloautlist;
- }, function () {
- UtilService.showMess("网络不给力,请稍后重试");
- });
- };
- initData();
- var addUser = function () {
- var useridstr = useridlist.join(',');
- AuthorityService.editAuthority(2, authorityid, authoritycomefrom, "", useridstr).then(function (response) {
- // console.log(response);
- AuthorityModel.editmemberflg = true;
- }, function () {
- UtilService.showMess("网络不给力,请稍后重试");
- });
- };
- //关注用户添加
- $scope.addMember = function (user, index) {
- useridlist = [];
- $scope.userList[index].isExisits = 1;
- useridlist.push(user.userId);
- addUser();
- };
- //批量导入权限
- $scope.addAuthority = function (authority, index) {
- useridlist = [];
- $scope.AuthorityList[index].isadd = 1;
- angular.forEach($scope.AuthorityList[index].userList, function (data, ind) {
- $scope.AuthorityList[index].userList[ind].isExisits = 1;
- useridlist.push($scope.AuthorityList[index].userList[ind].userId);
- });
- addUser();
- };
- //单个导入权限下用户
- $scope.addAuthorityMember = function (authority, user, index) {
- useridlist = [];
- var i = $scope.AuthorityList.indexOf(authority);
- $scope.AuthorityList[i].userList[index].isExisits = 1;
- useridlist.push($scope.AuthorityList[i].userList[index].userId);
- addUser();
- };
- //是否现在权限下用户
- $scope.showMember = function (index) {
- $scope.AuthorityList[index].showlist = !$scope.AuthorityList[index].showlist;
- };
- $scope.goUserSearch = function () {
- $scope.go('userSearch', {searchtype: 1, isset: 1, authorityid: authorityid, authoritycomefrom: authoritycomefrom});
- };
- $scope.goGroupCreate = function () {
- AuthorityModelService.isfirst = 0;
- $scope.go('groupCreate');
- };
- $scope.openShare = function () {
- $scope.showshare = true;
- };
- $scope.cancelShare = function () {
- $scope.showshare = false;
- };
- //隐藏二维码
- $scope.hiddenTwoCode = function () {
- $(".fixedTwo").css("display", "none");
- };
- //0:QQ,1:QQ空间,2:微信,3:微信朋友圈,4:新浪微博,5:邀请二维码
- $scope.shareMessage = function (type) {
- $scope.showshare = false;
- $scope.showLoadingToast();
- var title = '"' + UserService.user.user.userName + '"邀请你加入' + AuthorityModel.getReclibName();
- var message = {
- title: title,
- description: "使用对接宝、随时随地体验高效便捷",
- url: AuthorityModel.invite_url,
- imageurl: "http://pic.ubittc.com/group3/M00/04/31/wKjILFkIQKWACad2AABJ-vCWu_4719.jpg"
- };
- switch (type) {
- case 0:
- case 1:
- ShareService.shareToQQ(type, message).then(function () {
- UtilService.showMess("QQ分享成功");
- $scope.hideLoadingToast();
- }, function (error) {
- UtilService.showMess(error);
- $scope.hideLoadingToast();
- });
- break;
- case 2:
- case 3:
- ShareService.shareToWechat(0, message).then(function () {
- UtilService.showMess("微信分享成功");
- $scope.hideLoadingToast();
- }, function (error) {
- UtilService.showMess(error);
- $scope.hideLoadingToast();
- });
- break;
- case 4:
- ShareService.shareToWeibo(message).then(function () {
- UtilService.showMess("新浪微博分享成功");
- $scope.hideLoadingToast();
- }, function (error) {
- UtilService.showMess(error);
- $scope.hideLoadingToast();
- });
- break;
- case 5:
- $(".fixedTwo").css("display", "block");
- $scope.hideLoadingToast();
- break;
- default:
- break;
- }
- $timeout(function () {
- $scope.hideLoadingToast();
- }, 10000);
- };
- });
|