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
04104c20
Commit
04104c20
authored
Jul 26, 2024
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat: 优化
parent
2afaa98a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
9 deletions
+71
-9
src/components/tabbarPage.vue
+30
-3
src/pages/home/index.vue
+5
-0
src/pages/index/index.vue
+9
-4
src/pages/wxArticle/index.vue
+27
-2
No files found.
src/components/tabbarPage.vue
View file @
04104c20
...
...
@@ -65,7 +65,8 @@ export default {
let
pageUrl1
=
(
this
.
page
.
startsWith
(
'http://'
)
||
this
.
page
.
startsWith
(
'https://'
))?
(
this
.
page
+
this
.
params
)
:
this
.
link
+
this
.
page
+
this
.
params
let
pageUrl
=
forUrlAddKey
(
decodeURIComponent
(
pageUrl1
));
console
.
log
(
pageUrl
,
'--pageUrl'
)
return
pageUrl
+
this
.
ss
+
this
.
timestamp
;
let
newPageUrl
=
this
.
removeEmptyQueryParams
(
pageUrl
+
this
.
ss
+
this
.
timestamp
);
return
newPageUrl
;
}
},
onLoad
(
options
)
{
...
...
@@ -122,7 +123,7 @@ export default {
});
}
}
this
.
pageUrl1
=
this
.
pageUrl
;
this
.
pageUrl1
=
this
.
removeEmptyQueryParams
(
this
.
pageUrl
)
;
},
onShow
(){
console
.
log
(
'--onShow--'
)
...
...
@@ -141,7 +142,7 @@ export default {
setTimeout
(()
=>
{
this
.
showPage
=
true
;
},
0
);
this
.
pageUrl1
=
this
.
pageUrl
+
`&tim=
${
new
Date
().
getTime
()}
`
this
.
pageUrl1
=
this
.
removeEmptyQueryParams
(
this
.
pageUrl
+
`&tim=
${
new
Date
().
getTime
()}
`
)
wx
.
removeStorageSync
(
"reloadTabbarPage"
);
console
.
log
(
this
.
pageUrl1
,
'--this.pageUrl1'
)
}
...
...
@@ -155,6 +156,31 @@ export default {
getMessage
(
res
)
{
this
.
$emit
(
"getMessage"
,
res
);
},
// 将多余的参数删除: ?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
;
}
}
},
};
</
script
>
\ No newline at end of file
src/pages/home/index.vue
View file @
04104c20
...
...
@@ -479,6 +479,11 @@ export default {
employeeId
:
paramsObj
.
setGuideEmployeeId
,
})
}
}
else
{
// 不是导购进入移除参数
wx
.
removeStorageSync
(
this
.
$store
.
state
.
mixid
+
'setGuideEmployeeId'
);
wx
.
removeStorageSync
(
this
.
$store
.
state
.
mixid
+
'guide_QRCodeType'
);
wx
.
removeStorageSync
(
this
.
$store
.
state
.
mixid
+
'temp_QRCodeType'
);
}
if
(
paramsObj
.
QRCodeType
)
{
wx
.
setStorageSync
(
this
.
$store
.
state
.
mixid
+
'guide_QRCodeType'
,
paramsObj
.
QRCodeType
);
...
...
src/pages/index/index.vue
View file @
04104c20
...
...
@@ -374,10 +374,15 @@ export default {
// 判断是否为导购分享进入
if
(
paramsObj
.
setGuideEmployeeId
)
{
wx
.
setStorageSync
(
this
.
$store
.
state
.
mixid
+
'setGuideEmployeeId'
,
paramsObj
.
setGuideEmployeeId
);
}
if
(
paramsObj
.
QRCodeType
)
{
wx
.
setStorageSync
(
this
.
$store
.
state
.
mixid
+
'guide_QRCodeType'
,
paramsObj
.
QRCodeType
);
wx
.
setStorageSync
(
this
.
$store
.
state
.
mixid
+
'temp_QRCodeType'
,
paramsObj
.
QRCodeType
);
if
(
paramsObj
.
QRCodeType
)
{
wx
.
setStorageSync
(
this
.
$store
.
state
.
mixid
+
'guide_QRCodeType'
,
paramsObj
.
QRCodeType
);
wx
.
setStorageSync
(
this
.
$store
.
state
.
mixid
+
'temp_QRCodeType'
,
paramsObj
.
QRCodeType
);
}
}
else
{
// 非导购方式进入移除本地缓存
wx
.
removeStorageSync
(
this
.
$store
.
state
.
mixid
+
'setGuideEmployeeId'
);
wx
.
removeStorageSync
(
this
.
$store
.
state
.
mixid
+
'guide_QRCodeType'
);
wx
.
removeStorageSync
(
this
.
$store
.
state
.
mixid
+
'temp_QRCodeType'
);
}
wx
.
setStorageSync
(
'attractingCustomerChannelId'
,
paramsObj
.
attractingCustomerChannelId
);
wx
.
setStorageSync
(
this
.
$store
.
state
.
mixid
+
'storeId'
,
paramsObj
.
storeId
);
...
...
src/pages/wxArticle/index.vue
View file @
04104c20
...
...
@@ -212,13 +212,13 @@ export default {
if
(
wx
.
getStorageSync
(
"_ma_sid"
))
{
this
.
link
+=
`&_ma_sid=
${
wx
.
getStorageSync
(
"_ma_sid"
)}
`
;
}
this
.
useLink
=
this
.
link
;
this
.
useLink
=
this
.
removeEmptyQueryParams
(
this
.
link
)
;
console
.
log
(
this
.
useLink
,
'--this.useLink'
)
},
},
methods
:
{
setLink
(
data
)
{
this
.
link
=
data
;
this
.
link
=
this
.
removeEmptyQueryParams
(
data
)
;
console
.
log
(
this
.
useLink
,
89999999
)
},
getSsoBcakUrl
(
link
)
{
...
...
@@ -290,6 +290,31 @@ export default {
title
:
"网页加载失败 请右上角刷新"
,
});
},
// 将多余的参数删除: ?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
;
}
}
},
};
</
script
>
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