fix;修复bug

This commit is contained in:
2025-11-08 16:00:44 +08:00
parent 85702d8d08
commit 50a711bba8
13 changed files with 248 additions and 188 deletions
+109 -4
View File
@@ -22,7 +22,7 @@
<MapComponent v-if="!isLoading && userLocation" ref="mapRef" :userLocation="userLocation"
:positionList="positionList" :filteredPositions="filteredPositions" :searchKeyword="searchKeyword"
:enableMarkers="true"
:hideMapOverlays="showGuidePopup || showNoticePopup"
:hideMapOverlays="showGuidePopup || showNoticePopup || showActivityPopup"
@relocate="handleRelocate" @scan="handleScan" @showList="showLocationList" @markerTap="selectPosition"
@mapCenterChange="onMapCenterChange" />
@@ -150,6 +150,24 @@
</view>
</view>
</uv-popup>
<!-- 活动弹窗居中弹出主要展示海报 -->
<uv-popup ref="activityPopup" mode="center" round="16" :overlay="true" :closeOnClickOverlay="false" :safeAreaInsetBottom="false">
<view class="activity-popup" v-if="activityData">
<!-- 活动海报图片 -->
<view class="activity-poster-wrapper">
<image
:src="activityData.imageUrl || activityData.posterUrl"
mode="widthFix"
class="activity-poster"
></image>
</view>
<!-- 关闭按钮 -->
<view class="activity-close-btn" @click="closeActivityPopup">
<uv-icon name="close-circle-fill" size="40" color="#ffffff"></uv-icon>
</view>
</view>
</uv-popup>
</view>
</template>
@@ -176,7 +194,8 @@
getPotionsDetail
} from '../../config/api/order.js'
import {
getNoticeTextData
getNoticeTextData,
getActiveActivity
} from '../../config/api/system.js'
// 导入地图工具函数
import {
@@ -214,6 +233,8 @@ const showLocationPopup = ref(false)
const isRelocating = ref(false) // 防抖标志:是否正在重新定位
const showGuidePopup = ref(false) // 使用指南弹窗显示状态
const showNoticePopup = ref(false) // 通知详情弹窗显示状态
const showActivityPopup = ref(false) // 活动弹窗显示状态
const activityData = ref(null) // 活动数据
// 导航栏高度相关
const statusBarHeight = ref(0)
@@ -267,6 +288,31 @@ const statusBarHeight = ref(0)
console.warn('缓存通知内容失败:', e);
}
}
// 查询最近的活动
const checkActiveActivity = async () => {
try {
// 检查是否已经显示过活动弹窗(本次会话)
const hasShownActivity = uni.getStorageSync('hasShownActivityInSession');
if (hasShownActivity) {
console.log('本次会话已显示过活动弹窗,跳过');
return;
}
const res = await getActiveActivity();
if (res.code === 200 && res.data) {
activityData.value = res.data;
// 延迟一下显示,避免与其他弹窗冲突
setTimeout(() => {
openActivityPopup();
// 标记本次会话已显示过活动弹窗
uni.setStorageSync('hasShownActivityInSession', true);
}, 500);
}
} catch (e) {
console.warn('查询活动失败:', e);
}
}
// 距离格式化函数
const formatDistance = (distanceInMeters) => {
@@ -282,6 +328,7 @@ const statusBarHeight = ref(0)
const mapRef = ref(null)
const guidePopup = ref(null)
const noticePopup = ref(null)
const activityPopup = ref(null)
// 计算属性
const searchPlaceholder = computed(() => {
@@ -344,8 +391,8 @@ const noticePopup = ref(null)
// 2. 加载场地列表
await loadPositions()
// 3. 检查是否需要显示使用指南(可以根据用户行为记录来决定)
// 这里暂时默认显示,后续可以根据用户使用情况优化
// 3. 查询活动并显示弹窗
await checkActiveActivity()
} catch (error) {
console.error('初始化失败:', error)
@@ -843,6 +890,21 @@ const closeNoticePopup = () => {
noticePopup.value && typeof noticePopup.value.close === 'function' && noticePopup.value.close()
} catch (e) {}
}
// 活动弹窗控制
const openActivityPopup = () => {
try {
showActivityPopup.value = true
activityPopup.value && typeof activityPopup.value.open === 'function' && activityPopup.value.open()
} catch (e) {}
}
const closeActivityPopup = () => {
try {
showActivityPopup.value = false
activityPopup.value && typeof activityPopup.value.close === 'function' && activityPopup.value.close()
} catch (e) {}
}
</script>
<script>
@@ -1673,4 +1735,47 @@ const closeNoticePopup = () => {
.notice-actions {
margin-top: 20rpx;
}
/* 活动弹窗样式 - 简洁海报模式 */
.activity-popup {
position: relative;
width: 600rpx;
max-width: 80vw;
background: transparent;
border-radius: 16rpx;
overflow: visible;
}
.activity-poster-wrapper {
width: 100%;
border-radius: 16rpx;
overflow: hidden;
background: #fff;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.15);
}
.activity-poster {
width: 100%;
height: auto;
display: block;
vertical-align: middle;
}
.activity-close-btn {
position: absolute;
bottom: -100rpx;
left: 50%;
transform: translateX(-50%);
width: 80rpx;
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s ease;
&:active {
transform: translateX(-50%) scale(0.9);
}
}
</style>