<template>
	<view style="background-color: #F1F2F8;letter-spacing: 1rpx;min-height: 100vh;">
		<tn-nav-bar :isBack="false" backTitle="" :bottomShadow="true" backgroundColor="#FFFFFF">
			<view class="custom-nav 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 style="width: 83%;font-weight: bold;">
					<text>我的活动</text>
				</view>
			</view>
		</tn-nav-bar>
		<view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
			<view style="padding: 30rpx;">
				<view v-for="(item,index) in list"
					style="background-color: #FFF;border-radius: 20rpx;margin-bottom: 20rpx;">
					<view style="padding: 20rpx">
						<view>
							<view @click="openUrl('/pages/packageB/event/event_info?id='+item.id)"
								style="background-color: #FFF;border-radius: 20rpx;">
								<view class="tn-flex tn-flex-row-between"
									style="padding:20rpx 20rpx 10rpx 10rpx;position: relative;">
									<view style="margin-left: 10rpx;">
										<image :src="apiImgUrl+item.activity_image" mode="aspectFill"
											style="width: 250rpx;height: 180rpx;border-radius: 20rpx;"></image>
									</view>
									<view style="margin-left: 20rpx;width: 54%;">
										<view class="tn-text-ellipsis-2" style="font-size: 32rpx;font-weight: bold;">
											{{item.activity_name}}
										</view>
										<view style="font-size: 24rpx;margin: 20rpx 0rpx;color: #888888;">
											<text class="tn-icon-time"></text>
											<text>{{item.activity_start_time}}-{{item.activity_end_time}}</text>
										</view>
										<view class="tn-text-ellipsis" style="font-size:26rpx;color: #888888;">
											<text class="tn-icon-location" style="vertical-align: middle;"></text>
											<text style="vertical-align: middle;">{{item.activity_location}}</text>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		UserApplication
	} from "@/util/api";
	import store from "@/store";
	export default {
		data() {
			return {
				topCurrent: 0,
				list: [],
				apiImgUrl: this.$store.state.imgUrl,
			}
		},
		onLoad() {
			var uid = uni.getStorageSync('uid');
			this.uid = uid;
			this.getUserApplication();
		},
		methods: {
			getUserApplication() {
				UserApplication({
						member_id: this.uid
					})
					.then(res => {
						console.log(res);
						if (res.code == 1) {
							this.list = res.data;
						}
					})
					.catch(error => {
						uni.showToast({
							title: error,
							icon: 'none',
							duration: 2000
						});
					})
			},
			openUrl(e) {
				uni.navigateTo({
					url: e
				})
			},
			goBack() {
				if (getCurrentPages().length > 1) {
					uni.navigateBack()
				} else {
					uni.redirectTo({
						url: '/pages/index/index'
					})

				}
			}
		}
	}
</script>

<style>

</style>