af3ab7005f7ce248b4e414a7e5585847.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <?php $shoname_name = D('Home/Front')->get_config_by_name('shoname'); ?>
  6. <title><?php echo $shoname; ?></title>
  7. <link rel="shortcut icon" href="" />
  8. <meta name="renderer" content="webkit">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  11. <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
  12. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  13. <!--[if lt IE 9]>
  14. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  15. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  16. <![endif]-->
  17. <link href="./resource/css/bootstrap.min.css?v=201903260001" rel="stylesheet">
  18. <link href="./resource/css/common.css?v=201903260001" rel="stylesheet">
  19. <script type="text/javascript">
  20. window.sysinfo = {
  21. <?php if (!empty($_W['uniacid']) ){ ?>'uniacid': '<?php echo ($_W['uniacid']); ?>',<?php } ?>
  22. <?php if( !empty($_W['acid']) ){ ?>'acid': '<?php echo ($_W['acid']); ?>',<?php } ?>
  23. <?php if (!empty($_W['openid']) ) { ?>'openid': '<?php echo ($_W['openid']); ?>',<?php } ?>
  24. <?php if( !empty($_W['uid']) ) { ?>'uid': '<?php echo ($_W['uid']); ?>',<?php } ?>
  25. 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
  26. 'siteroot': '<?php echo ($_W['siteroot']); ?>',
  27. 'siteurl': '<?php echo ($_W['siteurl']); ?>',
  28. 'attachurl': '<?php echo ($_W['attachurl']); ?>',
  29. 'attachurl_local': '<?php echo ($_W['attachurl_local']); ?>',
  30. 'attachurl_remote': '<?php echo ($_W['attachurl_remote']); ?>',
  31. 'module' : {'url' : '<?php if( defined('MODULE_URL') ) { ?>{MODULE_URL}<?php } ?>', 'name' : '<?php if (defined('IN_MODULE') ) { ?>{IN_MODULE}<?php } ?>'},
  32. 'cookie' : {'pre': ''},
  33. 'account' : <?php echo json_encode($_W['account']);?>,
  34. };
  35. </script>
  36. <script type="text/javascript" src="./resource/js/lib/jquery-1.11.1.min.js"></script>
  37. <script type="text/javascript" src="./resource/js/lib/bootstrap.min.js"></script>
  38. <script type="text/javascript" src="./resource/js/app/util.js?v=201903260001"></script>
  39. <script type="text/javascript" src="./resource/js/app/common.min.js?v=201903260001"></script>
  40. <script type="text/javascript" src="./resource/js/require.js?v=201903260001"></script>
  41. <script type="text/javascript" src="./resource/js/lib/jquery.nice-select.js?v=201903260001"></script>
  42. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  43. <link href="/static/css/snailfish.css" rel="stylesheet">
  44. </head>
  45. <body layadmin-themealias="default">
  46. <div class="layui-fluid">
  47. <div class="layui-card">
  48. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">文章管理</span></div>
  49. <div class="layui-card-body" style="padding:15px;">
  50. <form action="" method="get" class="form-horizontal form-search layui-form" role="form">
  51. <input type="hidden" name="c" value="article" />
  52. <input type="hidden" name="type" value="<?php echo ($type); ?>" />
  53. <div class="layui-form-item">
  54. <div class="layui-inline">
  55. <div class="layui-input-inline" >
  56. <select name="enabled" class='layui-input layui-unselect' data-placeholder="状态">
  57. <option value="-1" <?php if( empty($enabled)){ ?>selected<?php } ?> >状态</option>
  58. <option value="1" <?php if( $enabled ==1){ ?>selected<?php } ?> >显示</option>
  59. <option value="0" <?php if( $enabled ==0){ ?>selected<?php } ?> >隐藏</option>
  60. </select>
  61. </div>
  62. <div class="layui-input-inline">
  63. <input type="text" class="layui-input" name='keyword' value="<?php echo ($keyword); ?>" placeholder="输入关键词然后回车">
  64. </div>
  65. <div class="layui-input-inline">
  66. <button class="layui-btn layui-btn-sm" type="submit"> 搜索</button>
  67. </div>
  68. </div>
  69. </div>
  70. </form>
  71. <form action="" class="layui-form" lay-filter="example" method="post" >
  72. <div class="row">
  73. <div class="col-md-12">
  74. <div class="page-table-header">
  75. <span class="pull-right">
  76. <a href="<?php echo U('article/add', array('ok' => 1));?>" class="layui-btn layui-btn-sm"><i class="fa fa-plus"></i> 添加文章</a>
  77. </span>
  78. <div class="btn-group">
  79. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="<?php echo U('article/change',array('type'=>'enabled','value'=>1));?>">显示</button>
  80. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="<?php echo U('article/change',array('type'=>'enabled','value'=>0));?>">隐藏</button>
  81. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除吗,删除后商品将进入回收站?" data-href="<?php echo U('article/delete');?>">删除</button>
  82. </div>
  83. </div>
  84. <table class="layui-table" lay-skin="line" lay-size="lg">
  85. <thead>
  86. <tr>
  87. <th style="width:25px;"><input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" /></th>
  88. <th style="width:80px;">ID</th>
  89. <th style="">标题</th>
  90. <th style="width: 150px;">状态</th>
  91. <th style="width:80px;">排序</th>
  92. <th style="width: 200px;">操作</th>
  93. </tr>
  94. </thead>
  95. <tbody>
  96. <?php foreach( $list as $item ){ ?>
  97. <tr>
  98. <td style="width:25px;">
  99. <input type='checkbox' name="item_checkbox" lay-skin="primary" value="<?php echo ($item['id']); ?>"/>
  100. </td>
  101. <td>
  102. <?php echo ($item['id']); ?>
  103. </td>
  104. <td>
  105. <?php echo ($item['title']); ?>
  106. </td>
  107. <td>
  108. <input type="checkbox" name="" lay-filter="statewsitch" data-href="<?php echo U('article/change',array('type'=>'enabled','id'=>$item['id']));?>" <?php if( $item['enabled']==1){ ?>checked<?php }else{ } ?> lay-skin="switch" lay-text="显示|隐藏">
  109. </td>
  110. <td>
  111. <a href='javascript:;' data-toggle='ajaxEdit' data-href="<?php echo U('article/change',array('id'=>$item['id'],'type'=>'displayorder'));?>" ><?php echo ($item['displayorder']); ?></a>
  112. </td>
  113. <td style="overflow:visible;position:relative">
  114. <a class='layui-btn layui-btn-xs' href="<?php echo U('article/add', array('id'=>$item['id'],'ok' => 1));?>" >
  115. <i class="layui-icon layui-icon-edit"></i>编辑
  116. </a>
  117. <a class='layui-btn layui-btn-xs deldom' href="javascript:;" data-href="<?php echo U('article/delete',array('id'=>$item['id']));?>" data-confirm='确认要删除吗?'>
  118. <i class="layui-icon">&#xe640;</i>删除
  119. </a>
  120. </td>
  121. </tr>
  122. <?php } ?>
  123. </tbody>
  124. <tfoot>
  125. <tr>
  126. <td colspan="4">
  127. <div class="page-table-header">
  128. <input type="checkbox" name="checkall" lay-skin="primary" lay-filter="checkboxall">
  129. <div class="btn-group">
  130. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="<?php echo U('article/change',array('type'=>'enabled'));?>">显示</button>
  131. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="<?php echo U('article/change',array('type'=>'enabled'));?>">隐藏</button>
  132. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除吗,删除后商品将进入回收站?" data-href="<?php echo U('article/delete');?>">删除</button>
  133. </div>
  134. </div>
  135. </td>
  136. <td colspan="2" style="text-align: right">
  137. <?php echo ($pager); ?>
  138. </td>
  139. </tr>
  140. </tfoot>
  141. </table>
  142. </div>
  143. </div>
  144. </form>
  145. </div>
  146. </div>
  147. </div>
  148. <script src="/layuiadmin/layui/layui.js"></script>
  149. <script>
  150. layui.config({
  151. base: '/layuiadmin/' //静态资源所在路径
  152. }).extend({
  153. index: 'lib/index' //主入口模块
  154. }).use('index');
  155. </script>
  156. <script>
  157. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  158. var layer = layui.layer;
  159. var $;
  160. layui.use(['jquery', 'layer','form'], function(){
  161. $ = layui.$;
  162. var form = layui.form;
  163. $('.deldom').click(function(){
  164. var s_url = $(this).attr('data-href');
  165. layer.confirm($(this).attr('data-confirm'), function(index){
  166. $.ajax({
  167. url:s_url,
  168. type:'post',
  169. dataType:'json',
  170. success:function(info){
  171. if(info.status == 0)
  172. {
  173. layer.msg(info.result.message,{icon: 1,time: 2000});
  174. }else if(info.status == 1){
  175. var go_url = location.href;
  176. if( info.result.hasOwnProperty("url") )
  177. {
  178. go_url = info.result.url;
  179. }
  180. layer.msg('操作成功',{time: 1000,
  181. end:function(){
  182. location.href = info.result.url;
  183. }
  184. });
  185. }
  186. }
  187. })
  188. });
  189. })
  190. $('.btn-operation').click(function(){
  191. var ids_arr = [];
  192. var obj = $(this);
  193. var s_toggle = $(this).attr('data-toggle');
  194. var s_url = $(this).attr('data-href');
  195. $("input[name=item_checkbox]").each(function() {
  196. if( $(this).prop('checked') )
  197. {
  198. ids_arr.push( $(this).val() );
  199. }
  200. })
  201. if(ids_arr.length < 1)
  202. {
  203. layer.msg('请选择要操作的内容');
  204. }else{
  205. var can_sub = true;
  206. if( s_toggle == 'batch-remove' )
  207. {
  208. can_sub = false;
  209. layer.confirm($(obj).attr('data-confirm'), function(index){
  210. $.ajax({
  211. url:s_url,
  212. type:'post',
  213. dataType:'json',
  214. data:{ids:ids_arr},
  215. success:function(info){
  216. if(info.status == 0)
  217. {
  218. layer.msg(info.result.message,{icon: 1,time: 2000});
  219. }else if(info.status == 1){
  220. var go_url = location.href;
  221. if( info.result.hasOwnProperty("url") )
  222. {
  223. go_url = info.result.url;
  224. }
  225. layer.msg('操作成功',{time: 1000,
  226. end:function(){
  227. location.href = info.result.url;
  228. }
  229. });
  230. }
  231. }
  232. })
  233. });
  234. }else{
  235. $.ajax({
  236. url:s_url,
  237. type:'post',
  238. dataType:'json',
  239. data:{ids:ids_arr},
  240. success:function(info){
  241. if(info.status == 0)
  242. {
  243. layer.msg(info.result.message,{icon: 1,time: 2000});
  244. }else if(info.status == 1){
  245. var go_url = location.href;
  246. if( info.result.hasOwnProperty("url") )
  247. {
  248. go_url = info.result.url;
  249. }
  250. layer.msg('操作成功',{time: 1000,
  251. end:function(){
  252. location.href = info.result.url;
  253. }
  254. });
  255. }
  256. }
  257. })
  258. }
  259. }
  260. })
  261. form.on('switch(statewsitch)', function(data){
  262. var s_url = $(this).attr('data-href')
  263. var s_value = 1;
  264. if(data.elem.checked)
  265. {
  266. s_value = 1;
  267. }else{
  268. s_value = 0;
  269. }
  270. $.ajax({
  271. url:s_url,
  272. type:'post',
  273. dataType:'json',
  274. data:{value:s_value},
  275. success:function(info){
  276. if(info.status == 0)
  277. {
  278. layer.msg(info.result.message,{icon: 1,time: 2000});
  279. }else if(info.status == 1){
  280. var go_url = location.href;
  281. if( info.result.hasOwnProperty("url") )
  282. {
  283. go_url = info.result.url;
  284. }
  285. layer.msg('操作成功',{time: 1000,
  286. end:function(){
  287. location.href = info.result.url;
  288. }
  289. });
  290. }
  291. }
  292. })
  293. });
  294. form.on('checkbox(checkboxall)', function(data){
  295. if(data.elem.checked)
  296. {
  297. $("input[name=item_checkbox]").each(function() {
  298. $(this).prop("checked", true);
  299. });
  300. $("input[name=checkall]").each(function() {
  301. $(this).prop("checked", true);
  302. });
  303. }else{
  304. $("input[name=item_checkbox]").each(function() {
  305. $(this).prop("checked", false);
  306. });
  307. $("input[name=checkall]").each(function() {
  308. $(this).prop("checked", false);
  309. });
  310. }
  311. form.render('checkbox');
  312. });
  313. //监听提交
  314. form.on('submit(formDemo)', function(data){
  315. $.ajax({
  316. url: data.form.action,
  317. type: data.form.method,
  318. data: data.field,
  319. dataType:'json',
  320. success: function (info) {
  321. if(info.status == 0)
  322. {
  323. layer.msg(info.result.message,{icon: 1,time: 2000});
  324. }else if(info.status == 1){
  325. var go_url = location.href;
  326. if( info.result.hasOwnProperty("url") )
  327. {
  328. go_url = info.result.url;
  329. }
  330. layer.msg('操作成功',{time: 1000,
  331. end:function(){
  332. location.href = info.result.url;
  333. }
  334. });
  335. }
  336. }
  337. });
  338. return false;
  339. });
  340. })
  341. </script>
  342. </body>
  343. </html>