<template>
	<view class="app">
		<view class="toptitle">
			{{item.surveySubject==1001?'高血压评估问卷':item.surveySubject==1002?'糖尿病评估问卷':item.surveySubject==1003?
		'脑卒中评估问卷':item.surveySubject==1004?'慢阻肺评估问卷':item.surveySubject==1005?'慢病评估问卷':item.surveySubject==1006?'糖尿病肾病评估问卷':item.surveySubject==1007?
		'糖尿病眼病评估问卷':item.surveySubject==1008?'糖尿病足病评估问卷':''}}
		</view>
		<view class="item" v-for="(item,index) in infoslist" :key="index">
			<view class="title">
				{{Number(index)+1}}、{{item.questionName}}
			</view>
			<view class="text">
				{{item.optionContent}}
			</view>
		</view>
	</view>
</template>

<script>
	import {
		answer,
	} from '@/api/questionnaire/index.js'
	import {
		surveylist
	} from '@/api/pagesC/healthtest/index.js'
	export default {
		data() {
			return {
				infoslist: null,
				item: null,
				query: {
					pageNum: 1,
					pageSize: 10,
				}
			};
		},
		methods: {
			infos() {
				surveylist(this.query).then(res => {
					res.rows.forEach(e => {
						if (e.surveySubject == this.item.surveySubject) {
							e.questions.forEach(el => el.optionContent = '')
							this.infoslist = e.questions
							this.info(this.item.recordId)
						}
					})
				})
			},
			info(id) {
				answer(id).then(res => {
					res.data.forEach(e => {
						this.infoslist.forEach(el => {
							el.optionContent = e.optionContent
						})
					})
				})
			},
		},
		onLoad(options) {
			this.infos()
			this.item = JSON.parse(options.item)
		}
	}
</script>

<style lang="scss">
	.app {
		width: 96%;
		margin: 16rpx auto;
		background: #FFFFFF;
		box-shadow: 0rpx 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
		border-radius: 5rpx;
		padding-bottom: 200rpx;

		.toptitle {
			width: 94%;
			margin: 0 auto;
			border-bottom: 2rpx solid #C1C1C1;
			font-size: 28rpx;
			color: #333333;
			line-height: 80rpx;
		}

		.btns {
			width: 90%;
			margin: 100rpx auto;
			background-color: #26A888;
			text-align: center;
			line-height: 60rpx;
			height: 60rpx;
			color: #fff;
		}

		.item {
			width: 90%;
			margin: 0 auto;
			padding: 30rpx 0;

			::v-deep .u-radio {
				padding: 20rpx;
			}

			.title {
				padding: 40rpx 0 20rpx;
				font-size: 28rpx;
				font-weight: 400;
				color: #333333;
			}

			::v-deep .uni-picker-container {
				width: 100%;
				height: 63rpx;
				background: #A7A7A7;
				line-height: 63rpx;
				opacity: 0.1;
				border-radius: 5rpx;
			}
		}
	}
</style>