<template>
	<view v-if="role" class="" :class="['bg', `bg${roleList[role].type}`]">
		<view class="scale_name">你的家庭关系健康吗？</view>
		<view class="test_time">测试时间：{{time}}</view>
		<view class="role_medal">
			<image src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Family/role/result_title.png"
				mode="widthFix"></image>
		</view>
		<view class="rgtd_box" style="margin-top: 490rpx;">
			<view style="overflow: hidden;"></view>
			<view class="rgtd_box_wrap">
				<view class="rgtd_box_title">
					<image class="title_img"
						src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Family/role/jgzp.png"
						mode="widthFix">
					</image>
					<image class="carton"
						:src="`https://test.jue-ming.com:8849/api/show?filePath=./webo/Family/role/role_img${roleList[role].type}.png`"
						mode="widthFix"></image>
				</view>
				<view class="rgtd_box_content">
					{{resultObj[0].improvementSuggestions}}
				</view>
			</view>
		</view>
		<view class="rgtd_box">
			<view style="overflow: hidden;"></view>
			<view class="rgtd_box_wrap">
				<view class="rgtd_box_title">
					<image class="title_img"
						src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Family/role/wtjj.png"
						mode="widthFix">
					</image>
				</view>
				<view class="remark_A">{{getAdvantage(resultObj[1].improvementSuggestions)['title']}}</view>
				<view class="rgtd_box_content">{{getAdvantage(resultObj[1].improvementSuggestions)['content']}}</view>
				<view class="jd">
					*{{resultObj[1].name + resultObj[1].nameExplain}}
				</view>
			</view>
		</view>
		<view class="rgtd_box">
			<view style="overflow: hidden;"></view>
			<view class="rgtd_box_wrap">
				<view class="rgtd_box_title">
					<image class="title_img"
						src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Family/role/gtwt.png"
						mode="widthFix">
					</image>
				</view>
				<view class="remark_B">{{getAdvantage(resultObj[2].improvementSuggestions)['title']}}</view>
				<view class="rgtd_box_content">{{getAdvantage(resultObj[2].improvementSuggestions)['content']}}</view>
				<view class="jd">
					*{{resultObj[2].name + resultObj[2].nameExplain}}
				</view>
			</view>
		</view>
		<view class="rgtd_box">
			<view style="overflow: hidden;"></view>
			<view class="rgtd_box_wrap">
				<view class="rgtd_box_title">
					<image class="title_img"
						src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Family/role/jsdw.png"
						mode="widthFix">
					</image>
				</view>
				<view class="remark_A">{{getAdvantage(resultObj[3].improvementSuggestions)['title']}}</view>
				<view class="rgtd_box_content">{{getAdvantage(resultObj[3].improvementSuggestions)['content']}}</view>
				<view class="jd">
					*{{resultObj[3].name + resultObj[3].nameExplain}}
				</view>
			</view>
		</view>
		<view class="rgtd_box">
			<view style="overflow: hidden;"></view>
			<view class="rgtd_box_wrap">
				<view class="rgtd_box_title">
					<image class="title_img"
						src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Family/role/qgfy.png"
						mode="widthFix">
					</image>
				</view>
				<view class="remark_B">{{getAdvantage(resultObj[4].improvementSuggestions)['title']}}</view>
				<view class="rgtd_box_content">{{getAdvantage(resultObj[4].improvementSuggestions)['content']}}</view>
				<view class="jd">
					*{{resultObj[4].name + resultObj[4].nameExplain}}
				</view>
			</view>
		</view>
		<view class="rgtd_box">
			<view style="overflow: hidden;"></view>
			<view class="rgtd_box_wrap">
				<view class="rgtd_box_title">
					<image class="title_img"
						src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Family/role/qgjr.png"
						mode="widthFix">
					</image>
				</view>
				<view class="remark_A">{{getAdvantage(resultObj[5].improvementSuggestions)['title']}}</view>
				<view class="rgtd_box_content">{{getAdvantage(resultObj[5].improvementSuggestions)['content']}}</view>
				<view class="jd">
					*{{resultObj[5].name + resultObj[5].nameExplain}}
				</view>
			</view>
		</view>
		<view class="rgtd_box">
			<view style="overflow: hidden;"></view>
			<view class="rgtd_box_wrap">
				<view class="rgtd_box_title">
					<image class="title_img"
						src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Family/role/xwkz.png"
						mode="widthFix">
					</image>
				</view>
				<view class="remark_B">{{getAdvantage(resultObj[6].improvementSuggestions)['title']}}</view>
				<view class="rgtd_box_content">{{getAdvantage(resultObj[6].improvementSuggestions)['content']}}</view>
				<view class="jd">
					*{{resultObj[6].name + resultObj[6].nameExplain}}
				</view>
			</view>
		</view>
		<view class="rgtd_box">
			<view style="overflow: hidden;"></view>
			<view class="rgtd_box_wrap">
				<view class="rgtd_box_title">
					<image class="title_img"
						src="https://test.jue-ming.com:8849/api/show?filePath=./webo/Family/role/zdgn.png"
						mode="widthFix">
					</image>
				</view>
				<view class="remark_A">{{getAdvantage(resultObj[7].improvementSuggestions)['title']}}</view>
				<view class="rgtd_box_content">{{getAdvantage(resultObj[7].improvementSuggestions)['content']}}</view>
				<view class="jd">
					*{{resultObj[7].name + resultObj[7].nameExplain}}
				</view>
			</view>
		</view>
		<view class="report_desc">
			<view class="desc_title">报告阅读说明</view>
			<view class="stext">谢谢您的参与，阅读本报告时，请注意以下内容:</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"
	import {
		getTestTime
	} from "@/utils/util.js"
	const photoUrls = `${photoUrl}api/show?filePath=./webo`
	export default {
		data() {
			return {
				photoUrl: photoUrl,
				isChecked: true,
				isShake: false,
				scaleDetail: {},
				questionList: [],
				currentQuestion: {},
				currentAnswerList: [],
				currentIndex: 0,
				userAnswerList: [],
				resultId: '',
				isLoading: false,
				isDisbale: false,
				roleList: {
					'家庭关系需用心经营': {
						type: 1,
						img: `${photoUrls}/Family/role/role_enfj.png`,
						mrBg: '#E4FFD3',
						mrBorder: '#66C666',
						mrColor: '#0B7000'
					},
					'家庭关系较为和睦': {
						type: 2,
						img: `${photoUrls}/Family/role/role_enfp.png`,
						mrBg: '#E4FFD3',
						mrBorder: '#66C666',
						mrColor: '#0B7000'
					},
					'家庭关系幸福美满': {
						type: 3,
						img: `${photoUrls}/Family/role/role_entj.png`,
						mrBg: '#F7E9FF',
						mrBorder: '#B262E1',
						mrColor: '#962ED4'
					}
				},
				resultObj: [],
				resultId: '',
				role: '',
				scoreNum: 0,
				maxScore: 0,
				minScore: 0,
				keywords: '',
				characteristic: '', // 特点
			}
		},
		onLoad(options) {
			if (options && options.resultId) {
				this.resultId = options.resultId
				this.getScaleTestResults(this.resultId);
			}
		},
		computed: {
			percentage() {
				return (((this.scoreNum / this.maxScore) * 318) - 318) + 'rpx'
			}
		},
		methods: {
			getScaleTestResults(id) {
				let _this = this;
				_this.$request
					.get({
						url: `${getRecordById}?id=${id}`,
						loadingTip: "加载中...",
						data: {},
					})
					.then(
						(res) => {
							if (res.code == 200) {
								_this.testResult = JSON.parse(res.data?.userRecordEntity?.testResult)[0];
								console.log(_this.testResult);
								_this.role = _this.testResult.tableContext[1].value[0];
								_this.resultObj = _this.testResult.newTableContext.result;
								_this.time = getTestTime(res.data.userRecordEntity.testDate);
							} else if (res.code == 401) {} else {
								(res) => {
									console.log("世界上绝对绝对绝对绝对绝对的", res);
								}
							}
						})
			},
			getAdvantage(str) {
				let tempArr = str.split("——");
				let advant = {
					title: tempArr[0],
					content: tempArr[1]
				}
				return advant
			}
		}
	}
