hookehuyr

feat(ActivitiesCover): 添加家庭状态检查逻辑

在参加活动按钮点击时检查用户是否已加入家庭
如果未加入家庭则提示并引导至欢迎页
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-08-29 10:31:14
* @LastEditTime: 2025-08-29 15:39:47
* @FilePath: /lls_program/src/pages/ActivitiesCover/index.vue
* @Description: 活动海报页面 - 展示活动信息并处理定位授权
-->
......@@ -71,7 +71,7 @@
class="join-button"
color="#3B82F6"
:loading="isJoining"
@click="handleJoinActivity"
@click="checkFamilyStatusAndJoinActivity"
>
{{ hasLocationAuth ? '进入活动' : '参加活动' }}
</nut-button>
......@@ -139,6 +139,7 @@ import PosterBuilder from '../../components/PosterBuilder/index.vue'
const hasLocationAuth = ref(false) // 是否已授权定位
const isJoining = ref(false) // 是否正在加入活动
const userLocation = ref({ lng: null, lat: null }) // 用户位置信息
const hasJoinedFamily = ref(false); // TODO: 是否加入家庭
// 海报生成相关状态
const show_share = ref(false) // 显示分享弹窗
......@@ -241,6 +242,31 @@ const getUserLocation = async () => {
}
/**
* 检查用户是否加入家庭并处理参加活动按钮点击
*/
const checkFamilyStatusAndJoinActivity = async () => {
// Mock data: hasJoinedFamily is set to false
if (!hasJoinedFamily.value) {
Taro.showModal({
title: '提示',
content: '没有加入家庭是无法参加活动的',
cancelText: '关闭',
confirmText: '前往加入',
success: (res) => {
if (res.confirm) {
Taro.navigateTo({
url: '/pages/Welcome/index',
});
}
},
});
} else {
handleJoinActivity();
}
};
/**
* 处理参加活动按钮点击
*/
const handleJoinActivity = async () => {
......