Skip to content

Commit ac6fd64

Browse files
committed
优化h5提示信息
1 parent 18e1189 commit ac6fd64

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Vue.H5/src/api/http.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ function post (url, params, showLoading) {
119119
// $httpVue.$toast("没有权限操作");
120120
// }
121121
if (err.status == 403 || err.status == 401) {
122-
return toLogin();
122+
// return toLogin();
123+
return redirect(err);
123124
}
124125
if (err.status == 404) {
125126
$httpVue.$toast("未找到请求地址,404!");
@@ -148,7 +149,7 @@ function get (url, param, showLoading) {
148149

149150
// }
150151
if (err.status == 403 || err.status == 401) {
151-
return toLogin();
152+
return redirect(err);
152153
}
153154
if (err.status == 404) {
154155
$httpVue.$toast("未找到请求地址,404!");
@@ -199,7 +200,7 @@ function redirect (responseText, message) {
199200
|| (responseData.data && responseData.data.code == 401)) {
200201
toLogin();
201202
} else {
202-
// $httpVue.$message.error(message);
203+
$httpVue.$toast(message || (responseData.data.message));
203204
}
204205
} catch (error) {
205206
console.log(error);
@@ -258,10 +259,7 @@ function ajax (param) {
258259
redirect(xhr.responseText);
259260
return;
260261
}
261-
if (xhr.status == 403) {
262262

263-
return toLogin();
264-
}
265263
if (xhr.readyState == 4 && xhr.status == 200) {
266264
httpParam.success(httpParam.json ? JSON.parse(xhr.responseText) : xhr.responseText);
267265
return;

0 commit comments

Comments
 (0)