隐藏页面特效

团队作业进度报告

今日任务:完成用户修改密码页面

主要代码:

resetpass.css

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
* {
    margin: 0;
    padding: 0
}
 
.from {
    overflow: hidden;
    position: relative;
}
 
.bgc {
    width: 100%;
    height: 100%;
}
 
.submit {
    position: absolute;
    z-index: 9;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    margin-top: 150px;
    width: 500px;
    height: 500px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #fff;
    display: flex;
    flex-direction: column;
}
 
.form_title {
    text-align: center;
    margin-top: 40px;
    font-size: 18px;
}
 
.form_input {
    padding: 0 30px;
    box-sizing: border-box;
    display: flex;
    margin-top: 20px;
}
 
.inputs {
    height: 40px;
    width: 300px;
    border-radius: 5px;
    border: none;
    background-color: #eee;
    color: #666;
    padding-left: 20px;
}
 
.form_input span {
    width: 85px;
    align-self: center;
}
 
.btn_submit {
    align-self: center;
}
 
.btn {
    border: none;
    width: 80px;
    height: 40px;
    color: #fff;
    border-radius: 5px;
    background: #999;
    margin-top: 40px;
}
 
.btn:hover {
    background: #666;
}
 
.back {
    margin-left: 10px;
}
 
.home_href {
    border: none;
    width: 80px;
    height: 40px;
    color: #fff;
    border-radius: 5px;
    background: #FFD204;
}

  resetpass.html(<script>部分的后台数据传递部分由队友完成)

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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>树懒电影---重置您的密码</title>
    <link rel="stylesheet" href="../static/css/resetpass.css">
</head>
<body>
    <form method="post" id="resetform">
    <div class="from">
    <img class="bgc" src="../static/img/9.jpg" alt="">
    <div class="submit">
        <span class="form_title">重置密码</span>
        <div class="form_input">
            <span>手机号码:</span>
            <input class="inputs" type="text" id="userphone" value="" placeholder="输入您的手机号码">
        </div>
        <div class="form_input">
            <span>新密码:</span>
            <input class="inputs" type="password" id="resetpass1" value="" placeholder="输入您的新密码">
        </div>
        <div class="form_input">
            <span>再次输入:</span>
            <input class="inputs" type="password" id="resetpass2" value="" placeholder="再次输入您的新密码">
        </div>
        <div class="btn_submit">
            <input type="reset" class="btn" value="清空">
            <input type="button" class="home_href" id="resetbtn" onclick="resetpass()" value="提交">
        </div>
    </div>
</div>
        </form>
</body>
</html>
<script src="../static/js/jquery.min.js"></script>
<script type="text/javascript">
    function resetpass(){
        var userphone=document.getElementById("userphone").value
        var resetpass1=document.getElementById("resetpass1").value
        var resetpass2=document.getElementById("resetpass2").value
        var submit_flag=1
        //判空
        if((userphone.length==0)||(resetpass1.length==0)||(resetpass2.length==0)){
            submit_flag=0
            alert("请把信息填写完整!")
        }
        //判断密码一致性
        if(resetpass2!=resetpass1){
            submit_flag=0
            alert("两次填写的密码不一致")
            document.getElementById("resetpass1").focus();
        }
        //判断手机号
        if(userphone.length!=11){
            submit_flag=0
            alert("手机号码应为11位!")
            document.getElementById("userphone").focus();
        }
        var regu =  /^1[3456789]\d{9}$/
        if(!(regu.test(userphone)) ){
            submit_flag=0
            alert("手机号码格式有误!")
            document.getElementById("userphone").focus();
        }
        //判断密码格式
        if(!((resetpass1.length>=6)&&resetpass1.length<=18))
        {
            submit_flag=0
            alert("密码长度应该为6-16位!")
            document.getElementById("resetpass1").focus();
        }
            var regex = new RegExp('(?=.*[0-9])(?=.*[a-zA-Z]).{6,18}');
            part_pass=resetpass1.split(" ")
        if((!(regex.test(resetpass1))) || part_pass.length!=1)
        {
            submit_flag=0
            alert("密码为数字+英文字母 且不可以包含空格!")
            document.getElementById("resetpass1").focus();
        }
 
        //发起请求
            if(submit_flag==1)
        {
            $.ajax({
                url:"/resetpass",
                data:{userphone:userphone,resetpass:resetpass2},
                success: function (data) {
                    if (data.data==1)
                    {
                        alert("密码修改成功!")
                        window.open("/",'_self')
                    }
                    else
                    {
                        alert("修改密码失败!请重试")
                    }
                },
                error: function (xhr, type, errorThrown) {
                    // print("ajax请求失败!")
                }
            })
        }
        // alert(submit_flag)
    }
</script>

  效果截图:

 


__EOF__

本文作者CherriesOvO
本文链接https://www.cnblogs.com/zyj3955/p/14807805.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐一下。您的鼓励是博主的最大动力!
posted @   CherriesOvO  阅读(50)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示