You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							110 lines
						
					
					
						
							3.9 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							110 lines
						
					
					
						
							3.9 KiB
						
					
					
				| <!DOCTYPE html> | |
| <html class="no-js" lang="zh-CN"> | |
| <head> | |
|     <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
|     <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
|     <script type="text/javascript" src="{$smarty.const.CSS_URL}/js/jquery-1.8.1.min.js"></script> | |
|     <script type="text/javascript" src="{$smarty.const.CSS_URL}/js/jquery.form.js"></script> | |
|     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
|     <title>管理员列表</title> | |
|     <meta name="viewport" content="width=device-width,initial-scale=1"> | |
|     <link href="{$smarty.const.CSS_URL}/css/global.css?v={$smarty.const.CSS_JS_VERSION}" media="screen" rel="stylesheet" | |
|           type="text/css"> | |
| </head> | |
| <body> | |
| 
 | |
| <div id="page"> | |
|     <div class="container"> | |
|         <section id="main" style="width: 100%;"> | |
|             <div id="main-content"> | |
|                 <div class="record-control"> | |
|                     <div class="flash-message"></div> | |
|                     <ul class="tabs"> | |
|                         <li class="active"><a href="javascript:;">管理员列表</a></li> | |
|                         <div style="display:inline-block;float: right;"> | |
|                             <button class="button primary next" onclick="to_add()">添加管理员</button> | |
|                         </div> | |
|                     </ul> | |
|                 </div> | |
|             </div> | |
| 
 | |
|             <div class="entry"> | |
|                 <div class="modal-body"> | |
|                     <table class="table table-striped table-bordered table-condensed"> | |
|                         <thead> | |
|                         <tr> | |
|                             <th width="50">ID</th> | |
|                             <th width="50">管理员</th> | |
|                             <th width="50">操作</th> | |
|                         </tr> | |
|                         </thead> | |
|                         <tbody> | |
|                         {foreach from=$list key=key item=item} | |
|                         <tr> | |
|                             <td>{$item.id}</td> | |
|                             <td>{$item.username}</td> | |
|                             <td> | |
|                                 {if $item.is_super == 0} | |
|                                     {if $item.status == 0} | |
|                                     <a href="javascript:;" onclick="to_disabled({$item.id},1)">禁用</a> | |
|                                     {else} | |
|                                     <a href="javascript:;" onclick="to_disabled({$item.id},0)">启用</a> | |
|                                     {/if} | |
|                                 {/if} | |
|                             </td> | |
|                         </tr> | |
|                         {/foreach} | |
|                         </tbody> | |
|                     </table> | |
|                 </div> | |
| 
 | |
|             </div> | |
|         </section><!--end of main section--> | |
| 
 | |
|     </div><!--end of container--> | |
| 
 | |
| </div><!--end of #page--> | |
| 
 | |
| {literal} | |
| <script type="text/javascript"> | |
|     function to_add() { | |
|         location.href = '/admin/user_add'; | |
|     } | |
| 
 | |
|     function to_disabled(id, status) { | |
|         if (!confirm("确定要禁用吗?")) { | |
|             console.log("用户选择了确认"); | |
|             return false; | |
|         } | |
| 
 | |
|         const data = { | |
|             id: id, | |
|             status: status, | |
|         }; | |
| 
 | |
|         $.ajax({ | |
|             url: '/admin/ajax_update_user', // 替换为你的服务器端处理文件 | |
|             type: 'POST', | |
|             data: data, | |
|             dataType: 'json', | |
|             success: function (response) { | |
|                 alert(response.info); | |
|                 if (response.status == true) { | |
|                     window.location.reload(); | |
|                 } | |
| 
 | |
|                 if (response.data.code == 40002) { | |
|                     window.location.href = "/admin/login"; | |
|                 } | |
|             }, | |
|             error: function (xhr, status, error) { | |
|                 console.error('错误:', response); | |
|                 alert('提交失败,请重试。'); | |
|             } | |
|         }); | |
|     } | |
| </script> | |
| {/literal} | |
| 
 | |
| </body> | |
| </html>
 | |
| 
 |