news.php 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?php
  2. use common\helpers\Url;
  3. use yii\widgets\LinkPager;
  4. use common\helpers\Html;
  5. $this->title = $allMediaType[$mediaType];
  6. $this->params['breadcrumbs'][] = ['label' => $this->title];
  7. ?>
  8. <?= $this->render('_nav', [
  9. 'allMediaType' => $allMediaType,
  10. 'mediaType' => $mediaType,
  11. 'keywords' => $keywords,
  12. 'count' => $pages->totalCount
  13. ]); ?>
  14. <div class="row" style="margin-top: 25px">
  15. <div class="col-sm-12">
  16. <div class="box" style="background: #f5f7f9">
  17. <div class="inlineBlockContainer col5 vAlignTop separateChildren">
  18. <?php foreach ($models as $item){ ?>
  19. <div class="normalPaddingRight" style="position:absolute">
  20. <div class="borderColorGray separateChildrenWithLine whiteBG m-b-sm">
  21. <?php foreach ($item['news'] as $index => $news){ ?>
  22. <div class="normalPadding relativePosition postItem">
  23. <?php if($index == 0){ ?>
  24. <div style="background-image: url(<?= Url::to(['analysis/image','attach'=>$news['thumb_url']]) ?>); height: 160px" class="backgroundCover relativePosition mainPostCover">
  25. <div class="bottomBar"><?= Html::encode($news['title']) ?></div>
  26. </div>
  27. <?php }else{ ?>
  28. <div class="flex-row">
  29. <div class="flex-col normalPadding"><?= Html::encode($news['title']) ?></div>
  30. <div style="background-image: url(<?= Url::to(['analysis/image', 'attach' => $news['thumb_url']]) ?>);" class="backgroundCover subPostCover"></div>
  31. </div>
  32. <?php } ?>
  33. <div class="halfOpacityBlackBG absoluteFullSize" style="display: none;">
  34. <?php if($item['link_type'] == 1){ ?>
  35. <?php if($index == 0){ ?>
  36. <a class="fontColorWhite" href="<?= $news['media_url'] ?>" target="_blank" style="left:25%;top: 50%;position: absolute;">文章预览</a>
  37. <a class="fontColorWhite" href="<?= Url::to(['preview','attach_id' => $item['id'], 'mediaType' => $mediaType])?>" data-toggle='modal' data-target='#ajaxModal' style="right:25%;top: 50%;position: absolute;">手机预览</a>
  38. <?php }else{ ?>
  39. <a class="absoluteCenter fontColorWhite" href="<?= $news['media_url'] ?>" target="_blank">文章预览</a>
  40. <?php } ?>
  41. <?php }else{ ?>
  42. <a class="absoluteCenter fontColorWhite" href="<?= $news['media_url'] ?>" target="_blank">本地预览 <i class="fa fa-question-circle" title="本地文章,不可以群发"></i></a>
  43. <?php } ?>
  44. </div>
  45. </div>
  46. <?php } ?>
  47. <div class="flex-row hAlignCenter normalPadding postToolbar">
  48. <?php if($item['link_type'] == 1){ ?>
  49. <div class="flex-col"><a href="<?= Url::to(['send', 'data'=> $item['id'], 'mediaType' => $mediaType])?>" title="群发" data-toggle='modal' data-target='#ajaxModal'><i class="fa fa-reply-all"></i></a></div>
  50. <div class="flex-col"><a href="<?= Url::to(['news-edit','attach_id'=> $item['id'], 'link_type' => $item['link_type']])?>" title="编辑"><i class="fa fa-edit"></i></a></div>
  51. <?php }else{ ?>
  52. <div class="flex-col"><a href="<?= Url::to(['news-edit','attach_id'=> $item['id'], 'link_type' => $item['link_type']])?>" title="编辑"><i class="fa fa-edit"></i></a></div>
  53. <?php } ?>
  54. <div class="flex-col"><a href="<?= Url::to(['delete','attach_id'=> $item['id'], 'mediaType' => $mediaType])?>" onclick="rfDelete(this, '删除后会删除素材对应的自动回复和等待群发');return false;" title="删除"><i class="fa fa-trash"></i></a></div>
  55. </div>
  56. </div>
  57. </div>
  58. <?php } ?>
  59. </div>
  60. <div class="row">
  61. <div class="col-sm-12">
  62. <?= LinkPager::widget([
  63. 'pagination' => $pages,
  64. ]);?>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. <script>
  71. $(function(){
  72. // 显示/隐藏“预览文章”按钮
  73. $('.postItem').mouseenter(function(e){
  74. $(e.currentTarget).find('.halfOpacityBlackBG').show();
  75. });
  76. $('.postItem').mouseleave(function(e){
  77. $(e.currentTarget).find('.halfOpacityBlackBG').hide();
  78. });
  79. // 弹出框选择新建图文类型
  80. var postType1Link = "<?= Url::to(['news-edit','model' => 'perm', 'link_type' => 1])?>";
  81. var postType2Link = "<?= Url::to(['news-edit','model' => 'perm', 'link_type' => 2])?>";
  82. $('#createPostBtn').click(function(){
  83. layer.open({
  84. type: 1,
  85. title: '新建图文消息',
  86. area: ['500px', '340px'],
  87. shadeClose: true,
  88. content: '<div class="farPadding separateChildren further">' +
  89. '<a class="farPadding borderColorGray displayAsBlock" href="' + postType1Link + '">' +
  90. '<div class="fontSizeL">创建微信图文</div>' +
  91. '<div class="fontColorGray">微信图文消息会自动同步至微信素材库,并可以直接群发给粉丝</div>' +
  92. '</a>' +
  93. '<a class="farPadding borderColorGray displayAsBlock" href="' + postType2Link + '">' +
  94. '<div class="fontSizeL">创建图文连接</div>' +
  95. '<div class="fontColorGray">点击图文直接跳转至指定链接,可用于自动回复及认证号菜单配置,不能同步至微信素材库。</div>' +
  96. '</a>' +
  97. '</div>'
  98. });
  99. });
  100. //
  101. })
  102. </script>
  103. <!--瀑布流-->
  104. <script type="text/javascript">
  105. var waterBasic = (function(){
  106. function init(){
  107. var nodeWidth = $(".normalPaddingRight").outerWidth(true),
  108. colNum = parseInt( $(window).width() / nodeWidth ),
  109. colSumHeight = [],
  110. maxSumHeight = 0;
  111. for (var i=0;i<colNum;i++) {
  112. colSumHeight.push(0);
  113. }
  114. $(".normalPaddingRight").each(function(){
  115. var $cur = $(this),
  116. idx = 0,
  117. minSumHeight = colSumHeight[0];
  118. maxSumHeight = colSumHeight[0];
  119. // 获取到solSumHeight中的最小高度
  120. for (var i=0;i<colSumHeight.length;i++) {
  121. if (minSumHeight > colSumHeight[i]) {
  122. minSumHeight = colSumHeight[i];
  123. idx = i;
  124. }
  125. if (maxSumHeight < colSumHeight[i]) {
  126. maxSumHeight = colSumHeight[i];
  127. }
  128. }
  129. // 设置各个item的css属性
  130. $cur.css({
  131. left: nodeWidth*idx,
  132. top: minSumHeight
  133. });
  134. // 更新solSumHeight
  135. colSumHeight[idx] = colSumHeight[idx] + $cur.outerHeight(true);
  136. });
  137. $('.inlineBlockContainer').height(maxSumHeight)
  138. }
  139. // 设置窗口改变时也能重新加载
  140. $(window).on("resize", function(){
  141. init();
  142. });
  143. return {
  144. init: init
  145. }
  146. })();
  147. waterBasic.init();
  148. </script>
粤ICP备19079148号