mapLibrary.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /**
  2. * @fileoverview 专题图 模块
  3. * @author Song.Huang
  4. * @version 1.0.0
  5. */
  6. define([
  7. 'html!templates/atlas/atlasList',
  8. 'modDir/service/regionSearch',
  9. 'css!styles/atlas/atlasList'
  10. ], function(tplLayout,regionSearchF) {
  11. /**
  12. * 模块数据 用于数据存储和外部调用
  13. * @type {Object}
  14. * 数据存放
  15. */
  16. var modValue = {
  17. options : {
  18. page: 1, //页数
  19. pageSize: 24, //每页条数
  20. searchType: 'byPage', //搜索类型
  21. searchKeyWord: '', //搜索关键字
  22. searchId: 0, //搜索ID
  23. theme: null, //分类
  24. region: '', //当前区域 0 全球
  25. area: ''
  26. },
  27. //查询数据集合
  28. thematicDataResult:null,
  29. //专题图分类
  30. thematicCategory:[]
  31. }
  32. /**
  33. * 状态值
  34. * @type {Boolean}
  35. * @default false
  36. * @private
  37. */
  38. var status = {
  39. initialized:false,
  40. showSideBar:false
  41. };
  42. var overLayerOpacityControl;
  43. /**
  44. * 初始化容器
  45. * @type {Function}
  46. */
  47. function init(idx) {
  48. //未初始化,初始化布局
  49. // if (idx == 0) {
  50. if (!status.initialized) {
  51. //设置容器布局
  52. setLayout();
  53. bindEvent();
  54. //订阅推送
  55. subscribe();
  56. status.initialized = true;
  57. }
  58. // ONEMAP.C.publisher.publish({
  59. // modName: 'map-library'
  60. // }, 'menuListClick');
  61. };
  62. /**
  63. * 初始化布局
  64. */
  65. function setLayout(){
  66. // $("#map-library").addClass("active");
  67. };
  68. /**
  69. * 窗口布局重置
  70. * @type {Function}
  71. */
  72. function layoutResize() {
  73. };
  74. /**
  75. * 界面事件绑定
  76. * @return {[type]} [description]
  77. */
  78. function bindEvent(){
  79. $("#map-library .im-1 .fu").on("click", function (){
  80. // ONEMAP.C.publisher.publish('handHide','layout::sideBar');
  81. var idx = $(this).parent().index() + 1;
  82. if(idx == 1){
  83. ONEMAP.D.user.searchType = 1;
  84. require(['modDir/atlas/atlasList'], function(atlasList) {
  85. atlasList.init(idx);
  86. status.showSideBar = true;
  87. });
  88. }
  89. else{
  90. ONEMAP.D.user.searchType = 2;
  91. require(['modDir/atlas/atlasList'], function(atlasList) {
  92. atlasList.init();
  93. require(['modDir/atlas/atlasCategory'], function(atlasCategory) {
  94. ONEMAP.C.publisher.publish('handShow','layout::sideBar');
  95. status.showSideBar = true;
  96. atlasCategory.init(idx);
  97. });
  98. });
  99. }
  100. })
  101. // 侧栏开关
  102. $("#map-library p").eq(0).on('click',function(){
  103. if(status.showSideBar){
  104. // $("#map-library").removeClass("active");
  105. ONEMAP.C.publisher.publish('handHide','layout::sideBar');
  106. status.showSideBar = false;
  107. }else{
  108. // $("#map-library").addClass("active");
  109. status.showSideBar = true;
  110. }
  111. })
  112. }
  113. /**
  114. * 注册监听
  115. * @type {Function}
  116. */
  117. function subscribe() {
  118. // ONEMAP.C.publisher.subscribe(removeCurrentOverLayer, 'cleanMap');
  119. };
  120. /**
  121. * 移除事件
  122. * @type {Function}
  123. */
  124. function remove() {
  125. }
  126. return ONEMAP.M.mapLibrary = {
  127. init: init
  128. };
  129. });