<!--{include file="<!--{$oetplpath}-->block_head.tpl"}-->

<!--{if $a == "run"}-->
<div class="layui-fluid oe_fluid">
  <div class="oe_breadcrumb_box clearfix">
    <div class="layui-breadcrumb fl" lay-filter="breadcrumb" style="visibility: visible;">
      <a href="javascript:;">我的帐号</a><span lay-separator="">/</span>
      <a><cite>我的资料</cite></a>
    </div>
  </div>
  
  <div class="layui-card">
    <div class="layui-card-body">
    
      <div class="layui-tab" style="margin-bottom:15px;">
        <ul class="layui-tab-title">
          <li class="layui-this"><a href="<!--{$oefile}-->&c=<!--{$c}-->">我的资料</a></li>
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=editinfo">修改资料</a></li>
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=editpass">修改密码</a></li>
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=power">我的权限</a></li>
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=subordinate">我的下属</a></li>
        </ul>
      </div>
    
      <table class="oe_tbl_form layui-form">
        <tr>
          <th width="15%">登录帐号：</th>
          <td width="35%"><!--{$cplogin.loginname}--></td>
          <th width="15%">角色：</th>
          <td width="35%">
            <!--{if $cplogin.super == '1'}-->
            系统管理员
            <!--{else}-->
            <!--{$cplogin.rolename}-->
            <!--{/if}-->
          </td>
        </tr>
        <tr>
          <th>姓名：</th>
          <td>
            <!--{if !empty($cplogin.lastname)}-->
            <!--{$cplogin.lastname}-->
            <!--{else}-->
            --
            <!--{/if}-->
          </td>
          <th>座机：</th>
          <td>
            <!--{if !empty($cplogin.tel)}-->
            <!--{$cplogin.tel}-->
            <!--{else}-->
            --
            <!--{/if}-->
          </td>
        </tr>
        <tr>
          <th>手机：</th>
          <td>
            <!--{if !empty($cplogin.mobile)}-->
            <!--{$cplogin.mobile}-->
            <!--{else}-->
            --
            <!--{/if}-->
          </td>
          <th>邮箱：</th>
          <td>
            <!--{if !empty($cplogin.email)}-->
            <!--{$cplogin.email}-->
            <!--{else}-->
            --
            <!--{/if}-->
          </td>
        </tr>
        <tr>
          <th>QQ：</th>
          <td>
            <!--{if !empty($cplogin.qq)}-->
            <!--{$cplogin.qq}-->
            <!--{else}-->
            --
            <!--{/if}-->
          </td>
          <th>微信：</th>
          <td>
            <!--{if !empty($cplogin.weixin)}-->
            <!--{$cplogin.weixin}-->
            <!--{else}-->
            --
            <!--{/if}-->
          </td>
        </tr>
        <tr>
          <th>创建时间：</th>
          <td><!--{$cplogin.addtime|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
          <th>最后登录：</th>
          <td><!--{$cplogin.logintime|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
        </tr>
        <tr>
          <th>登录次数：</th>
          <td><!--{$cplogin.logintimes}--></td>
          <th>登录IP：</th>
          <td><!--{$cplogin.loginip}--></td>
        </tr>
      </table>
    </div>
  </div>

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

<!--{if $a == "editinfo"}-->
<div class="layui-fluid oe_fluid">
  <div class="oe_breadcrumb_box clearfix">
    <div class="layui-breadcrumb fl" lay-filter="breadcrumb" style="visibility: visible;">
      <a href="javascript:;">基础模块</a><span lay-separator="">/</span>
      <a href="javascript:;">我的帐号</a><span lay-separator="">/</span>
      <a><cite>我的资料</cite></a>
    </div>
    <div class="oe_tool_bar ft">
      <button class="layui-btn layui-btn-sm layui-btn-radius" id="but_submit_post2" lay-submit lay-filter="editform">
        编辑保存
        <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
      </button>
      <button class="layui-btn layui-btn-sm layui-btn-primary layui-btn-radius"><a href="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->">返回列表</a></button>
    </div>
    
  </div>
  
  <div class="layui-card">
    <div class="layui-card-body">
    
      <div class="layui-tab" style="margin-bottom:15px;">
        <ul class="layui-tab-title">
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->">我的资料</a></li>
          <li class="layui-this"><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=editinfo">修改资料</a></li>
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=editpass">修改密码</a></li>
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=power">我的权限</a></li>
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=subordinate">我的下属</a></li>
        </ul>
      </div>
      
      <form class="layui-form" id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->" method="post">
      <input type="hidden" name="a" id="a" value="saveinfo" />
      <table class="oe_tbl_form layui-form">
        <tr>
          <th width="15%">登录帐号：</th>
          <td width="35%">
            <!--{$cplogin.loginname}--> (<!--{$cplogin.adminid}-->)
          </td>
          <th width="15%">角色：</th>
          <td width="35%">
            <!--{if $cplogin.super == '1'}-->
            系统管理员
            <!--{else}-->
            <!--{$cplogin.rolename}-->
            <!--{/if}-->
          </td>
        </tr>
        <tr>
          <th><font color="red">*</font>姓名：</th>
          <td><input type="text" name="lastname" id="lastname" class="layui-input input-200" value="<!--{$cplogin.lastname}-->" placeholder="请填写姓名" /></td>
          <th>座机：</th>
          <td><input type="text" name="tel" id="tel" class="layui-input input-200" value="<!--{$cplogin.tel}-->" /></td>
        </tr>
        <tr>
          <th>手机：</th>
          <td><input type="text" name="mobile" id="mobile" class="layui-input input-200" value="<!--{$cplogin.mobile}-->" /></td>
          <th>邮箱：</th>
          <td><input type="text" name="email" id="email" class="layui-input input-200" value="<!--{$cplogin.email}-->" /></td>
        </tr>
        <tr>
          <th>QQ：</th>
          <td><input type="text" name="qq" id="qq" class="layui-input input-200" value="<!--{$cplogin.qq}-->" /></td>
          <th>微信：</th>
          <td><input type="text" name="weixin" id="weixin" class="layui-input input-200" value="<!--{$cplogin.weixin}-->" /></td>
        </tr>
        
        <tr>
          <th>头像：</th>
          <td colspan="3">
            <div class="layui-btn">
              <i class="layui-icon layui-icon-upload"></i>
              上传头像
              <input type="file" name="img" id="img" f="but_upload_image" />
            </div>
            <div class="upload_loading" id="img_loading" style="display:none;"></div>
            <input type="hidden" id="img_thumb" name="img_thumb" value="" />
            <input type="hidden" id="img_url" name="headimg" value="<!--{$cplogin.headimg}-->" />
        
            <div class="tblform_tips normal">预览：</div>
            <div class="upload_pic upload_pic_md" style="width:30px;height:30px;">
              <img src="<!--{$urlpath}--><!--{if !empty($cplogin.headimg)}--><!--{$cplogin.headimg}--><!--{else}-->tpl/static/images/nopic.jpg<!--{/if}-->" id="img_preview" f="viewimg" />
            </div>
          </td>
        </tr>
        
      </table>
      </form>
    </div>
  </div>
  
  <div class="oe_tbl_form_btn">
    <button class="layui-btn" id="but_submit_post" lay-submit lay-filter="editform">
      编辑保存
      <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
    </button>
  </div>

</div>
<script type="text/javascript">
$(function(){

    layui.use('form', function(){
        $form = layui.form;
        //保存...
        $form.on('submit(editform)', function(data){
            $obj_id = data.elem.getAttribute("id");
            if (!$("#"+$obj_id).hasClass("forbid_submit")) {
            
                if ($("#lastname").val().length  == 0) {
                    layer.msg("请填写姓名");
                    return false;
                }
                
                $("#"+$obj_id).addClass("forbid_submit");
                if ($("#"+$obj_id).find("span").length > 0) {
                    $("#"+$obj_id).find("span").show();
                }
                //...
                $("#myform").submit();
            }
        });   
    });
    
});
</script>
<!--{/if}-->

<!--{if $a == "editpass"}-->
<div class="layui-fluid oe_fluid">
  <div class="oe_breadcrumb_box clearfix">
    <div class="layui-breadcrumb fl" lay-filter="breadcrumb" style="visibility: visible;">
      <a href="javascript:;">基础模块</a><span lay-separator="">/</span>
      <a href="javascript:;">我的帐号</a><span lay-separator="">/</span>
      <a><cite>我的资料</cite></a>
    </div>
    <div class="oe_tool_bar ft">
      <button class="layui-btn layui-btn-sm layui-btn-radius" id="but_submit_post2" lay-submit lay-filter="editform">
        修改保存
        <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
      </button>
      <button class="layui-btn layui-btn-sm layui-btn-primary layui-btn-radius"><a href="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->">返回列表</a></button>
    </div>
    
  </div>
  
  <div class="layui-card">
    <div class="layui-card-body">
    
      <div class="layui-tab" style="margin-bottom:15px;">
        <ul class="layui-tab-title">
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->">我的资料</a></li>
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=editinfo">修改资料</a></li>
          <li class="layui-this"><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=editpass">修改密码</a></li>
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=power">我的权限</a></li>
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=subordinate">我的下属</a></li>
        </ul>
      </div>
      
      <form class="layui-form" id="myform" action="" method="post">
      <table class="oe_tbl_form layui-form">
        <tr>
          <th width="15%">旧密码：</th>
          <td width="85%">
            <input type="password" name="oldpassword" id="oldpassword" maxlength="16" class="layui-input input-200" placeholder="请输入旧密码" />
            <font color="gray"></font>
          </td>
        </tr>
        <tr>
          <th>新密码：</th>
          <td>
            <input type="password" name="newpassword" id="newpassword" maxlength="16" class="layui-input input-200" placeholder="密码长度6~16个字符" />
            <font color="gray"></font>
          </td>
        </tr>
        <tr>
          <th>确认密码：</th>
          <td>
            <input type="password" name="confirmpassword" id="confirmpassword" maxlength="16" class="layui-input input-200" placeholder="再次输入新密码" />
            <font color="gray"></font>
          </td>
        </tr>
        
      </table>
      </form>
    </div>
  </div>
  
  <div class="oe_tbl_form_btn">
    <button class="layui-btn" id="but_submit_post" lay-submit lay-filter="editform">
      修改保存
      <span class="oe_btn_loading layui-anim layui-icon layui-anim-rotate layui-anim-loop" style="display:none;">&#xe63d;</span>
    </button>
  </div>

</div>
<script type="text/javascript">
$(function(){

    layui.use('form', function(){
        $form = layui.form;
        //保存...
        $form.on('submit(editform)', function(data){
            $obj_id = data.elem.getAttribute("id");
            if (!$("#"+$obj_id).hasClass("forbid_submit")) {
            
                $oldpassword = $("#oldpassword").val();
                $newpassword = $("#newpassword").val();
                $confirmpassword = $("#confirmpassword").val();
                if ($oldpassword.length == 0) {
                    layer.msg("请输入旧密码");
                    return false;
                }
                if ($newpassword.length == 0) {
                    layer.msg("请输入新密码");
                    return false;
                }
                if ($newpassword.length <6 || $newpassword > 16) {
                    layer.msg("密码长度不正确");
                    return false;
                }
                if ($confirmpassword != $newpassword) {
                    layer.msg("确认密码不正确");
                    return false;
                }
                
                $("#"+$obj_id).addClass("forbid_submit");
                if ($("#"+$obj_id).find("span").length > 0) {
                    $("#"+$obj_id).find("span").show();
                }
                
                $.ajax({
                    type: "POST",
                    url: "<!--{$oefile}-->&c=<!--{$c}-->",
                    cache: false,
                    data: {
                        a:"savepass", oldpassword:$oldpassword, newpassword:$newpassword, 
                        confirmpassword:$confirmpassword, r:get_rndnum(8)
                    },
                    dataType: "json",
                    success: function(data) {
                        $json = eval(data);
                        $response = $json.response;
                        $result = $json.result;
                        if ($response == '1') {
                            layer.msg("修改成功，请记住新密码。");
                            setTimeout(function(){
                                window.location.reload()
                            }, 800);
                        }
                        else {  
                            if ($result.length > 0) {
                                layer.msg($result);
                            }
                            else {
                                layer.msg("修改失败");
                            }
                            $("#"+$obj_id).removeClass("forbid_submit");
                            if ($("#"+$obj_id).find("span").length > 0) {
                                $("#"+$obj_id).find("span").hide();
                            }
                        }
                    },
                    error: function() {
                        layer.msg("系统繁忙，请稍后再试");
                        $("#"+$obj_id).removeClass("forbid_submit");
                        if ($("#"+$obj_id).find("span").length > 0) {
                            $("#"+$obj_id).find("span").hide();
                        }
                    }
                });          
                
            }
        });   
    });
    
});
</script>
<!--{/if}-->

<!--{if $a == "power"}-->
<div class="layui-fluid oe_fluid">
  <div class="oe_breadcrumb_box clearfix">
    <div class="layui-breadcrumb fl" lay-filter="breadcrumb" style="visibility: visible;">
      <a href="javascript:;">基础模块</a><span lay-separator="">/</span>
      <a href="javascript:;">我的帐号</a><span lay-separator="">/</span>
      <a><cite>我的资料</cite></a>
    </div>
    
  </div>
  
  <div class="layui-card">
    <div class="layui-card-body">
    
      <div class="layui-tab" style="margin-bottom:15px;">
        <ul class="layui-tab-title">
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->">我的资料</a></li>
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=editinfo">修改资料</a></li>
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=editpass">修改密码</a></li>
          <li class="layui-this"><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=power">我的权限</a></li>
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=subordinate">我的下属</a></li>
        </ul>
      </div>
      <style>
      .border-gray th{border: 1px solid #ebebeb;}
      .border-gray td{border: 1px solid #ebebeb;}
      </style>
      
      <table id="roles-profiles" class="oe_tbl_form layui-form border-gray">
        <tr>
          <th width="20%" style="line-height:35px;text-align:center;">模块</th>
          <th width="10%" style="text-align:center;">查看</th>
          <th width="10%" style="text-align:center;">添加</th>
          <th width="10%" style="text-align:center;">修改</th>
          <th width="10%" style="text-align:center;">删除</th>
          <th width="10%" style="text-align:center;">审批</th>
          <th style="text-align:center;">其他操作</th>
        </tr>
        <!--{$myroles}-->
      </table>
      
    </div>
  </div>

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

<!--{if $a == "subordinate"}-->
<div class="layui-fluid oe_fluid">
  <div class="oe_breadcrumb_box clearfix">
    <div class="layui-breadcrumb fl" lay-filter="breadcrumb" style="visibility: visible;">
      <a href="javascript:;">基础模块</a><span lay-separator="">/</span>
      <a href="javascript:;">我的帐号</a><span lay-separator="">/</span>
      <a><cite>我的资料</cite></a>
    </div>
  </div>
  
  <div class="layui-card">
    <div class="layui-card-body">
    
      <div class="layui-tab" style="margin-bottom:15px;">
        <ul class="layui-tab-title">
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->">我的资料</a></li>
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=editinfo">修改资料</a></li>
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=editpass">修改密码</a></li>
          <li><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=power">我的权限</a></li>
          <li class="layui-this"><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=subordinate">我的下属</a></li>
        </ul>
      </div>
      
      <table class="oe_tbl_form layui-form">
        <!--{if empty($roles)}-->
        <tr>
          <td class="text_center">没有符合条件的信息</td>
        </tr>
        <!--{else}-->
        <!--{foreach $roles as $volist}-->
        <tr>
          <td>
            <!--{$volist.tree_node}--> <font color="blue">（
            <!--{if $login.roleid == $volist.roleid}-->
              <!--{$login.lastname}-->
            <!--{else}-->
              <!--{hook mod='admin' item='lastname' type='multi' value=$volist.roleid}-->
            <!--{/if}-->
            ）</font>
          </td>
        </tr>
        <!--{/foreach}-->
        <!--{/if}-->
      </table>
      
    </div>
  </div>

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