Commit bb856523 by 张卓

新小程序码扫码进入小程序

parent 2a970119
import {requestPOST,requestGET} from "@/utils/request.js";
console.log(process.env,'-----------------config------')
// wx
export default {
//POST /shareSceneRecord/getShareSceneRecord/{sceneCode} 获取分享场景参数记录
getShareSceneRecord(options) {
return requestPOST(`${process.env.OLSHOP_URL}/shareSceneRecord/getShareSceneRecord/${options}`, {});
},
}
\ No newline at end of file
......@@ -7,6 +7,7 @@
<script>
import spokesman from "@/api/spokesman.js";
import shop from "@/api/shop.js";
import indexApi from "@/api/index.js";
import { serialize, getQueryVariable, DFSImg } from "@/utils/index";
export default {
data() {
......@@ -132,93 +133,111 @@ export default {
this.page = options.backpath;
this.params += "&" + serialize(options.params);
} else if (options.scene) {
//来自扫码
// options 中的scene需要使用decodeURIComponent才能获取到生成二维码时传入的scene
var scene = decodeURIComponent(options.scene); //参数二维码传递过来的参数
let querys = scene.split("_");
if (querys) {
if (querys[0] == "pid") {
//商品详情 pid_123
this.page = `/goods/${querys[1]}`;
this.params += this.paramsHander(querys,3)+`&discountMargin=${querys[querys.length-1]}`
// if(querys.length > 3){
// if(querys[5]){
// this.params += `&spokesmanGroupId=${querys[2]}&spokesmanShopId=${querys[3]}&spokesmanRelId=${querys[4]}&userId=${querys[5]}`
// }else{
// this.params += `&spokesmanGroupId=${querys[2]}&spokesmanShopId=${querys[3]}&spokesmanRelId=${querys[4]}`
// }
// }else if(querys.length == 3){
// this.params += `&userId=${querys[2]}`
// }
// console.log()
if(options.scene.indexOf('_') == -1){
//新二维码扫码进入
indexApi.getShareSceneRecord(options.scene).then(res=>{
if(res.data.code == '200'){
this.page = res.data.data.pageUri;
let paramsObj = JSON.parse(res.data.data.scene);
let params = '';
for(let i in paramsObj){
params += "&"+i+'='+paramsObj[i]
}
this.params += params
}
})
}else {
//来自扫码
// options 中的scene需要使用decodeURIComponent才能获取到生成二维码时传入的scene
var scene = decodeURIComponent(options.scene); //参数二维码传递过来的参数
let querys = scene.split("_");
if (querys) {
if (querys[0] == "pid") {
//商品详情 pid_123
this.page = `/goods/${querys[1]}`;
this.params += this.paramsHander(querys,3)+`&discountMargin=${querys[querys.length-1]}`
// if(querys.length > 3){
// if(querys[5]){
// this.params += `&spokesmanGroupId=${querys[2]}&spokesmanShopId=${querys[3]}&spokesmanRelId=${querys[4]}&userId=${querys[5]}`
// }else{
// this.params += `&spokesmanGroupId=${querys[2]}&spokesmanShopId=${querys[3]}&spokesmanRelId=${querys[4]}`
// }
// }else if(querys.length == 3){
// this.params += `&userId=${querys[2]}`
// }
} else if (querys[0] == "activty") {
//活动页面activty_turntable_123
this.params += `&pageInfo=${scene}`;
} else if (querys[0] == "spokesman") {
//分销员 小程序码
this.page = `/personalCenter/spokesmanCenter`;
this.params += this.paramsHander(querys,2)
// if(querys.length > 2){
// if(querys[4]){
// this.params += `&spokesmanGroupId=${querys[1]}&spokesmanShopId=${querys[2]}&spokesmanRelId=${querys[3]}&userId=${querys[4]}`
// }else{
// this.params += `&spokesmanGroupId=${querys[1]}&spokesmanShopId=${querys[2]}&spokesmanRelId=${querys[3]}`
// }
// }else if(querys.length == 2){
// this.params += `&userId=${querys[1]}`
// }
}else if(querys[0] == "home"){
this.page = `/`;
this.params += this.paramsHander(querys,2)
// if(querys.length > 2){
// if(querys[4]){
// this.params += `&spokesmanGroupId=${querys[1]}&spokesmanShopId=${querys[2]}&spokesmanRelId=${querys[3]}&userId=${querys[4]}`
// }else{
// this.params += `&spokesmanGroupId=${querys[1]}&spokesmanShopId=${querys[2]}&spokesmanRelId=${querys[3]}`
// }
// }else if(querys.length == 2){
// this.params += `&userId=${querys[1]}`
// }
}else if(querys[0] == "coupon"){
this.page = `/personalCenter/coupon/getCoupon`;
this.params+=`&couponId=${querys[1]}`
}else if(querys[0] == "a"){
this.page = "/activty/receivingGift"
this.params += `&orderId=${querys[1]}`
this.params += this.paramsHander(querys,3)
// if(querys.length > 3){
// if(querys[5]){
// this.params += `&orderSn=${querys[1]}&spokesmanGroupId=${querys[2]}&spokesmanShopId=${querys[3]}&spokesmanRelId=${querys[4]}&userId=${querys[5]}`
// }else{
// this.params += `&orderSn=${querys[1]}&spokesmanGroupId=${querys[2]}&spokesmanShopId=${querys[3]}&spokesmanRelId=${querys[4]}`
// }
} else if (querys[0] == "activty") {
//活动页面activty_turntable_123
this.params += `&pageInfo=${scene}`;
} else if (querys[0] == "spokesman") {
//分销员 小程序码
this.page = `/personalCenter/spokesmanCenter`;
this.params += this.paramsHander(querys,2)
// if(querys.length > 2){
// if(querys[4]){
// this.params += `&spokesmanGroupId=${querys[1]}&spokesmanShopId=${querys[2]}&spokesmanRelId=${querys[3]}&userId=${querys[4]}`
// }else{
// this.params += `&spokesmanGroupId=${querys[1]}&spokesmanShopId=${querys[2]}&spokesmanRelId=${querys[3]}`
// }
// }else if(querys.length == 2){
// this.params += `&userId=${querys[1]}`
// }
// }else if(querys.length == 3){
// this.params += `&orderSn=${querys[1]}&userId=${querys[2]}`
// }
}else if (querys[0] == 'redeemCode') {//兑换码
this.page = `/personalCenter/CDkey/exchange`;
}else if(querys[0] == 'card'){
this.page = `/giftCards/linkReceive`;
this.params+=`&id=${querys[1]}`
this.params += this.paramsHander(querys,3)
}else if(querys[0] == 'giftView'){
this.page = `/giftCoupon/preview`;
this.params+=`&id=${querys[1]}`
}else if(querys[0] == 'form'){//问卷调查
this.page = `/smartForm`;
this.params+=`&formId=${querys[1]}`;
this.params += this.paramsHander(querys,3)
}else if(querys[0] == "home"){
this.page = `/`;
this.params += this.paramsHander(querys,2)
// if(querys.length > 2){
// if(querys[4]){
// this.params += `&spokesmanGroupId=${querys[1]}&spokesmanShopId=${querys[2]}&spokesmanRelId=${querys[3]}&userId=${querys[4]}`
// }else{
// this.params += `&spokesmanGroupId=${querys[1]}&spokesmanShopId=${querys[2]}&spokesmanRelId=${querys[3]}`
// }
// }else if(querys.length == 2){
// this.params += `&userId=${querys[1]}`
// }
}else if(querys[0] == "coupon"){
this.page = `/personalCenter/coupon/getCoupon`;
this.params+=`&couponId=${querys[1]}`
}else if(querys[0] == "a"){
this.page = "/activty/receivingGift"
this.params += `&orderId=${querys[1]}`
this.params += this.paramsHander(querys,3)
// if(querys.length > 3){
// if(querys[5]){
// this.params += `&orderSn=${querys[1]}&spokesmanGroupId=${querys[2]}&spokesmanShopId=${querys[3]}&spokesmanRelId=${querys[4]}&userId=${querys[5]}`
// }else{
// this.params += `&orderSn=${querys[1]}&spokesmanGroupId=${querys[2]}&spokesmanShopId=${querys[3]}&spokesmanRelId=${querys[4]}`
// }
// }else if(querys.length == 3){
// this.params += `&orderSn=${querys[1]}&userId=${querys[2]}`
// }
}else if (querys[0] == 'redeemCode') {//兑换码
this.page = `/personalCenter/CDkey/exchange`;
}else if(querys[0] == 'card'){
this.page = `/giftCards/linkReceive`;
this.params+=`&id=${querys[1]}`
this.params += this.paramsHander(querys,3)
}else if(querys[0] == 'giftView'){
this.page = `/giftCoupon/preview`;
this.params+=`&id=${querys[1]}`
}else if(querys[0] == 'form'){//问卷调查
this.page = `/smartForm`;
this.params+=`&formId=${querys[1]}`;
this.params += this.paramsHander(querys,3)
}
}
console.log(querys, "scene");
console.log(this.page)
console.log(this.params)
}
console.log(querys, "scene");
console.log(this.page)
console.log(this.params)
// var query = options.query.dentistId; // 参数二维码传递过来的场景参数
}
console.log("url", this.link + this.page + this.params);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment