<template>
	<view class="bg">
		<view style="overflow: hidden;"></view>
		<view class="scale_name">象牙塔闯关：你是适应达人 还是新手上路？</view>
		<view class="test_time">测试时间：{{ time }}</view>
		<view class="role_medal">测试结果</view>
		<view class="chart_wrap">
			<view class="situation">
				<view class="situation_title">测评得分</view>
				<view class="situation_score">分数：<text>{{ dimensions[0].score }}</text>（满分{{dimensions[0].maxScore}}）
				</view>
				<view class="situation_conclusion">结论：</view>
				<image class="situation_role" v-if="dimensions.length > 0"
					:src="`https://test.jue-ming.com:8849/api/show?filePath=./webo/Adapt/${roleInfo[dimensions[0].symptom]}.png`"
					mode="widthFix">
				</image>
			</view>
			<view class="radar_wrap">
				<leiDa2 :options="options" />
			</view>
			<view class="my_table">
				<view class="t-head">
					<view width="50%">维度</view>
					<view>得分</view>
					<view>满分</view>
				</view>
				<view class="t-body" v-for="(item, index) in scoreList">
					<view>{{ indicator[index].name }}</view>
					<view>{{ item }}</view>
					<view style="border-right: 0;">{{maxScoreList[index]}}</view>
				</view>
			</view>
		</view>
		<view class="rgtd_box" v-for="item in dimensions">
			<view class="rgtd_box_title"><text>{{ item.name }}</text></view>
			<view class="rgtd_box_wrap">
				<view style="overflow: hidden;"></view>
				<!-- <view v-for="(item, index) in resultObj">
					<template v-if="index > 0"> -->
				<!-- <view class="dimension_name"><text>{{item.name}}</text></view> -->
				<view class="dimension_title">
					得分
				</view>
				<view class="dimension_content dc1">
					<text>{{ item.score }}</text>
				</view>
				<view class="dimension_title">
					维度结论
				</view>
				<view class="dimension_content dc1">
					<text>{{ item.symptom }}</text>
				</view>
				<view class="dimension_title">
					维度说明
				</view>
				<view class="dimension_content">
					{{ item.nameExplain }}
				</view>
				<view class="dimension_title">
					维度解释
				</view>
				<view class="dimension_content">
					{{ item.improvementSuggestions }}
				</view>
			</view>
		</view>
		<view class="report_desc">
			<view class="desc_title">报告阅读说明</view>
			<view class="desc_txt">谢谢您的参与，阅读本报告时，请注意以下内容:</view>
			<view style="display: flex;">
				<view class="list_mark">·</view>
				<view class="desc_txt">本结果仅供参考，不可作为临床诊断的依据；</view>
			</view>
			<view style="display: flex;">
				<view class="list_mark">·</view>
				<view class="desc_txt">如对报告有不理解的地方，建议咨询专业人员；</view>
			</view>
			<view style="display: flex;">
				<view class="list_mark">·</view>
				<view class="desc_txt">如结果与你自己或他人的感受有出入，可回忆在测试时是否有事情影响到你，或自己回答时是否有所顾虑。</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getRecordById
	} from "@/api/index.js";
	import {
		photoUrl
	} from "@/common/config.js"
	const photoUrls = `${photoUrl}api/show?filePath=./webo`
	import {
		getTestTime
	} from "@/utils/util.js"
	import leiDa2 from "@/components/mpvueEcharts/leiDa2.vue"
	import options from "./echartsData.js";
	export default {
		components: {
			leiDa2
		},
		data() {
			return {
				photoUrl: photoUrl,
				isChecked: true,
				isShake: false,
				scaleDetail: {},
				questionList: [],
				currentQuestion: {},
				currentAnswerList: [],
				currentIndex: 0,
				userAnswerList: [],
				resultId: '',
				isLoading: false,
				isDisbale: false,
				resultObj: [],
				resultId: '',
				scoreNum: 0,
				maxScore: 450,
				minScore: 0,
				keywords: '',
				characteristic: '', // 特点
				time: '',
				indicator: [],
				scoreList: [],
				maxScoreList: [],
				totalScore: {},
				dimensions: [],
				roleInfo: {
					'适应能力较低': 'role1',
					'适应能力中等': 'role2',
					'适应能力较强': 'role3',
				},
				options: options
			}
		},
		onLoad(options) {
			if (options && options.resultId) {
				this.resultId = options.resultId
				this.getScaleTestResults(this.resultId);
			}
		},
		computed: {
			percentage() {
				return ((this.scoreNum / this.maxScore) * 627) + 'rpx'
			}
		},
		methods: {
			getScaleTestResults(id) {
				let _this = this;
				_this.$request
					.get({
						url: `${getRecordById}?id=${id}`,
						loadingTip: "加载中...",
						data: {},
					})
					.then(
						(res) => {
							if (res.code == 200) {
								let testResult = JSON.parse(res.data?.userRecordEntity?.testResult);
								let result = testResult[0]['newTableContext']['result'];
								result.forEach((item, index) => {
									if (index > 0) {
										this.indicator.push({
											name: item.name
										});
										this.scoreList.push(item.score)
										this.maxScoreList.push(item.maxScore);
									}
									this.dimensions.push(item);
								})
								this.time = getTestTime(res.data.userRecordEntity.testDate);
								this.totalScore = result[0].score;
								this.options.radar.indicator = this.indicator;
								this.options.series[0].data[0].value = this.maxScoreList;
								this.options.series[0].data[1].value = this.scoreList;
							} else if (res.code == 401) {} else {
								(res) => {
									console.log("世界上绝对绝对绝对绝对绝对的", res);
								}
							}
						})
			},
			getAdvantage(str) {
				let tempArr = str.split("——");
				let title = tempArr[0].split(".")
				let advant = {
					title: title[1],
					content: tempArr[1]
				}
				return advant
			},
			getTips(str) {
				let temp = str.split(':');
				return `${temp[0]}是指${temp[1]}`
			}
		}
	}
