| | |
| | | <!-- 动态封面区域 --> |
| | | <view class="cover-container"> |
| | | <!-- 图片类型 --> |
| | | <block v-if="activityInfo.coverType === '图片' || activityInfo.coverType === '视频'"> |
| | | <image :src="getPreviewUrl(activityInfo.cover)" mode="aspectFill" class="activity-cover" /> |
| | | <block v-if="activityInfo.coverType === '图片'"> |
| | | <image :src="getUrl(activityInfo.cover)" class="activity-cover" /> |
| | | </block> |
| | | <block v-if=" activityInfo.coverType === '视频'"> |
| | | <video :src="getUrl(item.cover)" |
| | | @play="handleVideoPlay" class="activity-cover"></video> |
| | | </block> |
| | | <!-- 文字类型 --> |
| | | <block v-if="activityInfo.coverType === '文字'"> |
| | |
| | | </view> |
| | | <!-- 报名状态 --> |
| | | <view class="status-bar" :style="{ backgroundColor: statusBarColor }"> |
| | | <button class="signup-btn" @click="activityReport()" :disabled="reportBtn" >{{ reportBtn ? '已报名': '立即报名'}}</button> |
| | | <u-button class="signup-btn" @click.stop="activityReport()" :disabled="reportBtn" >{{ reportBtn ? '已报名': '立即报名'}}</u-button> |
| | | <u-button class="signup-btn" @click.stop="collect()">{{ isCollect ? '取消收藏' : '收藏' }}</u-button> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import {getPreviewUrl} from '@/api/common.js' |
| | | import UButton from '@/uview-components/uview-ui/components/u-button/u-button.vue'; |
| | | import {changeCollect} from '@/api/collect.js' |
| | | import {getFilePreviewUrl} from '@/api/common.js' |
| | | import { |
| | | getActivityDetail, |
| | | activityReport |
| | | } from '@/api/activity.js'; |
| | | export default { |
| | | components: { |
| | | UButton |
| | | }, |
| | | data() { |
| | | return { |
| | | activityInfo: { |
| | |
| | | activityType: '', |
| | | limitUserNum:'', |
| | | }, |
| | | isCollect:false, |
| | | reportBtn:false, |
| | | detailId: null, // 存储接收的参数 |
| | | reportFrom: { |
| | | activityId: '', |
| | | cancel: false, //报名接口默认我false |
| | | } |
| | | }, |
| | | collectForm:{ |
| | | collectType:'', |
| | | refId:'', |
| | | }, |
| | | }; |
| | | }, |
| | | onLoad(options) { |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | collect(){ |
| | | this.collectForm.collectType = 'activity' |
| | | this.collectForm.refId = this.detailId |
| | | changeCollect(this.collectForm).then(res=>{ |
| | | if (res.statusCode === 200) { |
| | | this.isCollect = true; |
| | | uni.showToast({ |
| | | title: res.data.msg, // 提示文字 |
| | | icon: 'success', // 图标类型(success/loading/none) |
| | | mask: true // 是否显示透明蒙层(防止触摸穿透) |
| | | }); |
| | | } |
| | | }) |
| | | }, |
| | | //报名 |
| | | activityReport() { |
| | | this.reportFrom.activityId = this.detailId |
| | |
| | | |
| | | }) |
| | | }, |
| | | getPreviewUrl(params){ |
| | | return getPreviewUrl(params); |
| | | getUrl(params){ |
| | | getFilePreviewUrl(params).then(res =>{ |
| | | return res.data.data |
| | | }) |
| | | }, |
| | | getActivityDetail(id) { |
| | | uni.showLoading({ |
| | |
| | | }); |
| | | getActivityDetail(id).then(res => { |
| | | uni.hideLoading(); |
| | | console.log(res.data) |
| | | if (res.statusCode === 200) { |
| | | //赋值 |
| | | this.activityInfo.coverType = res.data.data.coverType; |
| | |
| | | this.activityInfo.activityType = res.data.data.activityType; |
| | | this.activityInfo.limitUserNum = res.data.data.limitUserNum; |
| | | this.reportBtn = res.data.data.isReport; |
| | | |
| | | this.isCollect = res.data.data.isCollect; |
| | | } |
| | | }) |
| | | }, |
| | |
| | | height: 40rpx; |
| | | margin-bottom: 10rpx; |
| | | } |
| | | .btn-container { |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | margin-top: 8px; /* 与上方标题保持间距 */ |
| | | } |
| | | </style> |