123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319 |
- angular.module('push')
- .controller('CloudFolderDetailCtrl', function ($scope, $stateParams, ModelService, UtilService, $ionicHistory, ShareService, ResourceLibraryService,
- DockingService, $ionicActionSheet, UserService, $timeout, $ionicListDelegate) {
- //TODO
- if($scope.app){
- $scope.setStatusBar(0);
- }
- var cloudfolder = angular.fromJson($stateParams.folder);
- $scope.name = cloudfolder.name;
- var checkedresource = {};//单个分享时选中的资源
- var checkedindex = -1;//多个分享时第一个选择的索引
- $scope.checkedresourcelist = [];//多个分享时选中的资源
- $scope.userid = UserService.id;
- $scope.isload = false;
- var currentPage = 1;
- //获取云文件夹内容
- $scope.initConninfoList = function () {
- currentPage = 1;
- $scope.showLoadingToast();
- DockingService.newGetConnInfoList(cloudfolder.id, cloudfolder.level, currentPage).then(function (response) {
- // console.log(response);
- // isSet 是否有权限设置:0无 1有
- $scope.isSet = response.isSet;
- $scope.smallfolderlist = response.connFolderlist;
- $scope.recordList = response.list;
- //判断是否有下一页
- $timeout(function () {
- if (currentPage >= response.page.totalPage) {
- $scope.isload = false;
- } else {
- $scope.isload = true;
- currentPage = 2;
- }
- }, 1000);
- }, function () {
- }).finally(function () {
- $scope.hideLoadingToast();
- $scope.$broadcast('scroll.refreshComplete');
- });
- };
- $scope.initConninfoList();
- $scope.loadMore = function () {
- $scope.isload = false;
- $scope.showLoadingToast();
- DockingService.newGetConnInfoList(cloudfolder.id, cloudfolder.level, currentPage).then(function (response) {
- // console.log(response);
- if (response.list.length > 0) {
- $scope.recordList = $scope.recordList.concat(response.list);
- }
- //判断是否有下一页
- $timeout(function () {
- if (currentPage >= response.page.totalPage) {
- $scope.isload = false;
- } else {
- $scope.isload = true;
- currentPage++;
- }
- }, 1000);
- }, function () {
- }).finally(function () {
- $scope.hideLoadingToast();
- $scope.$broadcast('scroll.infiniteScrollComplete');
- });
- };
- $scope.showMoreAction = true;
- $scope.showAction = function () {
- $scope.showMoreAction = !$scope.showMoreAction;
- };
- //新建记录
- $scope.createConninfo = function () {
- ModelService.setCreateType(1);
- $scope.go('cloudAddConnInfo');
- };
- //创建子文件夹
- $scope.createFolder = function () {
- $scope.go("authorityCreate", {
- parentid: cloudfolder.id,
- level: cloudfolder.level,
- authorityid: cloudfolder.authorityid,
- authoritycomefrom: cloudfolder.authoritycomefrom,
- templettype: 1
- });
- };
- //进入分类详情,记录列表
- $scope.queryFolder = function (folder) {
- $scope.go('cloudFolderDetail', {folder: angular.toJson(folder)});
- };
- //侧滑设置文件夹
- $scope.goAutoritySet = function (folder) {
- $scope.go("authoritySet", {
- reclibid: folder.id,
- authorityid: folder.authorityid,
- authoritycomefrom: folder.authoritycomefrom,
- name: folder.name,
- content: folder.content,
- sort: folder.sort,
- goflg: 0,
- type: 0,
- parentid: folder.parentid
- });
- };
- //修改云文件夹
- $scope.editCloudFolder = function () {
- $ionicActionSheet.show({
- buttons: [{text: '<a class="action-sheet-push">设置</a>'}],
- cancelText: '取消',
- buttonClicked: function (index) {
- if (index == 0) {
- $scope.go("authoritySet", {
- reclibid: cloudfolder.id,
- authorityid: cloudfolder.authorityid,
- authoritycomefrom: cloudfolder.authoritycomefrom,
- name: cloudfolder.name,
- content: cloudfolder.content,
- sort: cloudfolder.sort,
- goflg: 1,
- type: 0,
- parentid: cloudfolder.parentid
- });
- }
- return true;
- }
- });
- };
- //点击进入对接详情
- $scope.goDockingdetails = function (rec, ind) {
- // 走企业模版
- if(rec.templettype == 2){
- $scope.go("technicalBrokerCompanyInfo", {connid: rec.id});
- }else if(rec.templettype == 1){
- if (selectflg) {
- selectResource(rec, ind);
- } else {
- $scope.go("cloudDockingdetail", {infoid: rec.id, infocomefrom: rec.creatorcomefrom, creator: rec.creator});
- }
- }
- };
- $scope.shareflg = false;
- $scope.openShare = function (tempobj, ind) {
- $timeout(function () {
- $ionicListDelegate.closeOptionButtons();
- }, 200);
- if (UserService.viplevel == 1) {
- ResourceLibraryService.getVisitAuthority(0, tempobj.id, tempobj.creator, "000000000", 81).then(function (response) {
- // isedit:是否可以编辑资源,isset:是否可以设置权限,bl:是否可以访问
- if (response.bl) {
- $scope.go('chooseShareFolder', {
- chereslist: angular.toJson([tempobj.id]),
- folderid: cloudfolder.id,
- isCloud: cloudfolder.isCloud
- });
- } else {
- UtilService.showMess("您没有该条记录的权限,暂时无法复制");
- }
- }, function () {
- UtilService.showMess("网络不给力,请稍后重试");
- });
- } else {
- $scope.go('chooseShareFolder', {
- chereslist: angular.toJson([tempobj.id]),
- folderid: cloudfolder.id,
- isCloud: cloudfolder.isCloud
- });
- }
- /*$scope.shareflg = true;
- $(".resource_wrap").css("left", "0%");
- $(".pay_list_c2").css("left", "-35px");
- $("#collect-bottom").css("display", "none");
- checkedresource = tempobj;
- checkedindex = ind;*/
- };
- $scope.closeShare = function () {
- $timeout(function () {
- $ionicListDelegate.closeOptionButtons();
- }, 10);
- $scope.shareflg = false;
- };
- //分享选择操作表
- var selectflg = false;//列表选择打开标志
- $scope.openCollectShare = function () {
- selectflg = true;
- $scope.recordList[checkedindex].value = true;
- var tempres = {
- infoid: checkedresource.id,
- infocomefrom: checkedresource.creatorcomefrom,
- infoType: 81,
- claid: cloudfolder.id
- };
- $scope.checkedresourcelist.push(tempres);
- $(".item-options").addClass("invisible");
- $(".resource_wrap").css("left", "10%");
- $(".pay_list_c2").css("left", "4%");
- $(".item-content").css("transform", "translate3d(0px, 0px, 0px)");
- $("#collect-bottom").css("display", "block");
- $scope.closeShare();
- };
- //取消分享
- $scope.cancelShare = function () {
- angular.forEach($scope.recordList, function (value, ind) {
- $scope.recordList[ind].value = false;
- });
- $scope.checkedresourcelist = [];
- $(".resource_wrap").css("left", "0%");
- $(".pay_list_c2").css("left", "-35px");
- $("#collect-bottom").css("display", "none");
- selectflg = false;
- };
- var selectResource = function (rec, ind) {
- var tempres = {
- infoid: rec.id,
- infocomefrom: rec.creatorcomefrom,
- infoType: 81,
- claid: cloudfolder.id
- };
- var chind = -1;
- angular.forEach($scope.checkedresourcelist, function (value, index) {
- if (value.infoid == rec.id) {
- chind = index;
- }
- });
- if (chind == -1) {
- $scope.recordList[ind].value = true;
- $scope.checkedresourcelist.unshift(tempres);
- } else {
- $scope.recordList[ind].value = false;
- $scope.checkedresourcelist.splice(chind, 1);
- }
- // console.log($scope.checkedresourcelist);
- };
- $scope.shareResourceToPrilib = function () {
- $scope.go('chooseShareFolder', {
- chereslist: angular.toJson($scope.checkedresourcelist),
- folderid: cloudfolder.id
- });
- };
- //跳转工具搜索
- $scope.goToolsSearch = function () {
- $timeout(function () {
- $scope.go("connsearch", {folderid: cloudfolder.id});
- }, 300);
- };
- //0:QQ,1:QQ空间,2:微信,3:微信朋友圈,4:新浪微博
- $scope.shareMessage = function (type) {
- $scope.shareflg = false;
- $scope.showLoadingToast();
- var imagurl = "http://test.ubitech.cn/000000000/themes/avatar_save/1490753632823.jpg";
- if (checkedresource.image.length > 0) {
- imagurl = $scope.imgUrl + checkedresource.image;
- }
- var message = {
- title: checkedresource.title,
- description: checkedresource.content.substring(0, 19),
- url: checkedresource.share_url,
- imageurl: imagurl
- };
- 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;
- default:
- break;
- }
- $timeout(function () {
- $scope.hideLoadingToast();
- }, 10000);
- };
- $scope.refreshDate = function () {
- $scope.initConninfoList();
- $scope.$broadcast('scroll.refreshComplete');
- var trHtml = "<div class='refresh_tip_div'>更新了" + $scope.recordList.length + "条内容</div>";
- $timeout(function () {
- $(".resourcelistDiv .list").prepend(trHtml);
- $(".refresh_tip_div").animate({width: 100 + "%"}, 150);
- }, 800);
- $timeout(function () {
- $(".refresh_tip_div").slideUp();
- }, 1200);
- };
- //页面加载完成,设置当前文件夹为选中文件夹
- $scope.$on('$ionicView.afterEnter', function () {
- ModelService.setCheckdeFolder(cloudfolder);
- });
- });
|