<template>
    <image style="width: 100%; height: 352rpx" :src="baseurl + detaildata.index_pic" mode=""></image>
    <view class="container" :style="{height: detaildata.form?'calc(100vh - 552rpx)': 'calc(100vh - 352rpx)'}">
        <text class="headtxt">{{ detaildata.title }}</text>
        <text class="address">活动地点：{{ detaildata.address }}</text>
        <view class="adressnum">
            <text class="time">活动时间：{{ detaildata.activity_time }}</text>
            <view class="ydl">
                <text class="time">阅读量：</text>
                <text class="value">
                    {{ detaildata.count }}
                </text>
            </view>
        </view>
        <view class="titlepart">
            <view class="icon"></view>
            <text class="title">活动详情</text>
        </view>
        <u-parse :content="detaildata.content"></u-parse>
        <text class="certetime">{{ detaildata.create_time }}</text>
    </view>
	<view class="baombut" v-if="detaildata.form">
		<view class="buttt" @click="gotij(detaildata.id, detaildata.form)">
			立即报名
		</view>
	</view>
</template>

<script setup>
import { onLoad } from '@dcloudio/uni-app'
import { ref } from 'vue'
import { activityInfo } from '@/api/index'

const baseurl = ref(import.meta.env.VITE_APP_BASE_URL + '/')
const detaildata = ref({})

const gotij = (id,item) => {
		uni.navigateTo({
			url: '/pages/index/subform?form='+JSON.stringify(item)+ '&id='+id +'&type='+'hd'
		})
	}

onLoad(async (param) => {
    await activityInfo(param.id).then((res) => {
        if (res.code === 1) {
            detaildata.value = res.data
        }
    })
})
</script>

<style scoped lang="scss">
.container {
    background-color: #ffffff;
    height: calc(100vh - 552rpx);
    width: 100%;
    padding: 40rpx 40rpx 0 40rpx;
    box-sizing: border-box;
    overflow-y: auto;

    .titlepart {
        margin-top: 40rpx;
        display: flex;
        align-items: center;
        margin-bottom: 30rpx;

        .icon {
            width: 12rpx;
            height: 32rpx;
            border-radius: 0rpx 32rpx 32rpx 0rpx;
            /* 蓝色渐变 */
            background: linear-gradient(0deg, #007fff 0%, #99ccff 100%);
        }

        .title {
            margin-left: 18rpx;
            font-family: Source Han Sans;
            font-size: 30rpx;
            font-weight: 350;
            line-height: 32rpx;
            text-align: justify;
            /* 浏览器可能不支持 */
            display: flex;
            align-items: center;
            letter-spacing: normal;
            color: #0072ff;
        }
    }

    .headtxt {
        font-family: Source Han Sans;
        font-size: 36rpx;
        font-weight: normal;
        line-height: 48rpx;
        display: flex;
        align-items: center;
        letter-spacing: normal;
        color: #0c092a;
    }

    .address {
        margin-top: 28rpx;
        font-family: Source Han Sans;
        font-size: 28rpx;
        font-weight: 350;
        line-height: 48rpx;
        display: flex;
        align-items: center;
        letter-spacing: normal;
        color: #858494;
    }

    .adressnum {
        display: flex;
        align-items: center;
        justify-content: space-between;

        .time {
            font-family: Source Han Sans;
            font-size: 28rpx;
            font-weight: 350;
            line-height: 48rpx;
            display: flex;
            align-items: center;
            letter-spacing: normal;
            color: #858494;
        }
        .ydl {
            display: flex;
            align-items: center;
            .time {
                font-family: Source Han Sans;
                font-size: 28rpx;
                font-weight: 350;
                line-height: 48rpx;
                display: flex;
                align-items: center;
                letter-spacing: normal;
                color: #858494;
            }
            .value {
                font-family: Source Han Sans;
                font-size: 28rpx;
                font-weight: 350;
                line-height: 48rpx;
                text-align: right;
                display: flex;
                align-items: center;
                letter-spacing: normal;
                color: #007fff;
            }
        }
    }
    .certetime {
        font-family: Roboto;
        font-size: 28rpx;
        font-weight: normal;
        line-height: 80rpx;
        letter-spacing: normal;
        color: #a1a1a1;
    }
}
.baombut {
		width: 100%;
		padding: 36rpx 0;
		display: flex;
		align-items: center;
		justify-content: center;
		box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.3);
		background: #FFFFFF;
		position: fixed;
		bottom: 0;

		.buttt {
			width: 574rpx;
			height: 96rpx;
			border-radius: 248rpx;
			background: linear-gradient(90deg, #007FFF 0%, #99CCFF 100%);
			font-family: Source Han Sans;
			font-size: 36rpx;
			color: #FFFFFF;
			display: flex;
			align-items: center;
			justify-content: center;
		}
	}
</style>
