login.ejs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6. <meta http-equiv="x-ua-compatible" content="ie=edge">
  7. <title>用户登录-计量支付</title>
  8. <link rel="stylesheet" href="public/css/bootstrap/bootstrap.min.css">
  9. <link rel="stylesheet" href="public/css/main.css">
  10. <link rel="stylesheet" href="/public/css/toast.css">
  11. <link rel="stylesheet" href="public/css/font-awesome/font-awesome.min.css">
  12. </head>
  13. <body class="login-body">
  14. <div class="container">
  15. <!--演示版-->
  16. <form class="form-signin" method="post" action="/login">
  17. <h4 class="d-flex justify-content-center mb-4"><span id="project_name"></span>纵横云计量</h4>
  18. <p class="text-center mb-4 text-muted"></p>
  19. <!--<nav class="nav nav-tabs nav-justified mb-3" role="tablist" id="login-tab">-->
  20. <!--<a class="nav-item nav-link" data-toggle="tab" data-type="1" href="#preview" role="tab">演示版登录</a>-->
  21. <!--<a class="nav-item nav-link active" data-toggle="tab" data-type="2" href="#paid" role="tab">项目版登录</a>-->
  22. <!--</nav>-->
  23. <div class="tab-content">
  24. <!--<div class="tab-pane active" id="preview" role="tabpanel">-->
  25. <!--<div class="form-group <% if (errorMessage !== undefined && errorMessage !== null) { %>has-danger<% } %>">-->
  26. <!--<input id="username" name="username" class="form-control form-control-sm" placeholder="通行账号 邮箱/手机" value="laiku123@qq.com" autofocus="">-->
  27. <!--</div>-->
  28. <!--<div class="form-group <% if (errorMessage !== undefined && errorMessage !== null) { %>has-danger<% } %>">-->
  29. <!--<input id="password" name="password" class="form-control form-control-sm" placeholder="输入密码" value="19930523" type="password">-->
  30. <!--</div>-->
  31. <!--</div>-->
  32. <div class="tab-pane active" id="paid" role="tabpanel">
  33. <div class="form-group <% if (errorMessage !== undefined && errorMessage !== null) { %>has-danger<% } %>">
  34. <input id="project" class="form-control" name="project" placeholder="项目编号" autofocus="" />
  35. </div>
  36. <div class="form-group <% if (errorMessage !== undefined && errorMessage !== null) { %>has-danger<% } %>">
  37. <input id="account" class="form-control" name="account" placeholder="输入账号" autofocus="" />
  38. </div>
  39. <div class="form-group <% if (errorMessage !== undefined && errorMessage !== null) { %>has-danger<% } %>">
  40. <input id="project-password" name="project_password" class="form-control" placeholder="输入密码" type="password" />
  41. </div>
  42. </div>
  43. <div class="form-group">
  44. <div class="alert alert-danger" <% if(errorMessage === undefined || errorMessage === null) { %>style="display: none"<% } %> role="alert" id="error-msg">
  45. <% if(errorMessage !== undefined && errorMessage !== null) { %><strong>登录失败</strong> <%= errorMessage %><% } %>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="form-group">
  50. <button class="btn btn-primary btn-block" type="submit">登录</button>
  51. <input type="hidden" name="_csrf" value="<%= ctx.csrf %>" />
  52. <input type="hidden" name="type" value="2" />
  53. </div>
  54. <!--<div class="pt-1 d-flex justify-content-center">-->
  55. <!--<a href="http://sso.smartcost.com.cn/getpasswd" target="_blank" class="mr-3">忘记密码</a>-->
  56. <!--<a href="http://sso.smartcost.com.cn/reg" target="_blank">免费注册</a>-->
  57. <!--</div>-->
  58. </form>
  59. <!--项目版-->
  60. <div class="text-white fixed-bottom"><p class="text-center mb-1">Copyright © 2018 <a href="https://smartcost.com.cn" target="_blank" class="text-white">珠海纵横创新软件有限公司</a>.All Rights Reserved.<a class="text-white ml-2" href="http://www.miitbeian.gov.cn" target="_blank">粤ICP备14032472号</a></p></div>
  61. </div>
  62. <div class="toast" style="text-align: center">
  63. <i class="icon fa"></i>
  64. <span class="message"></span>
  65. </div>
  66. <!-- JS. -->
  67. <script src="/public/js/jquery/jquery-3.2.1.min.js"></script>
  68. <script src="/public/js/popper/popper.min.js"></script>
  69. <script src="/public/js/bootstrap/bootstrap.min.js"></script>
  70. <script src="/public/js/global.js"></script>
  71. <script type="text/javascript">
  72. $(document).ready(function() {
  73. const lSPName = getLocalCache('project_name');
  74. const lSPCode = getLocalCache('project_code');
  75. if (lSPName !== null) {
  76. $('#project_name').text(lSPName);
  77. $('#project').val(lSPCode);
  78. $('#account').focus();
  79. }
  80. $("#login-tab a[data-toggle='tab']").on('shown.bs.tab', function () {
  81. let type = $(this).data('type');
  82. type = parseInt(type);
  83. type = isNaN(type) || type <= 0 ? 1 : type;
  84. $("input[name='type']:hidden").val(type);
  85. });
  86. // $('#username').blur(function () {
  87. // let account = $(this).val();
  88. // // 判断输入的邮箱/手机是否格式正确
  89. // if(/^1[3456789]\d{9}$/.test(account) || /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(account)) {
  90. // $('#error-msg').hide();
  91. // } else {
  92. // $('#error-msg').show();
  93. // $('#error-msg').text('账号格式有误');
  94. // }
  95. // })
  96. $('#project').blur(function () {
  97. if ($(this).val() == '') {
  98. $('#project_name').text('');
  99. removeLocalCache('project_code');
  100. removeLocalCache('project_name');
  101. } else {
  102. const pcode = getLocalCache('project_code');
  103. if ($(this).val() !== pcode) {
  104. const pc = $(this).val();
  105. $.ajax({
  106. type: 'get',
  107. url: '/project/name',
  108. data: { code: pc },
  109. dataType: 'json',
  110. success: function (result) {
  111. setLocalCache('project_code', pc);
  112. if (result.err === 1) {
  113. $('#project_name').text('');
  114. console.log(result.msg);
  115. toast(result.msg, 'error', 'exclamation-circle');
  116. removeLocalCache('project_name');
  117. } else {
  118. setLocalCache('project_name', result.data);
  119. $('#project_name').text(result.data);
  120. }
  121. }
  122. })
  123. }
  124. }
  125. })
  126. });
  127. </script>
  128. </body>
  129. </html>