liuxiaolong
2019-05-09 0d1d88cdb668e75ea8609417ac18ae19947e9525
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!DOCTYPE html>
<html>
 
<head>
    <meta charset="utf-8">
    <title>修改密码</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
 
    <link rel="stylesheet" href="css/mui.min.css">
    <link rel="stylesheet" href="node_modules/weui/dist/style/weui.css"/>
    <style>
        #content div{
            height:40px;
            line-height:40px;
            background-color:#ffffff;
            margin-bottom:25px;
 
        }
        #content div .font{
            float: left;
            width:25%;
            padding-left:10px;
        }
        #content div input{
            float: right;
            width:60%;
            border:0px;
            color:#353535;
        }
        #tishi_message{
            position: absolute;
            top:20%;
            left:10%;
        }
 
    </style>
</head>
 
<body>
 
 
<!--内容部分-->
<div id="content" class="mui-content mui-scroll-wrapper">
    <!--<div class="mui-scroll">-->
        <div style="margin-top:25px"><div class="font">旧密码</div><input type="password" id="pwd_old" placeholder="请输入您的密码"/></div>
        <div><div class="font">新密码</div><input type="password" id="pwd_new" placeholder="请输入您的新密码"/></div>
        <div><div class="font">确认密码</div><input type="password" id="pwd_news" placeholder="确认您的新密码"/></div>
 
        <a href="#" class="weui-btn weui-btn_primary" style="width:80%;margin-top:100px">确定</a>
            <!--提示信息-->
        <div style="height:200px;width:300px;display:none;border-radius:10px" id="tishi_message">
            <div class="close"><img src="images/close.png" alt="" style="height:30px;float: right;padding-right:20px;padding-top:10px "/></div>
            <div class="content" style="text-align:center">
            </div>
            <button style="margin-left:40%" id="queding">确定</button>
 
        </div>
    <!--</div>-->
</div>
 
 
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<!--<script src="js/common.js" ></script>-->
<script src="js/mui.min.js"></script>
<script>
 
 
 
 
    $('input:password').each(function(){
        var txt = $(this).val();
        $(this).focus(function(){
            if(txt === $(this).val())
                $(this).val("");
        }).blur(function(){
            if($(this).val() == "") $(this).val(txt);
        });
    })
 
 
 
 
    var serverUrl = "http://www.fschool365.cn/";
    //        if(sessionCache.getSessionCashe("userToken") == null){
    //            location.href="login.html";
    //        }
 
//    mui_.init({
//        load:true,
//        pull:true,
//        callback:function(){
 
//            var school = sessionCache.getSessionCashe("organizationTree",sessionCache.json_value);
//            var schoolId="";
//            $.each(school,function(index,entity){
//                schoolId =schoolId + ","+entity.id;
//            });
//            var posts = sessionCache.getSessionCashe("userPosts",sessionCache.json_value);
//            var postsId="";
//            $.each(posts,function(index,entity){
//                postsId =postsId + ","+entity.id;
//            });
//            达标
//            $("#submit_button").click(function(){
//                var status=document.getElementById("x11").checked;
//                var isUpStandard=0;
//                if(status){
//                    isUpStandard=1;
//                }
    var sessionCache = {
        json_value : "json",
        getSessionCashe : function(key,dataType,remove){
            var obj = window.localStorage.getItem(key);
            if(dataType != null && dataType === "json"){
                /*if(remove){
                 window.localStorage.removeItem(key);
                 }*/
                return jQuery.parseJSON(obj);
            }else{
                /*if(remove){
                 window.localStorage.removeItem(key);
                 }*/
                return obj;
            }
        },
        setSessionCashe : function(key,value,dataType){
            if(dataType != null && dataType === "json"){
                window.localStorage.setItem(key,JSON.stringify(value));
            }else{
                window.localStorage.setItem(key,value);
            }
        }
    }
 
 
            $(".weui-btn").click(function(){
                var oldpwd=$("#pwd_old").val();
                var newpwd=$("#pwd_new").val();
                var rnewpwd=$("#pwd_news").val();
                mui.ajax(
                        serverUrl + "auth/user/changePwd.json?newPwd="+newpwd+"&oldPwd="+oldpwd, {
                            data:JSON.stringify(
                                   /* {
                                        "oldPwd":oldpwd,
                                        "newPwd":newpwd
 
                                    }*/
                            ),
                            dataType:'json',
                            async : false,
                            type: 'get', //HTTP请求类型
                            headers: {
                                'Content-Type': 'application/json',
                                'Authorization': sessionCache.getSessionCashe("userToken")
                            },
                            success: function(data) {
                                if(data.code==000){
                                    $("#tishi_message").show();
//                                    alert(data.message);
                                    $(".content").text(data.message);
                                    $(".close").bind("tap",function(){
                                        mui.openWindow({
                                            url:'login.html'
                                        });
                                    });
                                    $("#queding").bind("tap",function(){
                                        mui.openWindow({
                                            url:'login.html'
                                        });
                                    });
 
                                }
 
 
                            },
                            error: function(xhr, type, errorThrown) {
                                //异常处理;
                                console.log(type);
                            }
                        });
            });
 
 
 
//        }
//    });
</script>
</body>
 
</html>