login.htmlback 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <title>登录</title>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <link rel="icon" type="image/x-ico" href=""/>
  8. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
  9. <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
  10. <link rel="stylesheet" href="./public/static/amis-sdk/helper.css">
  11. <link rel="stylesheet" href="./public/static/amis-sdk/sdk.css">
  12. <style>
  13. html,
  14. body,
  15. .app-wrapper {
  16. /* position: relative; */
  17. width: 100%;
  18. height: 100%;
  19. margin: 0;
  20. padding: 0;
  21. touch-action: pan-y;
  22. overflow: hidden;
  23. }
  24. :root {
  25. --Form-item-gap: 1.3rem;
  26. --InputGroup-height: 2.5rem;
  27. --Button-height: 2.5rem;
  28. --InputGroup-paddingX: .6rem;
  29. --InputGroup-addOn-bg: var(--Form-input-bg);
  30. /* --fontSizeBase: .9rem; */
  31. }
  32. .app-wrapper {
  33. /* position: relative; */
  34. width: 100%;
  35. height: 100%;
  36. margin: 0;
  37. padding: 0;
  38. }
  39. .amis-scope .cxd-Icon{height: 1rem}
  40. .amis-scope .cxd-TextControl-input input{height: 100% !important;}
  41. .amis-scope .cxd-TextControl-input:hover{border:var(--Form-input-borderWidth) solid var(--Form-input-borderColor)}
  42. .amis-scope .cxd-InputGroup .cxd-TextControl-input{border-left-width: 0;padding-left: 0;}
  43. .code_img{cursor: pointer;}
  44. .amis-scope .cxd-Form{
  45. font-size: var(--Form-fontSize);
  46. position: none !important;
  47. max-width: 700px;
  48. margin: 0 auto;
  49. margin-top: 10vh;
  50. /* position:; */
  51. }
  52. .amis-scope .cxd-Wrapper--md, .amis-scope .cxd-Container--md {
  53. width: 100%;
  54. height: 100%;
  55. }
  56. .change-language {
  57. float: right;
  58. }
  59. .amis-scope h1 {
  60. font-size: 5vw;
  61. }
  62. @media (max-width: 768px) {
  63. .amis-scope .cxd-Form{
  64. font-size: var(--Form-fontSize);
  65. position: none !important;
  66. margin: 0 auto;
  67. margin-top: 0vh;
  68. /* position:; */
  69. }
  70. .amis-scope .cxd-Wrapper--md, .amis-scope .cxd-Container--md {
  71. padding: 0;
  72. }
  73. }
  74. </style>
  75. </head>
  76. <body>
  77. <div id="root" class="app-wrapper"></div>
  78. <script type='text/javascript' src='./public/static/amis-sdk/sdk.js'></script>
  79. <script type="text/javascript">
  80. (function () {
  81. let amis = amisRequire('amis/embed');
  82. const amisJSON = {
  83. "type": "wrapper",
  84. "className": "fixed login_layout m:h-screen m:w-full bg-gray-50",
  85. "body": {
  86. "type": "form",
  87. "className": "h-full pc:p-9 m:p-4 m:pt-20",
  88. "api": {
  89. "method":"post",
  90. "url":"/login",
  91. "adaptor": function (data) {
  92. if (data.status !== 0) {
  93. // 登录请求提交后,刷新验证码
  94. refresh_code();
  95. }
  96. return data;
  97. },
  98. },
  99. "redirect": "/",
  100. "wrapWithPanel": false,
  101. "body": [
  102. {
  103. "type":"html",
  104. "className":"text-center",
  105. "html":"<img class='change-language' src='./public/static/icon/shield-user-line.svg'/>"
  106. },
  107. {
  108. "type":"html",
  109. "className":"text-center",
  110. "html":"<h1 class='title-name'>Roma管理后台</h1>"
  111. },
  112. {
  113. "type": "input-group",
  114. "label": "",
  115. "body": [
  116. {
  117. "type": "icon",
  118. "icon": "./public/static/icon/shield-user-line.svg"
  119. },
  120. {
  121. "type": "input-text",
  122. "label": false,
  123. "placeholder": "用户名",
  124. "name": "name",
  125. "required": true
  126. }
  127. ]
  128. },
  129. {
  130. "type": "input-group",
  131. "label": "",
  132. "body": [
  133. {
  134. "type": "icon",
  135. "icon": "./public/static/icon/lock-password-line.svg",
  136. },
  137. {
  138. "type": "input-password",
  139. "label": false,
  140. "placeholder": "密码",
  141. "name": "pwd",
  142. "required": true
  143. }
  144. ]
  145. },
  146. {
  147. "type": "input-group",
  148. "label": "",
  149. "body": [
  150. {
  151. "type": "icon",
  152. "icon": "./public/static/icon/shield-check-line.svg"
  153. },
  154. {
  155. "type": "input-text",
  156. "label": false,
  157. "placeholder": "验证码",
  158. "name": "code",
  159. "required": true
  160. },
  161. {
  162. "type": "action",
  163. "body": {
  164. "type": "image",
  165. "height": "38px",
  166. "width": "110px",
  167. "name":"codeUrl",
  168. "imageClassName":"code_img b-none",
  169. "imageMode":"original",
  170. "src": "/login/verify"
  171. },
  172. // 点击图片 刷新二维码
  173. "onClick": "refresh_code()"
  174. }
  175. ]
  176. },
  177. {
  178. "label": "登 录",
  179. "type": "action",
  180. "actionType": "submit",
  181. "level": "primary",
  182. "className":"w-full h-2.5",
  183. },
  184. // {
  185. // "type":"html",
  186. // "className":"text-center",
  187. // "html":"<p class='mt-10 text-gray-600'>Roma平台</p>"
  188. // },
  189. ]
  190. }
  191. };
  192. let amisScoped = amis.embed('#root', amisJSON);
  193. })();
  194. // 刷新验证码
  195. function refresh_code()
  196. {
  197. document.querySelector('.code_img').src = '/login/verify?' + Math.random();
  198. }
  199. </script>
  200. </body>
  201. </html>