<!--{include file="<!--{$oetplpath}-->block_head.tpl"}-->
<!--{if $a == "run"}-->
<div class="oemarry_layout">
  <div class="oe_top_nav"><i></i>帐号管理->系统用户</div>
  <div class="oe_content">
	
	<form id="serform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post">
	<div class="oe_txtwrap">
	  帐号名：<input type="text" name="sname" id="sname" class="input-100" value="<!--{$sname}-->" />&nbsp;
	  姓名：<input type="text" name="slastname" id="slastname" class="input-100" value="<!--{$slastname}-->" />&nbsp;
	  邮箱：<input type="text" name="semail" id="semail" class="input-100" value="<!--{$semail}-->" />&nbsp;
	  手机：<input type="text" name="smobile" id="smobile" class="input-100" value="<!--{$smobile}-->" />&nbsp;
	  状态：
	  <select name="sflag" id="sflag">
	  <option value=""></option>
	  <option value="1"<!--{if $sflag == '1'}--> selected<!--{/if}-->>正常</option>
	  <option value="2"<!--{if $sflag == '2'}--> selected<!--{/if}-->>锁定</option>
	  </select>
	  &nbsp;&nbsp;<input type="submit" name="btn_search" id="btn_search" class="button_2" value="搜索" />
	</div>
	</form>

    <div class="oe_tools_bar clearfix">
      <a class="icon-checkbox-unchecked" href="javascript:;" id="selAll" onclick="oemarrySelectAll(this, 'selall');">全选/反选</a>
      <a class="icon-remove-2" onclick="oemarryDialogFormDel('myform');">删除</a>
      <a class="icon-plus" href="<!--{$oefile}-->&c=<!--{$c}-->&a=add">添加</a>
      <span class="fr"><a class="icon-list" href="<!--{$oefile}-->&c=<!--{$c}-->">列表</a></span>
    </div>
    
	<form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->&a=del" method="post">
    <table class="oe_table_list table_cs">
	  <tr>
	    <th width="8%">ID</th>
		<th width="10%">帐号</th>
		<th width="8%">姓名</th>
		<th width="8%">角色</th>
		<th width="6%">状态</th>
		<th width="6%">管理员</th>
		<th width="12%">手机</th>
		<th width="15%">邮箱</th>
		<th width="15%">最后登录</th>
		<th>操作</th>
	  </tr>
	  <!--{if empty($admin)}-->
	  <tr>
	    <td class="text_center" colspan="10">No data!</td>
	  </tr>
	  <!--{else}-->
	  <!--{foreach $admin as $volist}-->
	  <tr>
	    <td class="text_center"><input type="checkbox" name="id[]" id="id[]" class="selall" value="<!--{$volist.adminid}-->" /><!--{$volist.adminid}--></td>
		<td><!--{$volist.loginname}--></td>
		<td><!--{$volist.lastname}--></td>
		<td class="text_center"><!--{$volist.rolename}--></td>
		<td class="text_center">
		<!--{if $volist.status == '1'}-->
		<font color="green">正常</font>
		<!--{else}-->
		<font color="red">锁定</font>
		<!--{/if}-->
		</td>
		<td class="text_center">
		<!--{if $volist.super == '1'}-->
		<font color="green">是</font>
		<!--{else}-->
		<font color="gray">否</font>
		<!--{/if}-->
		</td>
		<td><!--{$volist.mobile}--></td>
		<td><!--{$volist.email}--></td>
		<td>
		<!--{if $volist.logintime == '0'}-->
		~~
		<!--{else}-->
		<!--{$volist.logintime|date_format:"%Y-%m-%d %H:%M:%S"}-->
		<!--{/if}-->
		</td>
		<td class="text_center">
		 <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$volist.adminid}-->&<!--{$comeurl}-->" class="oe_ico_blue">编辑</a>
		 <a href="javascript:;" onclick="oemarryDialogUrlDel('<!--{$oefile}-->&c=<!--{$c}-->&a=del&id[]=<!--{$volist.adminid}-->&<!--{$comeurl}-->');" class="oe_ico_red">删除</a>
		</td>
	  </tr>
	  <!--{/foreach}-->
	  <!--{/if}-->
	</table>
	</form>

	<div class="oe_page_box"><!--{$showpage}--></div>

  </div>
</div>
<!--{/if}-->

