index.html 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <php>
  2. if (!function_exists('_get_system_widget')) {
  3. function _get_system_widget($name){
  4. </php>
  5. <switch name="name">
  6. <case value="CmfHub">
  7. <div class="panel panel-default">
  8. <div class="panel-heading">
  9. <h3 class="panel-title">使用</h3>
  10. </div>
  11. <div class="panel-body home-info">
  12. <ul class="list-unstyled">
  13. <li>
  14. <em>官网</em> <span><a href="http://www.thinkcmf.com" target="_blank">www.thinkcmf.com</a></span>
  15. </li>
  16. <li><em>QQ 群</em> <span>100828313,316669417</span></li>
  17. <li><em>联系邮箱</em> <span>catman@thinkcmf.com</span></li>
  18. </ul>
  19. </div>
  20. </div>
  21. </case>
  22. </switch>
  23. <php>
  24. }
  25. }
  26. </php>
  27. <include file="public@header"/>
  28. <style>
  29. .home-info li em {
  30. float: left;
  31. width: 120px;
  32. font-style: normal;
  33. font-weight: bold;
  34. }
  35. .home-info ul {
  36. padding: 0;
  37. margin: 0;
  38. }
  39. .panel {
  40. margin-bottom: 0;
  41. }
  42. .grid-sizer {
  43. width: 10%;
  44. }
  45. .grid-item {
  46. margin-bottom: 5px;
  47. padding: 5px;
  48. }
  49. .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 {
  50. padding-left: 5px;
  51. padding-right: 5px;
  52. float: none;
  53. }
  54. </style>
  55. <hook name="admin_before_head_end"/>
  56. </head>
  57. <body>
  58. <div class="wrap">
  59. <div class="grid-item col-md-12" id="thinkcmf-notices-grid" style="display:none;">
  60. <div class="dashboard-box">
  61. <div class="panel panel-default">
  62. <div class="panel-heading">
  63. <h3 class="panel-title">使用说明</h3>
  64. </div>
  65. <div class="panel-body home-info">
  66. <ul class="list-unstyled">
  67. <li>
  68. 请点击左侧对应的菜单,进行相应操作。
  69. </li>
  70. <li>
  71. 请谨慎操作,防止误操作。
  72. </li>
  73. </ul>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. <script src="__STATIC__/js/admin.js"></script>
  80. <php>
  81. $lang_set=defined('LANG_SET')?LANG_SET:'';
  82. $thinkcmf_version=cmf_version();
  83. </php>
  84. <script>
  85. Wind.css('dragula');
  86. Wind.use('masonry', 'imagesloaded', 'dragula', function () {
  87. var $homeGrid = $('.home-grid').masonry({
  88. // set itemSelector so .grid-sizer is not used in layout
  89. itemSelector: '.grid-item',
  90. // use element for option
  91. columnWidth: '.grid-sizer',
  92. percentPosition: true,
  93. horizontalOrder: false,
  94. transitionDuration: 0
  95. });
  96. $homeGrid.masonry('on', 'layoutComplete', function (event, laidOutItems) {
  97. });
  98. $homeGrid.masonry();
  99. var containers = [];
  100. $('.home-grid .grid-item').each(function () {
  101. containers.push(this);
  102. });
  103. dragula(containers, {
  104. isContainer: function (el) {
  105. return false; // only elements in drake.containers will be taken into account
  106. },
  107. moves: function (el, source, handle, sibling) {
  108. return true; // elements are always draggable by default
  109. },
  110. accepts: function (el, target, source, sibling) {
  111. return true; // elements can be dropped in any of the `containers` by default
  112. },
  113. invalid: function (el, handle) {
  114. return false; // don't prevent any drags from initiating by default
  115. },
  116. direction: 'vertical', // Y axis is considered when determining where an element would be dropped
  117. copy: false, // elements are moved by default, not copied
  118. copySortSource: false, // elements in copy-source containers can be reordered
  119. revertOnSpill: false, // spilling will put the element back where it was dragged from, if this is true
  120. removeOnSpill: false, // spilling will `.remove` the element, if this is true
  121. mirrorContainer: document.body, // set the element that gets mirror elements appended
  122. ignoreInputTextSelection: true // allows users to select input text, see details below
  123. }).on('drop', function (el, target, source, sibling) {
  124. var $target = $(target);
  125. var targetClasses = $target.attr('class');
  126. var targetDataWidget = $target.data('widget');
  127. var targetDataSystem = $target.data('system');
  128. var $source = $(source);
  129. var sourceClasses = $source.attr('class');
  130. var sourceDataWidget = $source.data('widget');
  131. var sourceDataSystem = $source.data('system');
  132. $(source).append($(target).find('.dashboard-box').not('.gu-transit'));
  133. $(target).append(el);
  134. $target.attr('class', sourceClasses);
  135. $target.data('widget', sourceDataWidget);
  136. $target.data('system', sourceDataSystem);
  137. $source.attr('class', targetClasses);
  138. $source.data('widget', targetDataWidget);
  139. $source.data('system', targetDataSystem);
  140. $homeGrid.masonry();
  141. _widgetSort();
  142. }).on('shadow', function (el, container, source) {
  143. $homeGrid.masonry();
  144. });
  145. });
  146. function _widgetSort() {
  147. var widgets = [];
  148. $('.home-grid .grid-item').each(function () {
  149. var $this = $(this);
  150. widgets.push({
  151. name: $this.data('widget'),
  152. is_system: $this.data('system')
  153. });
  154. });
  155. $.ajax({
  156. url: "{:url('main/dashboardWidget')}",
  157. type: 'post',
  158. dataType: 'json',
  159. data: {widgets: widgets},
  160. success: function (data) {
  161. },
  162. error: function () {
  163. },
  164. complete: function () {
  165. }
  166. });
  167. }
  168. //获取官方通知
  169. $.getJSON("//www.thinkcmf.com/service/sms_jsonp.php?lang={$lang_set}&v={$thinkcmf_version}&callback=?",
  170. function (data) {
  171. var tpl = '<li><em class="title"></em><span class="content"></span></li>';
  172. var $notices = $("#thinkcmf-notices");
  173. $notices.empty();
  174. if (data.length > 0) {
  175. $('#thinkcmf-notices-grid').show();
  176. $.each(data, function (i, n) {
  177. var $tpl = $(tpl);
  178. $(".title", $tpl).html(n.title);
  179. $(".content", $tpl).html(n.content);
  180. $notices.append($tpl);
  181. });
  182. } else {
  183. $notices.append("<li>^_^,{:lang('NO_NOTICE')}~~</li>");
  184. }
  185. });
  186. </script>
  187. <hook name="admin_before_body_end"/>
  188. </body>
  189. </html>