yunshangxie/pages/index/event_info.vue

514 lines
16 KiB
Vue
Raw Normal View History

2024-04-20 14:58:10 +08:00
<template>
2024-06-04 18:04:09 +08:00
<view style="letter-spacing: 1rpx;" v-cloak>
2024-04-20 14:58:10 +08:00
<tn-nav-bar :isBack="false" backTitle="" :bottomShadow="true" backgroundColor="#FFFFFF">
<view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-between">
<view class="tn-flex tn-flex-col-center tn-flex-row-left">
<view style="padding-left: 15rpx;" @click="goBack()">
<text class="tn-icon-left" style="font-size: 40rpx;"></text>
</view>
<view class="tn-margin-top"
style="text-shadow: 1rpx 0 0 #FFF, 0 1rpx 0 #FFF, -1rpx 0 0 #FFF , 0 -1rpx 0 #FFF;">
<tn-tabs :list="[{name:'活动详情'}]" :current="topCurrent" activeColor="#000" :bold="false"
:fontSize="36"></tn-tabs>
</view>
</view>
</view>
</tn-nav-bar>
<view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
2024-04-23 11:58:07 +08:00
<image :src="apiImgUrl+info.activity_image" style="width: 100%;" mode="widthFix"></image>
2024-04-20 14:58:10 +08:00
<view style="padding:20rpx 30rpx;">
2024-05-15 17:54:48 +08:00
<view style="font-size: 30rpx;font-weight: 600;">{{ info.activity_name }}</view>
2024-04-20 14:58:10 +08:00
<view style="margin-top: 40rpx;">
<view>
<text style="color: #26BB71;"></text>
2024-04-23 11:58:07 +08:00
<text style="margin-left: 10rpx;font-weight: 600;">开始时间</text>
2024-05-15 17:54:48 +08:00
<text style="color: #979797;">{{ info.activity_start_time }}</text>
2024-04-20 14:58:10 +08:00
</view>
<view style="margin: 15rpx 0rpx;">
<text style="color: #BE7E28;"></text>
2024-04-23 11:58:07 +08:00
<text style="margin-left: 10rpx;font-weight: 600;">结束时间</text>
2024-05-15 17:54:48 +08:00
<text style="color: #979797;">{{ info.activity_end_time }}</text>
2024-04-20 14:58:10 +08:00
</view>
<view>
<text style="color: #DB5022;"></text>
<text style="margin-left: 10rpx;font-weight: 600;">活动地点</text>
2024-05-15 17:54:48 +08:00
<text style="color: #979797;">{{ info.activity_location }}</text>
2024-04-20 14:58:10 +08:00
</view>
2024-05-31 18:06:24 +08:00
<view style="margin: 15rpx 0rpx;" v-if="info.if_display_registrants==2">
<text style="color: #0000FF;"></text>
<text style="margin-left: 10rpx;font-weight: 600;">报名人数</text>
2024-06-04 18:04:09 +08:00
<text style="color: #979797;">{{ info.list.length}}</text>
2024-05-31 18:06:24 +08:00
</view>
<view style="margin: 15rpx 0rpx;" v-if="info.if_display_registrants==1"
class="tn-flex tn-flex-center tn-flex-col-center tn-flex-row-between" @click="rightMod = true">
<view class="tn-flex tn-flex-center tn-flex-col-center">
<view style="color: #0000FF;"></view>
<view style="margin-left: 10rpx;font-weight: 600;">报名详情</view>
<tn-avatar-group :border="false" :lists="info.list.slice(0, 10)"></tn-avatar-group>
</view>
<view>
2024-06-04 18:04:09 +08:00
<text style="margin-right: 10rpx">{{info.list.length}}</text>
2024-05-31 18:06:24 +08:00
<text class="tn-icon-right"></text>
</view>
</view>
2024-04-20 14:58:10 +08:00
</view>
<view style="margin-top: 60rpx;font-size: 32rpx;font-weight: 600;">活动介绍</view>
<view>
2024-05-14 10:20:09 +08:00
<view class="ks_html" style="line-height: 50rpx;margin-top: 20rpx;">
2024-05-21 18:16:48 +08:00
<view v-if="info.video!=null&&info.video!=''">
<video :src="apiImgUrl+info.video" style="width: 100%;border-radius: 5rpx;"></video>
</view>
<view v-html="info.activity_content"></view>
2024-05-08 18:14:41 +08:00
</view>
2024-04-20 14:58:10 +08:00
</view>
2024-05-14 10:20:09 +08:00
<view v-if="info.activity_type==1||info.activity_type==3" style="height: 180rpx;"></view>
<view v-if="info.activity_type==2" style="padding-bottom: 180rpx;">
<view style="margin-top: 60rpx;font-size: 32rpx;font-weight: 600;">问卷问题</view>
<tn-form labelPosition="top" :model="form" ref="form">
2024-05-15 17:54:48 +08:00
<template v-for="(item,index) in questionnaireList">
2024-05-27 17:40:54 +08:00
<tn-form-item v-if="item.type==2" :label="(index+1)+'、'+item.title+'(多选题)'" prop="hobby">
2024-05-15 17:54:48 +08:00
<tn-checkbox-group v-model="questionnaireList[index].topic" size="40"
activeColor="#82B2FF" wrap>
<tn-checkbox :name="op.name" v-for="(op,opi) in item.option">
{{ op.name }}{{ op.val }}
</tn-checkbox>
</tn-checkbox-group>
</tn-form-item>
2024-05-27 17:40:54 +08:00
<tn-form-item v-if="item.type==1" :label="(index+1)+'、'+item.title+'(单选题)'" prop="danxuan">
2024-05-15 17:54:48 +08:00
<tn-radio-group v-model="questionnaireList[index].topic" size="40" activeColor="#82B2FF"
wrap>
<tn-radio :name="op.name" v-for="(op,opi) in item.option">
{{ op.name }}{{ op.val }}
</tn-radio>
</tn-radio-group>
</tn-form-item>
<tn-form-item v-if="item.type==3" :label="(index+1)+'、'+item.title+'(问答题)'" prop="wenda">
<tn-input placeholder="请填写答案" v-model="questionnaireList[index].topic"
type="textarea" />
</tn-form-item>
</template>
2024-05-14 10:20:09 +08:00
</tn-form>
</view>
2024-04-20 14:58:10 +08:00
</view>
</view>
2024-05-08 18:14:41 +08:00
<view style="position: fixed;bottom: 30rpx; width: 100%;">
<!-- <view class="tn-flex tn-flex-center tn-flex-row-center tn-flex-col-center"-->
<!-- style="background-color: #FDF2EC;text-align: center;padding: 30rpx;">-->
<!-- <view style="font-weight: 600;">-->
<!-- <text style="margin-right: 10rpx;">距报名结束剩<text style="color: #F73909;">119</text></text>-->
<!-- <tn-count-down fontColor="#F73909" backgroundColor="#FDF2EC" :fontSize="30" :timestamp="86400"-->
<!-- :showDays="true" :showHours="true" :showSeconds="true" :showMinutes="true"></tn-count-down>-->
<!-- </view>-->
<!-- </view>-->
2024-05-14 10:20:09 +08:00
<view style="text-align: center;padding:0 30rpx;" v-if="info.activity_type==1">
<button class="mmy" hover-class="none" @click="application_add" v-if="info.type=='未开始'">确认报名</button>
2024-05-15 17:54:48 +08:00
<button class="mmy" hover-class="none" :disabled="true" v-if="info.type=='已结束'||info.type=='进行中'">报名已结束
</button>
2024-05-14 10:20:09 +08:00
</view>
<view style="text-align: center;padding:0 30rpx;" v-if="info.activity_type==2">
2024-05-21 18:16:48 +08:00
<button class="mmy" hover-class="none" :disabled="true" v-if="info.type=='未开始'">问卷未开始</button>
2024-05-15 17:54:48 +08:00
<button class="mmy" hover-class="none" @click="option_add" v-if="info.type=='进行中'">确认提交</button>
2024-05-14 10:20:09 +08:00
<button class="mmy" hover-class="none" :disabled="true" v-if="info.type=='已结束'">问卷已结束</button>
</view>
<view style="text-align: center;padding:0 30rpx;" v-if="info.activity_type==3">
2024-05-31 18:06:24 +08:00
<button class="mmy" hover-class="none" :disabled="true" v-if="info.type=='未开始'">捐助未开始</button>
2024-05-14 10:20:09 +08:00
<button class="mmy" hover-class="none" @click="juanMod=true" v-if="info.type=='进行中'">我要捐助</button>
<button class="mmy" hover-class="none" :disabled="true" v-if="info.type=='已结束'">捐助已结束</button>
2024-04-20 14:58:10 +08:00
</view>
2024-05-14 18:14:14 +08:00
<view style="text-align: center;padding:0 30rpx;" v-if="info.activity_type==4">
<button class="mmy" hover-class="none" @click="peiMod=true" v-if="info.type=='未开始'">我要参加</button>
2024-05-15 17:54:48 +08:00
<button class="mmy" hover-class="none" :disabled="true" v-if="info.type=='已结束'||info.type=='进行中'">活动已结束
</button>
2024-05-14 18:14:14 +08:00
</view>
2024-04-20 14:58:10 +08:00
</view>
2024-05-14 10:20:09 +08:00
<tn-modal v-model="juanMod" :custom="true">
<view style="padding: 20rpx;text-align: center;font-size: 40rpx;">感谢您的捐助</view>
<tn-form :labelWidth="180">
<tn-form-item label="捐助金额">
<tn-input v-model="money" type="decimal" placeholder="请填写捐助金额" />
</tn-form-item>
</tn-form>
<view class="tn-flex tn-flex-row-center" style="margin-top: 50rpx;">
<tn-button @click="juanMod=false" backgroundColor="#E6E6E6" fontColor="#838383">我再想想</tn-button>
<tn-button @click="juanzhuDo" backgroundColor="#28B93D" fontColor="#ffffff"
2024-05-15 17:54:48 +08:00
style="margin-left: 70rpx;">确定捐助
</tn-button>
2024-05-14 10:20:09 +08:00
</view>
</tn-modal>
2024-05-14 18:14:14 +08:00
<tn-modal v-model="peiMod" :custom="true">
<view style="padding: 20rpx;text-align: center;font-size: 40rpx;">需要缴纳费用</view>
<view style="text-align: center;margin-top: 30rpx;">
<text style="font-size: 40rpx;">¥</text>
2024-05-15 17:54:48 +08:00
<text style="font-size: 70rpx;color: #26BB71;margin-left: 5rpx;font-weight: 600;">{{info.money}}</text>
2024-05-14 18:14:14 +08:00
</view>
<view class="tn-flex tn-flex-row-center" style="margin-top: 50rpx;">
<tn-button @click="peiMod=false" backgroundColor="#E6E6E6" fontColor="#838383">我再想想</tn-button>
<tn-button @click="zhifuDo" backgroundColor="#28B93D" fontColor="#ffffff"
2024-05-15 17:54:48 +08:00
style="margin-left: 70rpx;">支付费用
</tn-button>
2024-05-14 18:14:14 +08:00
</view>
</tn-modal>
2024-06-04 18:04:09 +08:00
<tn-popup v-model="rightMod" mode="right" width="70%">
<tn-nav-bar :isBack="false" backTitle="" :alpha="true" :bottomShadow="false">
<view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-left">
<view style="padding-left: 15rpx;" @click="rightMod = false">
<text class="tn-icon-left" style="font-size: 40rpx;"></text>
</view>
<view class="tn-margin-top"
style=";text-shadow: 1rpx 0 0 #FFF, 0 1rpx 0 #FFF, -1rpx 0 0 #FFF , 0 -1rpx 0 #FFF;">
<tn-tabs :list="[{name:'报名详情'}]" :current="topCurrent" activeColor="#000" :bold="false"
:fontSize="24"></tn-tabs>
</view>
</view>
</tn-nav-bar>
<view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
<view v-if="info.list.length!=0" class="tn-flex tn-flex-center tn-flex-col-center"
v-for="(item,index) in info.list" @click="openUrl('/pages/index/my_card?id='+item.id)"
style="margin-top: 20rpx;padding: 20rpx;">
<view>
<image :src="apiImgUrl+item.photo_image"
style="width: 100rpx;height: 100rpx;border-radius: 50%"></image>
</view>
<view style="margin-left: 20rpx;">
<view style="font-size: 30rpx;font-weight: 600">{{item.nikename}}</view>
<view style="font-size: 24rpx;color: #999999;margin-top: 10rpx">{{item.position_name}}</view>
</view>
</view>
<view v-if="info.list.length==0" style="text-align: center;padding-top: 40rpx">暂无</view>
</view>
</tn-popup>
2024-04-20 14:58:10 +08:00
</view>
</template>
<script>
2024-05-08 18:14:41 +08:00
import {
eventInfo,
2024-05-15 17:54:48 +08:00
questionnaireFind,
applicationAdd,
questionnaireAdd,
moneyLogAdd
2024-05-08 18:14:41 +08:00
} from '@/util/api.js';
import store from '@/store/index.js'
2024-05-15 17:54:48 +08:00
2024-04-20 14:58:10 +08:00
export default {
data() {
return {
2024-05-14 10:20:09 +08:00
money: '',
juanMod: false,
2024-06-04 18:04:09 +08:00
rightMod: false,
2024-05-14 18:14:14 +08:00
peiMod: false, //培训付费
2024-05-15 17:54:48 +08:00
questionnaireList: [], //问卷列表
2024-05-14 10:20:09 +08:00
button: [{
text: '取消',
backgroundColor: '#E6E6E6',
fontColor: '#FFFFFF',
shape: 'round'
},
{
text: '确定',
backgroundColor: 'tn-bg-indigo',
fontColor: '#FFFFFF'
}
],
form: {
wenda: '',
danxuan: '',
hobby: [],
},
2024-04-23 11:58:07 +08:00
topCurrent: 0,
2024-05-08 18:14:41 +08:00
id: 0,
2024-06-04 18:04:09 +08:00
info: {
list: []
},
2024-05-08 18:14:41 +08:00
apiImgUrl: this.$store.state.imgUrl
2024-04-20 14:58:10 +08:00
}
},
mounted() {
2024-04-23 11:58:07 +08:00
// this.$wxshare({
// url: 'http://ysh.0rui.cn/#/pages/index/event_info',
// data: {
// url: window.location.href.split("#")[0],
// },
// share_data: {
// title: '河南省青年企业家协会开展走进开封市龙亭区暨产业考察交流活动',
// desc: '河南省青年企业家协会开展走进开封市龙亭区暨产业考察交流活动',
// imgUrl: 'http://ysh.0rui.cn/static/ser.png',
// link: "http://ysh.0rui.cn/#/pages/index/event_info", // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
// }
2024-04-20 14:58:10 +08:00
// })
2024-05-08 18:14:41 +08:00
// var id = this.$route.query.id;
// this.id = id;
// this.getEventInfo();
},
2024-05-31 18:06:24 +08:00
onShareAppMessage() { // 分享到微信好友
// 更多参数配置,参考文档
return {
title: this.info.activity_name,
path: '/pages/index/event_info?id=' + this.info.id,
imageUrl: this.apiImgUrl + this.info.activity_image,
}
},
onShareTimeline() { // 分享到朋友圈
return {
title: this.info.activity_name,
path: '/pages/index/event_info?id=' + this.info.id,
imageUrl: this.apiImgUrl + this.info.activity_image,
}
},
2024-05-08 18:14:41 +08:00
onLoad(d) {
console.log(d);
this.id = d.id;
this.getEventInfo();
2024-04-20 14:58:10 +08:00
},
methods: {
2024-05-14 18:14:14 +08:00
zhifuDo() {
this.peiMod = false;
var uid = uni.getStorageSync('uid');
2024-05-15 17:54:48 +08:00
if (!uid) {
uni.showToast({
title: '请登录后报名!',
icon: 'none',
duration: 2000
});
return;
}
2024-05-14 18:14:14 +08:00
applicationAdd({
association_id: store.state.Gid,
member_id: uid,
activity_id: this.id,
})
.then(res => {
if (res.code == 1) {
uni.showToast({
title: '报名成功!',
icon: 'none',
duration: 2000
});
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
2024-05-14 10:20:09 +08:00
juanzhuDo() {
this.juanMod = false;
2024-05-15 17:54:48 +08:00
var uid = uni.getStorageSync('uid');
if (!uid) {
uni.showToast({
title: '请登录后捐助!',
icon: 'none',
duration: 2000
});
return;
}
moneyLogAdd({
association_id: store.state.Gid,
member_id: uid,
activity_id: this.id,
money: this.money
})
.then(res => {
if (res.code == 1) {
uni.showToast({
title: '捐助成功!',
icon: 'none',
duration: 2000
});
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
option_add() {
var uid = uni.getStorageSync('uid');
if (!uid) {
uni.showToast({
title: '请登录后报名!',
icon: 'none',
duration: 2000
});
return;
}
var that = this;
var uid = uni.getStorageSync('uid');
var key = this.questionnaireList.map((item, index) => {
if (!('topic' in item)) {
return '';
} else {
return {
activity_id: that.id,
topic_id: item.id,
member_id: uid,
option: Array.isArray(item.topic) ? item.topic.join(',') : item.topic,
}
}
2024-05-14 10:20:09 +08:00
});
2024-05-15 17:54:48 +08:00
for (var i = 0; i < key.length; i++) {
if (key[i] == '') {
uni.showToast({
title: '请填写第[' + (i + 1) + ']个问题',
icon: 'none',
duration: 2000
});
return;
}
}
questionnaireAdd({
2024-05-21 18:16:48 +08:00
option: JSON.stringify(key),
activity_id: this.id,
member_id: uid,
association_id: store.state.Gid,
2024-05-15 17:54:48 +08:00
})
.then(res => {
console.log(res);
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
2024-05-14 10:20:09 +08:00
},
2024-05-08 18:14:41 +08:00
application_add() {
var uid = uni.getStorageSync('uid');
if (!uid) {
uni.showToast({
title: '请登录后报名!',
icon: 'none',
duration: 2000
});
return;
}
applicationAdd({
association_id: store.state.Gid,
member_id: uid,
activity_id: this.id,
application_time: new Date().toISOString().slice(0, 19).replace('T', ' ')
})
.then(res => {
if (res.code == 1) {
uni.showToast({
title: '报名成功!',
icon: 'none',
duration: 2000
});
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
}
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
getEventInfo() {
eventInfo({
association_id: store.state.Gid,
id: this.id
})
.then(res => {
console.log(res);
if (res.code == 1) {
var key = res.data;
if (key.activity_content.indexOf("<img") != -1) {
key.activity_content = getApp().addWidthToImages(key.activity_content);
}
this.info = key;
2024-05-15 17:54:48 +08:00
if (this.info.activity_type == 2) {
this.getEventOption()
}
}
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
getEventOption() {
questionnaireFind({
activity_id: this.id
})
.then(res => {
console.log(res);
if (res.code == 1) {
this.questionnaireList = res.data;
2024-05-08 18:14:41 +08:00
}
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
2024-04-20 14:58:10 +08:00
},
2024-06-04 18:04:09 +08:00
openUrl(url) {
uni.navigateTo({
url: url
})
},
2024-04-20 14:58:10 +08:00
goBack() {
if (getCurrentPages().length > 1) {
uni.navigateBack()
} else {
uni.redirectTo({
url: '/pages/index/index'
})
}
}
2024-05-15 17:54:48 +08:00
},
2024-04-20 14:58:10 +08:00
}
</script>
<style>
2024-05-14 10:20:09 +08:00
.mmy {
background-color: #F73909;
border-radius: 30px;
height: 80rpx;
width: 100%;
color: #FFF;
line-height: 80rpx;
font-size: 28rpx;
}
2024-06-04 18:04:09 +08:00
</style>