<template>
	<view class="li_box">
		<view class="lb_title">
			{{index+1}}. {{item.question}}<br>
			<span style="color: #536387;font-size: 28rpx;line-height: 36rpx;margin-top: 12rpx;font-weight: 400;">{{item.questionEnglish||''}}</span>
		</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)"
					>
						<u-radio
							v-for="(pre,idx) in ua.questionOption" 
							:key="idx"
							:label="pre.questionOption"
							:name="pre.questionOption"
							activeColor="#33A7A7"
							size="36rpx"
							iconSize="32rpx"
							labelColor="#002846"
							labelSize="28rpx"
							:custom-style="{
								'padding': '0 24rpx',
								'background': '#FFFFFF',
								'border-radius': '24rpx',
								'margin-top': '10rpx',
								'width': '100%'
							}"
						></u-radio>
					</u-radio-group>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "QuestionItem",
		options: {
			styleIsolation: 'shared'
		},
		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="scss">
	.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;
				
				::v-deep .u-radio__text {
					width: 100% !important;
					padding: 31rpx 0 !important;
				}
			}
		}
	}
</style>
