index.html 4.9 KB

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