<template>
	<view class="bg">
		<view class="introduce">
			<image src="https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/introduce.png" mode="widthFix">
			</image>
		</view>
		<view class="process"></view>
		<view class="result_box">
			<view class="role_medal">
				<image v-if="roleList[role]" :src="roleList[role].medal" mode="widthFix"></image>
			</view>
			<view class="score_bar">
				<view class="score_title"><text>得分：</text><text class="score_num">{{scoreNum}}</text></view>
				<view class="score_percentage">
					<view class="score_wrap">
						<image class="process_bar" :style="{'left': percentage}"
							src="https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/process_bar.png"
							mode="widthFix"></image>
					</view>
					<view class="score_text">{{parseInt(scoreNum)}}/{{parseInt(maxScore)}}</view>
				</view>
				<view class="score_explain">注: 得分越高，情商水平越高</view>
			</view>
			<view class="role_name">
				<image v-if="roleList[role]" :src="roleList[role].name" mode="heightFix"></image>
			</view>
			<view class="role_img">
				<image v-if="roleList[role]" :src="roleList[role].img" mode="heightFix"></image>
			</view>
		</view>
		<view class="result_box2">
			<image class="fx_title" src="https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/fx_title.png"
				mode="widthFix">
			</image>
			<view class="result_box_r">
				<view class="c_item" v-for="item in (segmentation(improvementSuggestions))">
					<view class="list_style_bg"></view>
					<text style="flex: 1;">{{item}}</text>
				</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"
	const photoUrls = `${photoUrl}api/show?filePath=./webo`
	console.log(photoUrl);
	export default {
		data() {
			return {
				isChecked: true,
				isShake: false,
				scaleDetail: {},
				questionList: [],
				currentQuestion: {},
				currentAnswerList: [],
				currentIndex: 0,
				userAnswerList: [],
				resultId: '',
				isLoading: false,
				isDisbale: false,
				roleList: {
					'坚韧黑铁': {
						name: `${photoUrls}/EQtest/role/role_name1.png`,
						img: `${photoUrls}/EQtest/role/role_img1.png`,
						medal: `${photoUrls}/EQtest/role/role_medal1.png`
					},
					'英勇黄铜': {
						name: `${photoUrls}/EQtest/role/role_name2.png`,
						img: `${photoUrls}/EQtest/role/role_img2.png`,
						medal: `${photoUrls}/EQtest/role/role_medal1.png`
					},
					'英勇黄铜+': {
						name: `${photoUrls}/EQtest/role/role_name3.png`,
						img: `${photoUrls}/EQtest/role/role_img2.png`,
						medal: `${photoUrls}/EQtest/role/role_medal2.png`
					},
					'不屈白银': {
						name: `${photoUrls}/EQtest/role/role_name4.png`,
						img: `${photoUrls}/EQtest/role/role_img3.png`,
						medal: `${photoUrls}/EQtest/role/role_medal3.png`
					},
					'不屈白银+': {
						name: `${photoUrls}/EQtest/role/role_name5.png`,
						img: `${photoUrls}/EQtest/role/role_img3.png`,
						medal: `${photoUrls}/EQtest/role/role_medal3.png`
					},
					'荣耀黄金': {
						name: `${photoUrls}/EQtest/role/role_name6.png`,
						img: `${photoUrls}/EQtest/role/role_img4.png`,
						medal: `${photoUrls}/EQtest/role/role_medal4.png`
					},
					'荣耀黄金+': {
						name: `${photoUrls}/EQtest/role/role_name7.png`,
						img: `${photoUrls}/EQtest/role/role_img4.png`,
						medal: `${photoUrls}/EQtest/role/role_medal4.png`
					},
					'华贵铂金': {
						name: `${photoUrls}/EQtest/role/role_name8.png`,
						img: `${photoUrls}/EQtest/role/role_img5.png`,
						medal: `${photoUrls}/EQtest/role/role_medal5.png`
					},
					'华贵铂金+': {
						name: `${photoUrls}/EQtest/role/role_name9.png`,
						img: `${photoUrls}/EQtest/role/role_img5.png`,
						medal: `${photoUrls}/EQtest/role/role_medal5.png`
					},
					'流光翡翠': {
						name: `${photoUrls}/EQtest/role/role_name10.png`,
						img: `${photoUrls}/EQtest/role/role_img6.png`,
						medal: `${photoUrls}/EQtest/role/role_medal6.png`
					},
					'璀璨钻石': {
						name: `${photoUrls}/EQtest/role/role_name11.png`,
						img: `${photoUrls}/EQtest/role/role_img7.png`,
						medal: `${photoUrls}/EQtest/role/role_medal7.png`
					},
					'超凡大师': {
						name: `${photoUrls}/EQtest/role/role_name12.png`,
						img: `${photoUrls}/EQtest/role/role_img8.png`,
						medal: `${photoUrls}/EQtest/role/role_medal8.png`
					},
					'傲世宗师': {
						name: `${photoUrls}/EQtest/role/role_name13.png`,
						img: `${photoUrls}/EQtest/role/role_img9.png`,
						medal: `${photoUrls}/EQtest/role/role_medal9.png`
					},
					'最强王者': {
						name: `${photoUrls}/EQtest/role/role_name14.png`,
						img: `${photoUrls}/EQtest/role/role_img10.png`,
						medal: `${photoUrls}/EQtest/role/role_medal10.png`
					}
				},
				resultId: '',
				role: '',
				improvementSuggestions: '',
				scoreNum: 0,
				maxScore: 0,
				minScore: 0
			}
		},
		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) => {
							console.log('222:', new Date().getTime());
							console.log("----测试结果--->", res);
							if (res.code == 200) {
								_this.testResult = JSON.parse(res.data?.userRecordEntity?.testResult)[0];
								_this.role = _this.testResult.newTableContext.result[0].symptom;
								_this.improvementSuggestions = _this.testResult.newTableContext.result[0]
									.improvementSuggestions;
								_this.scoreNum = _this.testResult.newTableContext.result[0].score;
								_this.maxScore = _this.testResult.newTableContext.result[0].maxScore;
							} else if (res.code == 401) {} else {
								(res) => {
									console.log("世界上绝对绝对绝对绝对绝对的", res);
								}
							}
						})
			},
			getNameUrl() {
				console.log(`${photoUrls}/EQtest/role/role_name1.png`)
				return `${photoUrls}/EQtest/role/role_name1.png`
			},
			segmentation(str) {
				return str.split('\n');
			}
		}
	}
