Browse Source

no message

feature/v2.0
xpz2018 4 years ago
parent
commit
f7b6e5e1b9
2 changed files with 16 additions and 2 deletions
  1. 2
      colorui/components/cu-custom.js
  2. 16
      pages/index/scene.js

2
colorui/components/cu-custom.js

@ -90,7 +90,7 @@ Component({
}
},
toHome() {
if (app.userInfo.userId) {
if (app.userInfo && app.userInfo.userId) {
wx.redirectTo({ url: '/pages/index/index' })
} else {
wx.reLaunch({ url: '/pages/login/index' })

16
pages/index/scene.js

@ -1,5 +1,6 @@
const app = getApp()
export default function Scene(config) {
const { onLoad } = config
const { onLoad, onUnload } = config
config.onLoad = function(options) {
if (onLoad) {
onLoad.call(this, options)
@ -11,5 +12,18 @@ export default function Scene(config) {
}
}
}
config.onUnload = function(options) {
if (onUnload) {
onUnload.call(this, options)
}
let pages = getCurrentPages() //当前页面栈
if (pages.length == 1 && pages[0].route != 'pages/index/index') {
if (app.userInfo && app.userInfo.userId) {
wx.redirectTo({ url: '/pages/index/index' })
} else {
wx.reLaunch({ url: '/pages/login/index' })
}
}
}
return Page(config)
}
Loading…
Cancel
Save