9.2 zjd提交
This commit is contained in:
+265
-112
@@ -36,8 +36,8 @@
|
||||
<view class="time-header">2025年08月</view>
|
||||
|
||||
<!-- 会议列表 -->
|
||||
<view class="meeting-list">
|
||||
<view class="meeting-item" v-for="(item, index) in meetingList" :key="index">
|
||||
<view class="meeting-list" v-if="meetingList.length > 0">
|
||||
<view class="meeting-item" v-for="(item, index) in meetingList" :key="item.id || index">
|
||||
<!-- 左侧日期标识 -->
|
||||
<view class="date-tag" :style="{backgroundColor: item.tagColor}">
|
||||
<text class="date-text">{{ item.date }}</text>
|
||||
@@ -47,11 +47,20 @@
|
||||
<view class="meeting-content">
|
||||
<view class="meeting-title">{{ item.title }}</view>
|
||||
<view class="meeting-poster" @click="playVideo(item)">
|
||||
<image :src="item.poster" class="poster-image"></image>
|
||||
<image
|
||||
:src="docUrl+item.liveimg"
|
||||
class="poster-image"
|
||||
mode="aspectFill"
|
||||
@error="onImageError"
|
||||
@load="onImageLoad"
|
||||
:data-item-id="item.id"
|
||||
></image>
|
||||
<view class="play-btn">
|
||||
<up-image :src="playImg" width="108rpx" height="108rpx" ></up-image>
|
||||
</view>
|
||||
<view class="preview-tag">预告</view>
|
||||
<view class="preview-tag" v-if="item.status === 'upcoming'">预告</view>
|
||||
<view class="live-tag" v-else-if="item.status === 'live'">直播中</view>
|
||||
<view class="replay-tag" v-else-if="item.status === 'replay'">回放</view>
|
||||
</view>
|
||||
<view class="meeting-info">
|
||||
<view class="info-item">
|
||||
@@ -69,6 +78,15 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view class="empty-state" v-else-if="!isRefreshing">
|
||||
<view class="empty-icon">
|
||||
<uni-icons type="calendar" size="80" color="#ccc"></uni-icons>
|
||||
</view>
|
||||
<text class="empty-text">暂无会议数据</text>
|
||||
<text class="empty-subtext">请稍后再试或调整筛选条件</text>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多提示 -->
|
||||
<view class="load-more" v-if="showLoadMore">
|
||||
<view class="load-more-content" v-if="isLoadingMore">
|
||||
@@ -138,10 +156,13 @@
|
||||
import { ref,nextTick} from 'vue';
|
||||
import { onShow } from "@dcloudio/uni-app";
|
||||
import CustomTabbar from '@/components/tabBar/tabBar.vue';
|
||||
import api from '@/api/api.js';
|
||||
import select from "@/static/triangle_normal.png"
|
||||
import selectOn from "@/static/triangle_normal.png"
|
||||
import playImg from "@/static/bofang.png"
|
||||
import timeImg from "@/static/play_long.png"
|
||||
import docUrl from "@/utils/docUrl"
|
||||
|
||||
// 弹窗状态
|
||||
const isTimePopupShow = ref(false);
|
||||
const isLocationPopupShow = ref(false);
|
||||
@@ -214,32 +235,153 @@
|
||||
]);
|
||||
|
||||
// 会议列表数据
|
||||
const meetingList = ref([
|
||||
{
|
||||
date: '13',
|
||||
tagColor: '#FF4444',
|
||||
title: '"天山论·见"—疑难危重病患维训练营',
|
||||
poster: '/static/meeting-poster-1.jpg',
|
||||
time: '2025.08.13',
|
||||
location: '线上'
|
||||
},
|
||||
{
|
||||
date: '13',
|
||||
tagColor: '#FFA500',
|
||||
title: '护肝新声大咖谈',
|
||||
poster: '/static/meeting-poster-2.jpg',
|
||||
time: '2025.08.13',
|
||||
location: '线上'
|
||||
},
|
||||
{
|
||||
date: '15',
|
||||
tagColor: '#00BCD4',
|
||||
title: '小罐医生讲HIV和感染|专题二:抗菌药物-抗真菌药物特性解读',
|
||||
poster: '/static/meeting-poster-3.jpg',
|
||||
time: '2025.08.15',
|
||||
location: '线上'
|
||||
const meetingList = ref([]);
|
||||
|
||||
// 页面显示时获取会议列表数据
|
||||
onShow(() => {
|
||||
getMeetingList(true);
|
||||
});
|
||||
|
||||
// 获取会议列表数据的函数
|
||||
const getMeetingList = async (isRefresh = false) => {
|
||||
if (isRefresh) {
|
||||
currentPage.value = 1;
|
||||
hasMoreData.value = true;
|
||||
}
|
||||
]);
|
||||
|
||||
const params = {
|
||||
page: currentPage.value,
|
||||
pageSize: pageSize.value,
|
||||
month: selectedMonth.value !== 'all' ? selectedMonth.value : '',
|
||||
province: selectedProvince.value !== 'all' ? selectedProvince.value : ''
|
||||
};
|
||||
|
||||
try {
|
||||
console.log('获取会议列表参数:', params);
|
||||
const response = await api.meetingListV2U(params);
|
||||
console.log('会议列表API响应:', response);
|
||||
|
||||
if (response && response.code === 200 && response.data) {
|
||||
let newItems = [];
|
||||
let totalCount = 0;
|
||||
|
||||
// 处理不同的数据结构
|
||||
if (response.data.list && Array.isArray(response.data.list)) {
|
||||
newItems = response.data.list;
|
||||
totalCount = response.data.total || response.data.totalRow || 0;
|
||||
console.log('使用 res.data.list 结构');
|
||||
} else if (response.data && Array.isArray(response.data)) {
|
||||
newItems = response.data;
|
||||
totalCount = response.total || response.totalRow || newItems.length;
|
||||
console.log('使用 res.data 结构');
|
||||
} else if (Array.isArray(response)) {
|
||||
newItems = response;
|
||||
totalCount = newItems.length;
|
||||
console.log('使用 res 数组结构');
|
||||
}
|
||||
|
||||
console.log('解析后的数据:', { newItems, totalCount });
|
||||
console.log('图片字段映射示例:', newItems.slice(0, 2).map(item => ({
|
||||
liveimg: item.liveimg || item.live_image || item.live_img,
|
||||
poster: item.poster || item.cover_image || item.image
|
||||
})));
|
||||
|
||||
if (Array.isArray(newItems) && newItems.length > 0) {
|
||||
// 处理会议数据,添加必要的字段
|
||||
const processedItems = newItems.map(item => ({
|
||||
id: item.id || item.meeting_id || Math.random().toString(36).substr(2, 9),
|
||||
date: item.date || item.meeting_date || item.start_time || '13',
|
||||
tagColor: getTagColor(item.status || item.meeting_status || 'upcoming'),
|
||||
title: item.title || item.meeting_title || item.name || '会议标题',
|
||||
liveimg: item.liveimg || item.live_image || item.live_img || '',
|
||||
poster: item.poster || item.cover_image || item.image || '/static/meeting-poster-1.jpg',
|
||||
time: formatMeetingTime(item.start_time || item.meeting_time || item.time),
|
||||
location: item.location || item.address || item.venue || '线上',
|
||||
status: item.status || item.meeting_status || 'upcoming',
|
||||
description: item.description || item.content || '',
|
||||
organizer: item.organizer || item.host || '',
|
||||
speakers: item.speakers || item.experts || []
|
||||
}));
|
||||
|
||||
if (isRefresh) {
|
||||
meetingList.value = processedItems;
|
||||
} else {
|
||||
meetingList.value.push(...processedItems);
|
||||
}
|
||||
|
||||
// 检查是否还有更多数据
|
||||
if (meetingList.value.length >= totalCount) {
|
||||
hasMoreData.value = false;
|
||||
}
|
||||
|
||||
console.log('会议列表更新成功,当前总数:', meetingList.value.length);
|
||||
console.log('图片字段详情:', processedItems.slice(0, 2).map(item => ({
|
||||
id: item.id,
|
||||
liveimg: item.liveimg,
|
||||
poster: item.poster,
|
||||
finalImage: item.liveimg || item.poster
|
||||
})));
|
||||
} else {
|
||||
console.log('API返回的数据为空');
|
||||
if (isRefresh) {
|
||||
meetingList.value = [];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log('API响应格式不正确:', response);
|
||||
if (isRefresh) {
|
||||
meetingList.value = [];
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取会议列表失败:', error);
|
||||
if (isRefresh) {
|
||||
meetingList.value = [];
|
||||
}
|
||||
uni.showToast({
|
||||
title: '获取会议列表失败',
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 根据会议状态获取标签颜色
|
||||
const getTagColor = (status) => {
|
||||
const colorMap = {
|
||||
'upcoming': '#FF4444', // 预告
|
||||
'live': '#00BCD4', // 直播中
|
||||
'replay': '#9C27B0', // 回放
|
||||
'finished': '#4CAF50', // 已结束
|
||||
'cancelled': '#FF9800' // 已取消
|
||||
};
|
||||
return colorMap[status] || '#FF4444';
|
||||
};
|
||||
|
||||
// 格式化会议时间
|
||||
const formatMeetingTime = (timeStr) => {
|
||||
if (!timeStr) return '2025.08.13';
|
||||
|
||||
try {
|
||||
// 如果是时间戳
|
||||
if (typeof timeStr === 'number') {
|
||||
const date = new Date(timeStr);
|
||||
return `${date.getFullYear()}.${String(date.getMonth() + 1).padStart(2, '0')}.${String(date.getDate()).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
// 如果是字符串,尝试解析
|
||||
const date = new Date(timeStr);
|
||||
if (!isNaN(date.getTime())) {
|
||||
return `${date.getFullYear()}.${String(date.getMonth() + 1).padStart(2, '0')}.${String(date.getDate()).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
// 如果解析失败,返回原字符串
|
||||
return timeStr;
|
||||
} catch (error) {
|
||||
console.error('时间格式化失败:', error);
|
||||
return timeStr;
|
||||
}
|
||||
};
|
||||
|
||||
// 显示时间选择弹窗
|
||||
const showTimePopup = () => {
|
||||
@@ -255,7 +397,8 @@
|
||||
const selectMonth = (month) => {
|
||||
selectedMonth.value = month.value;
|
||||
console.log('选择月份:', month.label);
|
||||
// 这里可以根据选择的月份筛选会议数据
|
||||
// 选择月份后重新加载数据
|
||||
getMeetingList(true);
|
||||
hideTimePopup();
|
||||
};
|
||||
|
||||
@@ -273,7 +416,8 @@
|
||||
const selectProvince = (province) => {
|
||||
selectedProvince.value = province.code;
|
||||
console.log('选择省份:', province.name);
|
||||
// 这里可以根据选择的省份筛选会议数据
|
||||
// 选择省份后重新加载数据
|
||||
getMeetingList(true);
|
||||
hideLocationPopup();
|
||||
};
|
||||
|
||||
@@ -283,102 +427,64 @@
|
||||
// 这里可以实现视频播放逻辑
|
||||
};
|
||||
|
||||
// 图片加载失败处理
|
||||
const onImageError = (e) => {
|
||||
const itemId = e.currentTarget.dataset.itemId;
|
||||
console.log('图片加载失败,项目ID:', itemId);
|
||||
|
||||
// 找到对应的项目并设置默认图片
|
||||
const itemIndex = meetingList.value.findIndex(item => item.id === itemId);
|
||||
if (itemIndex !== -1) {
|
||||
// 如果liveimg加载失败,尝试使用poster
|
||||
if (meetingList.value[itemIndex].liveimg && meetingList.value[itemIndex].liveimg !== meetingList.value[itemIndex].poster) {
|
||||
console.log('liveimg加载失败,切换到poster');
|
||||
meetingList.value[itemIndex].liveimg = meetingList.value[itemIndex].poster;
|
||||
} else {
|
||||
// 如果poster也失败,使用默认图片
|
||||
console.log('设置默认图片');
|
||||
meetingList.value[itemIndex].poster = '/static/meeting-poster-1.jpg';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 图片加载成功处理
|
||||
const onImageLoad = (e) => {
|
||||
const itemId = e.currentTarget.dataset.itemId;
|
||||
console.log('图片加载成功,项目ID:', itemId, '图片地址:', e.currentTarget.src);
|
||||
};
|
||||
|
||||
// 下拉刷新
|
||||
const onRefresh = () => {
|
||||
isRefreshing.value = true;
|
||||
currentPage.value = 1;
|
||||
hasMoreData.value = true;
|
||||
|
||||
// 模拟网络请求
|
||||
setTimeout(() => {
|
||||
// 重置会议列表为初始数据
|
||||
meetingList.value = [
|
||||
{
|
||||
date: '13',
|
||||
tagColor: '#FF4444',
|
||||
title: '"天山论·见"—疑难危重病患维训练营',
|
||||
poster: '/static/meeting-poster-1.jpg',
|
||||
time: '2025.08.13',
|
||||
location: '线上'
|
||||
},
|
||||
{
|
||||
date: '13',
|
||||
tagColor: '#FFA500',
|
||||
title: '护肝新声大咖谈',
|
||||
poster: '/static/meeting-poster-2.jpg',
|
||||
time: '2025.08.13',
|
||||
location: '线上'
|
||||
},
|
||||
{
|
||||
date: '15',
|
||||
tagColor: '#00BCD4',
|
||||
title: '小罐医生讲HIV和感染|专题二:抗菌药物-抗真菌药物特性解读',
|
||||
poster: '/static/meeting-poster-3.jpg',
|
||||
time: '2025.08.15',
|
||||
location: '线上'
|
||||
}
|
||||
];
|
||||
isRefreshing.value = false;
|
||||
uni.showToast({
|
||||
title: '刷新成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
});
|
||||
}, 1500);
|
||||
// 调用获取会议列表函数
|
||||
getMeetingList(true).finally(() => {
|
||||
// 延迟关闭刷新状态,给用户更好的体验
|
||||
setTimeout(() => {
|
||||
isRefreshing.value = false;
|
||||
uni.showToast({
|
||||
title: '刷新成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
});
|
||||
}, 500);
|
||||
});
|
||||
};
|
||||
|
||||
// 上拉加载更多
|
||||
const onLoadMore = () => {
|
||||
console.log('上拉加载');
|
||||
console.log('上拉加载更多');
|
||||
if (isLoadingMore.value || !hasMoreData.value) return;
|
||||
|
||||
isLoadingMore.value = true;
|
||||
currentPage.value++;
|
||||
|
||||
// 模拟网络请求
|
||||
setTimeout(() => {
|
||||
// 模拟新增数据
|
||||
const newMeetings = [
|
||||
{
|
||||
date: '16',
|
||||
tagColor: '#9C27B0',
|
||||
title: '肝胆外科微创技术研讨会',
|
||||
poster: '/static/meeting-poster-4.jpg',
|
||||
time: '2025.08.16',
|
||||
location: '北京'
|
||||
},
|
||||
{
|
||||
date: '17',
|
||||
tagColor: '#FF9800',
|
||||
title: '胆囊疾病诊疗新进展',
|
||||
poster: '/static/meeting-poster-5.jpg',
|
||||
time: '2025.08.17',
|
||||
location: '上海'
|
||||
},
|
||||
{
|
||||
date: '18',
|
||||
tagColor: '#4CAF50',
|
||||
title: '肝移植术后管理专题讲座',
|
||||
poster: '/static/meeting-poster-6.jpg',
|
||||
time: '2025.08.18',
|
||||
location: '广州'
|
||||
}
|
||||
];
|
||||
|
||||
meetingList.value.push(...newMeetings);
|
||||
|
||||
// 模拟没有更多数据的情况(第3页后)
|
||||
if (currentPage.value >= 3) {
|
||||
hasMoreData.value = false;
|
||||
}
|
||||
|
||||
// 调用API获取更多数据
|
||||
getMeetingList(false).finally(() => {
|
||||
isLoadingMore.value = false;
|
||||
|
||||
// 强制更新页面,确保scroll-view可以正常滚动
|
||||
nextTick(() => {
|
||||
console.log('数据加载完成,列表长度:', meetingList.value.length);
|
||||
});
|
||||
}, 1000);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -701,7 +807,29 @@ $shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
position: absolute;
|
||||
top: 16rpx;
|
||||
right: 16rpx;
|
||||
border: 4rpx solid #fff;
|
||||
background-color: #FF4444;
|
||||
color: $white;
|
||||
font-size: 24rpx;
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.live-tag {
|
||||
position: absolute;
|
||||
top: 16rpx;
|
||||
right: 16rpx;
|
||||
background-color: #00BCD4;
|
||||
color: $white;
|
||||
font-size: 24rpx;
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
|
||||
.replay-tag {
|
||||
position: absolute;
|
||||
top: 16rpx;
|
||||
right: 16rpx;
|
||||
background-color: #9C27B0;
|
||||
color: $white;
|
||||
font-size: 24rpx;
|
||||
padding: 4rpx 16rpx;
|
||||
@@ -730,6 +858,31 @@ $shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
}
|
||||
}
|
||||
|
||||
// 空状态
|
||||
.empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 100rpx 30rpx;
|
||||
|
||||
.empty-icon {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 32rpx;
|
||||
color: $gray;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.empty-subtext {
|
||||
font-size: 26rpx;
|
||||
color: $gray-text;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
// 加载更多提示
|
||||
.load-more {
|
||||
padding: 30rpx;
|
||||
|
||||
Reference in New Issue
Block a user