</script>

<style scoped>
	.bg {
		width: 100%;
		min-height: 6365rpx;
		background: #FD654D;
		overflow: hidden;
		position: relative;
		padding-bottom: 200rpx;
	}

	.bg1 {
		background: #FD654D url('https://test.jue-ming.com:8849/api/show?filePath=./webo/Family/role/bg1.png') no-repeat top;
		background-size: 100% auto;
	}

	.bg2 {
		background: #FD654D url('https://test.jue-ming.com:8849/api/show?filePath=./webo/Family/role/bg2.png')no-repeat top;
		background-size: 100% auto;
	}


	.bg3 {
		background: #FD654D url('https://test.jue-ming.com:8849/api/show?filePath=./webo/Family/role/bg3.png')no-repeat top;
		background-size: 100% auto;
	}

	.scale_name {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: bold;
		font-size: 40rpx;
		color: #FFFFFF;
		text-shadow: 0rpx 3rpx 3rpx rgba(147, 52, 105, 0.85);
		margin: 29rpx 0 0 39rpx;
	}

	.test_time {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 28rpx;
		color: #FFFEFE;
		margin-left: 39rpx;
	}

	.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: 286rpx;
		position: absolute;
		bottom: 8rpx;
		right: 27rpx;
	}

	.rgtd_box {
		width: 702rpx;
		background: #FF9429;
		border-radius: 44rpx;
		margin: 0 auto;
		position: relative;
		margin-top: 59rpx;
	}

	.rgtd_box_title {
		width: 100%;
		height: 86rpx;
		background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Family/rgtd_box_title_bg.png) no-repeat 300rpx 10rpx;
		background-size: 383rpx auto;
		position: relative;
	}

	.remark_A {
		width: 588rpx;
		line-height: 83rpx;
		background: linear-gradient(90deg, #FFA400 0%, #FB3975 100%);
		border-radius: 42rpx;
		margin: 0 auto 18rpx;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 40rpx;
		color: #FFFEFE;
		text-align: center;
		letter-spacing: 2rpx;
	}

	.remark_B {
		width: 588rpx;
		line-height: 83rpx;
		background: linear-gradient(90deg, #FFF74B 0%, #77FF5F 100%);
		border-radius: 41rpx;
		margin: 0 auto 18rpx;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 40rpx;
		color: #333333;
		text-align: center;
		letter-spacing: 2rpx;
	}

	.rgtd_box_wrap {
		width: 692rpx;
		padding-bottom: 31rpx;
		background: #FFCB97;
		border-radius: 41rpx;
		margin: 5rpx;
	}

	.rgtd_box_content {
		box-sizing: border-box;
		width: 674rpx;
		min-height: 290rpx;
		padding: 28rpx 32rpx;
		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;
		text-align: justify;
	}

	.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;
	}

	.lover_type {
		width: 571rpx;
		font-family: 'ZhankuKuaiLeTi';
		font-weight: 400;
		font-size: 133rpx;
		color: #333333;
		line-height: 149rpx;
		text-align: center;
		margin: 50rpx auto 30rpx;
		background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/Family/role/lover_type_bg.png) no-repeat center bottom;
		background-size: 100% auto;
	}

	.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 {
		width: 300rpx;
		position: absolute;
		top: -36rpx;
		left: -10rpx;
	}

	.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/Family/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: 30rpx 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;
	}

	.role_medal {
		position: absolute;
		right: 38rpx;
		top: 32rpx;
	}

	.role_medal image {
		width: 205rpx;
	}

	.jd {
		padding: 32rpx;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 28rpx;
		color: #CD6A06;
		line-height: 50rpx;
		letter-spacing: 4rpx;
	}
</style>