resources.blade.php 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport"
  6. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8. <title>Document</title>
  9. <link href="{{asset('js/plugins/mricode-pagination-master/mricode.pagination.css')}}" rel="stylesheet"/>
  10. <link href="{{asset('css/bootstrap.min14ed.css?v=3.3.6')}}" rel="stylesheet">
  11. <style>
  12. .my-ul {
  13. list-style-type: none;
  14. padding: 0;
  15. margin: 10px 0 5px 10px;
  16. }
  17. .my-ul li {
  18. float: left;
  19. }
  20. .my-ul::after {
  21. content: '';
  22. display: block;
  23. clear: both;
  24. }
  25. .nav-li {
  26. padding: 5px 10px;
  27. border-radius: 5px;
  28. cursor: pointer;
  29. }
  30. .active {
  31. background-color: #404650;
  32. color: white;
  33. }
  34. .tool {
  35. background-color: #F0F0F0;
  36. padding: 10px;
  37. }
  38. .search-input {
  39. width: 200px;
  40. padding: 5px;
  41. border: 1px solid #999c9e;
  42. }
  43. .btn {
  44. padding: 5px 10px;
  45. border-radius: 5px;
  46. background-color: #0d8ddb;
  47. border: none;
  48. color: white;
  49. cursor: pointer;
  50. }
  51. .section-ul {
  52. list-style-type: none;
  53. margin: 0;
  54. padding: 0;
  55. }
  56. .section-li {
  57. display: none;
  58. }
  59. .sectionActive {
  60. display: block;
  61. }
  62. .image-ul {
  63. list-style-type: none;
  64. margin: 0;
  65. padding: 0 0 15px 0;
  66. }
  67. .image-ul::after {
  68. content: '';
  69. display: block;
  70. clear: both;
  71. }
  72. .image-li {
  73. cursor: pointer;
  74. float: left;
  75. width: 16.6%;
  76. padding: 5px 5px;
  77. }
  78. .imageDiv {
  79. border: 2px solid #F0F0F0;
  80. border-radius: 5px;
  81. }
  82. .image-li img {
  83. width: 100%;
  84. max-height: 100%;
  85. }
  86. .page {
  87. margin-left: 10px;
  88. }
  89. .imageActive {
  90. border-color: green !important;
  91. }
  92. button {
  93. cursor: pointer;
  94. }
  95. </style>
  96. </head>
  97. <body>
  98. <main>
  99. <nav>
  100. <ul class="my-ul">
  101. <li class="nav-li active" data-type="now">产品页面</li>
  102. <li class="nav-li" data-type="all">全部页面</li>
  103. </ul>
  104. </nav>
  105. <div class="tool">
  106. <div style="float: left">
  107. <input type="text" class="search-input" placeholder="请输入页面名称" id="title">
  108. <select name="social_ids" class="search-input" id="tpl_id">
  109. <option value="0">请选择模版</option>
  110. @foreach($templateList as $key=>$value)
  111. <option value="{{$key}}">{{$value}}</option>
  112. @endforeach
  113. </select>
  114. <button type="button" class="btn" onclick="utils.search()" style="background: #009688;">搜索</button>
  115. <button type="button" class="btn " onclick="utils.save()"
  116. style="background: #009688;">确定
  117. </button>
  118. </div>
  119. <div style="clear: both"></div>
  120. </div>
  121. <section>
  122. <ul class="section-ul">
  123. <li class="section-li sectionActive">
  124. <div class="img-list" id="now">
  125. </div>
  126. <div class="page">
  127. <div id="page" class="m-pagination"></div>
  128. </div>
  129. </li>
  130. <li class="section-li">
  131. <div class="img-list" id="all">
  132. </div>
  133. <div class="page">
  134. <div id="page1" class="m-pagination"></div>
  135. </div>
  136. </li>
  137. </ul>
  138. </section>
  139. </main>
  140. <script src="{{asset('js/jquery.min.js?v=2.1.4')}}"></script>
  141. <script src="{{asset('js/bootstrap.min.js?v=3.3.6')}}"></script>
  142. <script src="{{asset('js/plugins/layer-v3.1.1/layer/layer.js')}}"></script>
  143. <script src="{{asset('js/tools/tips.js')}}"></script>
  144. {{--自定义分页器--}}
  145. <script src="{{asset('js/plugins/mricode-pagination-master/mricode.pagination.js')}}"></script>
  146. <script>
  147. function getPage(object) {
  148. var list = 'all';
  149. if (object === 'page') {
  150. list = 'now';
  151. }
  152. $("#" + object).pagination({
  153. showInfo: true,
  154. showJump: true,
  155. pageSize: 12,
  156. pageElementSort: ['$page', '$size', '$jump', '$info'],
  157. remote: {
  158. url: '/admin/stencil/resources/{{$siteId}}/{{$type}}',
  159. pageParams: function (data) {
  160. return {
  161. page: data.pageIndex + 1,
  162. pageSize: data.pageSize,
  163. title: $("#title").val(),
  164. tplId: $("#tpl_id").val(),
  165. ref:list
  166. };
  167. },
  168. success: function (result) {
  169. var len = result.rows.length;
  170. if (len > 0) {
  171. var content = '<ul class="image-ul">';
  172. $(result.rows).each(function (key, value) {
  173. var image = value.thumb;
  174. if (!image) {
  175. image = 'https://admin.yinqingli.com/storage/202112/jpeg/5AaE6rbXyYBGitlad6l3vrSn3JYSePNeyxu8CV1p.jpeg';
  176. }
  177. content +=
  178. '<li class="image-li">' +
  179. '<div class="imageDiv">' +
  180. '<div class="title" data-id="' + value.id + '">' + value.title + '</div>' +
  181. '<img src="' + image + '" alt="' + value.title + '" data-id="' + value.id + '">' +
  182. '<div class="summary">' + tips.subStr(value.summary, 20) + '</div>' +
  183. '</div>' +
  184. '</li>';
  185. });
  186. content += '</ul>';
  187. } else {
  188. content = '<div style="padding:10px;">无数据</div>';
  189. }
  190. $("#" + list).html(content);
  191. }
  192. }
  193. });
  194. }
  195. $(document).on('click', '.my-ul li', function () {
  196. $(this).addClass('active').siblings().removeClass('active');
  197. $(".section-li").eq($(this).index()).addClass('sectionActive').siblings().removeClass('sectionActive');
  198. });
  199. var utils = {
  200. search: function () {
  201. $(".nav-li").each(function () {
  202. if ($(this).hasClass('active')) {
  203. var type = $(this).attr('data-type');
  204. if (type === 'now') {
  205. $("#page").pagination('remote');
  206. } else {
  207. $("#page1").pagination('remote');
  208. }
  209. }
  210. });
  211. },
  212. save: function () {
  213. $(".imageActive").each(function (key, value) {
  214. var id = $(value).find('.title').attr('data-id');
  215. var title = $(value).find('.title').text();
  216. var thumb = $(value).find('img').attr('src');
  217. var summary = $(value).find('.summary').text();
  218. var str =
  219. '<div class="js-item img-item resource-list {{$type}}" style="cursor:pointer;">' +
  220. '<div class="box">' +
  221. '<a class="thumb">' +
  222. '<img class="image-result" src="' + thumb + '" alt="' + title + '" data-id="' + id + '">' +
  223. '</a>' +
  224. '<div class="title cutstr resource-sub-title">' + title + '</div>' +
  225. '<div class="summary resource-summary">' + summary + '</div>' +
  226. '<div class="operate">' +
  227. '<a href="javascript:;" class="js-del-item">' +
  228. '<i class="fa fa-remove"></i>移除' +
  229. '</a>' +
  230. '</div>' +
  231. '</div>' +
  232. '</div>';
  233. parent.$('#{{$type}}').append(str);
  234. var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
  235. parent.layer.close(index);
  236. });
  237. }
  238. };
  239. $(document).on('click', '.imageDiv', function () {
  240. $(this).addClass('imageActive');
  241. });
  242. $(document).on('click', '.imageActive', function () {
  243. $(this).removeClass('imageActive');
  244. });
  245. $(function () {
  246. getPage('page');
  247. getPage('page1');
  248. })
  249. </script>
  250. </body>
  251. </html>