<template>
	<view class="li_box">
		<view class="lb_title">
			{{index+1}}. {{item.question}}
		</view>
		<view class="lb_card">
			<view class="lb_box" v-for="(ua,ui) in item[arrayKey]" :key="ui">
				<view class="memo">{{assessmentMethodCfg[ua.assessmentMethod]||''}}</view>
				<view class="lb_answers">
					<u-radio-group
						:value="ua.answer"
						placement="column"
						@change="e=>radioChange(e,ua.assessmentMethod,item.id)"
					>
						<view class="la_item" v-for="(pre,idx) in ua.questionOption" :key="idx">
							<u-radio
								:label="pre.questionOption"
								:name="pre.questionOption"
								activeColor="#33A7A7"
								size="36rpx"
								iconSize="32rpx"
								labelColor="#002846"
								labelSize="28rpx"
							></u-radio>
						</view>
					</u-radio-group>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "QuestionItem",
		props: {
			item: {
				type: Object,
				required: true
			},
			index: {
				type: Number,
				required: true
			},
			arrayKey: {
				type: String,
				default:'userAnswer'
			},
		},
		data(){
			return {
				assessmentMethodCfg:{
					'1':'您对团队当前在此项陈述上所描述的实际表现的同意程度为：',
					'2':'此项陈述对该团队当前的重要性： '
				}
			}
		},
		methods: {
			radioChange(value,assessmentMethod,id) {
				this.$emit('change', {
					value,
					assessmentMethod,
					id,
					index: this.index
				});
			}
		}
	}
</script>

<style scoped lang="less">
	.li_box{
		margin-top: 20rpx;
		.lb_title{
			font-family: PingFang-SC, PingFang-SC;
			font-weight: bold;
			font-size: 32rpx;
			color: #002846;
			line-height: 48rpx;
		}
		.lb_card{
			background: #F2F9F9;
			border-radius: 24rpx;
			padding: 0 24rpx 40rpx;
			overflow: hidden;
			margin-top: 32rpx;
		}
		.lb_box{
			margin-top: 40rpx;
			.memo{
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				font-size: 24rpx;
				color: #009191;
				line-height: 24rpx;
			}
			.lb_answers{
				width: 100%;
				margin-top: 20rpx;
				.la_item{
					padding: 31rpx 24rpx;
					background: #FFFFFF;
					border-radius: 24rpx;
					margin-top: 10rpx;
				}
			}
		}
	}
</style>