Commit dcd7f673 by 李伟康

兼容scene直接打开

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