| | |
| | | <div class="layui-form-item"> |
| | | <!--<input type="button" onclick="playSound('wavFileId');" value="play" />--> |
| | | <button type="button" lay-submit="" class="layui-btn layui-btn-fluid" id="LAY-user-login-submit" name="LAY-user-login-submit" lay-filter="LAY-user-login-submit">登 入</button> |
| | | |
| | | <!--<button type="button" lay-submit="" class="layui-btn layui-btn-fluid" id="LAY-user-login-yp" name="LAY-user-login-yp" lay-filter="LAY-user-login-yp">音频</button>--> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | if (result.count == 1) { // 说明验证成功了, |
| | | var data = result.data; |
| | | for (var i = 0; i < data.length; i++) { |
| | | if (i == 0) |
| | | Organization += '<option style="color:blue;" value="' + data[i].ID + '" selected>' + data[i].Name + '</option>'; |
| | | else |
| | | Organization += '<option style="color:blue;" value="' + data[i].ID + '">' + data[i].Name + '</option>'; |
| | | |
| | | } |
| | | $("#Organization").append(Organization); |
| | | form.render('select'); |
| | | |
| | | //读取配置文件 |
| | | get_ReadConfigFile(); |
| | | } |
| | | layer.closeAll("loading"); |
| | | } |
| | | }) |
| | | |
| | | |
| | | |
| | | //form.render(); |
| | | |
| | |
| | | form.on("submit(LAY-user-login-submit)", function (obj) { |
| | | loging(); |
| | | }) |
| | | |
| | | //音频 |
| | | form.on("submit(LAY-user-login-yp)", function (obj) { |
| | | playSound(); |
| | | }) |
| | | //密码框回车执行登录 |
| | | $('#LAY-user-login-password').on('keydown', function (e) { |
| | | if (e.keyCode == 13) { |
| | | playSound(); |
| | | //playSound(); |
| | | } |
| | | }); |
| | | //用户名框回车光标移到密码框 |
| | |
| | | $("#LAY-user-login-password").focus(); |
| | | } |
| | | }) |
| | | |
| | | |
| | | //读取配置文件 |
| | | function get_ReadConfigFile() { |
| | | //获取本地存储的数据 |
| | | var data = localStorage.getItem("data"); |
| | | if (data != null) { |
| | | var data2 = JSON.parse(data); |
| | | $("#LAY-user-login-username").val(data2["UserID"]); |
| | | $("#Organization").val(data2["OrgID"]); |
| | | form.render('select'); |
| | | } |
| | | } |
| | | |
| | | //存储配置文件 |
| | | function get_WriteConfigFile() { |
| | | //清空本地存储的数据 |
| | | localStorage.clear(); |
| | | var data = { |
| | | UserID: sessionStorage["Czybm"] |
| | | , OrgID: sessionStorage["OrganizationID"] |
| | | } |
| | | //本地存储 |
| | | localStorage.setItem("data", JSON.stringify(data)); |
| | | } |
| | | |
| | | //登录 |
| | | function loging() { |
| | | if ($("#Organization").val() == 0) { |
| | | //playSound(); |
| | | layer.msg("请选择组织!"); |
| | | return; |
| | | |
| | | } |
| | | var UserName = $("#LAY-user-login-username").val(); |
| | | var PassWord = $("#LAY-user-login-password").val(); |
| | |
| | | } else {//PC端 |
| | | window.location.href = '../../views/index.html' |
| | | } |
| | | get_WriteConfigFile(); |
| | | } |
| | | else { |
| | | // $("#verifycode").click(); |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | function playSound() { |
| | | var audio = document.getElementById("cs"); |
| | | if (audio == null) |
| | |
| | | var audio = document.getElementById("cs"); |
| | | audio.play(); |
| | | } |
| | | |
| | | |
| | | }); |
| | | </script> |
| | | </body> |