</script>

<style scoped>
	.bg {
		width: 100%;
		min-height: 1900rpx;
		background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/test_result_bg.png) no-repeat top, url(https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/test_result_bg2.png) repeat center 1498rpx;
		background-size: 100% auto;
		padding-bottom: 40rpx;
		overflow: hidden;
	}

	.role_name {
		position: relative;
		margin: 40rpx 0 0 40rpx;
		z-index: 2;
	}

	.role_name image {
		height: 621rpx;
	}

	.role_img {
		position: absolute;
		top: 310rpx;
		right: -20rpx;
	}

	.role_img image {
		height: 570rpx;
	}

	.result_box {
		width: 706rpx;
		min-height: 956rpx;
		padding-bottom: 28rpx;
		background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/result_bg_w.png) no-repeat top;
		background-size: 100% auto;
		overflow: hidden;
		margin: 18rpx auto;
		border-radius: 33rpx;
		position: relative;
	}

	.result_box2 {
		width: 706rpx;
		min-height: 548rpx;
		padding-bottom: 28rpx;
		background: #E5FAFA;
		overflow: hidden;
		margin: 0 auto;
		border-radius: 33rpx;
		position: relative;
	}

	.role_medal {
		position: absolute;
		right: 50rpx;
		top: 0;
	}

	.role_medal image {
		width: 155rpx;
	}

	.result_box_r {
		box-sizing: border-box;
		width: 660rpx;
		min-height: 283rpx;
		padding: 26rpx;
		margin: 0 auto 0;
		background: #FFFFFF url(https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/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: #333333;
		line-height: 1.8;
		text-align: justify;
		letter-spacing: 3rpx;
	}

	.c_item {
		display: flex;
		align-items: flex-start;
		text-align: justify;
		letter-spacing: 2px;
		margin-bottom: 16rpx;
	}

	.list_style_bg {
		width: 16rpx;
		height: 16rpx;
		background: #fd7884;
		background-size: 100% auto;
		border-radius: 50%;
		margin: 17rpx 10rpx 0 0;
	}

	.score_title {
		display: flex;
		align-items: center;
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: bolder;
		font-size: 36rpx;
		color: #333333;
		line-height: 31rpx;
		margin: 110rpx 0 25rpx 32rpx;
	}

	.score_num {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: bold;
		font-size: 81rpx;
		color: #FF9C00;
		line-height: 51rpx;
		/* text-stroke: 4px #FFFFFF;
		background: linear-gradient(269deg, #FF443D 0%, #FF9C00 100%);
		-webkit-text-stroke: 4px #FFFFFF;
		-webkit-background-clip: text;
		-webkit-text-fill-color: transparent; */
	}

	.score_percentage {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 420rpx;
		height: 46rpx;
		background: url(https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/score_percentage_bg.png) no-repeat center;
		background-size: cover;
		margin: 4rpx 0 0 72rpx;
	}

	.score_wrap {
		width: 318rpx;
		height: 32rpx;
		margin: 0 0 0 12rpx;
		position: relative;
		overflow-x: hidden;
		border-radius: 25rpx;
	}

	.process {
		overflow: hidden;
	}

	.process_bar {
		width: 318rpx;
		position: absolute;
		left: -100rpx;
	}

	.score_text {
		font-family: Alibaba PuHuiTi 2.0;
		font-weight: normal;
		font-size: 18rpx;
		color: #FFFFFF;
		line-height: 16rpx;
		margin-right: 16rpx;
	}

	.sm_title {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: bold;
		font-size: 36rpx;
		color: #333333;
		line-height: 31rpx;
		margin-bottom: 22rpx;
	}

	.report_desc {
		margin: 30rpx 38rpx;
		letter-spacing: 1px;
	}

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

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

	.introduce {
		width: 702rpx;
		margin: 174rpx auto 0;
	}

	.introduce image {
		width: 100%;
	}

	.fx_title {
		width: 383rpx;
		margin: 32rpx 0 20rpx 24rpx;
	}

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

	.score_explain {
		font-family: 'Alibaba PuHuiTi 2.0';
		font-weight: normal;
		font-size: 20rpx;
		color: #999999;
		line-height: 31rpx;
		margin-left: 86rpx;
	}
</style>