index.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <include file="public@header"/>
  2. <style>
  3. .home-info li em {
  4. float: left;
  5. width: 120px;
  6. font-style: normal;
  7. font-weight: bold;
  8. }
  9. .home-info ul {
  10. padding: 0;
  11. margin: 0;
  12. }
  13. .panel {
  14. margin-bottom: 0;
  15. }
  16. .grid-sizer {
  17. width: 10%;
  18. }
  19. .grid-item {
  20. margin-bottom: 5px;
  21. padding: 5px;
  22. }
  23. .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
  24. padding-left: 5px;
  25. padding-right: 5px;
  26. float: none;
  27. }
  28. </style>
  29. <hook name="admin_before_head_end"/>
  30. </head>
  31. <body>
  32. <h1>培训后台</h1>
  33. <script src="__STATIC__/js/admin.js"></script>
  34. <php>
  35. $lang_set=defined('LANG_SET')?LANG_SET:'';
  36. $thinkcmf_version=cmf_version();
  37. </php>
  38. <script>
  39. Wind.css('dragula');
  40. Wind.use('masonry', 'imagesloaded', 'dragula', function () {
  41. var $homeGrid = $('.home-grid').masonry({
  42. // set itemSelector so .grid-sizer is not used in layout
  43. itemSelector: '.grid-item',
  44. // use element for option
  45. columnWidth: '.grid-sizer',
  46. percentPosition: true,
  47. horizontalOrder: false,
  48. transitionDuration: 0
  49. });
  50. $homeGrid.masonry('on', 'layoutComplete', function (event, laidOutItems) {
  51. });
  52. $homeGrid.masonry();
  53. var containers = [];
  54. $('.home-grid .grid-item').each(function () {
  55. containers.push(this);
  56. });
  57. dragula(containers, {
  58. isContainer: function (el) {
  59. return false; // only elements in drake.containers will be taken into account
  60. },
  61. moves: function (el, source, handle, sibling) {
  62. return true; // elements are always draggable by default
  63. },
  64. accepts: function (el, target, source, sibling) {
  65. return true; // elements can be dropped in any of the `containers` by default
  66. },
  67. invalid: function (el, handle) {
  68. return false; // don't prevent any drags from initiating by default
  69. },
  70. direction: 'vertical', // Y axis is considered when determining where an element would be dropped
  71. copy: false, // elements are moved by default, not copied
  72. copySortSource: false, // elements in copy-source containers can be reordered
  73. revertOnSpill: false, // spilling will put the element back where it was dragged from, if this is true
  74. removeOnSpill: false, // spilling will `.remove` the element, if this is true
  75. mirrorContainer: document.body, // set the element that gets mirror elements appended
  76. ignoreInputTextSelection: true // allows users to select input text, see details below
  77. }).on('drop', function (el, target, source, sibling) {
  78. var $target = $(target);
  79. var targetClasses = $target.attr('class');
  80. var targetDataWidget = $target.data('widget');
  81. var targetDataSystem = $target.data('system');
  82. var $source = $(source);
  83. var sourceClasses = $source.attr('class');
  84. var sourceDataWidget = $source.data('widget');
  85. var sourceDataSystem = $source.data('system');
  86. $(source).append($(target).find('.dashboard-box').not('.gu-transit'));
  87. $(target).append(el);
  88. $target.attr('class', sourceClasses);
  89. $target.data('widget', sourceDataWidget);
  90. $target.data('system', sourceDataSystem);
  91. $source.attr('class', targetClasses);
  92. $source.data('widget', targetDataWidget);
  93. $source.data('system', targetDataSystem);
  94. $homeGrid.masonry();
  95. _widgetSort();
  96. }).on('shadow', function (el, container, source) {
  97. $homeGrid.masonry();
  98. });
  99. });
  100. function _widgetSort() {
  101. var widgets = [];
  102. $('.home-grid .grid-item').each(function () {
  103. var $this = $(this);
  104. widgets.push({
  105. name: $this.data('widget'),
  106. is_system: $this.data('system')
  107. });
  108. });
  109. $.ajax({
  110. url: "{:url('main/dashboardWidget')}",
  111. type: 'post',
  112. dataType: 'json',
  113. data: {widgets: widgets},
  114. success: function (data) {
  115. },
  116. error: function () {
  117. },
  118. complete: function () {
  119. }
  120. });
  121. }
  122. //获取官方通知
  123. $.getJSON("//www.thinkcmf.com/service/sms_jsonp.php?lang={$lang_set}&v={$thinkcmf_version}&callback=?",
  124. function (data) {
  125. var tpl = '<li><em class="title"></em><span class="content"></span></li>';
  126. var $notices = $("#thinkcmf-notices");
  127. $notices.empty();
  128. if (data.length > 0) {
  129. $('#thinkcmf-notices-grid').show();
  130. $.each(data, function (i, n) {
  131. var $tpl = $(tpl);
  132. $(".title", $tpl).html(n.title);
  133. $(".content", $tpl).html(n.content);
  134. $notices.append($tpl);
  135. });
  136. } else {
  137. $notices.append("<li>^_^,{:lang('NO_NOTICE')}~~</li>");
  138. }
  139. });
  140. </script>
  141. <hook name="admin_before_body_end"/>
  142. </body>
  143. </html>