fei.wang
2024-05-09 871d4095b07cedacb7fbef4c38d64982f539c404
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
193
194
<%--
  Created by IntelliJ IDEA.
  User: Dell
  Date: 2023/6/26
  Time: 16:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="/HxzkFlow/css/layui.css" media="all">
    <link href="/HxzkFlow/images/favicon.ico" rel="icon" type="image/x-icon"/>
 
</head>
<body style="width: 100%;height: 100%;background-color: #EFF1F4">
<div></div>
<div style="width: 100%;height: 100%;">
    <div class="layui-card" style="width: 100%;height: 100%;">
        <div class="layui-card-header">个人信息
            <button style="margin-left: 50px" id="cancelBtn" class="layui-btn" onclick="enableInputs()">修改</button>
        </div>
        <div class="layui-card-body">
            <form class="layui-form" method="post" action="/HxzkFlow/hxzk/upUser" style="margin-top: 20px" onsubmit="return checkadd()">
                <input type="text" name="companyabbname" id="gs1" style="display: none">
                <div class="layui-form-item">
                    <label class="layui-form-label">公司简称</label>
                    <div class="layui-input-block">
                        <input type="text" name="companyabbname1" disabled  id="gs" required  lay-verify="required" placeholder="请输入简称" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">登录电话</label>
                    <div class="layui-input-inline">
                        <input type="text" name="" disabled  style="width: 260px" id="phone" required lay-verify="required" placeholder="请输入电话" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item" id="sock1" style="display: none">
                    <label class="layui-form-label">新登录电话</label>
                    <div class="layui-input-inline">
                        <input type="text" name="loginphone" style="width: 260px" id="" required lay-verify="required" placeholder="请输入电话" autocomplete="off" class="layui-input">
                    </div>
                </div>
 
                <div class="layui-form-item" id="sock2" style="display: none">
                    <label class="layui-form-label">验证码</label>
                    <div class="layui-input-inline">
                        <input type="text" style="width: 120px" id="yzm"  required lay-verify="required" placeholder="请输入验证码" autocomplete="off" class="layui-input">
                        <input type="button" id="djs" class="layui-btn layui-btn-normal" value="获取验证码" onclick="YanZhengMa()" style="position: relative;left: 150px;top: -38px">
                    </div>
                </div>
 
                <div class="layui-form-item" id="sock3" style="display: none">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
 
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script src="/HxzkFlow/js/layui.js" charset="utf-8"></script>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script>
    var Zong = localStorage.getItem("gsjc")
    var yanzhengma = 0;
    var huoquyanzhengma = "未获取";
    $("#gs").val(Zong)
    $("#gs1").val(Zong)
    var data = "companyabbname="+Zong
    $.post("/HxzkFlow/hxzk/findLoginPhone",data,function (data){
        console.log(data)
        $("#phone").val(data.loginphone)
    })
 
    function enableInputs(){
        document.getElementById('sock1').style.display = '';
        document.getElementById('sock2').style.display = '';
        document.getElementById('sock3').style.display = '';
        // var inputBoxes = document.getElementById("sock1"); // 获取所有的输入框元素
        // console.log(inputBoxes.length)
        // for(var i=0;i<inputBoxes.length;i++){
        //     inputBoxes[i].disabled = false; // 取消禁用状态
        // }
 
    }
    function YanZhengMa() {
        var phone = $("#phone").val();
        if (phone == "") {
            alert("请先输入手机号!")
        }else {
            var djs1= $("#djs").val()
            if(djs1 != "获取验证码"){
                alert("请耐心等待倒计时结束!")
            }else{
                $.ajax({
                    url: '/HxzkFlow/hxzk/Login11',
                    async: false,
                    data: {
                        phone: phone
                    },
                    success: function (data) {
                        yanzhengma = data;
                    }
                })
                huoquyanzhengma = "已获取"
 
                // 设置倒计时的总时长为60秒
                var totalTime = 60;
                // 开始倒计时
                var countdown = setInterval(function () {
                    // 更新剩余时间
                    totalTime--;
                    // 将剩余时间显示在页面上
                    $("#djs").val(totalTime + " 秒") ;
                    // 判断倒计时是否结束
                    if (totalTime <= 0) {
                        // 清除倒计时
                        clearInterval(countdown);
                        // 倒计时结束时的操作
                        $("#djs").val("获取验证码");
                    }
                }, 1000);
            }
 
        }
    }
    function checkadd(){
        if(huoquyanzhengma == "未获取"){
            alert("请先获取验证码!")
            return false
        }else{
            var yan = $("#yzm").val();
            if(yanzhengma == yan){
                return true;
            }else{
                alert("验证码不正确!")
                return false
            }
            return false;
        }
    }
 
    /**
     * 判断用户在规定的时间内没有操作系统,则刷新浏览器
     * 参数:时间(单位分钟)
     * */
    function timeUserFun(time){
        var time = time || 2;
        var userTime = 3600;
        var objTime = {
            init:0,
            time:function(){
                objTime.init += 1;
                if(objTime.init === userTime){// 达到限制时间时,用户未操作事件,则刷新整个页面
                    localStorage.removeItem("gsjc")
                    sessionStorage.removeItem("admin")
                    alert("您长时间未操作当前页面,请重新登录")
                    var data = "Zong="+sessionStorage.getItem("admin");
                    //获取该用户最新时间
                    $.post("/HxzkFlow/hxzk/userdate",data,function (data){
 
                    })
                    parent.location.reload()
                    //达到限制时间没操作,所要执行的动作
                }
            },
            eventFun:function(){
                //清除上次监听,重新开始新的监听
                clearInterval(testUser);
                objTime.init = 0;
                testUser = setInterval(objTime.time,1000);
            }
        };
        //监听当前时间流动
        var testUser = setInterval(objTime.time,1000);
 
        //监听相应事件
        var body = document.querySelector('html');
        body.addEventListener("click",objTime.eventFun);
        body.addEventListener("keydown",objTime.eventFun);
        body.addEventListener("mousemove",objTime.eventFun);
        body.addEventListener("mousewheel",objTime.eventFun);
    }
    (function () {
        timeUserFun(1);
 
    }(0));
    //Demo
 
</script>
</body>
</html>