select.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. {extend name="../../admin/view/index/index"}
  2. {block name='style'}
  3. <style>
  4. .news-container {
  5. overflow: auto;
  6. position: relative;
  7. max-height: 480px;
  8. }
  9. .news-container .news-item {
  10. top: 0;
  11. left: 0;
  12. width: 228px;
  13. margin: 0 0 20px 20px;
  14. padding: 5px;
  15. cursor: pointer;
  16. position: relative;
  17. border: 1px solid #ccc;
  18. border-radius: 5px;
  19. box-sizing: content-box
  20. }
  21. .news-container .news-item.active,
  22. .news-container .news-item:hover {
  23. border-color: #09c;
  24. box-shadow: 1px 0 10px #09c
  25. }
  26. .news-container .news-item .news-articel-item {
  27. width: 100%;
  28. height: 150px;
  29. overflow: hidden;
  30. position: relative;
  31. background-size: cover;
  32. background-position: center center
  33. }
  34. .news-container .news-item .news-articel-item p {
  35. bottom: 0;
  36. color: #fff;
  37. width: 100%;
  38. padding: 5px;
  39. overflow: hidden;
  40. font-size: 12px;
  41. max-height: 5em;
  42. position: absolute;
  43. text-overflow: ellipsis;
  44. background: rgba(0, 0, 0, .7)
  45. }
  46. .news-container .news-item .news-articel-item.other {
  47. height: 50px;
  48. padding: 5px 0
  49. }
  50. .news-container .news-item .news-articel-item .left-image {
  51. width: 50px;
  52. height: 50px;
  53. float: left;
  54. overflow: hidden;
  55. position: relative;
  56. background-size: cover;
  57. background-position: center center
  58. }
  59. .news-container .news-item .news-articel-item .right-text {
  60. float: left;
  61. width: 165px;
  62. overflow: hidden;
  63. padding-right: 10px;
  64. text-overflow: ellipsis
  65. }
  66. .news-container .news-item .hr-line-dashed:last-child {
  67. display: none
  68. }
  69. .news-container .hr-line-dashed {
  70. margin: 6px 0 1px 0
  71. }
  72. .pagination-container {
  73. left: 0;
  74. right: 0;
  75. bottom: 0;
  76. padding: 5px 20px;
  77. position: fixed;
  78. background: #fff;
  79. border-top: 1px solid #dedede;
  80. }
  81. </style>
  82. {/block}
  83. {block name="body"}
  84. <div class="layui-clear news-container layui-hide padding-top-20">
  85. {foreach $list as $vo}
  86. <div class="news-item shadow-mini" data-news-id="{$vo.id}">
  87. {foreach $vo.articles as $k => $v}{if $k < 1}
  88. <div class='news-articel-item' data-lazy-src="{$v.local_url}">
  89. {if $v.title}<p>{$v.title}</p>{/if}
  90. </div>
  91. <div class="hr-line-dashed"></div>
  92. {else}
  93. <div class='news-articel-item other'>
  94. <div class='right-text'>{$v.title}</div>
  95. <div class='left-image' data-lazy-src="{$v.local_url}"></div>
  96. </div>
  97. <div class="hr-line-dashed"></div>
  98. {/if}{/foreach}
  99. </div>
  100. {/foreach}
  101. </div>
  102. {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
  103. {/block}
  104. {block name="script"}
  105. <script>
  106. require(['jquery.masonry'], function (Masonry) {
  107. $('.news-container.layui-hide').removeClass('layui-hide');
  108. var msnry = new Masonry($('.news-container').get(0), {
  109. itemSelector: '.news-item', columnWidth: 0
  110. });
  111. msnry.layout();
  112. /*! 事件处理 */
  113. $('.news-item').on('mouseenter', '.news-container', function () {
  114. $(this).addClass('active');
  115. }).on('mouseleave', '.news-container', function () {
  116. $(this).removeClass('active');
  117. });
  118. /*! 外部选择器 */
  119. var seletor = '[name="{:decode(input("get.field","0"))}"]';
  120. $('[data-news-id]').on('click', function () {
  121. window.top.$(seletor).val($(this).attr('data-news-id')).trigger('change');
  122. parent.layer.close(parent.layer.getFrameIndex(window.name))
  123. });
  124. /*! 分页事件处理 */
  125. $('body').off('change', '.pagination-trigger select').on('change', '.pagination-trigger select', function () {
  126. var urls = this.options[this.selectedIndex].getAttribute('data-url').split('#');
  127. urls.shift(), window.location.href = urls.join('#');
  128. }).off('click', '[data-open]').on('click', '[data-open]', function () {
  129. window.location.href = this.getAttribute('data-open');
  130. });
  131. });
  132. </script>
  133. {/block}