253 lines
7.2 KiB
Vue

<template>
<view style="background-color: #F7F7F7;letter-spacing: 1rpx;min-height: 100vh;">
<tn-nav-bar customBack :bottomShadow="false" backgroundColor="#ffffff">
<view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-center">
<view style="color: #000000;;text-align: left;font-size: 36rpx;font-weight: 600;">
<text>协会活动</text>
</view>
</view>
<view slot="back" class='tn-custom-nav-bar__back' @click="goBack">
<image src="/static/back.png" style="width: 60rpx;height: 60rpx;"></image>
</view>
</tn-nav-bar>
<view :style="{paddingTop: vuex_custom_bar_height + 'px',backgroundColor: '#ffffff'}">
<view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin">
<view class="justify-content-item align-content-item" style="width: 100%;">
<view class="tn-flex tn-flex-col-center"
style="border-radius: 100rpx;padding: 10rpx 0rpx 10rpx 20rpx;width: 100%;height:80rpx;background-color: rgba(238,238,238,0.5);">
<text
class="tn-icon-search justify-content-item tn-padding-right-xs tn-color-gray tn-text-lg"></text>
<input v-model="content" class="justify-content-item" placeholder="请填写活动标题" name="input"
placeholder-style="color:#9B9B9B" style="width: 90%;"></input>
<view style="height: 50rpx;width: 1px;background-color: #2368F2"></view>
<view @click="onsubmit()" style="width: 180rpx;text-align: center;">
<text style="color: #2368F2;">搜索</text>
</view>
</view>
</view>
</view>
<!-- <tn-tabs :list="tabList" :isScroll="false" :current="current" name="name" @change="tabChange"
activeColor="#3668FC"></tn-tabs> -->
<view style="margin: 20rpx 0rpx 20rpx 20rpx;">
<view style="padding:20rpx;">
<scroll-view :scroll-x="true" style="white-space: nowrap;width: 100%">
<view style="display: inline-block;margin-right: 50rpx;" v-for="(item,index) in tabList"
@click="tabChange(index)">
<view style="position: relative;">
<view :class="current == index?'news_title_active':'news_title'">{{item.name}}</view>
<image v-if="current == index" src="/static/news_title.png"
style="z-index: 0;width: 50rpx;position: absolute;bottom: 0;right: -10rpx;"
mode="widthFix" class="no-img"></image>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
<view style="padding-bottom: 30rpx;">
<view>
<view v-for="(item,index) in actList" style="padding:0rpx 30rpx 30rpx 30rpx;">
<view @click="openUrl('/pages/packageB/event/event_info?id='+item.id)"
style="width: 100%;padding-bottom: 20rpx;background-color: #FFF;box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(12,0,5,0.1);position: relative;border-radius: 20rpx;overflow: hidden;">
<view>
<image :src="apiImgUrl+item.activity_image" mode="aspectFill"
style="width: 100%;height: 350rpx;">
</image>
</view>
<view style="padding:10rpx 20rpx;font-weight: 400;">
<view class="tn-text-ellipsis-3" style="text-align: left;font-size: 30rpx;font-weight: 600;">
{{ item.activity_name }}
</view>
<view style="font-size: 24rpx;margin-top: 20rpx;color: #9B9B9B;">
活动时间:{{formatTime(item.activity_start_time)}}至{{formatTime(item.activity_end_time)}}
</view>
</view>
<view style="position: absolute;top: 20rpx;left: 20rpx;">
<view class="my_tag" style="background-color: rgb(75, 130, 235)">
进行中
</view>
<view v-if="item.type=='未开始'" class="my_tag" style="background-color: rgb(248, 155, 59)">
预告
</view>
<view v-if="item.type=='已结束'" class="my_tag" style="background-color: rgb(225, 43, 51)">
已结束
</view>
</view>
</view>
</view>
</view>
</view>
<view style="padding-bottom: 120rpx;">
<tn-load-more class="tn-margin-top" :status="load_status"></tn-load-more>
</view>
<!-- <tn-tabbar :outHeight="140" :height="120" v-model="currentIndex" :list="tabbarList" activeColor="#3377FF"
inactiveColor="#AAAAAA" activeIconColor="#3377FF" inactiveIconColor="#8A8E99" :animation="true"
:safeAreaInsetBottom="true" @change="switchTabbar"></tn-tabbar> -->
</view>
</template>
<script>
import {
activityIndex,
} from '@/util/api.js';
import store from '@/store/index.js'
export default {
data() {
//1.线下活动2.调查问卷3.公益捐赠4.学习培训
return {
currentIndex: -1,
// 底部tabbar菜单数据
tabbarList: [{
title: '首页',
activeIcon: '/static/01_1.png',
inactiveIcon: '/static/01.png'
},
{
title: '通讯录',
activeIcon: '/static/02_2.png',
inactiveIcon: '/static/02.png'
},
{
title: '发现',
activeIcon: '/static/03_3.png',
inactiveIcon: '/static/03.png'
},
{
title: '个人中心',
activeIcon: '/static/04_4.png',
inactiveIcon: '/static/04.png'
}
],
current: 0,
load_status: 'loading ',
tabList: [{
name: '全部',
id: 0
}, {
name: '协会活动',
id: 1
}, {
name: '调查问卷',
id: 2
}, {
name: '公益捐赠',
id: 3
}, {
name: '学习培训',
id: 4
}],
apiImgUrl: this.$store.state.imgUrl,
content: '',
topCurrent: 0,
actList: [],
page: 1,
}
},
onLoad(d) {
console.log(d);
if (typeof(d.type) != 'undefined') {
this.current = d.type;
}
this.getActivityIndex();
},
methods: {
switchTabbar(d) {
console.log(d);
uni.$emit('depId', {
index: d
})
uni.navigateBack()
},
onsubmit() {
this.page = 1;
this.actList = [];
this.getActivityIndex();
},
tabChange(d) {
console.log(d);
this.current = d;
this.page = 1;
this.actList = [];
this.getActivityIndex();
},
ReachBottom() {
console.log('service');
this.page = this.page + 1;
this.getActivityIndex();
//this.getIndex();
},
getNewInfo() {
this.current = 0;
this.page = 1;
this.actList = [];
this.getActivityIndex();
},
getActivityIndex() {
var type = this.tabList[this.current].id;
activityIndex({
association_id: store.state.Gid,
page: this.page,
size: 10,
activity_name: this.content,
activity_type: type
})
.then(res => {
console.log(res);
if (res.code == 1) {
this.actList.push(...res.data.ret);
} else {
this.load_status = 'nomore';
}
})
.catch(error => {
uni.showToast({
title: error,
duration: 2000
});
})
},
goBack() {
if (getCurrentPages().length > 1) {
uni.navigateBack()
} else {
uni.redirectTo({
url: '/pages/index/index'
})
}
},
openUrl(e) {
uni.navigateTo({
url: e
})
},
formatTime(time) {
const [year, month, day] = time.split(' ')[0].split('-');
return `${year}.${month}.${day}`;
},
}
}
</script>
<style lang="scss" scoped>
.news_title {
color: #9B9B9B;
font-size: 35rpx;
}
.news_title_active {
color: #323232;
font-size: 35rpx;
font-weight: 600;
z-index: 10;
}
.my_tag {
padding: 8rpx 25rpx;
font-size: 20rpx;
color: rgba(255, 255, 255, 1);
border-radius: 22rpx;
}
</style>