feat: 完善对象存储上传与真实条码二维码引擎,彻底剥离保底Mock数据

这个提交包含在:
xcbyy
2026-10-09 17:18:14 +08:00
父节点 6d3076cdb8
当前提交 d0f4050cdc
共有 329 个文件被更改,包括 54416 次插入 和 926 次删除

查看文件

@@ -1,167 +1,251 @@
<template>
<view class="activity-container" :class="{ 'theme-warm': currentThemeKey === 'warm' }">
<!-- 顶部模式切换选项卡 (矢量SVG模式图标) -->
<view class="tab-header">
<view
class="tab-item btn-active"
:class="{ active: currentTab === 'ALL' }"
@click="switchTab('ALL')"
>
<text class="tab-text">全部活动</text>
<view class="tab-indicator" v-if="currentTab === 'ALL'"></view>
</view>
<view
class="tab-item btn-active"
:class="{ active: currentTab === 'AA' }"
@click="switchTab('AA')"
>
<image class="tab-svg" :src="ICONS.bolt" mode="aspectFit" />
<text class="tab-text">AA制拼桌</text>
<view class="tab-indicator" v-if="currentTab === 'AA'"></view>
</view>
<view
class="tab-item btn-active"
:class="{ active: currentTab === 'PROJECT' }"
@click="switchTab('PROJECT')"
>
<image class="tab-svg" :src="ICONS.gameTrophy" mode="aspectFit" />
<text class="tab-text">房主请客</text>
<view class="tab-indicator" v-if="currentTab === 'PROJECT'"></view>
</view>
</view>
<view class="activity-container" :class="{ 'theme-warm': currentThemeKey === 'warm' }" :style="navStyle">
<!-- 活动大厅骨架屏 (首屏加载中流光占位,杜绝空白) -->
<skeleton-screen v-if="isLoading" type="activity" />
<!-- 核心品类快捷筛选胶囊栏 (陪吃·陪唱·陪喝) -->
<view class="category-capsule-bar">
<view
class="capsule-item btn-active"
:class="{ active: currentCategory === 'ALL' }"
@click="switchCategory('ALL')"
>
<text class="capsule-text">全部品类</text>
</view>
<view
class="capsule-item btn-active"
:class="{ active: currentCategory === 'MEAL' }"
@click="switchCategory('MEAL')"
>
<image class="capsule-svg" :src="ICONS.utensils" mode="aspectFit" />
<text class="capsule-text">美食陪吃</text>
</view>
<view
class="capsule-item btn-active"
:class="{ active: currentCategory === 'SING' }"
@click="switchCategory('SING')"
>
<image class="capsule-svg" :src="ICONS.micVocal" mode="aspectFit" />
<text class="capsule-text">同城陪唱</text>
</view>
<view
class="capsule-item btn-active"
:class="{ active: currentCategory === 'DRINK' }"
@click="switchCategory('DRINK')"
>
<image class="capsule-svg" :src="ICONS.coffee" mode="aspectFit" />
<text class="capsule-text">下午茶陪喝</text>
</view>
</view>
<!-- 顶部状态小提示 (矢量盾牌图标) -->
<view class="tips-bar">
<image class="tips-svg" :src="ICONS.shield" mode="aspectFit" />
<text class="tips-text">AA制聚会人均费用透明平摊,项目制为房主全额请客或悬赏组局,凭4位门票码现场核销</text>
</view>
<!-- 活动列表 -->
<view class="activity-list">
<view
v-for="act in filteredActivities"
:key="act.id"
class="activity-card card-active"
@click="goToDetail(act.id)"
>
<!-- 卡片头部 -->
<view class="card-header">
<view class="game-tag" :class="getCategoryTagClass(act.game)">{{ act.game }}</view>
<view class="mode-tag" :class="act.payType === 'AA' ? 'aa-mode' : 'project-mode'">
{{ act.payType === 'AA' ? 'AA制平摊' : '房主请客' }}
</view>
<view class="status-pill" :class="act.status">
{{ act.status === 'RECRUITING' ? '招募中' : '进行中' }}
</view>
</view>
<!-- 卡片标题 -->
<view class="activity-title">{{ act.title }}</view>
<!-- 详细信息条 (矢量时钟与商圈位置) -->
<view class="meta-row">
<view class="meta-item">
<image class="meta-svg" :src="ICONS.clock" mode="aspectFit" />
<text class="meta-val">{{ act.startTime }}</text>
</view>
<view class="meta-item">
<image class="meta-svg" :src="ICONS.mapPin" mode="aspectFit" />
<text class="meta-val">{{ act.location }}</text>
</view>
</view>
<!-- 进度与头像 -->
<view class="progress-section">
<view class="progress-info">
<text class="progress-label">组局进度</text>
<text class="progress-count tabular-num">{{ act.currentParticipants }} / {{ act.maxParticipants }}人</text>
</view>
<view class="progress-track">
<view
class="progress-fill"
:style="{ width: (act.currentParticipants / act.maxParticipants * 100) + '%' }"
></view>
</view>
</view>
<!-- 底部房主与价格 -->
<view class="card-footer">
<view class="creator-info">
<image class="creator-avatar" :src="act.creatorAvatar" mode="aspectFill" />
<text class="creator-name">局长:{{ act.creatorNickname }}</text>
</view>
<view class="fee-info tabular-num">
<template v-if="act.payType === 'AA'">
<text class="fee-label">人均预估</text>
<text class="fee-amount">¥{{ act.aaFee }}</text>
</template>
<template v-else>
<text class="fee-label">房主请客</text>
<text class="fee-amount project-gold">¥{{ act.totalFee }}</text>
</template>
<!-- 真实内容 (首屏数据加载完成后平滑展示) -->
<view v-else class="activity-body-wrapper">
<!-- 顶部综合搜索栏 (支持搜组局标题、美食/KTV品类、商圈地点、局长昵称) -->
<view class="header-search">
<view class="search-box">
<image class="search-icon-img" :src="ICONS.search" mode="aspectFit" />
<input
class="search-input"
v-model="searchKeyword"
confirm-type="search"
placeholder="搜索组局、美食火锅、商圈地点、局长..."
placeholder-class="placeholder-text"
/>
<view class="clear-btn btn-active" v-if="searchKeyword" @click="clearSearch">
<text class="clear-text">x</text>
</view>
</view>
</view>
<view v-if="filteredActivities.length === 0" class="empty-tip">
<text>暂无符合条件的组局活动,快来发起吧!</text>
<!-- 顶部模式切换选项卡 (矢量SVG模式图标) -->
<view class="tab-header">
<view
class="tab-item btn-active"
:class="{ active: currentTab === 'ALL' }"
@click="switchTab('ALL')"
>
<text class="tab-text">全部活动</text>
<view class="tab-indicator" v-if="currentTab === 'ALL'"></view>
</view>
<view
class="tab-item btn-active"
:class="{ active: currentTab === 'MINE' }"
@click="switchTab('MINE')"
>
<image class="tab-svg" :src="ICONS.gameCrown" mode="aspectFit" />
<text class="tab-text">我发起的</text>
<view class="tab-indicator" v-if="currentTab === 'MINE'"></view>
</view>
<view
class="tab-item btn-active"
:class="{ active: currentTab === 'AA' }"
@click="switchTab('AA')"
>
<image class="tab-svg" :src="ICONS.bolt" mode="aspectFit" />
<text class="tab-text">AA制拼桌</text>
<view class="tab-indicator" v-if="currentTab === 'AA'"></view>
</view>
<view
class="tab-item btn-active"
:class="{ active: currentTab === 'PROJECT' }"
@click="switchTab('PROJECT')"
>
<image class="tab-svg" :src="ICONS.gameTrophy" mode="aspectFit" />
<text class="tab-text">房主请客</text>
<view class="tab-indicator" v-if="currentTab === 'PROJECT'"></view>
</view>
</view>
<!-- 核心品类快捷筛选胶囊栏 (陪吃·陪唱·陪喝) -->
<view class="category-capsule-bar">
<view
class="capsule-item btn-active"
:class="{ active: currentCategory === 'ALL' }"
@click="switchCategory('ALL')"
>
<text class="capsule-text">全部品类</text>
</view>
<view
class="capsule-item btn-active"
:class="{ active: currentCategory === 'MEAL' }"
@click="switchCategory('MEAL')"
>
<image class="capsule-svg" :src="ICONS.utensils" mode="aspectFit" />
<text class="capsule-text">美食陪吃</text>
</view>
<view
class="capsule-item btn-active"
:class="{ active: currentCategory === 'SING' }"
@click="switchCategory('SING')"
>
<image class="capsule-svg" :src="ICONS.micVocal" mode="aspectFit" />
<text class="capsule-text">同城陪唱</text>
</view>
<view
class="capsule-item btn-active"
:class="{ active: currentCategory === 'DRINK' }"
@click="switchCategory('DRINK')"
>
<image class="capsule-svg" :src="ICONS.coffee" mode="aspectFit" />
<text class="capsule-text">下午茶陪喝</text>
</view>
</view>
<!-- 顶部状态小提示 (矢量盾牌图标) -->
<view class="tips-bar">
<image class="tips-svg" :src="ICONS.shield" mode="aspectFit" />
<text class="tips-text">AA制聚会人均费用透明平摊,项目制为房主全额请客或悬赏组局,凭4位门票码现场核销</text>
</view>
<!-- 活动列表 -->
<view class="activity-list">
<view
v-for="act in filteredActivities"
:key="act.id"
class="activity-card card-active"
:class="{ 'is-cancelled': act.status === 'CANCELLED' }"
@click="goToDetail(act.id)"
>
<!-- 卡片头部 -->
<view class="card-header">
<view class="game-tag" :class="getCategoryTagClass(act.game)">{{ act.game }}</view>
<view class="mode-tag" :class="act.payType === 'AA' ? 'aa-mode' : 'project-mode'">
{{ act.payType === 'AA' ? 'AA制平摊' : '房主请客' }}
</view>
<view class="status-pill" :class="act.status || 'RECRUITING'">
{{ getStatusText(act.status) }}
</view>
</view>
<!-- 卡片标题 -->
<view class="activity-title">{{ act.title }}</view>
<!-- 详细信息条 (矢量时钟与商圈位置) -->
<view class="meta-row">
<view class="meta-item">
<image class="meta-svg" :src="ICONS.clock" mode="aspectFit" />
<text class="meta-val">{{ act.startTime }}</text>
</view>
<view class="meta-item">
<image class="meta-svg" :src="ICONS.mapPin" mode="aspectFit" />
<text class="meta-val">{{ act.location }}</text>
</view>
</view>
<!-- 进度与头像 -->
<view class="progress-section">
<view class="progress-info">
<text class="progress-label">组局进度</text>
<text class="progress-count tabular-num">{{ act.currentParticipants }} / {{ act.maxParticipants }}人</text>
</view>
<view class="progress-track">
<view
class="progress-fill"
:style="{ width: (act.currentParticipants / act.maxParticipants * 100) + '%' }"
></view>
</view>
</view>
<!-- 底部房主与价格 -->
<view class="card-footer">
<view class="creator-info">
<image class="creator-avatar" :src="act.creatorAvatar" mode="aspectFill" />
<text class="creator-name">局长:{{ act.creatorNickname }}</text>
</view>
<view class="fee-info tabular-num">
<template v-if="act.payType === 'AA'">
<text class="fee-label">人均预估</text>
<text class="fee-amount">¥{{ act.aaFee }}</text>
</template>
<template v-else>
<text class="fee-label">房主请客</text>
<text class="fee-amount project-gold">¥{{ act.totalFee }}</text>
</template>
</view>
</view>
</view>
<view v-if="filteredActivities.length === 0" class="empty-tip">
<text v-if="searchKeyword">未找到与“{{ searchKeyword }}”匹配的组局</text>
<text v-else>暂无符合条件的组局活动,快来发起吧!</text>
<button class="empty-reset-btn btn-active" v-if="searchKeyword" @click="clearSearch">
清空搜索条件
</button>
</view>
</view>
</view>
<!-- 悬浮发起活动按钮 (脉冲微流光) -->
<view class="fab-btn btn-active" @click="createActivity">
<text class="fab-icon">+</text>
<text class="fab-text">发起组局</text>
</view>
<!-- 底部自定义导航栏 (发单人端:活动中心 / 我要发单 / 友圈 / 个人中心) -->
<custom-tab-bar current="activity" />
</view>
</template>
<script setup>
import { ref, computed, onMounted, onUnmounted } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { ACTIVITIES_LIST } from '@/common/mock.js';
import { onShow, onLoad } from '@dcloudio/uni-app';
import CustomTabBar from '@/components/CustomTabBar.vue';
import SkeletonScreen from '@/components/SkeletonScreen.vue';
import { getActivities } from '@/common/api.js';
import { ICONS } from '@/common/icons.js';
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
import { getNavBarInfo } from '@/common/nav.js';
const activities = ref(ACTIVITIES_LIST);
const CURRENT_USER_ID = 1001;
const isLoading = ref(true);
const activities = ref([]);
const currentTab = ref('ALL');
const currentCategory = ref('ALL');
const currentThemeKey = ref(getCurrentThemeKey());
const searchKeyword = ref('');
const navInfo = ref(getNavBarInfo());
const navStyle = computed(() => {
return {
'--safe-header-gap': `${navInfo.value.safeHeaderGap}px`,
'--capsule-right-space': `${navInfo.value.capsuleRightSpace}px`,
'--capsule-height': `${navInfo.value.capsuleHeight}px`
};
});
const clearSearch = () => {
searchKeyword.value = '';
};
const loadInitialActivities = async () => {
try {
await fetchLiveActivities();
} finally {
setTimeout(() => {
isLoading.value = false;
}, 200);
}
};
const fetchLiveActivities = async () => {
try {
const list = await getActivities();
if (Array.isArray(list) && list.length > 0) {
activities.value = list;
}
} catch (err) {
console.warn('[ActivityList] 获取线上数据异常,保持缓存:', err);
}
};
onLoad((options) => {
if (options && options.category) {
currentCategory.value = options.category;
}
if (options && options.tab) {
currentTab.value = options.tab;
}
});
const onThemeChanged = (key) => {
currentThemeKey.value = key;
@@ -169,13 +253,24 @@ const onThemeChanged = (key) => {
};
onMounted(() => {
navInfo.value = getNavBarInfo();
currentThemeKey.value = getCurrentThemeKey();
applyThemeToNativeUI(currentThemeKey.value);
uni.$on('theme-change', onThemeChanged);
loadInitialActivities();
});
onShow(() => {
navInfo.value = getNavBarInfo();
currentThemeKey.value = getCurrentThemeKey();
applyThemeToNativeUI(currentThemeKey.value);
uni.hideTabBar({ animation: false, fail: () => {} });
const pendingTab = uni.getStorageSync('ACTIVITY_ACTIVE_TAB');
if (pendingTab) {
currentTab.value = pendingTab;
uni.removeStorageSync('ACTIVITY_ACTIVE_TAB');
}
fetchLiveActivities();
});
onUnmounted(() => {
@@ -189,11 +284,37 @@ const getCategoryTagClass = (game) => {
return '';
};
const getStatusText = (status) => {
if (status === 'CANCELLED') return '已解散';
if (status === 'COMPLETED') return '已完成';
if (status === 'FULL') return '已满员';
if (status === 'IN_PROGRESS' || status === 'RUNNING') return '进行中';
return '招募中';
};
const filteredActivities = computed(() => {
const kw = (searchKeyword.value || '').trim().toLowerCase();
return activities.value.filter(a => {
// 支付模式筛选
const matchTab = currentTab.value === 'ALL' || a.payType === currentTab.value;
// 品类筛选 (美食陪吃 / 同城陪唱 / 下午茶陪喝/微醺)
// 1. 关键词搜索筛选 (标题、商圈地点、品类、局长昵称)
let matchKeyword = true;
if (kw) {
const titleMatch = (a.title || '').toLowerCase().includes(kw);
const locationMatch = (a.location || '').toLowerCase().includes(kw);
const gameMatch = (a.game || '').toLowerCase().includes(kw);
const creatorMatch = (a.creatorNickname || '').toLowerCase().includes(kw);
matchKeyword = titleMatch || locationMatch || gameMatch || creatorMatch;
}
// 2. 支付模式或发单人筛选
let matchTab = true;
if (currentTab.value === 'MINE') {
matchTab = Number(a.creatorId) === CURRENT_USER_ID || a.creatorNickname === '同城局长';
} else if (currentTab.value !== 'ALL') {
matchTab = a.payType === currentTab.value;
}
// 3. 品类筛选 (美食陪吃 / 同城陪唱 / 下午茶陪喝/微醺)
let matchCat = true;
if (currentCategory.value === 'MEAL') {
matchCat = a.game === '美食陪吃';
@@ -202,7 +323,7 @@ const filteredActivities = computed(() => {
} else if (currentCategory.value === 'DRINK') {
matchCat = a.game === '下午茶陪喝' || a.game === '同城微醺';
}
return matchTab && matchCat;
return matchKeyword && matchTab && matchCat;
});
});
@@ -231,7 +352,74 @@ const createActivity = () => {
.activity-container {
min-height: 100vh;
background-color: #0A0F1D;
padding: var(--safe-header-gap, 36rpx) 32rpx calc(180rpx + env(safe-area-inset-bottom));
padding: 0 32rpx calc(180rpx + env(safe-area-inset-bottom));
}
.header-search {
padding-top: var(--safe-header-gap, 36rpx);
padding-bottom: 24rpx;
background-color: #0A0F1D;
position: sticky;
top: 0;
z-index: 50;
/* #ifdef MP-WEIXIN */
padding-right: calc(var(--capsule-right-space, 210rpx));
/* #endif */
.search-box {
display: flex;
align-items: center;
background-color: #151D30;
height: 80rpx;
/* #ifdef MP-WEIXIN */
height: var(--capsule-height, 64rpx);
/* #endif */
border-radius: 40rpx;
padding: 0 28rpx;
border: 1px solid rgba(255, 255, 255, 0.08);
transition: all 0.2s ease;
&:focus-within {
border-color: #6366F1;
box-shadow: 0 0 16rpx rgba(99, 102, 241, 0.35);
}
.search-icon-img {
width: 32rpx;
height: 32rpx;
margin-right: 16rpx;
opacity: 0.8;
flex-shrink: 0;
}
.search-input {
flex: 1;
font-size: 26rpx;
color: #F8FAFC;
}
.placeholder-text {
color: #64748B;
}
.clear-btn {
width: 36rpx;
height: 36rpx;
border-radius: 50%;
background: rgba(255, 255, 255, 0.1);
display: flex;
align-items: center;
justify-content: center;
margin-left: 12rpx;
flex-shrink: 0;
.clear-text {
font-size: 22rpx;
color: #94A3B8;
line-height: 1;
}
}
}
}
.tab-header {
@@ -371,6 +559,20 @@ const createActivity = () => {
padding: 60rpx 0;
font-size: 26rpx;
color: #64748B;
display: flex;
flex-direction: column;
align-items: center;
gap: 16rpx;
.empty-reset-btn {
font-size: 24rpx;
color: #6366F1;
background: rgba(99, 102, 241, 0.12);
border: 1px solid rgba(99, 102, 241, 0.3);
padding: 8rpx 28rpx;
border-radius: 30rpx;
margin: 0;
}
}
.activity-card {
@@ -379,6 +581,12 @@ const createActivity = () => {
padding: 28rpx;
border: 1px solid rgba(255, 255, 255, 0.06);
box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.3);
transition: all 0.2s ease;
&.is-cancelled {
opacity: 0.65;
filter: grayscale(0.2);
}
.card-header {
display: flex;
@@ -438,10 +646,24 @@ const createActivity = () => {
background: rgba(99, 102, 241, 0.2);
color: #818CF8;
}
&.FULL {
background: rgba(245, 158, 11, 0.2);
color: #F59E0B;
}
&.IN_PROGRESS,
&.RUNNING {
background: rgba(16, 185, 129, 0.2);
color: #10B981;
}
&.COMPLETED {
background: rgba(148, 163, 184, 0.2);
color: #94A3B8;
}
&.CANCELLED {
background: rgba(239, 68, 68, 0.15);
color: #F87171;
border: 1px solid rgba(239, 68, 68, 0.3);
}
}
}
@@ -552,48 +774,47 @@ const createActivity = () => {
}
}
.fab-btn {
position: fixed;
right: 36rpx;
bottom: calc(140rpx + env(safe-area-inset-bottom));
background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
border-radius: 44rpx;
padding: 18rpx 34rpx;
display: flex;
align-items: center;
box-shadow: 0 8rpx 28rpx rgba(99, 102, 241, 0.55);
border: 1px solid rgba(255, 255, 255, 0.2);
z-index: 100;
animation: fabPulse 3s infinite ease-in-out;
.fab-icon {
font-size: 32rpx;
color: #FFF;
font-weight: 700;
margin-right: 8rpx;
}
.fab-text {
font-size: 26rpx;
color: #FFF;
font-weight: 600;
}
}
@media screen and (min-width: 481px) {
.fab-btn {
right: calc(50% - 225px + 36rpx);
bottom: calc(140rpx + 20px);
.activity-container {
max-width: 450px;
margin: 0 auto;
}
}
@keyframes fabPulse {
0%, 100% { box-shadow: 0 8rpx 24rpx rgba(99, 102, 241, 0.45); }
50% { box-shadow: 0 8rpx 36rpx rgba(99, 102, 241, 0.75); }
}
.activity-container.theme-warm {
background-color: #FDFBF7;
.header-search {
background-color: #FDFBF7;
.search-box {
background-color: #FFFFFF;
border-color: #F0ECE4;
box-shadow: 0 4rpx 16rpx rgba(28, 25, 23, 0.04);
&:focus-within {
border-color: #EA580C;
box-shadow: 0 0 16rpx rgba(234, 88, 12, 0.2);
}
.search-input {
color: #1C1917;
}
.placeholder-text {
color: #78716C;
}
.clear-btn {
background: #F8F5F0;
.clear-text {
color: #78716C;
}
}
}
}
.tab-header {
background-color: #FFFFFF;
border-color: #F0ECE4;
@@ -662,9 +883,13 @@ const createActivity = () => {
}
}
.fab-btn {
background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
box-shadow: 0 8rpx 28rpx rgba(234, 88, 12, 0.4);
.empty-tip {
color: #78716C;
.empty-reset-btn {
color: #EA580C;
background: rgba(234, 88, 12, 0.1);
border-color: rgba(234, 88, 12, 0.3);
}
}
}
</style>