test_login.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>登入 - layuiAdmin</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  9. <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
  10. <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
  11. <link rel="stylesheet" href="../../layuiadmin/style/login.css" media="all">
  12. </head>
  13. <body>
  14. <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
  15. <div class="layadmin-user-login-main">
  16. <div class="layadmin-user-login-box layadmin-user-login-header">
  17. <h2>layuiAdmin</h2>
  18. <p>layui 官方出品的单页面后台管理模板系统</p>
  19. </div>
  20. <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
  21. <div class="layui-form-item">
  22. <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
  23. <input type="text" name="username" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input">
  24. </div>
  25. <div class="layui-form-item">
  26. <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
  27. <input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
  28. </div>
  29. <div class="layui-form-item">
  30. <div class="layui-row">
  31. <div class="layui-col-xs7">
  32. <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
  33. <input type="text" name="vercode" id="LAY-user-login-vercode" lay-verify="required" placeholder="图形验证码" class="layui-input">
  34. </div>
  35. <div class="layui-col-xs5">
  36. <div style="margin-left: 10px;">
  37. <img src="https://www.oschina.net/action/user/captcha" class="layadmin-user-login-codeimg" id="LAY-user-get-vercode">
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. <div class="layui-form-item" style="margin-bottom: 20px;">
  43. <input type="checkbox" name="remember" lay-skin="primary" title="记住密码">
  44. <a href="forget.html" class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;">忘记密码?</a>
  45. </div>
  46. <div class="layui-form-item">
  47. <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">登 入</button>
  48. </div>
  49. <div class="layui-trans layui-form-item layadmin-user-login-other">
  50. <label>社交账号登入</label>
  51. <a href="javascript:;"><i class="layui-icon layui-icon-login-qq"></i></a>
  52. <a href="javascript:;"><i class="layui-icon layui-icon-login-wechat"></i></a>
  53. <a href="javascript:;"><i class="layui-icon layui-icon-login-weibo"></i></a>
  54. <a href="reg.html" class="layadmin-user-jump-change layadmin-link">注册帐号</a>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="layui-trans layadmin-user-login-footer">
  59. <p>© 2018 <a href="http://www.layui.com/" target="_blank">layui.com</a></p>
  60. <p>
  61. <span><a href="http://www.layui.com/admin/#get" target="_blank">获取授权</a></span>
  62. <span><a href="http://www.layui.com/admin/pro/" target="_blank">在线演示</a></span>
  63. <span><a href="http://www.layui.com/admin/" target="_blank">前往官网</a></span>
  64. </p>
  65. </div>
  66. <!--<div class="ladmin-user-login-theme">
  67. <script type="text/html" template>
  68. <ul>
  69. <li data-theme=""><img src="{{ layui.setter.base }}style/res/bg-none.jpg"></li>
  70. <li data-theme="#03152A" style="background-color: #03152A;"></li>
  71. <li data-theme="#2E241B" style="background-color: #2E241B;"></li>
  72. <li data-theme="#50314F" style="background-color: #50314F;"></li>
  73. <li data-theme="#344058" style="background-color: #344058;"></li>
  74. <li data-theme="#20222A" style="background-color: #20222A;"></li>
  75. </ul>
  76. </script>
  77. </div>-->
  78. </div>
  79. <script src="../../layuiadmin/layui/layui.js"></script>
  80. <script>
  81. layui.config({
  82. base: '../../layuiadmin/' //静态资源所在路径
  83. }).extend({
  84. index: 'lib/index' //主入口模块
  85. }).use(['index', 'user'], function(){
  86. var $ = layui.$
  87. ,setter = layui.setter
  88. ,admin = layui.admin
  89. ,form = layui.form
  90. ,router = layui.router()
  91. ,search = router.search;
  92. form.render();
  93. //提交
  94. form.on('submit(LAY-user-login-submit)', function(obj){
  95. //请求登入接口
  96. admin.req({
  97. url: layui.setter.base + 'json/user/login.js' //实际使用请改成服务端真实接口
  98. ,data: obj.field
  99. ,done: function(res){
  100. //请求成功后,写入 access_token
  101. layui.data(setter.tableName, {
  102. key: setter.request.tokenName
  103. ,value: res.data.access_token
  104. });
  105. //登入成功的提示与跳转
  106. layer.msg('登入成功', {
  107. offset: '15px'
  108. ,icon: 1
  109. ,time: 1000
  110. }, function(){
  111. location.href = '../'; //后台主页
  112. });
  113. }
  114. });
  115. });
  116. //实际使用时记得删除该代码
  117. layer.msg('为了方便演示,用户名密码可随意输入', {
  118. offset: '15px'
  119. ,icon: 1
  120. });
  121. });
  122. </script>
  123. </body>
  124. </html>