<template>
	<view style="letter-spacing: 1rpx;">
		<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'}">
			<image :src="apiImgUrl+info.activity_image" style="width: 100%;" mode="widthFix"></image>
			<view style="padding:20rpx 30rpx;">
				<view style="font-size: 30rpx;font-weight: 600;">{{info.activity_name}}</view>
				<view style="margin-top: 40rpx;">
					<view>
						<text style="color: #26BB71;">●</text>
						<text style="margin-left: 10rpx;font-weight: 600;">开始时间：</text>
						<text style="color: #979797;">{{info.activity_start_time}}</text>
					</view>
					<view style="margin: 15rpx 0rpx;">
						<text style="color: #BE7E28;">●</text>
						<text style="margin-left: 10rpx;font-weight: 600;">结束时间：</text>
            <text style="color: #979797;">{{info.activity_end_time}}</text>
					</view>
					<view>
						<text style="color: #DB5022;">●</text>
						<text style="margin-left: 10rpx;font-weight: 600;">活动地点：</text>
						<text style="color: #979797;">{{info.activity_location}}</text>
					</view>
				</view>
				<view style="margin-top: 60rpx;font-size: 32rpx;font-weight: 600;">活动介绍</view>
				<view>
          <view class="ks_html"  style="line-height: 50rpx;margin-top: 20rpx;padding-bottom:180rpx">
            <div v-html="info.activity_content"></div>
          </view>
				</view>
			</view>
		</view>
		<view style="position: fixed;bottom: 0;background-color: #ffffff;padding: 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>-->
			<view style="text-align: center;margin-top: 30rpx;">
				<tn-button v-if="info.type=='未开始'" backgroundColor="#F73909" height="80rpx" width="100%" fontColor="#ffffff"
					shape="round">报名</tn-button>
        <tn-button v-if="info.type=='已结束'||info.type=='进行中'" backgroundColor="#F73909" height="80rpx" width="100%" fontColor="#ffffff"
                   shape="round">报名</tn-button>
			</view>
		</view>
	</view>
</template>

<script>
import {
  eventInfo,
} from '@/util/api.js';
import store from '@/store/index.js'
	export default {
		data() {
			return {
				topCurrent: 0,
        id: 0,
        info:{},
        apiImgUrl:this.$store.state.imgUrl
			}
		},
		mounted() {
			// 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 安全域名一致
			// 	}
			// })
      // var id =  this.$route.query.id;
      // this.id = id;
      // this.getEventInfo();
		},
    onLoad(d) {
      console.log(d);
      this.id = d.id;
      this.getEventInfo();
    },
		methods: {
      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;
              }
            })
            .catch(error => {
              uni.showToast({
                title: error,
                icon: 'none',
                duration: 2000
              });
            })
			},
			goBack() {
				if (getCurrentPages().length > 1) {
					uni.navigateBack()
				} else {
					uni.redirectTo({
						url: '/pages/index/index'
					})

				}
			}
		}
	}
</script>

<style>

</style>
