resourceLibraryLocalTypeCtrl.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. angular.module('push')
  2. .controller('resourceLibraryLocalTypeCtrl', function ($scope, $stateParams, $timeout, $ionicActionSheet, SqliteStorageService) {
  3. if($scope.app){
  4. $scope.setStatusBar(0);
  5. }
  6. $scope.reclib = angular.fromJson($stateParams.reclib);
  7. // console.log($scope.reclib);
  8. var getResourceLibrary = function () {
  9. var sql = "select * from conninfofolder where localparentid = " + $scope.reclib.localid;// + " and infocount > 0 "
  10. SqliteStorageService.queryData(sql).then(function (response) {
  11. // console.log(response);
  12. $scope.resourcelibraryclass = response;
  13. }, function () {
  14. });
  15. };
  16. getResourceLibrary();
  17. //私人库资源库搜索
  18. $scope.goResourceSearch = function () {
  19. $timeout(function () {
  20. $scope.go('resourceSearch', {tabindex: 3});
  21. }, 350);
  22. };
  23. //网络异常时点击屏幕重新加载
  24. $scope.repeatLoad = function () {
  25. // console.log("重新加载");
  26. getResourceLibrary();
  27. };
  28. //进入私人资源库详情
  29. $scope.goResorceLibaryDetail = function (reclibc) {
  30. $scope.go('resourceList', {
  31. libtype: reclibc.moduleid,
  32. privateName: $scope.reclib.name,
  33. name: reclibc.name,
  34. reclibid: $scope.reclib.localid,
  35. modlibid: reclibc.localid,
  36. isCloud: $scope.reclib.isCloud
  37. });
  38. };
  39. //打开操作表
  40. $scope.openActionSheet = function () {
  41. $ionicActionSheet.show({
  42. buttons: [
  43. {text: '设置'}
  44. ],
  45. cancelText: '取消',
  46. buttonClicked: function (index) {
  47. if (index == 0) {
  48. $scope.go("authorityLocalSet", {authoritydata: angular.toJson($scope.reclib), type: 1, goflg: 1});
  49. }
  50. return true;
  51. }
  52. });
  53. };
  54. //下拉刷新数据
  55. $scope.refreshData = function () {
  56. $scope.repeatLoad();
  57. $scope.$broadcast('scroll.refreshComplete');
  58. var trHtml = "<div class='refresh_tip_div'>更新了" + $scope.resourcelibraryclass.length + "条内容</div>";
  59. $timeout(function () {
  60. $(".calendarList-content-ul .list").prepend(trHtml);
  61. $(".refresh_tip_div").animate({width: 100 + "%"}, 150);
  62. }, 800);
  63. $timeout(function () {
  64. $(".refresh_tip_div").slideUp();
  65. }, 1200);
  66. };
  67. });