lock.html 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <!--360浏览器优先以webkit内核解析-->
  7. <title>锁定屏幕</title>
  8. <link th:href="@{favicon.ico}" rel="shortcut icon"/>
  9. <link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
  10. <link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
  11. <style>.lockscreen{background:#d2d6de;height:auto;}.lockscreen .lockscreen-name{text-align:center;font-weight:600;margin-top:50px;margin-bottom:30px;}.lockscreen-wrapper{max-width:400px;margin:10% auto;z-index:800;position:relative;}.lockscreen .lockscreen-name{text-align:center;font-weight:600;margin-top:50px;margin-bottom:30px;}.lockscreen-item{border-radius:4px;padding:0;background:#fff;position:relative;margin:10px auto 30px auto;width:290px}.lockscreen-image{border-radius:50%;position:absolute;left:-10px;top:-25px;background:#fff;padding:5px;z-index:10}.lockscreen-image>img{border-radius:50%;width:70px;height:70px}.lockscreen-credentials{margin-left:70px}.lockscreen-credentials .form-control{border:0}.lockscreen-credentials .btn{background-color:#fff;border:0;padding:0 10px}.lockscreen-footer{margin-top:150px}.lockscreen-time{width:100%;color:#fff;font-size:60px;display:inline-block;text-align:center;font-family:'Open Sans',sans-serif;font-weight:300;}</style>
  12. </head>
  13. <body class="lockscreen">
  14. <div class="lockscreen-wrapper">
  15. <div class="lockscreen-time"></div>
  16. <div class="lockscreen-name">[[ ${user.loginName} ]] / [[${#strings.defaultString(user.userName, '-')}]]</div>
  17. <div class="lockscreen-item">
  18. <div class="lockscreen-image">
  19. <img th:src="(${#strings.isEmpty(user.avatar)}) ? @{/img/profile.jpg} : @{${user.avatar}}" th:onerror="this.src='img/profile.jpg'" class="img-circle" alt="User Image">
  20. </div>
  21. <form class="lockscreen-credentials" method="post" action="#" onsubmit="return false;">
  22. <div class="input-group">
  23. <input type="password" name="password" autocomplete="off" class="form-control" placeholder="密码">
  24. <div class="input-group-btn">
  25. <button type="button" class="btn" onclick="unlock()"><i class="fa fa-arrow-right text-muted"></i></button>
  26. </div>
  27. </div>
  28. </form>
  29. </div>
  30. <div class="help-block text-center" style="margin-top: 50px;">系统锁屏,请输入密码登陆!</div>
  31. <div class="text-center">
  32. <a th:href="@{logout}">退出重新登陆</a>
  33. </div>
  34. </div>
  35. <script src="../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
  36. <script src="../static/js/bootstrap.min.js" th:src="@{/js/bootstrap.min.js}"></script>
  37. <script src="../static/js/three.min.js" th:src="@{/js/three.min.js}"></script>
  38. <script src="../static/ajax/libs/layer/layer.min.js" th:src="@{/ajax/libs/layer/layer.min.js}"></script>
  39. <script src="../static/ruoyi/js/ry-ui.js" th:src="@{/ruoyi/js/ry-ui.js?v=4.6.2}"></script>
  40. </body>
  41. <script th:inline="javascript">
  42. var ctx = [[@{/}]];
  43. Date.prototype.format = function(fmt) {
  44. var o = {
  45. "M+" : this.getMonth()+1, //月份
  46. "d+" : this.getDate(), //日
  47. "h+" : this.getHours(), //小时
  48. "m+" : this.getMinutes(), //分
  49. "s+" : this.getSeconds(), //秒
  50. "q+" : Math.floor((this.getMonth()+3)/3), //季度
  51. "S" : this.getMilliseconds() //毫秒
  52. };
  53. if (/(y+)/.test(fmt)) {
  54. fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  55. }
  56. for (var k in o) {
  57. if (new RegExp("(" + k + ")").test(fmt)) {
  58. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  59. }
  60. }
  61. return fmt;
  62. }
  63. $(function() {
  64. $('.lockscreen-time').text((new Date()).format('hh:mm:ss'));
  65. setInterval(function() {
  66. $('.lockscreen-time').text((new Date()).format('hh:mm:ss'));
  67. }, 500);
  68. init();
  69. animate();
  70. });
  71. $(document).keydown(function(event) {
  72. if (event.keyCode == 13) {
  73. unlock();
  74. }
  75. });
  76. function unlock() {
  77. var username = $("input[name='username']").val();
  78. var password = $("input[name='password']").val();
  79. if ($.common.isEmpty(password)) {
  80. $.modal.msg("请输入密码");
  81. return;
  82. }
  83. var index = "";
  84. var config = {
  85. url: ctx + "unlockscreen",
  86. type: "post",
  87. dataType: "json",
  88. data: { password: password },
  89. beforeSend: function() {
  90. index = layer.load(2, {shade: false});
  91. },
  92. success: function(result) {
  93. if (result.code == web_status.SUCCESS) {
  94. location.href = ctx + 'index';
  95. } else {
  96. $.modal.msg(result.msg);
  97. $("input[name='password']").val("");
  98. }
  99. layer.close(index);
  100. }
  101. };
  102. $.ajax(config);
  103. };
  104. var container;
  105. var camera, scene, projector, renderer;
  106. var PI2 = Math.PI * 2;
  107. var programFill = function(context) {
  108. context.beginPath();
  109. context.arc(0, 0, 1, 0, PI2, true);
  110. context.closePath();
  111. context.fill();
  112. };
  113. var programStroke = function(context) {
  114. context.lineWidth = 0.05;
  115. context.beginPath();
  116. context.arc(0, 0, 1, 0, PI2, true);
  117. context.closePath();
  118. context.stroke();
  119. };
  120. var mouse = { x: 0, y: 0 }, INTERSECTED;
  121. function init() {
  122. container = document.createElement('div');
  123. container.id = 'bgc';
  124. container.style.position = 'absolute';
  125. container.style.zIndex = '0';
  126. container.style.top = '0px';
  127. $(".lockscreen-wrapper").before(container);
  128. camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 10000);
  129. camera.position.set(0, 300, 500);
  130. scene = new THREE.Scene();
  131. for (var i = 0; i < 100; i++) {
  132. var particle = new THREE.Particle(new THREE.ParticleCanvasMaterial({ color: Math.random() * 0x808080 + 0x808080, program: programStroke }));
  133. particle.position.x = Math.random() * 800 - 400;
  134. particle.position.y = Math.random() * 800 - 400;
  135. particle.position.z = Math.random() * 800 - 400;
  136. particle.scale.x = particle.scale.y = Math.random() * 10 + 10;
  137. scene.add(particle);
  138. }
  139. projector = new THREE.Projector();
  140. renderer = new THREE.CanvasRenderer();
  141. renderer.setSize(window.innerWidth, window.innerHeight - 10);
  142. container.appendChild(renderer.domElement);
  143. document.addEventListener('mousemove', onDocumentMouseMove, false);
  144. window.addEventListener('resize', onWindowResize, false);
  145. };
  146. function onWindowResize() {
  147. camera.aspect = window.innerWidth / window.innerHeight;
  148. camera.updateProjectionMatrix();
  149. renderer.setSize(window.innerWidth, window.innerHeight - 10);
  150. };
  151. function onDocumentMouseMove(event) {
  152. event.preventDefault();
  153. mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
  154. mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
  155. };
  156. function animate() {
  157. requestAnimationFrame(animate);
  158. render();
  159. };
  160. var radius = 600;
  161. var theta = 0;
  162. function render() {
  163. theta += 0.2;
  164. camera.position.x = radius * Math.sin(theta * Math.PI / 360);
  165. camera.position.y = radius * Math.sin(theta * Math.PI / 360);
  166. camera.position.z = radius * Math.cos(theta * Math.PI / 360);
  167. camera.lookAt(scene.position);
  168. camera.updateMatrixWorld();
  169. var vector = new THREE.Vector3(mouse.x, mouse.y, 0.5);
  170. projector.unprojectVector(vector, camera);
  171. var ray = new THREE.Ray(camera.position, vector.subSelf(camera.position).normalize());
  172. var intersects = ray.intersectObjects(scene.children);
  173. if (intersects.length > 0) {
  174. if (INTERSECTED != intersects[0].object) {
  175. if (INTERSECTED) INTERSECTED.material.program = programStroke;
  176. INTERSECTED = intersects[0].object;
  177. INTERSECTED.material.program = programFill;
  178. }
  179. } else {
  180. if (INTERSECTED) INTERSECTED.material.program = programStroke;
  181. INTERSECTED = null;
  182. }
  183. renderer.render(scene, camera);
  184. }
  185. </script>
  186. </html>