Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
lls_program
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-10-01 20:41:27 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d72d32e45d9acf563dbaa132e64a72052cfbc1c8
d72d32e4
1 parent
d8314e52
fix(AdPage): 修复点击图片时未实时查询家庭状态的问题
在handleImageClick中增加实时查询家庭状态的逻辑,当查询失败时回退到之前的状态
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
11 deletions
src/pages/AdPage/index.vue
src/pages/AdPage/index.vue
View file @
d72d32e
...
...
@@ -187,17 +187,37 @@ const performSilentAuth = async () => {
/**
* 点击图片处理
*/
const handleImageClick = () => {
if (hasFamily.value) {
// 已加入家庭,跳转到dashboard页面
Taro.redirectTo({
url: '/pages/Dashboard/index'
});
} else {
// 未加入家庭,跳转到welcome页面
Taro.redirectTo({
url: '/pages/Welcome/index'
});
const handleImageClick = async () => {
try {
// 重新查询家庭状态
const { code, data } = await getMyFamiliesAPI();
const currentHasFamily = code && data && data?.families?.length > 0;
if (currentHasFamily) {
// 已加入家庭,跳转到dashboard页面
Taro.redirectTo({
url: '/pages/Dashboard/index'
});
} else {
// 未加入家庭,跳转到welcome页面
Taro.redirectTo({
url: '/pages/Welcome/index'
});
}
} catch (error) {
console.error('查询家庭状态失败:', error);
// 查询失败时,使用之前的状态进行跳转
if (hasFamily.value) {
// 已加入家庭,跳转到dashboard页面
Taro.redirectTo({
url: '/pages/Dashboard/index'
});
} else {
// 未加入家庭,跳转到welcome页面
Taro.redirectTo({
url: '/pages/Welcome/index'
});
}
}
};
...
...
Please
register
or
login
to post a comment