Эх сурвалжийг харах

登录页面请求登录接口失败显示异常

locky 1 жил өмнө
parent
commit
e96c42783f
1 өөрчлөгдсөн 15 нэмэгдсэн , 10 устгасан
  1. 15 10
      templates/login_VSees.html

+ 15 - 10
templates/login_VSees.html

@@ -327,17 +327,22 @@
             var params = ("user=" + user.value + "&pwd=" + pwd.value + "&state={{ state }}" + "&client_id={{ client_id }}"
                 + "&response_type={{ response_type }}" + "&scope={{ scope }}" + "&redirect_uri={{ redirect_uri }}"
                 + "&skill_name={{ skill_name }}");
-            $.get("/oa2/login", params, function (reUrl) {
-                //alert(reUrl);
-                let data = JSON.parse(reUrl)
-                if(data['code']===0){
-                    console.log('request start')
-                    window.location = data['res'];
-                }else{
-                    alert(data['msg'])
-                }
+						$.get("/oa2/login", params)
+							.done(function (reUrl) {
+								let data = JSON.parse(reUrl);
+								if (data['code'] === 0) {
+									console.log('request start');
+									window.location = data['res'];
+								} else {
+									alert(data['msg']);
+								}
 								hideLoadingIcon();
-            });
+							})
+							.fail(function (xhr, textStatus, error) {
+								// 请求失败的处理
+								hideLoadingIcon();
+								alert(textStatus);
+							});
         } else {
             alert("please input user and password");
         }