usergroup.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  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. </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="communityhead" />
  52. <input type="hidden" name="a" value="usergroup" />
  53. <div class="layui-form-item">
  54. <div class="layui-inline">
  55. <div class="layui-input-inline">
  56. <input type="text" class="layui-input" name='keyword' value="{$gpc['keyword']}" placeholder="输入关键词然后回车">
  57. </div>
  58. <div class="layui-input-inline">
  59. <button class="layui-btn layui-btn-sm" type="submit"> 搜索</button>
  60. </div>
  61. </div>
  62. </div>
  63. </form>
  64. <form action="" class="layui-form" lay-filter="example" method="post" >
  65. <div class="row">
  66. <div class="col-md-12">
  67. <div class="page-table-header">
  68. <input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" />
  69. <span class="pull-right">
  70. <a href="javascript:;" data-href="{:U('communityhead/addusergroup')}" class="layui-btn layui-btn-sm ajaxModal"><i class="fa fa-plus"></i> 添加团长分组</a>
  71. </span>
  72. <div class="btn-group">
  73. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{php echo shopUrl('user/deleteusergroup')}">
  74. 删除
  75. </button>
  76. </div>
  77. </div>
  78. <table class="table table-responsive" lay-even lay-skin="line" lay-size="lg">
  79. <thead>
  80. <tr>
  81. <th style="width:25px;"></th>
  82. <th>ID</th>
  83. <th>分组名称</th>
  84. <th style="width:180px;">团长数量</th>
  85. <th style="width:260px;text-align: center;">操作</th>
  86. </tr>
  87. </thead>
  88. <tbody>
  89. <?php foreach($list as $row){ ?>
  90. <tr <?php if($row['id']=='default'){ ?>style='background:#eee;'<?php } ?>>
  91. <td>
  92. <?php if($row['id']!='default'){ ?>
  93. <input type='checkbox' name="item_checkbox" lay-skin="primary" value="{$row['id']}"/>
  94. <?php } ?>
  95. </td>
  96. <td>
  97. <?php if($row['id']!='default'){ ?>
  98. {$row['id']}
  99. <?php }else{ ?>
  100. 0
  101. <?php } ?>
  102. </td>
  103. <td style="cursor: pointer;" onclick='location="{:U("communityhead/index", array('group_id' => $row['id']))}"'>{$row['groupname']}</td>
  104. <td style="cursor: pointer;" onclick='location="{:U("communityhead/index", array('group_id' => $row['id']))}"'>{$row['membercount']}</td>
  105. <td>
  106. <a class='layui-btn layui-btn-xs' href="{:U('communityhead/index', array('group_id' => $row['id']))}">
  107. <span data-toggle="tooltip" data-placement="top" data-original-title="分组团长">
  108. <i class='icow icow-member'></i>分组团长
  109. </span>
  110. </a>
  111. <?php if($row['id']!='default'){ ?>
  112. <a class="layui-btn layui-btn-xs ajaxModal" href="javascript:;" data-href="{:U('communityhead/addusergroup', array('id' => $row['id']))}">
  113. <i class="layui-icon layui-icon-edit"></i>编辑
  114. </a>
  115. <a class='layui-btn layui-btn-xs deldom' href="javascript:;" data-href="{:U('communityhead/deleteusergroup', array('id' => $row['id']))}" data-confirm='确认要删除此分组吗'>
  116. <i class="layui-icon">&#xe640;</i>删除
  117. </a>
  118. <?php } ?>
  119. </td>
  120. </tr>
  121. <?php } ?>
  122. </tbody>
  123. <tfoot>
  124. <tr>
  125. <td colspan="2">
  126. <div class="page-table-header">
  127. <input type="checkbox" name="checkall" lay-skin="primary" lay-filter="checkboxall">
  128. <div class="btn-group">
  129. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{:U('communityhead/deleteusergroup')}">
  130. 删除
  131. </button>
  132. </div>
  133. </div>
  134. </td>
  135. <td colspan="2" style="text-align: right">
  136. {$pager}
  137. </td>
  138. </tr>
  139. </tfoot>
  140. </table>
  141. </div>
  142. </div>
  143. </form>
  144. </div>
  145. </div>
  146. </div>
  147. <script src="/layuiadmin/layui/layui.js"></script>
  148. <script>
  149. layui.config({
  150. base: '/layuiadmin/' //静态资源所在路径
  151. }).extend({
  152. index: 'lib/index' //主入口模块
  153. }).use('index');
  154. </script>
  155. <script>
  156. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  157. var layer = layui.layer;
  158. var $;
  159. layui.use(['jquery', 'layer','form'], function(){
  160. $ = layui.$;
  161. var form = layui.form;
  162. $('.deldom').click(function(){
  163. var s_url = $(this).attr('data-href');
  164. layer.confirm($(this).attr('data-confirm'), function(index){
  165. $.ajax({
  166. url:s_url,
  167. type:'post',
  168. dataType:'json',
  169. success:function(info){
  170. if(info.status == 0)
  171. {
  172. layer.msg(info.result.message,{icon: 1,time: 2000});
  173. }else if(info.status == 1){
  174. var go_url = location.href;
  175. if( info.result.hasOwnProperty("url") )
  176. {
  177. go_url = info.result.url;
  178. }
  179. layer.msg('操作成功',{time: 1000,
  180. end:function(){
  181. location.href = info.result.url;
  182. }
  183. });
  184. }
  185. }
  186. })
  187. });
  188. })
  189. $('.btn-operation').click(function(){
  190. var ids_arr = [];
  191. var obj = $(this);
  192. var s_toggle = $(this).attr('data-toggle');
  193. var s_url = $(this).attr('data-href');
  194. $("input[name=item_checkbox]").each(function() {
  195. if( $(this).prop('checked') )
  196. {
  197. ids_arr.push( $(this).val() );
  198. }
  199. })
  200. if(ids_arr.length < 1)
  201. {
  202. layer.msg('请选择要操作的内容');
  203. }else{
  204. var can_sub = true;
  205. if( s_toggle == 'batch-remove' )
  206. {
  207. can_sub = false;
  208. layer.confirm($(obj).attr('data-confirm'), function(index){
  209. $.ajax({
  210. url:s_url,
  211. type:'post',
  212. dataType:'json',
  213. data:{ids:ids_arr},
  214. success:function(info){
  215. if(info.status == 0)
  216. {
  217. layer.msg(info.result.message,{icon: 1,time: 2000});
  218. }else if(info.status == 1){
  219. var go_url = location.href;
  220. if( info.result.hasOwnProperty("url") )
  221. {
  222. go_url = info.result.url;
  223. }
  224. layer.msg('操作成功',{time: 1000,
  225. end:function(){
  226. location.href = info.result.url;
  227. }
  228. });
  229. }
  230. }
  231. })
  232. });
  233. }else{
  234. $.ajax({
  235. url:s_url,
  236. type:'post',
  237. dataType:'json',
  238. data:{ids:ids_arr},
  239. success:function(info){
  240. if(info.status == 0)
  241. {
  242. layer.msg(info.result.message,{icon: 1,time: 2000});
  243. }else if(info.status == 1){
  244. var go_url = location.href;
  245. if( info.result.hasOwnProperty("url") )
  246. {
  247. go_url = info.result.url;
  248. }
  249. layer.msg('操作成功',{time: 1000,
  250. end:function(){
  251. location.href = info.result.url;
  252. }
  253. });
  254. }
  255. }
  256. })
  257. }
  258. }
  259. })
  260. form.on('switch(statewsitch)', function(data){
  261. var s_url = $(this).attr('data-href')
  262. var s_value = 1;
  263. if(data.elem.checked)
  264. {
  265. s_value = 1;
  266. }else{
  267. s_value = 0;
  268. }
  269. $.ajax({
  270. url:s_url,
  271. type:'post',
  272. dataType:'json',
  273. data:{value:s_value},
  274. success:function(info){
  275. if(info.status == 0)
  276. {
  277. layer.msg(info.result.message,{icon: 1,time: 2000});
  278. }else if(info.status == 1){
  279. var go_url = location.href;
  280. if( info.result.hasOwnProperty("url") )
  281. {
  282. go_url = info.result.url;
  283. }
  284. layer.msg('操作成功',{time: 1000,
  285. end:function(){
  286. location.href = info.result.url;
  287. }
  288. });
  289. }
  290. }
  291. })
  292. });
  293. form.on('checkbox(checkboxall)', function(data){
  294. if(data.elem.checked)
  295. {
  296. $("input[name=item_checkbox]").each(function() {
  297. $(this).prop("checked", true);
  298. });
  299. $("input[name=checkall]").each(function() {
  300. $(this).prop("checked", true);
  301. });
  302. }else{
  303. $("input[name=item_checkbox]").each(function() {
  304. $(this).prop("checked", false);
  305. });
  306. $("input[name=checkall]").each(function() {
  307. $(this).prop("checked", false);
  308. });
  309. }
  310. form.render('checkbox');
  311. });
  312. //监听提交
  313. form.on('submit(formDemo)', function(data){
  314. $.ajax({
  315. url: data.form.action,
  316. type: data.form.method,
  317. data: data.field,
  318. dataType:'json',
  319. success: function (info) {
  320. if(info.status == 0)
  321. {
  322. layer.msg(info.result.message,{icon: 1,time: 2000});
  323. }else if(info.status == 1){
  324. var go_url = location.href;
  325. if( info.result.hasOwnProperty("url") )
  326. {
  327. go_url = info.result.url;
  328. }
  329. layer.msg('操作成功',{time: 1000,
  330. end:function(){
  331. location.href = info.result.url;
  332. }
  333. });
  334. }
  335. }
  336. });
  337. return false;
  338. });
  339. })
  340. </script>
  341. <script>
  342. var ajax_url = "";
  343. $(function(){
  344. $(".ajaxModal").click(function () {
  345. var s_url = $(this).attr('data-href');
  346. ajax_url = s_url;
  347. $.ajax({
  348. url:s_url,
  349. type:"get",
  350. success:function(shtml){
  351. $('#ajaxModal').html(shtml);
  352. $("#ajaxModal").modal();
  353. }
  354. })
  355. });
  356. $(document).delegate(".modal-footer .btn-primary","click",function(){
  357. var s_data = $('#ajaxModal form').serialize();
  358. $.ajax({
  359. url:ajax_url,
  360. type:'post',
  361. dataType:'json',
  362. data:s_data,
  363. success:function(info){
  364. if(info.status == 0)
  365. {
  366. layer.msg(info.result.message,{icon: 1,time: 2000});
  367. }else if(info.status == 1){
  368. var go_url = location.href;
  369. if( info.result.hasOwnProperty("url") )
  370. {
  371. go_url = info.result.url;
  372. }
  373. layer.msg('操作成功',{time: 1000,
  374. end:function(){
  375. location.href = info.result.url;
  376. }
  377. });
  378. }
  379. }
  380. })
  381. return false;
  382. })
  383. })
  384. </script>
  385. <div id="ajaxModal" class="modal fade" style="display: none;">
  386. </div>
  387. </body>