<%@ page language="java" pageEncoding="UTF-8"
         contentType="text/html; charset=UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
    String basePath = request.getContextPath();
    String resourcePath = basePath + "/resource";
%>
<!DOCTYPE html>
<head>
    <title>用户基本信息</title>
    <jsp:include page="../common/head.jsp"></jsp:include>
</head>
<body>
<jsp:include page="../common/body_header.jsp"></jsp:include>
    <div class="mid">
        <jsp:include page="../common/user_center_header.jsp"></jsp:include>
        <div class="user-mid2">
        <div class="xinxi0">
            <div class="user-mid0">
                <div class="if">
                    <span  onclick="fnBaseInfoId()" id="baseInfoId" class="xx0"><a>基本信息</a></span>
                    <%--<span class="xx"><a>实名认证</a></span>--%>
                    <span onclick="fnPasswordId()" id="passwordId" class="xx"><a>修改密码</a></span>
                </div>
                <div class="clearfix"></div>
                <div class="xx-main" id="fnBaseInfoIdView">
                    <table>
                        <tr>
                            <td>账户名：</td>
                            <td>${outputModel.username}</td>
                        </tr>
                        <tr>
                            <td>所在部门：</td>
                            <td>${outputModel.sectorName}</td>
                        </tr>
                        <tr>
                            <td>APIkey：</td>
                            <td><%--${outputModel.authKey}--%></td>
                        </tr>
                        <tr>
                            <td>scretKey：</td>
                            <td><%--${outputModel.authSecret}--%></td>
                        </tr>
                        <tr>
                            <td>手机号码：</td>
                            <td><%--${outputModel.authPhone}--%></td>
                        </tr>
                        <%--<tr>
                            <td>用户类型：</td>
                            <td>部门用户</td>
                        </tr>--%>
                    </table>
                </div>
                <div class="xx-main" id="fnPasswordIdView">
                    <form id="changePasswordId">
                        <div class="form0">
                                            <span class="font">
                                                <span class="xinghao" >*</span>旧密码
                                            </span>
                            <div class="form1">
                                <input type="password" class="input4" name="oldpassword" placeholder="请输入旧密码">
                                <div class="tishi4"></div>
                            </div>
                        </div>
                        <div class="tishi" style="display: none">! &nbsp;旧密码不正确</div>
                        <div class="form0">
                                            <span class="font">
                                                <span class="xinghao" >*</span>新密码
                                            </span>
                            <div class="form1">
                                <input type="password" class="input4" name="newpassword" placeholder="请输入新密码">
                                <div class="tishi4"></div>
                            </div>
                        </div>
                        <div class="tishi" style="display: none" name="newAndRe">! &nbsp;两次密码输入不一致</div>
                        <div class="form0">
                                            <span class="font01">
                                                <span class="xinghao" >*</span>确认新密码
                                            </span>
                            <div class="form1">
                                <input type="password" class="input4" name="renewpassword" placeholder="请再次填写新密码">
                                <div class="tishi4"></div>
                            </div>
                        </div>
                        <div class="form010">
                            注意：密码只能包含数字字母下划线中划线，8到20位
                        </div>
                        <input type="button" class="queren1" value="确认"  onclick="fnSubimt()">
                    </form>
                </div>
            </div>
        </div>
    </div>
    </div>
<jsp:include page="../common/body_footer.jsp"></jsp:include>
</body>
<script type="text/javascript">

    //tab页切换
    /*if ($("#type").val() ==1){
        fnApplyData();
    }else{
        fnFollowData();
    }*/

    fnBaseInfoId();

    function fnBaseInfoId(){
        $('#fnBaseInfoIdView').show();
       /* $('#fnVerifyIdView').hide();*/
        $('#fnPasswordIdView').hide();
        $("#baseInfoId").addClass("xx01");
        /*$("#verifyId").removeClass("xx01");*/
        $("#passwordId").removeClass("xx01");
    }
   /* function fnVerifyId(){
        $('#fnBaseInfoIdView').hide();
        $('#fnVerifyIdView').show();
        $('#fnPasswordIdView').hide();
        $("#baseInfoId").removeClass("xx01");
        $("#verifyId").addClass("xx01");
        $("#passwordId").removeClass("xx01");
    }*/

    function fnPasswordId(){
        $('#fnBaseInfoIdView').hide();
       /* $('#fnVerifyIdView').hide();*/
        $('#fnPasswordIdView').show();
        $("#baseInfoId").removeClass("xx01");
        /*$("#verifyId").removeClass("xx01");*/
        $("#passwordId").addClass("xx01");
    }

    //修改密码----验证待做

    function fnSubimt(){
        $('.tishi4').text('');//清空验证
       //前台验证

        //后台验证
        $.post("<%=basePath%>/share/userverify/changePassword.action",$('#changePasswordId').serialize(),function(result){
            if(result.stateCode==200){
                alert(result.msg)
                $("#changePasswordId input[type='password']").val("");
            }else{
                if(result.data ==null){
                    alert(result.msg);//弹出发布失败提示
                }else{
                    for(var item in result.data){
                        $("[name='"+item+"']").next().text("! "+result.data[item]);
                        $("[name='"+item+"']").next().show();
                    }
                }
            }
        })
    }
</script>
</html>