Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
bb856523
Commit
bb856523
authored
Aug 28, 2020
by
张卓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新小程序码扫码进入小程序
parent
2a970119
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
114 additions
and
82 deletions
+114
-82
src/api/index.js
+13
-0
src/pages/index/index.vue
+101
-82
No files found.
src/api/index.js
0 → 100644
View file @
bb856523
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
src/pages/index/index.vue
View file @
bb856523
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment