Commit 5e74ee83 by 李伟康

登录拦截

1 parent 18ef5492
......@@ -104,5 +104,13 @@ class UsersApi {
true
)
}
/**检查sessionId 是否过期 */
checkSession() {
return api.post({
method: 'scrm.api.sso.login.status.check'
},
true
)
}
}
export default UsersApi
\ No newline at end of file
......@@ -54,7 +54,6 @@ Component({
if (showBack && currentPages.length > 1) this.setData({
SHOWBACK: true
})
console.log(currentPages.length, showBack)
let navigationBarHeight = height + ((top - statusBarHeight) * 2) + 4 // 4
let navigationBarPadding = screenWidth - right
let navigationBarWidth = screenWidth - (navigationBarPadding * 2 + width) - width
......
......@@ -4,6 +4,8 @@ import {
import {
getSessionId,
} from '~/utils/cache/storageApi'
import USERAPI from '~/api/usersApi/index'
Page({
/**
......@@ -38,19 +40,23 @@ Page({
targetPath = url ? decodeURIComponent(url) : ''
} = this.options
wx.nextTick(() => {
wx.hideLoading()
let path = 'pages.index',
obj = {}
if (targetPath) obj.targetPath = targetPath
if (sessionId) {
let url = 'pages.index',
obj = {}
if (targetPath) {
url = setRouteData(targetPath).url
obj = setRouteData(targetPath).obj
}
wx.$router.reLaunch(url, obj)
} else {
let obj = {}
if (targetPath) obj.targetPath = targetPath
wx.$router.reLaunch('login.index', obj)
}
USERAPI.checkSession().then(({
code
}) => {
if (code == '0') {
if (targetPath) {
path = setRouteData(targetPath).url
obj = setRouteData(targetPath).obj
}
wx.$router.reLaunch(path, obj)
} else wx.$router.reLaunch('login.index', obj)
})
} else wx.$router.reLaunch('login.index', obj)
})
},
......
......@@ -310,7 +310,6 @@ class Draw {
}
return type[textDecoration][textBaseline]
}
setLineX({
textAlign,
text,
......@@ -324,7 +323,6 @@ class Draw {
}
return type[textAlign]
}
drawRadiusRect({
borderRadius,
height,
......
......@@ -46,7 +46,11 @@ class Request {
data
} = response
if (code == 20 || code == 21) {
//重新登录
const thisPage = wx.$router.getPageInstance()
if(thisPage.route == 'login/loading/loading') {
resolve(data)
return
} else wx.$router.reLaunch('login.index')
} else {
if (returnAll) {
resolve(data)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!