-
Notifications
You must be signed in to change notification settings - Fork 22
/
app.js
36 lines (32 loc) · 923 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const util = require('./utils/util.js')
const lastestPageKey = 'lastest-page'
App({
onLaunch: function (options) {
},
onError(error) {
util.Alert(error)
},
onShow: function (options) {
var path = options.path
console.log('onShow path: ', path)
if (!path.startsWith('pages/')) {
util.GitHubNavi(path, wx.redirectTo)
return
}
if (path != 'pages/github/index') {
return
}
var lastest = wx.getStorageSync(lastestPageKey)
if (lastest && lastest.path!=undefined && lastest.param!=undefined && path != lastest.path) {
console.log('invoke page recover:', lastest.path, lastest.param)
wx.navigateTo({url: lastest.path + '?' + lastest.param})
}
},
onHide() {
var [path, param] = util.GetLastestPage()
console.log('onHide:', path, param)
wx.setStorageSync(lastestPageKey, {path, param, time: new Date()})
},
globalData: {
}
})