Commit dcd7f673 by 李伟康

兼容scene直接打开

1 parent 8a2d3141
......@@ -10,15 +10,17 @@ module.exports = Behavior({
const {
options
} = this
let query = ['isLogin=1']
let query = ['isLogin=1'],
params = {
merchantId: options.merchantId || ''
}
Object.keys(options).map(key => {
query.push(`${key}=${options[key]}`)
if (key != 'scene') query.push(`${key}=${options[key]}`)
})
let url = encodeURIComponent(`/${this.route}?${query.join('&')}`)
wx.p.router.redirectTo('/pages/loading/loading', {
url,
merchantId: options.merchantId
})
params.url = url
if (options.scene) params.scene = options.scene
wx.p.router.redirectTo('/pages/loading/loading', params)
},
}
})
\ No newline at end of file
......@@ -80,12 +80,16 @@ Page({
id
})
const params = data.scene.split('url='),
options = {}
options = {},
{
options: _options
} = this
data.scene.split('&').map(item => {
const [key, val] = item.split('=')
options[key] = val
})
if (params.length > 1) options.url = params.at(-1)
if (_options.url) options.url = _options.url
if (code == 0) this.login(options)
else throw {}
} catch (error) {
......@@ -103,6 +107,9 @@ Page({
routeName = this.tabList.findIndex(e => `/${e.pagePath}` == `${url}.html`) > -1 ? 'switchTab' : 'redirectTo'
events.notIntercept = true
events.merchantId = options.merchantId || ''
Object.keys(options).map(key => {
if (key != 'url') events[key] = options[key]
})
wx.p.router[routeName](url, events)
},
setRouteData(targetPath) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!