index.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. {extend name="public/container"}
  2. {block name="head_top"}
  3. <link href="{__MODULE_PATH}wechat/news/css/index.css" type="text/css" rel="stylesheet">
  4. {/block}
  5. {block name="content"}
  6. <style>
  7. tr td img{height: 50px;}
  8. </style>
  9. <div class="row">
  10. <div class="col-sm-3">
  11. <div class="ibox">
  12. <div class="ibox-title">分类</div>
  13. <div class="ibox-content">
  14. <ul class="folder-list m-b-md">
  15. {volist name="tree" id="vo"}
  16. <li class="p-xxs"><a href="{:Url('article.article/index',array('pid'=>$vo.id))}">{$vo.html}{$vo.title}</a></li>
  17. {/volist}
  18. </ul>
  19. </div>
  20. </div>
  21. </div>
  22. <div class="col-sm-9 m-l-n-md">
  23. <div class="ibox">
  24. <div class="ibox-title">
  25. <button type="button" class="btn btn-w-m btn-primary" onclick="$eb.createModalFrame(this.innerText,'{:Url('create',array('cid'=>$where.cid))}',{w:1100,h:760})">添加文章</button>
  26. <div style="margin-top: 2rem"></div>
  27. <div class="row">
  28. <div class="m-b m-l">
  29. <form action="" class="form-inline">
  30. <div class="input-group">
  31. <input type="text" name="title" value="{$where.title}" placeholder="请输入关键词" class="input-sm form-control"> <span class="input-group-btn"><button type="submit" class="btn btn-sm btn-primary"> <i class="fa fa-search" ></i>搜索</button> </span>
  32. </div>
  33. </form>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="ibox-content">
  38. <table class="footable table table-striped table-bordered " data-page-size="20">
  39. <thead>
  40. <tr>
  41. <th class="text-center" width="5%">id</th>
  42. <th class="text-center" width="10%">图片</th>
  43. <th class="text-left" >[分类]标题</th>
  44. <th class="text-center" width="8%">浏览量</th>
  45. <th class="text-center">关联标题</th>
  46. <th class="text-center" width="15%">添加时间</th>
  47. <th class="text-center" width="20%">操作</th>
  48. </tr>
  49. </thead>
  50. <tbody>
  51. {volist name="list" id="vo"}
  52. <tr>
  53. <td>{$vo.id}</td>
  54. <td>
  55. <img src="{$vo.image_input}"/>
  56. </td>
  57. <td>[{$vo.catename}]{$vo.title}</td>
  58. <td>{$vo.visit}</td>
  59. <td>{$vo.store_name}</td>
  60. <td>{$vo.add_time|date="Y-m-d H:i:s"}</td>
  61. <td class="text-center">
  62. <button style="margin-top: 5px;" class="btn btn-info btn-xs" type="button" onclick="$eb.createModalFrame('编辑','{:Url('create',array('id'=>$vo['id'],'cid'=>$where.cid))}',{w:1100,h:760})"><i class="fa fa-edit"></i> 编辑</button>
  63. {if $vo.product_id}
  64. <button style="margin-top: 5px;" class="btn btn-warning btn-xs underline" data-id="{$vo.id}" type="button" data-url="{:Url('unrelation',array('id'=>$vo['id']))}" ><i class="fa fa-chain-broken"></i> 取消关联</button>
  65. {else}
  66. <button style="margin-top: 5px;" class="btn btn-warning btn-xs openWindow" data-id="{$vo.id}" type="button" data-url="{:Url('relation',array('id'=>$vo['id']))}" ><i class="fa fa-chain"></i> 关联产品</button>
  67. {/if}
  68. <button style="margin-top: 5px;" class="btn btn-danger btn-xs del_news_one" data-id="{$vo.id}" type="button" data-url="{:Url('delete',array('id'=>$vo['id']))}" ><i class="fa fa-times"></i> 删除</button>
  69. </td>
  70. </tr>
  71. {/volist}
  72. </tbody>
  73. </table>
  74. </div>
  75. </div>
  76. <div style="margin-left: 10px">
  77. {include file="public/inner_page"}
  78. </div>
  79. </div>
  80. </div>
  81. {/block}
  82. {block name="script"}
  83. <script>
  84. $('.del_news_one').on('click',function(){
  85. window.t = $(this);
  86. var _this = $(this),url =_this.data('url');
  87. $eb.$swal('delete',function(){
  88. $eb.axios.get(url).then(function(res){
  89. console.log(res);
  90. if(res.status == 200 && res.data.code == 200) {
  91. $eb.$swal('success',res.data.msg);
  92. _this.parents('tr').remove();
  93. }else
  94. return Promise.reject(res.data.msg || '删除失败')
  95. }).catch(function(err){
  96. $eb.$swal('error',err);
  97. });
  98. })
  99. });
  100. $('.openWindow').on('click',function () {
  101. return $eb.createModalFrame('选择产品',$(this).data('url'));
  102. });
  103. $('.underline').on('click',function () {
  104. var url=$(this).data('url');
  105. $eb.$swal('delete',function(){
  106. $eb.axios.get(url).then(function(res){
  107. if(res.status == 200 && res.data.code == 200) {
  108. $eb.$swal('success',res.data.msg);
  109. window.location.reload();
  110. }else
  111. return Promise.reject(res.data.msg || '取消失败')
  112. }).catch(function(err){
  113. $eb.$swal('error',err);
  114. });
  115. },{title:'确认取消关联产品?',text:'取消后可再关联页选择产品重新关联',confirm:'确定'})
  116. })
  117. </script>
  118. {/block}