index.html 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. {extend name='admin@main'}
  2. {block name="button"}
  3. <button data-open='{:url("add")}' data-title="添加" class='layui-btn layui-btn-sm layui-btn-primary'>添加</button>
  4. {/block}
  5. {block name="content"}
  6. <div class="think-box-shadow">
  7. {include file='news_manage/index_search'}
  8. <table class="layui-table margin-top-20" lay-skin="line">
  9. <thead>
  10. <tr>
  11. <th class='text-left nowrap' >标题</th>
  12. <th class='text-left nowrap' >封面/视频</th>
  13. <th class='text-left nowrap'>类型</th>
  14. <th class='text-left nowrap'>状态</th>
  15. <th class='text-left nowrap'>置顶</th>
  16. <th class="text-left nowrap">操作</th>
  17. </tr>
  18. </thead>
  19. <tbody>
  20. {foreach $list as $key=>$vo}
  21. <tr>
  22. <td class='text-left nowrap'>{$vo.title|default=''}</td>
  23. <td class='text-left nowrap'>
  24. {if $vo.type == 1}
  25. <img data-tips-image="{$vo.cover|default=''}" src="{$vo.cover|default=''}" width="50px"/>
  26. {else}
  27. <img class="video_player" alert="点击播放" src="{$vo.cover|default=''}" data-src="{$vo.video_url|default=''}" style="height: 50px;width: 75px" />
  28. {/if}
  29. </td>
  30. <td class='text-left nowrap'>{$vo.type == 1 ?'文章' :'视频'}</td>
  31. <td class='text-left nowrap'>{$vo.status == 1 ?'已启用' :'已禁用'}</td>
  32. <td class='text-left nowrap'>{$vo.is_top == 1 ?'是' :'否'}</td>
  33. <td class='text-left nowrap' >
  34. <a data-title="编辑" class="layui-btn layui-btn-sm" data-open='{:url("edit")}?id={$vo.id}'>编 辑</a>
  35. <a data-title="商品管理" class="layui-btn layui-btn-sm layui-btn-normal" data-open='{:url("/nutrition/information_goods/index")}?id={$vo.id}'>商品管理</a>
  36. {if $vo.status == 1}
  37. <span class="layui-btn layui-btn-sm layui-btn-warm" onclick="btn_confirm('禁用','forbidden','{$vo.id}');" >禁 用</span>
  38. {else}
  39. <span class="layui-btn layui-btn-sm layui-btn-sm" onclick="btn_confirm('启用','enable','{$vo.id}');">启 用</span>
  40. {/if}
  41. <span class="layui-btn layui-btn-sm layui-btn-danger" onclick="btn_confirm('删除','del','{$vo.id}');">删 除</span>
  42. </td>
  43. </tr>
  44. {/foreach}
  45. </tbody>
  46. </table>
  47. {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
  48. </div>
  49. <script>
  50. function btn_confirm(msg,fun,id) {
  51. layer.confirm('请确定是否'+msg, {btn: ['确定', '取消'], title: "提示"}, function () {
  52. var url = "/nutrition/news_manage/"+fun;
  53. layer.closeAll();
  54. $.ajax({
  55. type: "post",
  56. url: url,
  57. data: {id:id},
  58. dataType: "json",
  59. async: false,
  60. success: function (data) {
  61. layer.msg(data.info);
  62. setTimeout(function () {
  63. window.location.reload();
  64. },1000)
  65. }
  66. });
  67. });
  68. }
  69. $('.video_player').click(function () {
  70. vUrl = $(this).data('src'); //获取到播放的url
  71. var loadstr = '<video width="100%" height="100%" controls="controls" autobuffer="autobuffer" autoplay="autoplay" loop="loop">' +
  72. '<source src='+vUrl+' type="video/mp4"></source></video>';
  73. layer.open({
  74. type: 1,
  75. title: false,
  76. area: ['730px', '500px'],
  77. shade: [0.8, 'rgb(14, 16, 22)'],
  78. skin: 'demo-class',
  79. content: loadstr
  80. });
  81. });
  82. </script>
  83. {/block}