|
@@ -24,6 +24,7 @@ export let request = (options) => {
|
|
return uni.showToast({
|
|
return uni.showToast({
|
|
title: '获取失败',
|
|
title: '获取失败',
|
|
icon: 'error',
|
|
icon: 'error',
|
|
|
|
+ duration: 5000
|
|
})
|
|
})
|
|
// uni.hideLoading()
|
|
// uni.hideLoading()
|
|
} else if (res.data.msg != '成功') { //接口返回报错
|
|
} else if (res.data.msg != '成功') { //接口返回报错
|
|
@@ -39,12 +40,14 @@ export let request = (options) => {
|
|
'AuthenticationCredentialsNotFoundException') {
|
|
'AuthenticationCredentialsNotFoundException') {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: '登录过期',
|
|
title: '登录过期',
|
|
- icon: 'error'
|
|
|
|
|
|
+ icon: 'error',
|
|
|
|
+ duration: 5000
|
|
})
|
|
})
|
|
if (uni.getStorageSync('refreshToken') && uni.getStorageSync('token') ) {
|
|
if (uni.getStorageSync('refreshToken') && uni.getStorageSync('token') ) {
|
|
// 刷新token
|
|
// 刷新token
|
|
uni.showLoading({
|
|
uni.showLoading({
|
|
title: '刷新登录中',
|
|
title: '刷新登录中',
|
|
|
|
+ duration: 5000
|
|
})
|
|
})
|
|
uni.request({
|
|
uni.request({
|
|
url: BASE_URL + '/zswl-cloud-bdb/user/refreshToken',
|
|
url: BASE_URL + '/zswl-cloud-bdb/user/refreshToken',
|
|
@@ -57,7 +60,8 @@ export let request = (options) => {
|
|
if (r.data.content == '刷新令牌错误') {
|
|
if (r.data.content == '刷新令牌错误') {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: '登录失效',
|
|
title: '登录失效',
|
|
- icon: 'fail'
|
|
|
|
|
|
+ icon: 'fail',
|
|
|
|
+ duration: 5000
|
|
})
|
|
})
|
|
uni.clearStorageSync()
|
|
uni.clearStorageSync()
|
|
uni.reLaunch({
|
|
uni.reLaunch({
|
|
@@ -114,7 +118,9 @@ export let request = (options) => {
|
|
//请求失败
|
|
//请求失败
|
|
fail: (err) => {
|
|
fail: (err) => {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
- title: '请求接口失败'
|
|
|
|
|
|
+ title: '请求接口失败',
|
|
|
|
+ icon:"none",
|
|
|
|
+ duration: 5000
|
|
})
|
|
})
|
|
reject(err)
|
|
reject(err)
|
|
}
|
|
}
|