移动端V1.0
This commit is contained in:
238
pages/OneStopCommunity/activity/detail.vue
Normal file
238
pages/OneStopCommunity/activity/detail.vue
Normal file
@@ -0,0 +1,238 @@
|
||||
<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>
|
256
pages/OneStopCommunity/activity/index.vue
Normal file
256
pages/OneStopCommunity/activity/index.vue
Normal file
@@ -0,0 +1,256 @@
|
||||
<template>
|
||||
<view class="index">
|
||||
<view class="search">
|
||||
<uni-search-bar @confirm="search" cancelButton="none" @clear="onClear" v-model="queryParams.activityTheme">
|
||||
</uni-search-bar>
|
||||
</view>
|
||||
<scroll-view class="scroll-views" scroll-y="true" @scrolltolower="scrolltolower">
|
||||
<view class="list">
|
||||
<view v-for="(item,index) in list" :key="index" @click="detail(item)" class="box">
|
||||
<view>
|
||||
<view>活动主题:{{item.activityTheme}}</view>
|
||||
<view v-if="item.activityStatus==0" class="active">进行中</view>
|
||||
<view v-if="item.activityStatus==1" class="active">报名中</view>
|
||||
<view v-else-if="item.activityStatus==2" class="dark">已结束</view>
|
||||
</view>
|
||||
<view>
|
||||
<text>
|
||||
<image mode="aspectFill" :src="basePath+item.activityImgs"></image>
|
||||
</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>活动地点:</text>
|
||||
<text>{{item.activityPlace}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>可容纳人数:</text>
|
||||
<text>{{item.galleryful}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>当前报名人数:</text>
|
||||
<text>{{item.numberApplicants}}</text>
|
||||
</view>
|
||||
<!--活动开始时间 知无涯 -->
|
||||
<view>
|
||||
<text>活动开始时间:</text>
|
||||
<text>{{item.activityStartTime}}</text>
|
||||
</view>
|
||||
<!-- 活动结束时间 知无涯 -->
|
||||
<view>
|
||||
<text>活动结束时间:</text>
|
||||
<text>{{item.activityEndTime}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>具体要求:</text>
|
||||
<text>{{item.specificRequirements}}</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="empty" v-if="list.length==0&&topLoading==false">
|
||||
<image src="@/static/empty.png" mode="widthFix"></image>
|
||||
暂时没有数据
|
||||
</view>
|
||||
<view class="loading-more-top" v-if="topLoading">
|
||||
<uni-load-more style="padding-top: 90px;" status="loading" />
|
||||
</view>
|
||||
<view class="loading-more" v-if="loading">
|
||||
<uni-load-more status="loading" />
|
||||
</view>
|
||||
<view class="no-more" v-if="!loading&&list.length!=0">
|
||||
到底啦~~
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
activitiesList
|
||||
} from '@/api/OneStopCommunity/activity.js'
|
||||
import {
|
||||
baseUrl
|
||||
} from "@/config.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
basePath: baseUrl,
|
||||
list: [],
|
||||
loading: false,
|
||||
topLoading: true,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
activityTheme: "",
|
||||
publishStatus: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
search(res) {
|
||||
// uni.showToast({
|
||||
// title: '搜索:' + res.value,
|
||||
// icon: 'none'
|
||||
// })
|
||||
this.getlist()
|
||||
},
|
||||
onClear() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.queryParams.activityTheme = "";
|
||||
this.getlist();
|
||||
},
|
||||
toDetailPage(item) {
|
||||
|
||||
},
|
||||
scrolltolower() {
|
||||
if (this.queryParams.pageNum < this.totalPages) {
|
||||
this.queryParams.pageNum++;
|
||||
this.loading = true;
|
||||
setTimeout(() => {
|
||||
//请求参数
|
||||
this.getlist()
|
||||
}, 1000)
|
||||
} else {
|
||||
|
||||
}
|
||||
},
|
||||
detail(item) {
|
||||
uni.navigateTo({
|
||||
url: `detail?activityId=${item.activityId}&activityTheme=${item.activityTheme}&initiator=${item.eventPromoter}`
|
||||
})
|
||||
},
|
||||
async getlist() {
|
||||
let res = await activitiesList(this.queryParams)
|
||||
if (res.code == 200) {
|
||||
this.loading = false;
|
||||
if (this.queryParams.pageNum == 1) {
|
||||
this.list = res.rows; // 如果是第一页,直接显示新数据
|
||||
} else {
|
||||
this.list = this.list.concat(res.rows); // 否则追加新数据到列表中
|
||||
}
|
||||
this.list.forEach(element => {
|
||||
element.numberApplicants = element.oneStopRegistrationRecords.filter(item => (item
|
||||
.auditStatus === 0 || item.auditStatus === 1)).length
|
||||
});
|
||||
this.totalPages = Math.ceil(res.total / this.queryParams.pageSize);
|
||||
this.topLoading = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {},
|
||||
onShow() {
|
||||
this.topLoading = true;
|
||||
this.queryParams.pageNum = 1;
|
||||
this.list = [];
|
||||
this.getlist();
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.index {
|
||||
background-color: #F5F5F7;
|
||||
min-height: 100vh;
|
||||
|
||||
.search {
|
||||
width: 100%;
|
||||
background-color: white;
|
||||
position: fixed;
|
||||
z-index: 10;
|
||||
top: 80rpx;
|
||||
padding: 0rpx 8rpx;
|
||||
background-color: #F5F5F7;
|
||||
|
||||
/deep/ .uni-searchbar__box {
|
||||
background-color: white !important;
|
||||
}
|
||||
}
|
||||
|
||||
.scroll-views {
|
||||
height: calc(100vh - 10px);
|
||||
|
||||
.list {
|
||||
margin-top: 100rpx;
|
||||
padding: 24rpx;
|
||||
|
||||
&>view:nth-child(n+2) {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.box {
|
||||
width: 100%;
|
||||
// height: 364rpx;
|
||||
padding: 20rpx 40rpx;
|
||||
border-radius: 16rpx;
|
||||
background-color: white;
|
||||
font-size: 28rpx;
|
||||
|
||||
&>view {
|
||||
word-break: break-all;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
&>view:nth-child(1) {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 334rpx;
|
||||
}
|
||||
|
||||
.active {
|
||||
background-color: #E7FAF0;
|
||||
border: 1px solid #D0F5E0;
|
||||
padding: 4rpx;
|
||||
font-size: 20rpx;
|
||||
color: #71E2A3;
|
||||
}
|
||||
|
||||
.dark {
|
||||
background-color: #F5F5F7;
|
||||
border: 1px solid #C1CCDF;
|
||||
padding: 4rpx;
|
||||
font-size: 20rpx;
|
||||
color: #A7A8AC;
|
||||
}
|
||||
}
|
||||
|
||||
&>view:nth-child(2) {
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
&>view:nth-child(n+2) {
|
||||
line-height: 50rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.no-more {
|
||||
text-align: center;
|
||||
color: gray;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-top: 200rpx;
|
||||
color: #9E9E9E;
|
||||
font-size: 36rpx;
|
||||
|
||||
image {
|
||||
width: 250rpx;
|
||||
margin-bottom: 50rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user