对接活动实况接口;注掉登录接口代码
This commit is contained in:
@@ -37,20 +37,20 @@
|
||||
<view class="info-section">
|
||||
<view class="info-item">
|
||||
<view class="info-label">报名截止时间</view>
|
||||
<view class="info-value">{{activityConent.applyDeadline}}</view>
|
||||
<view class="info-value">{{formatTime(activityConent.applyDeadline)}}</view>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<view class="info-label">活动时间</view>
|
||||
<view class="info-value">
|
||||
<text>{{activityConent.startTime}} 至 {{activityConent.endTime}}</text>
|
||||
<text>{{formatTime(activityConent.startTime)}} 至 {{formatTime(activityConent.endTime)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<view class="info-label">签到时间</view>
|
||||
<view class="info-value">
|
||||
<text>{{activityConent.signinStartTime}} 至 {{activityConent.signinEndTime}}</text>
|
||||
<text>{{formatTime(activityConent.signinStartTime)}} 至 {{formatTime(activityConent.signinEndTime)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
<view class="section" style="margin-bottom: 40rpx;">
|
||||
<view class="section-title">活动详情</view>
|
||||
<view class="section-content">
|
||||
<view>{{activityConent.content}}</view>
|
||||
<view>{{activityConent.content || "暂无"}}</view>
|
||||
<view></view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -168,7 +168,7 @@
|
||||
</button>
|
||||
|
||||
<!-- 活动实况页显示添加实况按钮 -->
|
||||
<button class="action-btn add-status-btn" v-if="activeTab === 'status'" @click="liveClick">添加实况</button>
|
||||
<button class="action-btn add-status-btn" v-if="hasSigned &&activeTab === 'status'" @click="liveClick">添加实况</button>
|
||||
</view>
|
||||
|
||||
<!-- 报名确认模态框 -->
|
||||
@@ -244,14 +244,32 @@ const liveRecords = ref([
|
||||
// }
|
||||
])
|
||||
|
||||
// 接受参数
|
||||
|
||||
// ========方法=====
|
||||
// 时间格式化函数
|
||||
const formatTime = (timeStr) => {
|
||||
if (!timeStr) return ''
|
||||
// 格式化:YYYY-MM-DD HH:mm:ss → 简化为 YYYY-MM-DD HH:mm
|
||||
return moment(timeStr).format('YYYY-MM-DD HH:mm')
|
||||
}
|
||||
|
||||
// ---接收参数---
|
||||
onLoad((option) =>{
|
||||
navTitle.value = option?.title
|
||||
curActivityId.value = option?.id
|
||||
// 处理applied参数(可能是字符串类型,需要转布尔)
|
||||
hasSigned.value = option?.applied === 'true' || option?.applied === true
|
||||
// console.log('hasSigned.value',hasSigned.value)
|
||||
getActivityDetailsData(curActivityId.value)
|
||||
// 2. 初始化数据
|
||||
if (curActivityId.value) {
|
||||
getActivityDetailsData(curActivityId.value) // 获取活动详情
|
||||
getLiveActivityList() // 获取实况列表
|
||||
}
|
||||
|
||||
// 3. 监听实况列表刷新事件
|
||||
uni.$on('refreshLiveList', () => {
|
||||
getLiveActivityList()
|
||||
})
|
||||
})
|
||||
|
||||
// 获取列表详情
|
||||
@@ -356,7 +374,7 @@ const cancelActivityData = async () =>{
|
||||
try{
|
||||
const res = await cancelActivity(curActivityId.value)
|
||||
if(res.code === 200){
|
||||
hasSigned.value = true // 报名成功后更新状态
|
||||
hasSigned.value = false // 报名成功后更新状态
|
||||
uni.showToast({
|
||||
title: '取消报名成功',
|
||||
icon:"success"
|
||||
@@ -364,7 +382,7 @@ const cancelActivityData = async () =>{
|
||||
setTimeout(() =>{
|
||||
uni.$emit('refreshActivityList', {
|
||||
activityId: curActivityId.value,
|
||||
isSigned: true
|
||||
isSigned: false
|
||||
})
|
||||
uni.navigateBack()
|
||||
},1500)
|
||||
@@ -414,12 +432,6 @@ const liveClick = () =>{
|
||||
// 监听实况列表刷新
|
||||
|
||||
// ---------
|
||||
onLoad(() =>{
|
||||
uni.$on('refreshLiveList', () => {
|
||||
getLiveActivityList();
|
||||
});
|
||||
getLiveActivityList()
|
||||
})
|
||||
onUnload(() => {
|
||||
uni.$off('refreshLiveList')
|
||||
})
|
||||
@@ -446,6 +458,12 @@ const showToastMessage = (message) => {
|
||||
flex-direction: column;
|
||||
background: linear-gradient(to bottom left, #E2F0FF 0%, #ffffff 50%)
|
||||
}
|
||||
/* 状态栏 */
|
||||
.status_bar {
|
||||
height: 46px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 顶部导航栏 */
|
||||
.nav-bar {
|
||||
height: 90rpx;
|
||||
@@ -489,10 +507,6 @@ const showToastMessage = (message) => {
|
||||
overflow-y: auto;
|
||||
margin-bottom: 120rpx;
|
||||
}
|
||||
.status_bar {
|
||||
height: 46px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 选项卡 */
|
||||
.tabs {
|
||||
|
||||
Reference in New Issue
Block a user