<template>
	<view class="">
		<u-navbar :back-text="i18n('Back')" :back-text-style="backStyle" back-icon-color="#fff" title-color="#fff"
			:title="i18n('NationalregionalCommissions')" :background="background">
		</u-navbar>
		<view class="" style="background-color: #fff;width: 100%;">
			<view>
				<view style="margin: 10upx 20upx;
					overflow: hidden;background-color: #fff;position: relative;">
					<img :src="websiteUrl+ activityInfo.activityLogo" alt="" v-if="activityInfo.activityLogo"
						style="width: 100%;height: 300upx;border-radius: 0 0 20upx 20upx;">
					<img :src="websiteUrl+'/def/def1.png'" alt="" v-if="!activityInfo.activityLogo"
						style="width: 100%;height: 300upx;border-radius: 0 0 20upx 20upx;">

					<view class="recommend-bottom">
						<view class="recommend-bottom-name" style="width: 700upx;">
							{{activityInfo.activityName}}

						</view>
						<view style="padding: 10upx 15upx;background-color: #66CC01;color: #fff;
								border-radius: 12upx;margin-left: 10upx;min-width: 200upx;text-align: center;max-width: 300upx;">
							{{activityInfo.activityTypeDict == '1' ?
									$i18n.locale == 'zh'? '委员会活动':'CommitteeActivities':$i18n.locale == 'zh'?'委员会动态':'CommitteeDynamics'
								
								}}
						</view>

						<view class="activityInfoDetails">
							<image src="../../../static/img/nationaIntroductionList/placeName.png" mode="" class="icon">
							</image>
							{{$i18n.locale=='zh'?basisInfo.ZH:basisInfo.EN}}
						</view>
						<view class="recommend-bottom-time activityInfoDetails">
							<image src="../../../static/img/nationaIntroductionList/naTime.png" mode="" class="icon">
							</image>
							<text>{{formatDate(activityInfo.activityStartTime)}} -
								{{formatDate(activityInfo.activityEndTime)}}</text>
						</view>
						<view class="activityInfoDetails">
							<image src="../../../static/img/nationaIntroductionList/naPlace.png" mode="" class="icon">
							</image>
							{{activityInfo.activityPlace}}
						</view>
						<view class="" style="color: #333333;width: 700upx;">
							{{activityInfo.activityIntroduction}}
						</view>

					</view>

				</view>

			</view>
		</view>
		<u-gap height="20" bg-color="#F3F4F5" style="width: 750upx !important;"></u-gap>
		<view style="margin: 10upx 20upx;" v-if="activityInfo.activityReviewUe">
			<view v-html="activityInfo.activityReviewUe" class="coo_box"></view>
		</view>
		<view style="margin: 10upx 20upx;" v-else>
			<view v-html="activityInfo.activityPreviewUe" class="coo_box"></view>
		</view>
		<u-gap height="20" bg-color="#F3F4F5" style="width: 750upx !important;"
			v-if="activityInfo.activityReviewUe || activityInfo.activityPreviewUe"></u-gap>
		<!-- 重要活动 -->
		<view class="" style="margin: 10upx 30upx;" v-if="recommendData.length>0">
			<text style="display: inline-block;width: 10upx;height: 30upx;
			background-color: #6DD400;vertical-align: middle;margin-right: 10upx;"></text>
			{{i18n('ImportantEvent')}}
		</view>
		<view class="" style="margin-left: 30upx;">
			<view class="swiper " style="height: 400upx;">
				<view class="swiper-box" style="height: 400upx">
					<swiper>
						<swiper-item v-for="(item, index) in recommendData" :key="index"
							@click="dataChange(item.entityId)">
							<view class="swiper-item" style="height: 100%;">
								<image v-if="item.activityLogo" :src="websiteUrl + item.activityLogo" alt=""
									style="width: 100%;height:200upx"></image>
								<image v-else :src="websiteUrl+'/def/def1.png'" alt=""
									style="width: 100%;height:200upx"></image>
								<view class="" style="min-height: 100upx;">{{item.activityName}}</view>
							</view>
						</swiper-item>
					</swiper>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {

		data() {
			return {
				input: '',
				activityId: null,
				activityInfo: [],
				options: [], // 区域
				options2: [], // 类型
				background: {
					backgroundImage: 'linear-gradient(270deg, #4BC0E2 0%, #538BE7 100%)',
				},
				backStyle: {
					color: '#fff'
				},
				basisInfo: {},
				recommendData: [],

			}
		},
		async onLoad(options) {
			this.activityId = options.id;
			this.getDicts();

		},
		onShow() {
			this.getList();
		},
		methods: {
			options2Map() {
				return this.options2.array2Obj("value", "label");
			},
			async getDicts() {
				const res = await this.$myRequest({
					url: '/sys/sysDicts',
					data: {
						type: 'COMMITTEE_REGIONAL_DICT,COMMITTEE_ACTIVITY_TYPE,COMMITTEE_REGIONAL_DICT_EN,COMMITTEE_ACTIVITY_TYPE_EN'
					}
				})
				var data = res.data;
				if (data) {
					if (this.$i18n.locale == 'zh') {
						this.options = [];
						this.options2 = [];
						this.options = res.data[0];
						this.options2 = res.data[1];
						this.options.unshift({
							label: "全部区域",
							value: null,
						});
						this.options2.unshift({
							label: "全部类型",
							value: null,
						});
					} else if (this.$i18n.locale == 'en') {
						this.options = [];
						this.options2 = [];
						this.options = res.data[2];
						this.options2 = res.data[3];
						this.options.unshift({
							label: "ALL",
							value: null,
						});
						this.options2.unshift({
							label: "ALL",
							value: null,
						});
					}
				}
			},
			dataChange(id) {
				this.activityId = id;
				this.getList();
			},
			async getList() {
				// 详情信息
				let page = {
					language: this.$i18n.locale.toUpperCase(),
					entityId: this.activityId,
				};
				const res = await this.$myRequest({
					url: '/project/committeeActivityInfos/getCommitteeActivityInfo',
					data: page
				})
				this.activityInfo = res.data.committeeActivityInfo || [];
				this.basisInfo = res.data.basisInfo;
				// 重要活动
				let list = {
					pageSize: 6,
					pageNo: 1,
					language: this.$i18n.locale.toUpperCase(),
				};

				const important = await this.$myRequest({
					url: '/project/committeeActivityInfos/getCommitteeActivityList',
					data: list
				})
				if (important.data.importantCommitteeActivityInfos !== undefined) {
					important.data.importantCommitteeActivityInfos.forEach((item, index) => {
						if (item.activityId = this.activityId) {
							important.data.importantCommitteeActivityInfos.splice(index, 1);
						}
					})
				}
				this.recommendData = important.data.importantCommitteeActivityInfos || [];
			},
			i18n(data) {
				return this.$t('common.' + data);
			},
		}
	}
