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
c5ffa3af
Commit
c5ffa3af
authored
May 08, 2024
by
李嘉林
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'xhyx/release' of
http://code.mayi888.com/chengmo/mayi-mp-shop
into xhyx/release
parents
5f3ca3e5
314ac48f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
+27
-2
src/pages/index/index.vue
+27
-2
No files found.
src/pages/index/index.vue
View file @
c5ffa3af
...
...
@@ -109,7 +109,7 @@ export default {
if
(
!
this
.
withoutScene
)
{
return
;
}
this
.
newPageUrl
=
this
.
pageUrl
;
this
.
newPageUrl
=
this
.
removeEmptyQueryParams
(
this
.
pageUrl
)
;
console
.
log
(
'------------------index----2'
)
// 进入直播页面调用不息屏api
console
.
log
(
this
.
pageUrl
,
this
.
pageUrl
.
includes
(
'/liveBroadcast/lived'
),
"this.pageUrl.includes('/liveBroadcast/lived')"
)
...
...
@@ -502,7 +502,7 @@ export default {
}
}
this
.
newPageUrl
=
this
.
pageUrl
;
this
.
newPageUrl
=
this
.
removeEmptyQueryParams
(
this
.
pageUrl
)
;
console
.
log
(
'this.newPageUrl'
,
this
.
newPageUrl
)
// 商品分享进入 (卡片分享、扫码、点击小程序链接)
if
(
this
.
newPageUrl
.
includes
(
'/goods/'
)
&&
(
options
.
share
||
options
.
share_copy
))
{
...
...
@@ -716,6 +716,31 @@ export default {
}
return
''
;
},
// 将多余的参数删除: ?abc=&cba=1 => ?cba=1
removeEmptyQueryParams
(
url
)
{
try
{
// 分割URL,分离基础URL和查询字符串
const
[
baseUrl
,
queryPart
]
=
url
.
split
(
'?'
);
// 若没有查询字符串,直接返回基础URL
if
(
!
queryPart
)
return
baseUrl
;
// 分割查询字符串为参数数组
const
queryParams
=
queryPart
.
split
(
'&'
);
// 过滤掉空值参数
const
filteredParams
=
queryParams
.
filter
(
param
=>
{
const
[
key
,
value
]
=
param
.
split
(
'='
);
return
value
;
});
// 重新组合查询字符串并附加到基础URL上
const
cleanedQuery
=
filteredParams
.
join
(
'&'
);
return
baseUrl
+
(
cleanedQuery
?
`?
${
cleanedQuery
}
`
:
''
);
}
catch
(
err
)
{
console
.
log
(
'parseUrlError:'
,
err
);
return
url
;
}
}
},
onUnload
()
{
...
...
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