<!--{if $a == 'add'}-->
<div class="oemarry_layout">
  <div class="oe_top_nav">
	<i></i>帐号管理->系统用户->添加用户
	<span><a href="<!--{$oefile}-->&c=<!--{$c}-->">&lt;&lt;返回列表</a></span>
  </div>
  <div class="oe_content">
    <h6>添加用户</h6>
	<form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post" />
	<input type="hidden" name="a" id="a" value="saveadd" />
    <table class="oe_table_wrap">
	  <tr>
	    <th width="15%">登录帐号：<span class="f_red">*</span></th>
		<td width="35%">
		  <input type="text" name="loginname" id="loginname" class="input-150" />
		  <span class="oe_trap">（系统登录帐号）</span>
		</td>
		<th width="15%">系统管理员：</th>
		<td width="35%">
		<input type="checkbox" name="super" id="super" value="1" />
		<span class="oe_trap">（拥有所有操作权限）</span>
		</td>
	  </tr>
	  <tr>
	    <th>登录密码：<span class="f_red">*</span></th>
		<td>
		  <input type="password" name="password" id="password" class="input-150" />
		  <span class="oe_trap">（6~16个字符）</span>
		</td>
		<th>帐号状态：</th>
		<td>
		<input type="radio" name="status" id="status" value="1" checked />正常，
		<input type="radio" name="status" id="status" value="0" />锁定
		</td>
	  </tr>
	  <tr>
	    <th>确认密码：<span class="f_red">*</span></th>
		<td>
		  <input type="password" name="confirmpassword" id="confirmpassword" class="input-150" />
		  <span class="oe_trap">（6~16个字符）</span>
		</td>
		<th>所属角色：</th>
		<td>
		<!--{hook mod='roles' type='select' name='roleid' text='=请选择='}-->
		<span class="oe_trap">（选择角色操作权限）</span>
		</td>
	  </tr>
	  <tr>
	    <th>姓名：</th>
		<td><input type="text" name="lastname" id="lastname" class="input-150" /></td>
		<th>座机：</th>
		<td><input type="text" name="tel" id="tel" class="input-150" /></td>
	  </tr>
	  <tr>
	    <th>手机：</th>
		<td><input type="text" name="mobile" id="mobile" class="input-150" /></td>
		<th>邮箱：</th>
		<td><input type="text" name="email" id="email" class="input-200" /></td>
	  </tr>
	  <tr>
	    <th>QQ：</th>
		<td><input type="text" name="qq" id="qq" class="input-150" /></td>
		<th>微信：</th>
		<td><input type="text" name="weixin" id="weixin" class="input-150" /></td>
	  </tr>
	  <tr>
	    <th>备注说明：</th>
		<td colspan="3">
		<textarea name="remark" id="remark" style="width:50%;height:60px;"></textarea>
		</td>
	  </tr>
	  <tr>
	    <th>头像/照片：</th>
		<td colspan="3">
		  <div class="oe_img_upload">
		    <label class="_uploadbtn">上传头像<input type="file" name="img" id="img" value="" /></label>
		    <label class="_uploading" id="img_loading">
			  <img src="<!--{$urlpath}-->tpl/admin/images/loading.gif" />上传中...
		    </label>
		    <input type="hidden" id="img_thumb" name="img_thumb" value="" />
		    <input type="hidden" id="img_url" name="headimg" value="" />
		  </div>
		  <script type="text/javascript">
		  $(function(){
			  $("#img").live("change", function(){
				oemarryUploadImg("img", "<!--{$oefile}-->&c=index&a=uploadimg&module=upload");
			  });
		  });
		  </script>
		</td>
	  </tr>
	  <tr>
	    <th>头像预览：</th>
	    <td><img src="<!--{$urlpath}-->tpl/static/images/nopic.jpg" width="60px" height="60px" id="img_preview" /></td>
	  </tr>
	</table>
	<div class="oe_button_layout">
	  <input type="button" id="btn_save" class="button_2" value="添加保存" /> 
	  <span id="submit_tips" class="error"></span>
	</div>
	</form>
  </div>
</div>
<script type="text/javascript">
$(function(){
	/*
	var myeditor;
	KindEditor.ready(function(K) {myeditor = K.create('#intro');});
	*/
	$("#loginname").bind("blur", function(){ //检测帐号
		if ($(this).val().length > 0) {
			$.ajax({
				type: "POST",
				url: "<!--{$oefile}-->&c=<!--{$c}-->",
				cache: false,
				data: {a:"checkname", name:$(this).val(),r:get_rndnum(8)},
				dataType: "json",
				success: function(data) {
					$json = eval(data);
					$response = $json.response;
					$result = $json.result;
					if ($response == '1') {
						oemarryCheckOk("loginname", "该帐号可用");
					}
					else {
						if ($result.length == 0) {
							$result = "该帐号已存在";
						}
						oemarryCheckError("loginname", $result);
					}
				},
				error: function() {
					ToastShow("检测失败，请检查网络...");
				}
			});
		}
	});

	$("#btn_save").bind("click", function(){ //添加保存
		if ($("#loginname").val().length == 0) {
			ToastShow("登录帐号不能为空", "loginname");
			return false;
		}
		if ($("#password").val().length < 6 || $("#password").val().length > 16) {
			ToastShow("请输入6~16位的密码", "password");
			return false;
		}
		if ($("#confirmpassword").val() != $("#password").val()) {
			ToastShow("确认密码不正确", "confirmpassword");
			return false;
		}
		//$("#intro").text(myeditor.html());
		$("#myform").submit();
	});
});
</script>
<!--{/if}-->


<!--{if $a == 'edit'}-->
<div class="oemarry_layout">
  <div class="oe_top_nav">
	<i></i>帐号管理->系统用户->编辑用户
	<span><a href="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->">&lt;&lt;返回列表</a></span>
  </div>
  <div class="oe_content">
    <h6>编辑用户</h6>
	<form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post" />
	<input type="hidden" name="a" id="a" value="saveedit" />
	<input type="hidden" name="id" id="id" value="<!--{$id}-->" />
    <table class="oe_table_wrap">
	  <tr>
	    <th width="15%">登录帐号：<span class="f_red">*</span></th>
		<td width="35%"><!--{$admin.loginname}--></td>
		<th width="15%">帐号ID：</th>
		<td width="35%"><!--{$admin.adminid}--></td>
	  </tr>
	  <tr>
	    <th>登录密码：<span class="f_red"></span></th>
		<td>
		  <input type="password" name="password" id="password" class="input-150" />
		  <span class="oe_trap">（不修改请留空）</span>
		</td>
		<th>系统管理员：</th>
		<td>
		  <input type="checkbox" name="super" id="super" value="1"<!--{if $admin.super=='1'}--> checked<!--{/if}--> />
		  <span class="oe_trap">（拥有所有操作权限）</span>
		</td>
	  </tr>
	  <tr>
	    <th>帐号状态：<span class="f_red"></span></th>
		<td>
		  <input type="radio" name="status" id="status" value="1"<!--{if $admin.status=='1'}--> checked<!--{/if}--> />正常，
		  <input type="radio" name="status" id="status" value="0"<!--{if $admin.status=='0'}--> checked<!--{/if}--> />锁定
		</td>
		<th>所属角色：</th>
		<td>
		<!--{hook mod='roles' type='select' name='roleid' text='=请选择=' value=$admin.roleid}-->
		<span class="oe_trap">（选择角色操作权限）</span>
		</td>
	  </tr>
	  <tr>
	    <th>姓名：</th>
		<td><input type="text" name="lastname" id="lastname" class="input-150" value="<!--{$admin.lastname}-->" /></td>
		<th>座机：</th>
		<td><input type="text" name="tel" id="tel" class="input-150" value="<!--{$admin.tel}-->" /></td>
	  </tr>
	  <tr>
	    <th>手机：</th>
		<td><input type="text" name="mobile" id="mobile" class="input-150" value="<!--{$admin.mobile}-->" /></td>
		<th>邮箱：</th>
		<td><input type="text" name="email" id="email" class="input-200" value="<!--{$admin.email}-->" /></td>
	  </tr>
	  <tr>
	    <th>QQ：</th>
		<td><input type="text" name="qq" id="qq" class="input-150" value="<!--{$admin.qq}-->" /></td>
		<th>微信：</th>
		<td><input type="text" name="weixin" id="weixin" class="input-150" value="<!--{$admin.weixin}-->" /></td>
	  </tr>
	  <tr>
	    <th>备注说明：</th>
		<td colspan="3">
		<textarea name="remark" id="remark" style="width:50%;height:60px;"><!--{$admin.remark}--></textarea>
		</td>
	  </tr>
	  <tr>
	    <th>头像/照片：</th>
		<td colspan="3">
		  <div class="oe_img_upload">
		    <label class="_uploadbtn">上传头像<input type="file" name="img" id="img" value="" /></label>
		    <label class="_uploading" id="img_loading">
			  <img src="<!--{$urlpath}-->tpl/admin/images/loading.gif" />上传中...
		    </label>
		    <input type="hidden" id="img_thumb" name="img_thumb" value="" />
		    <input type="hidden" id="img_url" name="headimg" value="<!--{$admin.headimg}-->" />
		  </div>
		  <script type="text/javascript">
		  $(function(){
			  $("#img").live("change", function(){
				oemarryUploadImg("img", "<!--{$oefile}-->&c=index&a=uploadimg&module=upload");
			  });
		  });
		  </script>
		</td>
	  </tr>
	  <tr>
	    <th>头像预览：</th>
	    <td>
		<!--{if !empty($admin.headimg)}-->
		<img src="<!--{$urlpath}--><!--{$admin.headimg}-->" width="60px" height="60px" id="img_preview" />
		<!--{else}-->
		<img src="<!--{$urlpath}-->tpl/static/images/nopic.jpg" width="60px" height="60px" id="img_preview" />
		<!--{/if}-->
		</td>
	  </tr>
	</table>
	<div class="oe_button_layout">
	  <input type="button" id="btn_save" class="button_2" value="编辑保存" /> 
	  <span id="submit_tips" class="error"></span>
	</div>
	</form>
  </div>
</div>
<script type="text/javascript">
$(function(){
	$("#btn_save").bind("click", function(){ //编辑保存
		$("#myform").submit();
	});
});
</script>
<!--{/if}-->

</body>
</html>