Files
zhxg_app_v1.0/pages/OneStopCommunity/activity/detail.vue

238 lines
5.0 KiB
Vue
Raw Normal View History

2025-07-16 15:34:34 +08:00
<template>
<view class="detail">
<view class="message">
<view class="title">活动信息</view>
<view>
<text>活动主题</text>
<text>{{activity.activityTheme}}</text>
</view>
<!-- 活动开始 知无涯 -->
<view>
<text>活动开始时间</text>
<text>{{ activity.activityStartTime }}</text>
</view>
<!-- 活动结束 知无涯 -->
<view>
<text>活动结束时间</text>
<text>{{ activity.activityEndTime }}</text>
</view>
<view>
<text>活动地点</text>
<text>{{activity.activityPlace}}</text>
</view>
<view>
<text>活动可容纳人数</text>
<text>{{activity.galleryful}}</text>
</view>
<view>
<text>当前报名人数</text>
<text>{{headcount}}</text>
</view>
</view>
<view class="require">
<view class="title">
具体要求
</view>
<view>
<text>具体要求</text>
<text>{{activity.specificRequirements}}</text>
</view>
</view>
<view class="feedback" v-if="activity.activityStatus==2">
<view class="title">
活动结束反馈
</view>
<view>
<text>活动反馈</text>
<text>{{activity.feedback}}</text>
</view>
<view>
<text>活动图</text>
<view class="feedback-imgs">
<image @tap="previewImg(feedbackImgs,index)" :src="basePath+item" mode="aspectFill"
v-for="(item,index) in feedbackImgs"></image>
</view>
</view>
</view>
<button class="apply" @tap="onActivitiesApply" :disabled="applyStatus==1">{{applyStatus==1?'已报名':'报名'}}</button>
</view>
</template>
<script>
import {
activitiesDetail,
activitiesApply
} from '@/api/OneStopCommunity/activity.js'
import {
getCurrentTime
} from "@/utils/getCurrentDateTime.js";
import {
baseUrl
} from "@/config.js";
import {
previewImg
} from "@/utils/uploadImg.js"
export default {
data() {
return {
activity: {},
activityId: "", //活动id
activityTheme: "", //活动主题
initiator: "", //活动发起人
registrationTime: "", //报名时间
headcount: null,
applyStatus: 0,
feedbackImgs: [],
basePath: baseUrl
}
},
onLoad(option) {
this.activityId = option.activityId;
this.activityTheme = option.activityTheme;
this.initiator = option.initiator;
this.getdetail(this.activityId)
},
methods: {
async getdetail(activityid) {
let res = await activitiesDetail(activityid)
if (res.code == 200) {
this.activity = res.data
this.headcount = res.data.oneStopRegistrationRecords.filter(item => (item
.auditStatus === 0 || item.auditStatus === 1)).length
if (res.data.feedbackImgs != null) {
this.feedbackImgs = res.data.feedbackImgs.split(",")
}
res.data.oneStopRegistrationRecords.forEach(item => {
if (item.jobNumber == uni.getStorageSync('stuNo')) {
this.applyStatus = 1;
}
})
}
},
onActivitiesApply() {
uni.showModal({
title: "确定报名吗?",
success: async (bool) => {
if (bool.confirm) {
let formData = {
activityId: this.activityId,
activityTheme: this.activityTheme,
initiator: this.initiator,
registrationTime: getCurrentTime()
}
let res = await activitiesApply(formData);
if (res.code == 200) {
uni.showToast({
title: "报名成功"
})
setTimeout(() => {
uni.redirectTo({
url: "/pages/OneStopCommunity/apply/index"
})
}, 1000)
}
}
}
})
},
previewImg(imgs, index) {
let images = imgs.map(img => {
return {
path: baseUrl + img
}
})
previewImg(images, index);
}
},
}
</script>
<style lang="scss" scoped>
.detail {
min-height: 100vh;
background-color: #F5F5F7;
padding: 40rpx;
.message {
background-color: white;
border-radius: 16rpx;
padding: 30rpx 40rpx 20rpx 40rpx;
.title {
font-size: 32rpx;
font-weight: 700;
color: #202020;
}
&>view:nth-child(2) {
margin-top: 40rpx;
}
&>view:nth-child(n+2) {
font-size: 28rpx;
line-height: 50rpx;
}
}
.require {
background-color: white;
border-radius: 16rpx;
padding: 30rpx 20rpx 20rpx 40rpx;
margin-top: 40rpx;
&>view:nth-child(1) {
font-size: 32rpx;
font-weight: 700;
}
&>view:nth-child(2) {
margin-top: 40rpx;
}
}
.feedback {
background-color: white;
border-radius: 16rpx;
padding: 30rpx 20rpx 20rpx 40rpx;
margin-top: 40rpx;
.feedback-imgs {
margin-top: 10rpx;
display: flex;
flex-wrap: wrap;
image {
margin-bottom: 10rpx;
width: 23.5%;
border-radius: 8rpx;
height: 136rpx;
&:not(:nth-child(4n)) {
margin-right: 2%;
}
}
}
&>view:nth-child(1) {
font-size: 32rpx;
font-weight: 700;
}
&>view:not(:first-child) {
margin-top: 20rpx;
}
}
.apply {
background-color: #1890FF !important;
color: white;
margin-top: 100rpx;
}
uni-button[disabled] {
opacity: 0.5;
}
}
</style>