angular.module('push') .controller('resourceLibraryPrivateCtrl', function ($scope, $stateParams, $timeout, $ionicActionSheet, resourceLibraryTempData, ResourceLibraryService) { //TODO if($scope.app){ $scope.setStatusBar(0); } $scope.reclib = angular.fromJson($stateParams.reclib); var getResourceLibrary = function () { ResourceLibraryService.getResourceLibrary("", $scope.reclib.id).then(function (response) { $scope.resourcelibraryclass = response; }, function () { //TODO if ($scope.resourcelibraryclass.length == 0) { $scope.shownone = true; } }) }; getResourceLibrary(); //私人库资源库搜索 $scope.goResourceSearch = function () { $timeout(function () { $scope.go('resourceSearch', {tabindex: 3}); }, 350); }; //网络异常时点击屏幕重新加载 $scope.repeatLoad = function () { getResourceLibrary(); }; //进入私人资源库详情 $scope.goResorceLibaryDetail = function (reclibc) { resourceLibraryTempData.setCategoryIndex(0); resourceLibraryTempData.resetChecked(); if ($scope.reclib.fixtype == 1) { $scope.go('publicResource', { libtype: reclibc.moduleid, name: reclibc.name, reclibid: $scope.reclib.id, modlibid: reclibc.id }); } else { $scope.go('privateResource', { reclib: angular.toJson($scope.reclib), privateName: reclibc.name, libtype: reclibc.moduleid, modlibid: reclibc.id }); } }; //打开操作表 $scope.openActionSheet = function () { $ionicActionSheet.show({ buttons: [ {text: '设置'} ], cancelText: '取消', buttonClicked: function (index) { if (index == 0) { $scope.go("authoritySet", { reclibid: $scope.reclib.id, authorityid: $scope.reclib.authorityid, authoritycomefrom: $scope.reclib.authoritycomefrom, name: $scope.reclib.name, content: $scope.reclib.content, sort: $scope.reclib.sort, goflg: 1, type: 1, parentid: $scope.reclib.parentid }); } return true; } }); }; //下拉刷新数据 $scope.refreshData = function () { $scope.repeatLoad(); $scope.$broadcast('scroll.refreshComplete'); var trHtml = "
更新了" + $scope.resourcelibraryclass.length + "条内容
"; $timeout(function () { $(".calendarList-content-ul .list").prepend(trHtml); $(".refresh_tip_div").animate({width: 100 + "%"}, 150); }, 800); $timeout(function () { $(".refresh_tip_div").slideUp(); }, 1200); }; });