|
|
|
@ -6,12 +6,18 @@ |
|
|
|
/* 路由分发页面仅供跳转页面 */ |
|
|
|
export default { |
|
|
|
onLoad(options){ |
|
|
|
this.routeToPage(options); |
|
|
|
if(this.$shared.isValueType(options.scene) != 'undefined'){ |
|
|
|
const scene = decodeURIComponent(options.scene); // 二维码扫码进入 |
|
|
|
const par = this.strToObj(scene); |
|
|
|
this.routeToPage(par); |
|
|
|
}else{ |
|
|
|
this.routeToPage(options); // 普通小程序分享进入 |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 路由分发 |
|
|
|
routeToPage(options){ |
|
|
|
if(options.route == 'goods_detail'){ |
|
|
|
if(options.route == 'goods_detail' || options.route == 'goods'){ |
|
|
|
options.page_url = '/pages/goodsDetail/index'; |
|
|
|
this.joinPagePath(options); |
|
|
|
}else if(options.route == 'home'){ |
|
|
|
@ -45,6 +51,18 @@ |
|
|
|
}else{ |
|
|
|
this.$url(path, {type: 'redirect'}); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 将key=value&key=value形式的字符串转为对象 |
|
|
|
strToObj(str){ |
|
|
|
let obj = {}; |
|
|
|
if(!str) return obj; |
|
|
|
|
|
|
|
let arr = str.split('&'); |
|
|
|
arr.map(item => { |
|
|
|
let a = item.split('='); |
|
|
|
obj[a[0]] = a[1]; |
|
|
|
}); |
|
|
|
return obj; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|