<template>
	<view class="box">
		<u-navbar :autoBack="true" bgColor="rgba(255,255,255,0)"></u-navbar>
		<view>
			<u-swiper
				@click="clickImg"
				:list="imageList"
				imgMode="aspectFill"
				:height="200"
				:indicator="true"
				:autoplay="true"
				:circular="true"
				indicatorStyle="bottom: 25px"
				indicatorMode="dot"
				indicatorActiveColor="#fff"
				indicatorInactiveColor="rgba(255, 255, 255, 0.35)"
			></u-swiper>
		</view>
		<view class="box">
			<view class="" style="display: flex; align-items: center; margin-left: 28rpx; margin-top: 30rpx">
				<view style="color: #640000; margin-right: 20rpx; font-weight: 700; font-size: 36rpx">{{ list.title }}</view>
			</view>
			
			<view v-if="list.intro" style="margin-left: 24rpx; display: flex; align-items: center; margin-top: 40rpx">
				<view style="display: flex; align-items: center">
					<uni-icons type="calendar" size="22" color="#940000"></uni-icons>
					<view class="item_tit">介绍</view>
				</view>
			</view>
			<view class="text">
				<u-parse :content="list.content"></u-parse>
			</view>
		</view>
		
		<!-- 构件 -->
		<view class="" v-if="association.length > 0">
			<view style="margin-left: 24rpx; display: flex; align-items: center; margin-top: 40rpx">
				<view style="display: flex; align-items: center">
					<uni-icons type="cloud-download" size="22" color="#940000"></uni-icons>

					<view class="item_tit">活动相关</view>
				</view>
			</view>

			<view class="jj_btm">
				<view @click="$common.navigateTo(item.page)" class="container" v-for="(item, index) in association" :key="item.index">
					<view class="mn_box">
						<image style="border-radius: 10rpx; width: 100%; height: 100%" :lazy-load="true" :src="item.image"></image>
					</view>
					<view class="mn_text">{{ item.title }}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
let that = this;
export default {
	data() {
		return {
			list: [],
			association: [],
			showadmin: false,
			imageList: ['https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/sh_lb1.jpg']
		};
	},
	onLoad(e) {
		that = this;
		this.getContentDetail(e.id);
	},
	methods: {
		// 详情
		getContentDetail(id) {
			this.$api.getContentDetail(
				{
					main_body_id: 1,
					id: id
				},
				function (res) {
					// console.log(res, 666666666);
					that.list = res.data;
					let aa = Object.values(res.data.association_me_list);
					that.association = aa.filter((item) => item.title !== '文保牌' && item.main_body_column_name !== '我和文物的故事');
					if (res.data.images.length > 0) {
						that.imageList = res.data.images;
					}

					let auth = that.$common.userInfo();
					//获取用户权限
					if (!(auth === 'undefined' || auth === '' || auth === [] || auth === null) && auth.token !== 'undefined') {
						that.$api.userManageCrAuth(
							{
								main_body_id: 1,
								cr_code: res.data.code
							},
							function (res) {
								console.log(res);
								if (res.data === true) {
									that.showadmin = true;
								}
							}
						);
					}
				}
			);
		},
		// 图片预览
		clickImg(index) {
			// console.log(index, 555);
			var imgs = this.imageList;
			let temp = [imgs[index]];
			// console.log('temp', temp);

			uni.previewImage({
				urls: imgs,
				current: index,
				success: function (data) {
					console.log(data);
				},
				fail: function (err) {
					console.log(err.errMsg);
				}
			});
		}
	}
};
</script>

<style>
/deep/.u-swiper-indicator__wrapper__dot--active {
	width: 5px !important;
}
.box {
	min-height: 100%;
	height: auto;
	width: 100%;
	padding-bottom: 50rpx;
	background-image: url('https://huli-app.wenlvti.net/app_static/wuyuan/static/shouhu/wyj-feiyi3-001.png');
	background-repeat: repeat-y;
	background-attachment: fixed;
	background-size: 100% 100%;
}
.title {
	font-size: 28rpx;
	font-weight: 400;
	color: #444444;
	line-height: 44rpx;
}
.u-info {
	font-size: 28rpx;
	color: #444444;
	line-height: 44rpx;
	margin: 20rpx;
	text-align: center;
}
.text {
	margin: 20rpx;
}
.info {
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	margin: 20rpx;
	margin-top: 16rpx;
}
.info_item {
}
.info > view {
	margin-top: 20rpx;
	font-size: 30rpx;
	margin-left: 8rpx;
	color: #940000;
	/* font-weight: 900; */
}
.item_tit {
	font-size: 32rpx;
	color: #940000;
	line-height: 48rpx;
	font-weight: 700;
}
.jj_btm {
	width: 92%;
	margin: auto;
	display: flex;
	margin-top: 20rpx;
	flex-wrap: wrap;
	justify-content: space-between;
}
.mn_box {
	width: 300rpx;
	height: 200rpx;
}
.mn_text {
	width: 298rpx;
	font-size: 28rpx;
	text-align: center;
	color: #ffffff;
	position: absolute;
	top: 160rpx;
	left: 2rpx;
	line-height: 40rpx;
	background: rgba(0, 0, 0, 0.3);
	border-radius: 0px 0rpx 10rpx 10rpx;
}
.container {
	position: relative;
	margin-top: 20rpx;
	/* 	width: 260rpx;
	height: 182rpx; */
}
</style>
