Commit 26fe3218 authored by xiangzj's avatar xiangzj

登出问题

parent 7875b2fe
...@@ -179,7 +179,7 @@ ...@@ -179,7 +179,7 @@
logOut() { logOut() {
apiLogOut().then((res) => { apiLogOut().then((res) => {
uni.setStorageSync('lifeData', {}); uni.setStorageSync('lifeData', {});
uni.navigateTo({ uni.redirectTo({
url: "/pages/login/login" url: "/pages/login/login"
}) })
}).catch(() => { }).catch(() => {
......
...@@ -94,8 +94,7 @@ class Request { ...@@ -94,8 +94,7 @@ class Request {
duration: 2000, duration: 2000,
icon: 'none' icon: 'none'
}) })
} }else if (response.statusCode == 401) {
if (response.statusCode == 401) {
uni.showToast({ uni.showToast({
title: '登录已失效', title: '登录已失效',
duration: 2000, duration: 2000,
...@@ -104,7 +103,7 @@ class Request { ...@@ -104,7 +103,7 @@ class Request {
uni.navigateTo({ uni.navigateTo({
url: "/pages/login/login" url: "/pages/login/login"
}) })
} }else{
uni.showToast({ uni.showToast({
title: '服务器异常', title: '服务器异常',
duration: 2000, duration: 2000,
...@@ -114,6 +113,7 @@ class Request { ...@@ -114,6 +113,7 @@ class Request {
} }
} }
} }
}
// 判断用户传递的URL是否/开头,如果不是,加上/,这里使用了uView的test.js验证库的url()方法 // 判断用户传递的URL是否/开头,如果不是,加上/,这里使用了uView的test.js验证库的url()方法
options.url = validate.url(options.url) ? options.url : ((options.baseUrl ? options.baseUrl : options.url = validate.url(options.url) ? options.url : ((options.baseUrl ? options.baseUrl :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment