<template>
	<view class="" style="padding: 20rpx 40rpx; background-color: #fff;">
		<view class="" v-for="(val,index) in tableList.cereQuestionManagements" style="padding: 10rpx;" v-if="tableList.cereQuestionManagements">
			<view class="" style="font-size: 20px;margin-bottom: 5px;">
				<span style="margin-right: 10px;">{{index + 1}}.</span> {{val.tikuTitle}}
			</view>
			 <u-radio-group class="radio-box" v-model="selectedOption" :wrap="true" v-if="val.questionType == '单选'">
			    <u-radio shape="circle" v-for="(value, key, ind) in val.optionSettings" :key="ind" :label="value" style="padding: 3px 0;" disabled>{{ value }}</u-radio>
			  </u-radio-group>
			  <u-checkbox-group  v-model="cheOption"  :wrap="true" v-if="val.questionType == '多选'">
			  			<u-checkbox 
							v-for="(value, key, ex) in val.optionSettings" :key="ex" :label="value" style="padding: 3px 0;" disabled
			  			>{{value}}</u-checkbox>
			  		</u-checkbox-group>
					<u-input type="text" value="" v-if="val.questionType == '文本'" border  disabled/>
					
		</view>
		<view class="" v-for="(val,index) in tableList.msg" style="padding: 10rpx;" v-if="tableList.msg">
			<view class="" style="font-size: 20px;margin-bottom: 5px;">
				<span style="margin-right: 10px;">{{index + 1}}.</span> {{val.tikuTitle}} 
			</view>
			 <u-radio-group class="radio-box" v-model="selectedOption" :wrap="true" v-if="val.questionType == '单选'">
			    <u-radio shape="circle" v-for="(value, key, ind) in val.optionSettings" :key="ind" :label="value" style="padding: 3px 0;" disabled>{{ value }}</u-radio>
			  </u-radio-group>
			  <u-checkbox-group  v-model="cheOption"  :wrap="true" v-if="val.questionType == '多选'">
			  			<u-checkbox 
							v-for="(value, key, ex) in val.optionSettings" :key="ex" :label="value" style="padding: 3px 0;" disabled
			  			>{{value}}</u-checkbox>
			  		</u-checkbox-group>
					
			<u-input type="text" value="" v-if="val.questionType == '文本'" border  disabled/>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cheOption:null,
				selectedOption:null,
				tableList:{
					
				}
			};
		},
		onLoad(option) {
				
			this.tableList  = JSON.parse(option.detail)
			if(this.tableList.cereQuestionManagements){
				if(this.tableList.cereQuestionManagements.length >0){
					this.tableList.cereQuestionManagements.map(item=>{
					item.optionSettings  = JSON.parse(item.optionSettings)
							if (Object.keys(item.optionSettings).length > 0) {
							       this.selectedOption = Object.keys(item.optionSettings)[0];
							     }
						})
				}
			}else{
			
				
				
				this.tableList = JSON.parse(this.tableList)
				// this.items.map(tem=>{
				// 	tem.optionSettings = `{${tem.optionSettings.map(item => `"ules":"${item.ules}"`).join(',')}}`
				
				// })
				this.tableList.msg.map(item=>{
					item.optionSettings = `{${item.optionSettings.map((val,item) => `"${item +1}":"${val.ules}"`).join(',')}}`
				item.optionSettings  = JSON.parse(item.optionSettings)
						if (Object.keys(item.optionSettings).length > 0) {
						       this.selectedOption = Object.keys(item.optionSettings)[0];
						     }
					})
			}
		 
			
		},
		mounted() {
	
		},
		methods:{
			
		}
	}
</script>

<style>
	
</style>