root 2 سال پیش
والد
کامیت
78e60a1d14
2فایلهای تغییر یافته به همراه234 افزوده شده و 85 حذف شده
  1. 90 7
      login.html
  2. 144 78
      login.htmlback

+ 90 - 7
login.html

@@ -57,9 +57,6 @@
             width: 100%;
             height: 100%;
         }
-        .change-language {
-            float: right;
-        }
         .amis-scope h1 {
             font-size: 5vw;
         }
@@ -75,6 +72,28 @@
                 padding: 0;
             }
         }
+        .amis-scope .cxd-Button--default {
+          border: none;
+          outline: none;
+        }
+        .amis-scope .cxd-Button--default:not(:disabled):not(.is-disabled):hover {
+        color: none;
+        background: none;
+        border-color: none;
+        border-width: none;
+        border-style: none;
+        box-shadow: none;
+        border: none;
+        outline: none;
+      }
+      .amis-scope .m-r-xs {
+        margin-top:-5px;
+        width: 30px;
+        height: 30px;
+      }
+      .amis-scope .cxd-Wrapper--md, .amis-scope .cxd-Container--md {
+        height: 1%;
+      }
     </style>
 </head>
 <body>
@@ -105,11 +124,75 @@
                 "redirect": "/",
                 "wrapWithPanel": false,
                 "body": [
+                {
+  "type": "wrapper",
+  "body": [
+    {
+      "type": "flex",
+      "justify": "flex-end",
+      "items": [
+        {
+          "type": "dropdown-button",
+          "label": "",
+          "className": "header-menu",
+          "buttons": [
+            {
+              "type": "button",
+              "label": "中文",
+              "id": "u:6911502c8fcc",
+              "onEvent": {
+                "click": {
+                  "actions": [
                     {
-                        "type":"html",
-                        "className":"text-center",
-                        "html":"<img class='change-language' src='./public/static/icon/shield-user-line.svg'/>"
-                    },
+                      "script": "localStorage.setItem('language', 'zh-CN')\nlocation.reload()",
+                      "actionType": "custom",
+                      "args": {
+                      }
+                    }
+                  ],
+                  "weight": 0
+                }
+              }
+            },
+            {
+              "type": "button",
+              "label": "English",
+              "id": "u:e702685a7a45",
+              "onEvent": {
+                "click": {
+                  "actions": [
+                    {
+                      "script": "localStorage.setItem('language', 'en-US')\r\nlocation.reload()",
+                      "actionType": "custom"
+                    }
+                  ],
+                  "weight": 0
+                }
+              },
+              "actionType": "",
+              "link": "/view/user_info"
+            }
+          ],
+          "id": "u:4fedf7a987bf",
+          "size": "md",
+          "level": "default",
+          "align": "right",
+          "block": false,
+          "hideCaret": true,
+          "trigger": "hover",
+          "icon": "./public/static/icon/language-change.png",
+          "btnClassName": "no-border"
+        }
+      ],
+      "id": "u:e7752d0c1dbe"
+    }
+  ],
+  "id": "u:d16525b6aae6",
+  "asideResizor": false,
+  "pullRefresh": {
+    "disabled": true
+  }
+},
                     {
                         "type":"html",
                         "className":"text-center",

+ 144 - 78
login.htmlback

@@ -14,12 +14,13 @@
         html,
         body,
         .app-wrapper {
-            position: relative;
+            /* position: relative; */
             width: 100%;
             height: 100%;
             margin: 0;
             padding: 0;
             touch-action: pan-y;
+            overflow: hidden;
         }
         :root {
             --Form-item-gap: 1.3rem;
@@ -31,21 +32,48 @@
         }
 
         .app-wrapper {
-            position: relative;
+            /* position: relative; */
             width: 100%;
             height: 100%;
             margin: 0;
             padding: 0;
         }
 
-        .loginTitle {
-            text-align: center;
-        }
+        .amis-scope .cxd-Icon{height: 1rem}
+        .amis-scope .cxd-TextControl-input input{height: 100% !important;}
+        .amis-scope .cxd-TextControl-input:hover{border:var(--Form-input-borderWidth) solid var(--Form-input-borderColor)}
+        .amis-scope .cxd-InputGroup .cxd-TextControl-input{border-left-width: 0;padding-left: 0;}
+        .code_img{cursor: pointer;}
 
-        .loginTitle p {
-            margin: 10px auto;
-            color: black;
-            font-size: 25px;
+        .amis-scope .cxd-Form{
+            font-size: var(--Form-fontSize);
+            position: none !important;
+            max-width: 700px;
+            margin: 0 auto;
+            margin-top: 10vh;
+            /* position:; */
+        }
+        .amis-scope .cxd-Wrapper--md, .amis-scope .cxd-Container--md {
+            width: 100%;
+            height: 100%;
+        }
+        .change-language {
+            float: right;
+        }
+        .amis-scope h1 {
+            font-size: 5vw;
+        }
+        @media (max-width: 768px) {
+            .amis-scope .cxd-Form{
+                font-size: var(--Form-fontSize);
+                position: none !important;
+                margin: 0 auto;
+                margin-top: 0vh;
+                /* position:; */
+            }
+            .amis-scope .cxd-Wrapper--md, .amis-scope .cxd-Container--md {
+                padding: 0;
+            }
         }
     </style>
 </head>
@@ -58,87 +86,125 @@
         let amis = amisRequire('amis/embed');
 
         const amisJSON = {
-            type: 'page',
-            title: "",
-            style: {
-                "backgroundImage": "linear-gradient(180deg, #86a4e9, transparent)"
-            },
-            cssVars: {
-                "--Form-input-onFocused-borderColor": "#e8e9eb",
-                "--Form-input-onHover-borderColor": "#e8e9eb",
-            },
-            body: {
-                "type": "grid-2d",
-                "cols": 12,
-                "grids": [{
-                    x: 5,
-                    y: 5,
-                    h: 1,
-                    w: 4,
-                    width: 200,
-                    type: 'form',
-                    mode: 'horizontal',
-                    title: "",
-                    api: {
-                        url: "/api/new-login",
-                        method: "post",
-                        dataType: "form-data",
-                        adaptor: function(payload, response, api) {
-
+            "type": "wrapper",
+            "className": "fixed login_layout m:h-screen m:w-full bg-gray-50",
+            "body": {
+                "type": "form",
+                "className": "h-full pc:p-9 m:p-4 m:pt-20",
+                "api": {
+                    "method":"post",
+                    "url":"/login",
+                    "adaptor": function (data) {
+                        if (data.status !== 0) {
+                            // 登录请求提交后,刷新验证码
+                            refresh_code();
                         }
+                        return data;
+                    },
+                },
+                "redirect": "/",
+                "wrapWithPanel": false,
+                "body": [
+                    {
+                        "type":"html",
+                        "className":"text-center",
+                        "html":"<img class='change-language' src='./public/static/icon/shield-user-line.svg'/>"
                     },
-                    panelClassName: "p-r p-l p-b-md",
-                    redirect: "/admins",
-                    body: [{
-                        "type": "tpl",
-                        "tpl": "<div class='loginTitle'><p>管理后台</p></div>"
+                    {
+                        "type":"html",
+                        "className":"text-center",
+                        "html":"<h1 class='title-name'>Roma管理后台</h1>"
                     },
-                        {
-                            type: "input-text",
-                            label: false,
-                            name: "userName",
-                            size: "full",
-                            placeholder: "登录名",
-                            addOn: {
-                                "label": "",
-                                "type": "text",
-                                "position": "left",
-                                "icon": "fa fa-user"
+                    {
+                        "type": "input-group",
+                        "label": "",
+                        "body": [
+                            {
+                                "type": "icon",
+                                "icon": "./public/static/icon/shield-user-line.svg"
                             },
-                        },
-                        {
-                            type: "input-password",
-                            label: false,
-                            name: "password",
-                            size: "full",
-                            placeholder: "密码",
-                            addOn: {
-                                "label": "",
-                                "type": "text",
-                                "position": "left",
-                                "icon": "fa fa-lock"
+                            {
+                                "type": "input-text",
+                                "label": false,
+                                "placeholder": "用户名",
+                                "name": "name",
+                                "required": true
+                            }
+                        ]
+                    },
+                    {
+                        "type": "input-group",
+                        "label": "",
+                        "body": [
+                            {
+                                "type": "icon",
+                                "icon": "./public/static/icon/lock-password-line.svg",
                             },
-                        },
-                        {
-                            type: "control",
-                            label: false,
-                            body: {
-                                "type": "button",
-                                "level": "primary",
-                                "actionType": "submit",
-                                "block": true,
-                                "label": "登录"
+                            {
+                                "type": "input-password",
+                                "label": false,
+                                "placeholder": "密码",
+                                "name": "pwd",
+                                "required": true
                             }
-                        }
-                    ]
-                }
-
+                        ]
+                    },
+                    {
+                        "type": "input-group",
+                        "label": "",
+                        "body": [
+                            {
+                                "type": "icon",
+                                "icon": "./public/static/icon/shield-check-line.svg"
+                            },
+                            {
+                                "type": "input-text",
+                                "label": false,
+                                "placeholder": "验证码",
+                                "name": "code",
+                                "required": true
+                            },
+                            {
+                                "type": "action",
+                                "body": {
+                                    "type": "image",
+                                "height": "38px",
+                                "width": "110px",
+                                "name":"codeUrl",
+                                "imageClassName":"code_img b-none",
+                                "imageMode":"original",
+                                "src": "/login/verify"
+                                },
+                                // 点击图片 刷新二维码
+                                "onClick": "refresh_code()"
+                            }
+                        ]
+                    },
+                    {
+                        "label": "登 录",
+                        "type": "action",
+                        "actionType": "submit",
+                        "level": "primary",
+                        "className":"w-full h-2.5",
+                    },
+                    // {
+                    //     "type":"html",
+                    //     "className":"text-center",
+                    //     "html":"<p class='mt-10 text-gray-600'>Roma平台</p>"
+                    // },
                 ]
+
             }
+
         };
 
         let amisScoped = amis.embed('#root', amisJSON);
     })();
+    // 刷新验证码
+    function refresh_code()
+    {
+        document.querySelector('.code_img').src = '/login/verify?' + Math.random();
+    }
 </script>
 </body>
 </html>