</script>

<style>
	page {
		background-color: #fff;
	}

	.yellow {
		position: absolute;
		top: 0;
		left: 0;
		/* min-width: 96px;  */
		padding: 0 40upx;
		height: 64upx;
		text-align: center;
		line-height: 64upx;
		font-size: 28upx;
		color: #fff;
		border-radius: 0 0 20upx 0;
	}

	.yellow {
		background: rgb(255, 153, 0);
	}

	.icon {
		width: 30upx;
		height: 30upx;
		vertical-align: middle;
		margin-right: 14upx;
	}

	.activityInfoDetails {
		line-height: 50upx;
	}

	/deep/.uni-swiper-slides,
	.swiper-item {
		width: 270upx;
		max-height: 400upx;
	}

	.swiper-item {
		height: 100% !important;

	}

	.uni-swiper-slide-frame :nth-child(1) {
		margin-right: 50upx;
	}

	.border-top {
		border-top: 1px solid #03B6B3;
	}

	.uni-swiper-slide-frame :nth-child(1) .swiper-item {
		background: #F8F8F8;
	}

	.uni-swiper-slide-frame :nth-child(2) .swiper-item {
		background: #EFFAFF;
	}

	.uni-swiper-slide-frame :nth-child(3) .swiper-item {
		background: #c2a3e0;
	}

	.uni-swiper-slide-frame :nth-child(4) .swiper-item {
		background: #a3e0c2;
	}

	.uni-swiper-slide-frame :nth-child(5) .swiper-item {
		background: #feb84d;
	}

	/deep/ uni-swiper {
		height: 400upx !important;
	}

	.nationTitle {
		font-size: 26upx;
		font-family: PingFangSC-Semibold, PingFang SC;
		font-weight: 600;
		color: #333333;
		line-height: 37upx;
	}

	.Box_view:active {
		background-color: #f1f2f3;
	}

	.introduceMap-title {
		padding: 10upx 15upx;
		margin-left: 15upx;
		border: 1px solid #0079ef;
	}

	.nationLable {
		font-size: 26upx;
		font-family: PingFangSC-Semibold, PingFang SC;
		color: #333333;
		line-height: 37upx;
	}

	.recommend-bottom {

		width: 488upx;
	}

	.recommend-bottom-name {
		font-size: 35upx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: #0B0B11;
		line-height: 55upx;
		margin-top: 30upx;
		/* overflow: hidden;
		text-overflow:ellipsis;
		white-space: nowrap; */
	}

	.imgage-user {
		width: 60upx;
		height: 60upx;
		overflow: hidden;
		border-radius: 60upx;
	}
</style>
