sideBar.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /**
  2. * [ONEMAP.M.sideBar]
  3. * @return {[object]}
  4. */
  5. define([
  6. 'html!templates/sideBar',
  7. 'css!styles/sideBar'
  8. ], function(tplLayout) {
  9. /**
  10. * 模块数据 用于数据存储和外部调用
  11. * @type {Object}
  12. * 数据存放
  13. */
  14. var modValue = {
  15. //用于输出侧栏模块的zindex值,取完加一
  16. modZIndex:1
  17. }
  18. function init() {
  19. setLayout();
  20. bindEvent();
  21. }
  22. function setLayout() {
  23. $(tplLayout).appendTo($("#sideBar .cover-content"));
  24. if(ONEMAP.D.user.guest){
  25. $('#sideLinkFav').remove();
  26. $('#sideLinkGcms').remove();
  27. }
  28. }
  29. function bindEvent() {
  30. //$("#sideBar").bind("mouseleave",function(){
  31. // ONEMAP.C.publisher.publish('hide', 'layout::sideBar');
  32. // if(ONEMAP.M.tdEarth){
  33. // $("#openTdSideContent").show();
  34. // }
  35. //})
  36. //关闭侧栏
  37. $('.abtn-mini-side-bar').bind('click', function() {
  38. //ONEMAP.C.publisher.publish('hide', 'layout::sideBar');
  39. //if(ONEMAP.M.tdEarth){
  40. //$("#openTdSideContent").show();
  41. //}
  42. if($('.abtn-mini-side-bar').hasClass('close')){
  43. $('.abtn-mini-side-bar').removeClass('close')
  44. }else{
  45. $('.abtn-mini-side-bar').addClass('close')
  46. }
  47. });
  48. //专题地图更多
  49. $("#sideBarHeader .abtn-atlas").bind("click",function(){
  50. require(['modDir/atlas/atlasList'],function(atlasList){
  51. atlasList.init();
  52. });
  53. });
  54. //GCMS
  55. $("#sideBarHeader .abtn-gcms").bind("click",function(){
  56. require(['modDir/gcms/gcmsNav'],function(gcmsNav){
  57. gcmsNav.init();
  58. });
  59. });
  60. //海量地图库
  61. $("#sideBarHeader .abtn-atlas-labrary").bind("click",function(){
  62. var windowOpen = window.open();
  63. var openUrl = onemapUrlConfig.atlasLibraryUrl;
  64. windowOpen.location = openUrl;
  65. });
  66. //三维数据
  67. $("#sideBarHeader .abtn-3dData").bind("click",function(){
  68. require(['modDir/tools/toolFor3d'],function(toolFor3d){
  69. toolFor3d.init();
  70. })
  71. });
  72. //我的收藏
  73. // $("#sideBarHeader .abtn-myFav").bind("click",function(){
  74. // require(['modDir/user/userCenter'], function(userCenter) {
  75. // userCenter.init('userFav');
  76. // });
  77. // });
  78. }
  79. /**
  80. * 用于侧栏模块获取zIndex
  81. * @return {[type]} [description]
  82. */
  83. function getZIndex(){
  84. return modValue.modZIndex++;
  85. }
  86. return ONEMAP.M.sideBar = {
  87. init: init,
  88. getZIndex:getZIndex
  89. };
  90. });