hookehuyr

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

在参加活动按钮点击时检查用户是否已加入家庭
如果未加入家庭则提示并引导至欢迎页
1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-08-29 10:31:14 4 + * @LastEditTime: 2025-08-29 15:39:47
5 * @FilePath: /lls_program/src/pages/ActivitiesCover/index.vue 5 * @FilePath: /lls_program/src/pages/ActivitiesCover/index.vue
6 * @Description: 活动海报页面 - 展示活动信息并处理定位授权 6 * @Description: 活动海报页面 - 展示活动信息并处理定位授权
7 --> 7 -->
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
71 class="join-button" 71 class="join-button"
72 color="#3B82F6" 72 color="#3B82F6"
73 :loading="isJoining" 73 :loading="isJoining"
74 - @click="handleJoinActivity" 74 + @click="checkFamilyStatusAndJoinActivity"
75 > 75 >
76 {{ hasLocationAuth ? '进入活动' : '参加活动' }} 76 {{ hasLocationAuth ? '进入活动' : '参加活动' }}
77 </nut-button> 77 </nut-button>
...@@ -139,6 +139,7 @@ import PosterBuilder from '../../components/PosterBuilder/index.vue' ...@@ -139,6 +139,7 @@ import PosterBuilder from '../../components/PosterBuilder/index.vue'
139 const hasLocationAuth = ref(false) // 是否已授权定位 139 const hasLocationAuth = ref(false) // 是否已授权定位
140 const isJoining = ref(false) // 是否正在加入活动 140 const isJoining = ref(false) // 是否正在加入活动
141 const userLocation = ref({ lng: null, lat: null }) // 用户位置信息 141 const userLocation = ref({ lng: null, lat: null }) // 用户位置信息
142 +const hasJoinedFamily = ref(false); // TODO: 是否加入家庭
142 143
143 // 海报生成相关状态 144 // 海报生成相关状态
144 const show_share = ref(false) // 显示分享弹窗 145 const show_share = ref(false) // 显示分享弹窗
...@@ -241,6 +242,31 @@ const getUserLocation = async () => { ...@@ -241,6 +242,31 @@ const getUserLocation = async () => {
241 } 242 }
242 243
243 /** 244 /**
245 + * 检查用户是否加入家庭并处理参加活动按钮点击
246 + */
247 +const checkFamilyStatusAndJoinActivity = async () => {
248 + // Mock data: hasJoinedFamily is set to false
249 + if (!hasJoinedFamily.value) {
250 + Taro.showModal({
251 + title: '提示',
252 + content: '没有加入家庭是无法参加活动的',
253 + cancelText: '关闭',
254 + confirmText: '前往加入',
255 + success: (res) => {
256 + if (res.confirm) {
257 + Taro.navigateTo({
258 + url: '/pages/Welcome/index',
259 + });
260 + }
261 + },
262 + });
263 + } else {
264 + handleJoinActivity();
265 + }
266 +};
267 +
268 +
269 +/**
244 * 处理参加活动按钮点击 270 * 处理参加活动按钮点击
245 */ 271 */
246 const handleJoinActivity = async () => { 272 const handleJoinActivity = async () => {
......