Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
飞
飞鹤小程序
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
FH
飞鹤小程序
Commits
cd7b58a5
Commit
cd7b58a5
authored
Aug 08, 2025
by
spc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
this.hasShownPopu
parent
f5d8e817
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
14 deletions
+40
-14
home.js
stores/home.js
+17
-1
Home.vue
views/Home.vue
+23
-13
No files found.
stores/home.js
View file @
cd7b58a5
...
...
@@ -9,6 +9,7 @@ export const useHomeStore = defineStore("homeInfo", {
homeInfo
:
null
,
isLogin
:
false
,
babyExistence
:
false
,
hasShownPopup
:
false
,
// 记录是否已经显示过弹窗(全局状态)
};
},
actions
:
{
...
...
@@ -30,6 +31,20 @@ export const useHomeStore = defineStore("homeInfo", {
this
.
babyExistence
=
!
babyExistence
;
},
/**
* 标记弹窗已显示
*/
markPopupAsShown
()
{
this
.
hasShownPopup
=
true
;
},
/**
* 重置弹窗状态(用于测试或特殊需求)
*/
resetPopupState
()
{
this
.
hasShownPopup
=
false
;
},
/**
* 获取首页信息
*/
...
...
@@ -38,8 +53,9 @@ export const useHomeStore = defineStore("homeInfo", {
console
.
log
(
"loadHomeInfo"
,
data
);
if
(
data
)
{
this
.
setHomeInfo
(
data
);
// 通过参数传入的方式使用 $sensors
// 通过参数传入的方式使用 $sensors
this
.
hasShownPopup
=
false
const
userStore
=
useUserStore
();
const
mdData
=
{
...
...
views/Home.vue
View file @
cd7b58a5
...
...
@@ -398,7 +398,6 @@ export default {
channelTabListMianTitle
:
''
,
popupImageUrl
:
''
,
popupImageObj
:
{},
showPop1
:
false
,
}
},
components
:
{
...
...
@@ -421,18 +420,7 @@ export default {
this
.
showRegisterLayer
=
this
.
isClickPhoneAuth
&&
newVal
.
isLogin
&&
!
newVal
.
babyExistence
;
if
(
newVal
.
homeInfo
!==
null
)
{
this
.
initHomeInfo
();
// 处理 showPop1 弹窗逻辑(来自 fetchHomeInfo)
console
.
warn
(
"showPop1"
,
newVal
,
this
.
showPop1
)
if
(
newVal
.
homeInfo
.
showPop1
&&
!
this
.
showPop1
)
{
this
.
showPop1
=
true
;
// 延迟显示弹窗,确保页面渲染完成
this
.
$nextTick
(()
=>
{
setTimeout
(()
=>
{
this
.
showImagePopup
();
},
500
);
});
}
this
.
checkAndShowPopup
();
}
},
deep
:
true
,
...
...
@@ -462,6 +450,10 @@ export default {
this
.
checkExposure
(
this
.
scrollTop
);
});
},
unmounted
()
{
// 组件销毁时清理弹窗状态(可选,根据业务需求决定是否保留状态)
// 如果需要重置弹窗状态,可以在这里调用 this.resetPopupState()
},
methods
:
{
async
initHomeInfo
()
{
const
{
data
}
=
await
fetchHomeJSON
();
...
...
@@ -754,6 +746,24 @@ export default {
},
closePop1
()
{
this
.
$refs
.
imagePopup
.
close
();
},
// 重置弹窗状态(可在需要时调用)
resetPopupState
()
{
this
.
homeStore
.
resetPopupState
();
// 重置 store 中的弹窗状态
},
// 检查并显示弹窗(使用 store 全局状态管理)
checkAndShowPopup
()
{
// 使用 store 中的 hasShownPopup 来记录是否已经显示过弹窗
if
(
!
this
.
homeStore
.
hasShownPopup
&&
this
.
homeStore
.
homeInfo
?.
showPop1
)
{
this
.
homeStore
.
markPopupAsShown
();
// 标记已显示过弹窗(全局状态)
this
.
$nextTick
(()
=>
{
setTimeout
(()
=>
{
this
.
showImagePopup
();
},
500
);
});
}
}
}
}
...
...
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