Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ydl-group-course
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄志
ydl-group-course
Commits
0dfe5870
Commit
0dfe5870
authored
Apr 08, 2023
by
huangzhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 支付成功页使用replace策略,返回后刷新
parent
f290c6ef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
15 deletions
+33
-15
pay.vue
src/pages/pay/pay.vue
+1
-1
web.vue
src/pages/web/web.vue
+32
-14
No files found.
src/pages/pay/pay.vue
View file @
0dfe5870
...
@@ -210,7 +210,7 @@ export default {
...
@@ -210,7 +210,7 @@ export default {
pagePath
=
'pay/groupSuccess'
pagePath
=
'pay/groupSuccess'
}
}
const
url
=
`
${
hostPrefix
}
/h5-course/
${
pagePath
}
?
${
urlStr
}
`
const
url
=
`
${
hostPrefix
}
/h5-course/
${
pagePath
}
?
${
urlStr
}
`
uni
.
navigate
To
({
uni
.
redirect
To
({
url
:
`/pages/web/web?title=
${
'支付成功'
}
&loadUrl=
${
encodeURIComponent
(
url
)}
`
,
url
:
`/pages/web/web?title=
${
'支付成功'
}
&loadUrl=
${
encodeURIComponent
(
url
)}
`
,
})
})
},
},
...
...
src/pages/web/web.vue
View file @
0dfe5870
...
@@ -15,8 +15,9 @@ export default {
...
@@ -15,8 +15,9 @@ export default {
name
:
'WebPage'
,
name
:
'WebPage'
,
data
()
{
data
()
{
return
{
return
{
cccc
:
''
,
loadUrl
:
''
,
loadUrl
:
''
,
// 只用于页面第一次初始化的时候,只要加载页面数据一次,防止onShow时重复加载
isMountedPageLoaded
:
false
,
options
:
{},
options
:
{},
}
}
},
},
...
@@ -31,20 +32,20 @@ export default {
...
@@ -31,20 +32,20 @@ export default {
})
})
}
}
this
.
cccc
=
options
.
scene
this
.
isMountedPageLoaded
=
true
this
.
loadPage
()
// 有scene,说明是扫描二维码进入
if
(
options
.
scene
)
{
uni
.
showLoading
({
title
:
'加载中'
,
})
this
.
getParamsByScene
(
options
.
scene
)
}
},
},
// 移除登录成功事件
// 移除登录成功事件
onUnload
()
{
onUnload
()
{
uni
.
$off
(
'loginSuccess'
,
this
.
handleLoginSuccess
)
uni
.
$off
(
'loginSuccess'
,
this
.
handleLoginSuccess
)
},
},
// 主要用于返回上一页,刷新当前页面
onShow
()
{
if
(
this
.
isMountedPageLoaded
)
return
if
(
this
.
isNeedLoadPageOnShow
)
{
this
.
loadPage
()
}
},
// 分享给朋友
// 分享给朋友
onShareAppMessage
()
{
onShareAppMessage
()
{
const
getDetailPageUrl
=
()
=>
{
const
getDetailPageUrl
=
()
=>
{
...
@@ -70,6 +71,12 @@ export default {
...
@@ -70,6 +71,12 @@ export default {
}
}
}
}
},
},
computed
:
{
// 课程详情页需要回退后,刷新
isNeedLoadPageOnShow
()
{
return
this
.
loadUrl
&&
this
.
loadUrl
.
includes
(
'h5-course/detail'
)
},
},
watch
:
{
watch
:
{
loadUrl
:
{
loadUrl
:
{
handler
(
url
)
{
handler
(
url
)
{
...
@@ -82,13 +89,24 @@ export default {
...
@@ -82,13 +89,24 @@ export default {
},
},
},
},
mounted
()
{
mounted
()
{
// this.options.scene 无值,说明是非扫描二维码,此时自己拼装路径
// 第一次加载完毕,置于初始值
if
(
!
this
.
options
.
scene
)
{
this
.
isMountedPageLoaded
=
false
this
.
initWeviewUrl
()
}
},
},
methods
:
{
methods
:
{
loadPage
()
{
const
options
=
this
.
options
// 有scene,说明是扫描二维码进入
if
(
options
.
scene
)
{
uni
.
showLoading
({
title
:
'加载中'
,
})
this
.
getParamsByScene
(
options
.
scene
)
}
else
{
// this.options.scene 无值,说明是非扫描二维码,此时自己拼装路径
this
.
initWeviewUrl
()
}
},
// 设置页面地址额外的通用参数
// 设置页面地址额外的通用参数
setCommonUrlParams
(
pageUrl
,
urlParmas
)
{
setCommonUrlParams
(
pageUrl
,
urlParmas
)
{
let
url
=
decodeURIComponent
(
pageUrl
)
let
url
=
decodeURIComponent
(
pageUrl
)
...
...
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