</script>

<style lang="less" scoped>
	.bg {
		width: 100%;
		background: linear-gradient(0deg, #F4BEF0 0%, #9051FB 100%);
		position: relative;
		padding-bottom: 100rpx;
	}

	.scale_name {
		width: 423rpx;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: bold;
		font-size: 36rpx;
		color: #FFFFFF;
		margin: 20rpx 0 0 32rpx;
	}

	.test_time {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 28rpx;
		color: #ffffff;
		margin: 16rpx 0 0 32rpx;
	}

	.role_medal {
		width: 205rpx;
		line-height: 53rpx;
		background: #FFFFFF;
		border-radius: 27rpx;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 32rpx;
		color: #333333;
		text-align: center;
		position: absolute;
		top: 36rpx;
		right: 25rpx;
	}


	.role_wrap {
		position: relative;
	}

	.role_char {
		width: 714rpx;
		height: 156rpx;
		display: flex;
		justify-content: space-around;
		align-items: center;
		position: absolute;
		left: 18rpx;
		bottom: 0;
	}

	.char_item {
		width: 30%;
		font-family: 'ZhankuKuaiLeTi';
		font-weight: 800;
		font-size: 36rpx;
		color: #333333;
		line-height: 52rpx;
		text-align: center;
	}


	.shadow_img {
		display: block;
		width: 170rpx;
		position: absolute;
		left: 50%;
		bottom: -6rpx;
		transform: translateX(-50%);
	}

	.role_name {
		text-align: center;
		margin: 202rpx 0 0 0;
	}

	.role_name image {
		width: 550rpx;
	}

	.temp_type {
		width: 714rpx;
		margin: 0 auto;
	}

	.carton {
		width: 718rpx;
		margin: 0 16rpx;
	}

	.score_percentage {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 627rpx;
		height: 20rpx;
		background: #FFFFFF;
		border-radius: 10rpx;
		border-radius: 14rpx;
		margin: 14rpx 0 8rpx 20rpx;
		position: relative;
		z-index: 3;
		overflow-x: hidden;
	}

	.process_bar {
		width: 0rpx;
		height: 16rpx;
		background: #FF1E00;
		border-radius: 8rpx;
		box-shadow: 0rpx 0rpx 4rpx 2rpx #FFC600;
		position: absolute;
		top: 3rpx;
		left: 4rpx;
	}

	.rgtd_box {
		box-sizing: border-box;
		width: 712rpx;
		min-height: 700rpx;
		padding: 24rpx;
		margin: 0 auto 124rpx;
		position: relative;
		z-index: 0;
		background: #7A2FFF;
		box-shadow: 0rpx 8rpx 11rpx 0rpx rgba(47, 24, 76, 0.22);
		border-top: 2px solid #FFFDA1;
		border-radius: 58rpx;
	}

	.rgtd_box_title {
		width: 701rpx;
		height: 97rpx;
		background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Adapt/title_bg.png) no-repeat center;
		background-size: 488rpx 30rpx;
		text-align: center;
	}

	.rgtd_box_title text {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: 600;
		font-size: 40rpx;
		color: #FFFDA2;
		line-height: 97rpx;
		margin-top: 20rpx;
	}

	.dimension_name {
		width: 465rpx;
		height: 79rpx;
		padding-top: 2rpx;
		background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/MarriageQuality/dimension_name.png) no-repeat;
		background-size: cover;
		margin: 60rpx auto 0;
		text-align: center;
	}

	.dimension_name text {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: bold;
		font-size: 44rpx;
		color: #FFFEFE;
	}

	.dimension_title {
		box-sizing: border-box;
		width: 100%;
		background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/MarriageQuality/list_style_bg.png) no-repeat 16rpx center;
		background-size: 19rpx auto;
		padding: 26rpx 0 0 44rpx;
		font-family: Alibaba PuHuiTi 2.0;
		font-weight: 600;
		font-size: 32rpx;
		color: #FFFDA1;
	}

	.dt1 {
		margin-top: 78rpx;
	}

	.dimension_content {
		box-sizing: border-box;
		width: 598rpx;
		min-height: 91rpx;
		padding: 30rpx 32rpx;
		background: #FFFFFF;
		border-radius: 28rpx;
		margin: 20rpx auto;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 28rpx;
		color: #333333;
		line-height: 50rpx;
		text-align: justify;
	}

	.dimension_explain {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 20rpx;
		color: #D3987E;
		line-height: 24rpx;
		margin-top: 10rpx;
	}

	.dc1 {
		width: 598rpx;
		line-height: 1;
		background: #FFFFFF;
		box-shadow: 0rpx 7rpx 8rpx 0rpx rgba(4, 129, 200, 0.13);
		border-radius: 48rpx;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 32rpx;
		color: #7A2FFF;
		text-align: center;
	}

	.rgtd_box_wrap {
		box-sizing: border-box;
		width: 668rpx;
		min-height: 700rpx;
		margin: 0 auto;
		position: relative;
		z-index: 1;
		padding-top: 46rpx;
	}

	.rgtd_box_content {
		box-sizing: border-box;
		width: 674rpx;
		min-height: 390rpx;
		padding: 28rpx 47rpx;
		background: #FFF9FA;
		border-radius: 18rpx;
		margin: 0 auto;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 32rpx;
		color: #333333;
		line-height: 50rpx;
		letter-spacing: 2rpx;
	}

	.rgtd_text {
		width: 181rpx;
		margin: 6rpx 0 0 39rpx;
	}

	.emo_img {
		width: 112rpx;
		margin-right: 7rpx;
	}

	.rgtg_content {
		box-sizing: border-box;
		width: 714rpx;
		padding: 40rpx;
		background: #FFFFFF;
		border-radius: 35rpx;
		margin: 0 auto;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 28rpx;
		color: #333333;
		line-height: 1.8;
		letter-spacing: 2rpx;
	}

	.mrmj_content {
		display: flex;
		flex-wrap: wrap;
		min-height: 255rpx;
	}

	.star_img {
		width: 92rpx;
		margin-right: 43rpx;
	}

	.mrmj_content .mr_name {
		height: 44rpx;
		padding: 0 34rpx;
		margin: 4rpx 10rpx;
		background: #E4FFD3;
		border-radius: 22rpx;
		border: 1px solid #66C666;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 28rpx;
		color: #0B7000;
		line-height: 44rpx;
		text-align: center;
	}

	.mr_pic_box {
		width: 100%;
	}

	.mr_pic {
		width: 316rpx;
		margin: 5rpx 8rpx;
	}

	.advantage_title {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: bold;
		font-size: 32rpx;
		color: #333333;
		margin: 25rpx 5rpx 8rpx;
	}

	.advantage_content {
		box-sizing: border-box;
		width: 632rpx;
		background: #E4FFD3;
		border-radius: 22rpx;
		border: 1px solid #66C666;
		padding: 28rpx;
		margin: 0 auto;
	}

	.ad_item_title {
		display: flex;
		align-items: center;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: bold;
		font-size: 32rpx;
		color: #156300;
	}

	.love_role {
		width: 571rpx;
		margin: 0 auto;
	}

	.single_star {
		width: 32rpx;
		margin: 0 8rpx 4rpx 0;
	}

	.heart_img {
		width: 93rpx;
		margin-right: 16rpx;
	}

	.lover_type_title {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: bold;
		font-size: 32rpx;
		color: #333333;
		line-height: 43rpx;
	}

	.love_decode {
		box-sizing: border-box;
		width: 632rpx;
		padding: 39rpx 30rpx;
		background: #FFE8FD;
		border-radius: 22rpx;
		border: 1px solid #FF59F1;
		margin: 0 auto;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 28rpx;
		color: #333333;
	}


	.result_box {
		width: 702rpx;
		min-height: 807rpx;
		background: #ffffff;
		box-shadow: 0rpx 3rpx 24rpx 0rpx rgba(126, 77, 0, 0.13);
		border-radius: 26rpx;
		margin: 168rpx auto 0;
		position: relative;
	}

	.pad_box {
		width: 100%;
		height: 200rpx;
		border-radius: 26rpx;
		overflow: hidden;
	}

	.title_img {
		height: 60rpx;
		margin: 37rpx 0 0 96rpx;
	}

	.result_box_r {
		box-sizing: border-box;
		width: 702rpx;
		min-height: 453rpx;
		margin: -188rpx auto 0;
		background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/MarriageQuality/result_bg_r.png) no-repeat top;
		background-size: 100% auto;
		border-radius: 33rpx;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 32rpx;
		color: #555555;
		line-height: 50rpx;
		position: relative;
		z-index: 2;
	}


	.r_content {
		width: 600rpx;
		min-height: 307rpx;
		background: #FFE1E1;
		border-radius: 20rpx;
		border: 1px solid #FF6666;
		margin: 20rpx auto 0;
		padding: 30rpx;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 32rpx;
		color: #333333;
		line-height: 50rpx;
		display: flex;
		align-items: flex-start;
	}


	.report_desc {
		padding: 0 38rpx;
		letter-spacing: 1px;
	}

	.desc_title {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 28rpx;
		color: #ffffff;
		line-height: 46rpx;
	}

	.stext {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 20rpx;
		color: #ffffff;
		line-height: 30rpx;
	}

	.desc_txt {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 20rpx;
		color: #ffffff;
		line-height: 30rpx;
	}

	.list_mark {
		line-height: 0.7;
		font-size: 36rpx;
		color: #ffffff;
		font-weight: 600;
		margin-right: 5rpx;
	}

	.analysis_title {
		width: 362rpx;
		position: absolute;
		top: -30rpx;
		left: 50%;
		transform: translateX(-50%);
	}

	.paperclip {
		width: 55rpx;
		position: absolute;
		top: -40rpx;
		left: 38rpx;
	}

	.score_title {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 32rpx;
		color: #333333;
		line-height: 24rpx;
		margin: 0 0 0 5rpx;
	}

	.score_num {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: bold;
		font-size: 93rpx;
		color: #FF1E00;
		text-align: center;
		margin-top: 20rpx;
		line-height: 1.2;
	}

	.score_explain {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 24rpx;
		color: #999999;
		line-height: 34rpx;
		text-align: center;
	}

	.chart_wrap {
		width: 702rpx;
		min-height: 1053rpx;
		background: #FFFFFF;
		border-radius: 16rpx;
		margin: 16rpx auto 100rpx;
		padding-bottom: 30rpx;
	}

	.my_table {
		width: 634rpx;
		line-height: 52rpx;
		margin: 0 auto;
		text-align: center;
		border: 0;
	}

	.my_table {}

	.my_table .t-head {
		width: 634rpx;
		height: 52rpx;
		background: #2394FC;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-size: 28rpx;
		color: #FEFEFE;
	}

	.my_table .t-head,
	.my_table .t-body {
		display: flex;
	}

	.my_table .t-head view,
	.my_table .t-body view {
		flex: 1;
	}

	.my_table .t-body view {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 20rpx;
		color: #333333;
		line-height: 50rpx;
		border-right: 1px solid #E6EFF5;
		border-bottom: 1px solid #E6EFF5;
	}

	.my_table .t-body:nth-child(2n+1) {
		background: #EFF7FF;
	}

	.situation {
		width: 100%;
		min-height: 111rpx;
		background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Adapt/situation_bg.png) no-repeat;
		background-size: 100% auto;
		overflow: hidden;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 32rpx;
		color: #333333;
	}

	.situation_title {
		margin: 24rpx 0 0 26rpx;
	}

	.situation_score {
		font-size: 24rpx;
		margin: 17rpx 0 30rpx 52rpx;

		text {
			font-size: 32rpx;
			color: #FF1E00;
			font-weight: 600;
		}
	}

	.situation_conclusion {
		font-size: 24rpx;
		margin-left: 52rpx;
	}

	.situation_role {
		width: 628rpx;
		height: auto;
		margin-left: 52rpx;
	}

	.radar_wrap {
		width: 100%;
		margin: 26rpx 0;
	}

	.container {
		width: 630rpx !important;
		height: 576rpx !important;
		/* padding: 0 !important; */
		background: #F7F9FA;
		border-radius: 27rpx;
		margin: 0 auto;
	}
</style>