root 2 лет назад
Родитель
Сommit
4376cfdf31
2 измененных файлов с 11 добавлено и 7 удалено
  1. 1 1
      login.html
  2. 10 6
      pages/login/login-json.js

+ 1 - 1
login.html

@@ -53,7 +53,7 @@
     function getVerify() {
       // 创建请求对象
       var request = new XMLHttpRequest()
-      request.open('get', 'http://localhost:8081/login/verifyCode')
+      request.open('post', 'http://localhost:8081/login/verifyCode')
       request.send()
       // 获取网络请求响应的数据
       request.onreadystatechange = function () {

+ 10 - 6
pages/login/login-json.js

@@ -8,6 +8,7 @@ function getLoginJson() {
             "api": {
                 "method":"post",
                 "url":"http://localhost:8081/api/login",
+                "dataType":"form",
                 "headers": {
                   "Authorization": 'Bearer ' + getToken()
                 },
@@ -16,7 +17,7 @@ function getLoginJson() {
                   
                   return data;
                 },
-                "adaptor": function (data) {
+                "adaptor": function (data, response) {
                     // token 续期的问题,在app.html中进行续期判断.
                     if (data.status != "200") {
                         // 登录请求提交后,刷新验证码
@@ -25,8 +26,11 @@ function getLoginJson() {
                     // 存储登录token
                     let token = data.data.token;
 
-                    return data;
-                },
+                    return {
+                      ...data,
+                      status: 500
+                    };
+                }
             },
             // "redirect": "http://www.baidu.com",
             "wrapWithPanel": false,
@@ -48,7 +52,7 @@ function getLoginJson() {
                             "type": "input-text",
                             "label": false,
                             "placeholder": "用户名",
-                            "name": "name",
+                            "name": "api_name",
                             "required": true
                         }
                     ]
@@ -65,7 +69,7 @@ function getLoginJson() {
                             "type": "input-password",
                             "label": false,
                             "placeholder": "密码",
-                            "name": "pwd",
+                            "name": "api_password",
                             "required": true
                         }
                     ]
@@ -82,7 +86,7 @@ function getLoginJson() {
                             "type": "input-text",
                             "label": false,
                             "placeholder": "验证码",
-                            "name": "code",
+                            "name": "api_captcha",
                             "required": true
                         },
                         {