Commit 5e74ee83 by 李伟康

登录拦截

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