index.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. <!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': '{$_W['uniacid']}',<?php } ?>
  22. <?php if( !empty($_W['acid']) ){ ?>'acid': '{$_W['acid']}',<?php } ?>
  23. <?php if (!empty($_W['openid']) ) { ?>'openid': '{$_W['openid']}',<?php } ?>
  24. <?php if( !empty($_W['uid']) ) { ?>'uid': '{$_W['uid']}',<?php } ?>
  25. 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
  26. 'siteroot': '{$_W['siteroot']}',
  27. 'siteurl': '{$_W['siteurl']}',
  28. 'attachurl': '{$_W['attachurl']}',
  29. 'attachurl_local': '{$_W['attachurl_local']}',
  30. 'attachurl_remote': '{$_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' : {: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. <style>
  45. tbody tr td{
  46. position: relative;
  47. }
  48. tbody tr .icow-weibiaoti--{
  49. visibility: hidden;
  50. display: inline-block;
  51. color: #fff;
  52. height:18px;
  53. width:18px;
  54. background: #e0e0e0;
  55. text-align: center;
  56. line-height: 18px;
  57. vertical-align: middle;
  58. }
  59. tbody tr:hover .icow-weibiaoti--{
  60. visibility: visible;
  61. }
  62. tbody tr .icow-weibiaoti--.hidden{
  63. visibility: hidden !important;
  64. }
  65. .full .icow-weibiaoti--{
  66. margin-left:10px;
  67. }
  68. .full>span{
  69. display: -webkit-box;
  70. display: -webkit-flex;
  71. display: -ms-flexbox;
  72. display: flex;
  73. vertical-align: middle;
  74. align-items: center;
  75. }
  76. tbody tr .label{
  77. margin: 5px 0;
  78. }
  79. .goods_attribute a{
  80. cursor: pointer;
  81. }
  82. .newgoodsflag{
  83. width: 22px;height: 16px;
  84. background-color: #ff0000;
  85. color: #fff;
  86. text-align: center;
  87. position: absolute;
  88. bottom: 70px;
  89. left: 57px;
  90. font-size: 12px;
  91. }
  92. .a{cursor: pointer;}
  93. </style>
  94. </head>
  95. <body layadmin-themealias="default">
  96. <table id="demo" lay-filter="test"></table>
  97. <div class="layui-fluid">
  98. <div class="layui-card">
  99. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">图片广告列表</span></div>
  100. <div class="layui-card-body" style="padding:15px;">
  101. <form action="" class="layui-form" lay-filter="example" method="post" >
  102. <div class="row">
  103. <div class="col-md-12">
  104. <div class="page-table-header">
  105. <input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" />
  106. <span class="pull-right">
  107. <a href="{:U('advimg/add', array('ok' => 1))}" class="layui-btn layui-btn-sm"><i class="fa fa-plus"></i> 添加广告</a>
  108. </span>
  109. <div class="btn-group">
  110. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除吗?" data-href="{:U('advimg/delete')}">
  111. 删除
  112. </button>
  113. </div>
  114. </div>
  115. <table class="table table-responsive" lay-even lay-skin="line" lay-size="lg">
  116. <thead>
  117. <tr>
  118. <th style="width:25px;"></th>
  119. <th style="width:100px;">ID</th>
  120. <th style="width:100px;">排序</th>
  121. <th>广告图片</th>
  122. <th style="width:100px;">活动状态</th>
  123. <th style="width:165px;text-align: center;">操作</th>
  124. </tr>
  125. </thead>
  126. <tbody>
  127. <?php foreach( $label as $row ){ ?>
  128. <tr>
  129. <td>
  130. <?php if( $row['id']!='default'){ ?>
  131. <input type='checkbox' name="item_checkbox" lay-skin="primary" value="{$row['id']}"/>
  132. <?php } ?>
  133. </td>
  134. <td>{$row['id']}</td>
  135. <td>{$row['displayorder']}</td>
  136. <td><a href="{:tomedia($row['thumb'])}" target="_blank"><img src="{:tomedia($row['thumb'])}" style="width: 150px;"></a></td>
  137. <td>
  138. <input type="checkbox" name="" lay-filter="statewsitch" data-href="{:U('advimg/change_status',array('id'=>$row['id']))}" <?php if( $row['enabled']==1){ ?>checked<?php }else{ ?><?php } ?> lay-skin="switch" lay-text="开启|关闭">
  139. </td>
  140. <td style="text-align: center;">
  141. <a class='layui-btn layui-btn-xs' href="{:U('advimg/add', array('id' => $row['id'], 'ok' => 1))}" >
  142. <i class="layui-icon">&#xe608;</i>编辑
  143. </a>
  144. <a class='layui-btn layui-btn-xs deldom' href="javascript:;" data-href="{:U('advimg/delete', array('id' => $row['id']))}" data-confirm='确认要删除此广告吗?'>
  145. <i class="layui-icon">&#xe640;</i>删除
  146. </a>
  147. </td>
  148. </tr>
  149. <?php } ?>
  150. </tbody>
  151. <tfoot>
  152. <tr>
  153. <td colspan="2">
  154. <div class="page-table-header">
  155. <input type="checkbox" name="checkall" lay-skin="primary" lay-filter="checkboxall">
  156. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除吗?" data-href="{:U('advimg/delete')}">
  157. 删除
  158. </button>
  159. </div>
  160. </td>
  161. <td colspan="6" style="text-align: right">
  162. {$pager}
  163. </td>
  164. </tr>
  165. </tfoot>
  166. </table>
  167. </div>
  168. </div>
  169. </form>
  170. </div>
  171. </div>
  172. </div>
  173. <script src="/layuiadmin/layui/layui.js"></script>
  174. <script>
  175. layui.config({
  176. base: '/layuiadmin/' //静态资源所在路径
  177. }).extend({
  178. index: 'lib/index' //主入口模块
  179. }).use('index');
  180. </script>
  181. <script>
  182. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  183. var layer = layui.layer;
  184. var $;
  185. layui.use(['jquery', 'layer','form'], function(){
  186. $ = layui.$;
  187. var form = layui.form;
  188. $('.deldom').click(function(){
  189. var s_url = $(this).attr('data-href');
  190. layer.confirm($(this).attr('data-confirm'), function(index){
  191. $.ajax({
  192. url:s_url,
  193. type:'post',
  194. dataType:'json',
  195. success:function(info){
  196. if(info.status == 0)
  197. {
  198. layer.msg(info.result.message,{icon: 1,time: 2000});
  199. }else if(info.status == 1){
  200. var go_url = location.href;
  201. if( info.result.hasOwnProperty("url") )
  202. {
  203. go_url = info.result.url;
  204. }
  205. layer.msg('操作成功',{time: 1000,
  206. end:function(){
  207. location.href = info.result.url;
  208. }
  209. });
  210. }
  211. }
  212. })
  213. });
  214. })
  215. $('.btn-operation').click(function(){
  216. var ids_arr = [];
  217. var obj = $(this);
  218. var s_toggle = $(this).attr('data-toggle');
  219. var s_url = $(this).attr('data-href');
  220. $("input[name=item_checkbox]").each(function() {
  221. if( $(this).prop('checked') )
  222. {
  223. ids_arr.push( $(this).val() );
  224. }
  225. })
  226. if(ids_arr.length < 1)
  227. {
  228. layer.msg('请选择要操作的内容');
  229. }else{
  230. var can_sub = true;
  231. if( s_toggle == 'batch-remove' )
  232. {
  233. can_sub = false;
  234. layer.confirm($(obj).attr('data-confirm'), function(index){
  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. }else{
  260. $.ajax({
  261. url:s_url,
  262. type:'post',
  263. dataType:'json',
  264. data:{ids:ids_arr},
  265. success:function(info){
  266. if(info.status == 0)
  267. {
  268. layer.msg(info.result.message,{icon: 1,time: 2000});
  269. }else if(info.status == 1){
  270. var go_url = location.href;
  271. if( info.result.hasOwnProperty("url") )
  272. {
  273. go_url = info.result.url;
  274. }
  275. layer.msg('操作成功',{time: 1000,
  276. end:function(){
  277. location.href = info.result.url;
  278. }
  279. });
  280. }
  281. }
  282. })
  283. }
  284. }
  285. })
  286. form.on('switch(statewsitch)', function(data){
  287. var s_url = $(this).attr('data-href')
  288. var s_value = 1;
  289. if(data.elem.checked)
  290. {
  291. s_value = 1;
  292. }else{
  293. s_value = 0;
  294. }
  295. $.ajax({
  296. url:s_url,
  297. type:'post',
  298. dataType:'json',
  299. data:{enabled:s_value},
  300. success:function(info){
  301. if(info.status == 0)
  302. {
  303. layer.msg(info.result.message,{icon: 1,time: 2000});
  304. }else if(info.status == 1){
  305. var go_url = location.href;
  306. if( info.result.hasOwnProperty("url") )
  307. {
  308. go_url = info.result.url;
  309. }
  310. layer.msg('操作成功',{time: 1000,
  311. end:function(){
  312. location.href = info.result.url;
  313. }
  314. });
  315. }
  316. }
  317. })
  318. });
  319. form.on('checkbox(checkboxall)', function(data){
  320. if(data.elem.checked)
  321. {
  322. $("input[name=item_checkbox]").each(function() {
  323. $(this).prop("checked", true);
  324. });
  325. $("input[name=checkall]").each(function() {
  326. $(this).prop("checked", true);
  327. });
  328. }else{
  329. $("input[name=item_checkbox]").each(function() {
  330. $(this).prop("checked", false);
  331. });
  332. $("input[name=checkall]").each(function() {
  333. $(this).prop("checked", false);
  334. });
  335. }
  336. form.render('checkbox');
  337. });
  338. //监听提交
  339. form.on('submit(formDemo)', function(data){
  340. $.ajax({
  341. url: data.form.action,
  342. type: data.form.method,
  343. data: data.field,
  344. dataType:'json',
  345. success: function (info) {
  346. if(info.status == 0)
  347. {
  348. layer.msg(info.result.message,{icon: 1,time: 2000});
  349. }else if(info.status == 1){
  350. var go_url = location.href;
  351. if( info.result.hasOwnProperty("url") )
  352. {
  353. go_url = info.result.url;
  354. }
  355. layer.msg('操作成功',{time: 1000,
  356. end:function(){
  357. location.href = info.result.url;
  358. }
  359. });
  360. }
  361. }
  362. });
  363. return false;
  364. });
  365. $('.view_statis').click(function(){
  366. var id = $(this).attr('adv_id');
  367. $.post("{:U('popadv/popadv_click')}", {id:id}, function(shtml){
  368. layer.open({
  369. title: "活动统计",
  370. type: 1,
  371. scrollbar: false,
  372. area: ['700px', '260px'],
  373. content: shtml
  374. });
  375. });
  376. });
  377. })
  378. </script>
  379. </body>