<template>
	<view class="container">
		<!-- 返回按钮 -->
		<back text="活动详情"></back>
		<!-- 单个数据详情 -->
		<view class="detail-item">
			<view class="flex" style="width: 100%;height: 90rpx;">
				<view class="flex" style="margin: -30rpx 0 0 10rpx;">
					<view class="index"
						:style="{backgroundColor: singleDetail.survey.progress === 'finish'||singleDetail.vote.progress === 'finish'? '#23b46c': '#f9c752' }">
					</view>
					<view class="name">{{singleDetail.survey.name||singleDetail.vote.name}}</view>
				</view>
		
				<view class="t-icon t-icon-yiwancheng1"
					v-if="singleDetail.survey.progress === 'finish'||singleDetail.vote.progress === 'finish'"
					style="margin-left: auto; width: 90rpx; height: 90rpx;"></view>
				<view class="t-icon t-icon-jinhangzhong-copy"
					v-if="singleDetail.survey.progress === 'going'||singleDetail.vote.progress === 'going'"
					style="margin-left: auto; width: 90rpx; height: 90rpx;"></view>
			</view>
			<!-- 正文 -->
			<view class="content-box">
				<view style="display:flex;flex-direction: column;padding: 0 30rpx;">
					<rich-text class="subtitle-info" style="margin-bottom: 15rpx;"
						:nodes="singleDetail.survey.description||singleDetail.vote.description">
					</rich-text>
					<view class="flex">
						<view class="subtitle">布置老师:</view>
						<view class="subtitle-info" style="margin-left: 10rpx;">
							{{singleDetail.survey.creatorId||singleDetail.vote.creatorId}}
						</view>
						<view class="subtitle" style="margin-left: 20rpx;">截止时间:</view>
						<view class="subtitle-info" style="margin-left: 10rpx;" v-if="singleDetail.survey">
							{{$timestampToTime(singleDetail.survey.endTime)}}
						</view>
						<view class="subtitle-info" style="margin-left: 10rpx;" v-if="singleDetail.vote">
							{{$timestampToTime(singleDetail.vote.endTime)}}
						</view>
					</view>
				</view>
				<!-- 内容 -->
				<view class="content-detail-box">
					<!-- 问卷 -->
					<view class="title-box"
						:style="{backgroundColor: singleDetail.survey.progress === 'finish'? '#23b46c': '#f9c752' }"
						v-if="singleDetail.survey">
						<view class="content-subtitle">问卷详情</view>
					</view>
					<view class="flex" style="justify-content: space-around;">
						<view class="option-box"
							:style="{backgroundColor: singleDetail.survey.progress === 'finish'? '#23b46c': '#f9c752' }"
							v-for="(option,i) in singleDetail.survey.answers[0]" :key="i">
							<view class="content-subtitle" style="font-size: 30rpx;">{{option}}</view>
						</view>
					</view>
					
					<!-- 投票 -->
					<view class="title-box"
						:style="{backgroundColor: singleDetail.vote.progress === 'finish'? '#23b46c': '#f9c752' }"
						v-if="singleDetail.vote">
						<view class="content-subtitle">{{singleDetail.vote.secret ? '匿名投票':'普通投票'}}</view>
					</view>
					<view class="flex" style="justify-content: space-around;">
						<view class="flex-colum" v-for="(option,j) in singleDetail.vote.options" :key="j">
							<rich-text class="subtitle-info" style="margin-bottom: 15rpx;" :nodes="option.value">
							</rich-text>
							<view class="option-box"
								:style="{backgroundColor: singleDetail.vote.progress === 'finish'? '#23b46c': '#f9c752' }">
								<view class="content-subtitle" style="font-size: 30rpx;">{{option.code}}</view>
							</view>
						</view>
					</view>
		
		
				</view>
			</view>
		
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex'
	export default {
		computed: {
			...mapState('m_children', ['singleDetail'])
		},
		data(){
			return{
			};
		},
		onLoad() {
		},
		methods:{

		}
	}
</script>

<style lang="scss">
	@import '@/subpkg/common/detailpage.scss';
	.flex-colum{
		display: flex;
		flex-direction: column;
		align-items: center;
	}
</style>