|
|
@@ -9,22 +9,19 @@ const baseUrl = config.baseUrl
|
|
|
|
|
|
const request = config => {
|
|
|
// 是否需要设置 token
|
|
|
- const isSession = config.isSession === false
|
|
|
+ const isSession = config.isSession || false
|
|
|
config.header = config.header || {}
|
|
|
if (isSession) {
|
|
|
- if (getSession()) {
|
|
|
- config.header['cookie'] = getSession()
|
|
|
- } else {
|
|
|
- showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
|
|
|
- // if (res.confirm) {
|
|
|
- // store.dispatch('LogOut').then(res => {
|
|
|
- // uni.reLaunch({ url: '/pages/login' })
|
|
|
- // })
|
|
|
- // }
|
|
|
- })
|
|
|
- reject('无效的会话,或者会话已过期,请重新登录。')
|
|
|
+ if (getSession()) {
|
|
|
+ config.header['cookie'] = getSession()
|
|
|
+ } else {
|
|
|
+ showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(() => {
|
|
|
+ uni.reLaunch({ url: '/pages/login' })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ reject('无效的会话,或者会话已过期,请重新登录。')
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
// get请求映射params参数
|
|
|
if (config.params) {
|
|
|
let url = config.url + '?' + tansParams(config.params)
|