Commit 82c08aac by chenwq

定制跳转

1 parent c9ccb265
......@@ -7,10 +7,11 @@ const setRouteData = targetPath => {
let [url, query] = targetPath.split('?'),
obj = {}
if (query) {
const [key, val] = query.split('=')
obj = {
[key]: val
}
var list = query.split('&') || []
list.forEach(item => {
const [key, val] = item.split('=')
obj[key] = val
})
}
return {
url,
......
......@@ -33,13 +33,23 @@ Page({
if (extraData && Object.keys(extraData).length) this.phoneSmsLogin(extraData)
else this.init()
} else this.init()
} else if ([1011, 1012, 1013].includes(appEnter.scene)) {
} else if ([1047, 1048, 1049].includes(appEnter.scene)) {
if (!this.options.scene) {
this.init()
return
}
sceneByIdApi({
id: decodeURIComponent(appEnter.query.scene).split('=')[1]
}).then(res => {
const url = res.scene
const obj = this.arrToObj(url.split('&'))
if (obj.hasOwnProperty('userName') && obj.hasOwnProperty('password')) {
wx.$storage.rm("sessionId")
wx.$storage.rm("userInfo")
wx.$storage.rm("auto_login_object")
wx.$storage.rm("posterId")
wx.$storage.set("firstLogin", "firstLogin")
wx.$storage.set("disLikeRecordFlag", true)
this.accountLogin(obj)
} else this.init()
}).catch(() => {
......@@ -157,7 +167,7 @@ Page({
if (code == '0') {
const { sessionId, loginUserInfoList } = data
var routeParams = {}
setLoginInfo(loginUserInfoList[0], sessionId)
var list = []
if (obj.url == '/packagesList/packageOutput/pages/summary') {
routeParams = {
merchantId: obj.merchantId,
......@@ -167,9 +177,12 @@ Page({
isSuper: loginUserInfoList[0].isSuper,
fixScenceCode: obj.sceneCode
}
// console.log(routeParams, 'routeParams---')
Object.keys(routeParams).forEach((item) => {
list.push(item + "=" + routeParams[item])
})
this.options.targetPath = obj.url + "?" + list.join("&")
}
wx.$router.reLaunch(obj.url, routeParams)
setLoginInfo(loginUserInfoList[0], sessionId)
} else {
wx.$api.showToast(message || '系统异常')
setTimeout(() => {
......
......@@ -86,7 +86,7 @@
"pathName": "login/loading/loading",
"query": "scene=sceneId%3D22402",
"launchMode": "default",
"scene": 1011
"scene": 1047
}
]
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!