From b87f40d077669eaceced44aadf7e02117f53671e Mon Sep 17 00:00:00 2001 From: zxl <763096477@qq.com> Date: 星期五, 06 六月 2025 15:25:50 +0800 Subject: [PATCH] 优化我的收藏,活动报名,我的活动页面,活动页面页面,新增加载更多 --- pages/mine/activity/detail.vue | 54 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 46 insertions(+), 8 deletions(-) diff --git a/pages/mine/activity/detail.vue b/pages/mine/activity/detail.vue index 4c5bb5b..fb61737 100644 --- a/pages/mine/activity/detail.vue +++ b/pages/mine/activity/detail.vue @@ -4,8 +4,12 @@ <!-- 鍔ㄦ�佸皝闈㈠尯鍩� --> <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 === '鏂囧瓧'"> @@ -53,18 +57,24 @@ </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: { @@ -79,12 +89,17 @@ activityType: '', limitUserNum:'', }, + isCollect:false, reportBtn:false, detailId: null, // 瀛樺偍鎺ユ敹鐨勫弬鏁� reportFrom: { activityId: '', cancel: false, //鎶ュ悕鎺ュ彛榛樿鎴慺alse - } + }, + collectForm:{ + collectType:'', + refId:'', + }, }; }, onLoad(options) { @@ -96,6 +111,20 @@ } }, 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', // 鍥炬爣绫诲瀷锛坰uccess/loading/none锛� + mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛堥槻姝㈣Е鎽哥┛閫忥級 + }); + } + }) + }, //鎶ュ悕 activityReport() { this.reportFrom.activityId = this.detailId @@ -111,8 +140,10 @@ }) }, - getPreviewUrl(params){ - return getPreviewUrl(params); + getUrl(params){ + getFilePreviewUrl(params).then(res =>{ + return res.data.data + }) }, getActivityDetail(id) { uni.showLoading({ @@ -120,6 +151,7 @@ }); getActivityDetail(id).then(res => { uni.hideLoading(); + console.log(res.data) if (res.statusCode === 200) { //璧嬪�� this.activityInfo.coverType = res.data.data.coverType; @@ -132,7 +164,7 @@ 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; } }) }, @@ -277,4 +309,10 @@ height: 40rpx; margin-bottom: 10rpx; } + .btn-container { + display: flex; + justify-content: center; + align-items: center; + margin-top: 8px; /* 涓庝笂鏂规爣棰樹繚鎸侀棿璺� */ + } </style> \ No newline at end of file -- Gitblit v1.8.0