<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<style>
		* {
			padding: 0;
			margin: 0;
		}

		.flex-2 {
			flex: 2;
		}

		.flex-3 {
			flex: 3;
		}

		.flex-4 {
			flex: 4;
		}

		.flex-8 {
			flex: 8;
		}

		.flex-10 {
			flex: 10;
		}

		.main-content {
			width: 1000px;
			font-size: 30px;
			font-family: "Microsoft YaHei";
			font-weight: bold;
		}

		.page-box {
			width: 1000px;
			display: flex;
			flex-direction: column;
		}

		.page-header {
			display: flex;
			flex-direction: column;
		}

		.clan-user-server {
			height: 120px;
			text-align: center;
			font-size: 45px;
			line-height: 120px;
		}

		.clan {
			display: inline-block;
			padding-right: 10px;
			height: 120px;
		}

		.user {
			display: inline-block;
			height: 120px;
		}

		.server {
			display: inline-block;
			padding-left: 10px;
		}

		.server-border {
			width: 200px;
			height: 50px;
			line-height: 50px;
			text-align: center;
			background-color: #F2F2F2;
			border-radius: 25px;
			font-size: 35px;
		}

		.ship-bar {
			height: 80px;
			font-size: 40px;
			line-height: 80px;
			text-align: center;
			display: flex;
		}

		.ship-level {
			flex: 1;
			text-align: right;
			margin-right: 30px;
		}

		.ship-icon {
			flex: 1;
			text-align: left;
			margin-left: 30px;
		}

		.ship-icon img {
			width: 80px;
			height: 80px;
		}

		.pr {
			display: flex;
			height: 100px;
			font-weight: bold;
			line-height: 60px;
			padding: 0 50px;
		}

		.pr-bar-bg {
			position: relative;
			flex: 1;
			line-height: 80px;
			background-color: #A6A6A6;
			height: 80px;
			border-radius: 40px;
			margin-top: 10px;
			text-align: center;
			color: #FFFFFF;
		}

		.pr-bar {
			position: absolute;
			top: 0;
			left: 0;
			height: 80px;
			z-index: 1;
			border-radius: 40px;
		}

		.pr-number {
			z-index: 99;
			position: absolute;
			left: 0px;
			right: 0px;
			font-size: 35px;
			font-weight: bold;
		}

		.recnet-time {
			text-align: center;
			font-weight: normal;
		}

		.overview-change {
			display: flex;
			margin-top: 30px;
			padding: 0 30px;
			height: 300px;
		}

		.overview-change-item {
			flex: 1;
			display: flex;
			flex-direction: column;
			margin: 0 20px;

		}

		.item-top {
			flex: 5;
			background-color: #F2F2F2;
			border-radius: 16px;
		}

		.item-bottom {
			display: flex;
			flex: 4;
			margin-top: 20px;
		}

		.left-item-bottom {
			background-color: #F2F2F2;
			border-radius: 16px;
		}

		.bottom-mini-item-left {
			flex: 1;
			margin-right: 10px;
			background-color: #F2F2F2;
			border-radius: 16px;
		}

		.bottom-mini-item-right {
			flex: 1;
			margin-left: 10px;
			background-color: #F2F2F2;
			border-radius: 16px;
		}

		.item-top {
			display: flex;
			flex-direction: column;
		}

		.item-top div {
			height: 80px;
			text-align: center;
			font-size: 40px;
		}

		.item-top-top {
			color: #606266;
			font-weight: normal;
			line-height: 100px;
		}

		.item-top-bottom {
			line-height: 60px;
		}

		.left-item-bottom {
			display: flex;
			flex-direction: column;
		}

		.change-pr-title {
			color: #606266;
			height: 60px;
			display: flex;
			font-weight: normal;
			line-height: 70px;
		}

		.change-pr {
			height: 60px;
			line-height: 50px;
			text-align: center;
			font-size: 30px;
		}

		.change-pr-title-left {
			flex: 1;
			font-size: 35px;
			text-align: right;
			margin-right: 30px;
		}

		.change-pr-title-right {
			flex: 1;
			font-size: 20px;
		}

		.bottom-mini-item-left,
		.bottom-mini-item-right {
			display: flex;
			flex-direction: column;
		}

		.mini-item-top {
			color: #606266;
			font-weight: normal;
			line-height: 70px;
		}

		.mini-item-bottom {
			line-height: 45px;
			font-size: 27px;
		}

		.bottom-mini-item-left div,
		.bottom-mini-item-right div {
			height: 60px;
			text-align: center;
		}

		.information-header,
		.day-header {
			margin: 0 200px;
			margin-top: 30px;
			height: 60px;
			line-height: 60px;
			border-radius: 16px;
			background-color: #D9D9D9;
			text-align: center;
		}

		.information-body {
			margin: 0 50px;
			margin-top: 30px;
			display: flex;
			flex-direction: column;
			background-color: #F2F2F2;
			border-radius: 16px;
		}

		.information-col {
			height: 60px;
			display: flex;
			line-height: 60px;
		}

		.information-col-item,
		.day-col-item {
			flex: 1;
			text-align: center;
		}

		.information-table-header {
			color: #606266;
		}

		.information-type {
			color: #909399;
		}

		.day-body {
			margin: 0 50px;
			margin-top: 30px;
		}

		.day-table-header {
			height: 60px;
			line-height: 60px;
			background-color: #D9D9D9;
			display: flex;
			border-radius: 16px;
			color: #606266;
		}

		.date {
			background-color: #D9D9D9;
			width: 300px;
			height: 40px;
			line-height: 40px;
			text-align: center;
			border-radius: 20px;
			margin-top: 10px;
		}

		.day-col {
			display: flex;
			height: 60px;
			line-height: 60px;
			background-color: #F2F2F2;
			border-radius: 30px;
			margin: 10px 0;
		}

		.footer {
			margin-top: 30px;
			text-align: center;
			font-weight: bold;
			font-size: 24px;
			color: #909399;
			margin-bottom: 20px;
		}
	</style>
	<body>
		<div class="main-content">
			<div class="page-box">
				<div class="page-header">
					<div class="clan-user-server">
						
						{% if data['clanInfo']['tag'] %}
						<div class="clan" style="color: {{ data['clanInfo']['colorRgb'] }};">[{{ data['clanInfo']['tag'] }}]</div>
						{% endif %}
						<div class="user">{{ data['userName'] }}</div>
						<div class="server">
							<div class="server-border">
								{{ data['serverName'] }}
							</div>
						</div>
					</div>
				</div>

				<div class="ship-bar">
					{% if data['shipData'][0]['shipInfo']['shipInfo']['nameCn'] %}
					<div class="ship-level">{{ data['shipData'][0]['shipInfo']['shipInfo']['level'] }}</div>
					{% else %}
					<div class="ship-level">{{ data['shipData'][0]['rankSolo']['shipInfo']['level'] }}</div>
					{% endif %}
					
					{% if data['shipData'][0]['shipInfo']['shipInfo']['nameCn'] %}
					<div class="ship-name">{{ data['shipData'][0]['shipInfo']['shipInfo']['nameCn'] }}</div>
					{% else %}
					<div class="ship-name">{{ data['shipData'][0]['rankSolo']['shipInfo']['nameCn'] }}</div>
					{% endif %}
					
					<div class="ship-icon"><img
									src={% if data['shipData'][0]['shipInfo']['shipInfo']['shipType'] == 'Destroyer' or data['shipData'][0]['rankSolo']['shipInfo']['shipType'] == 'Destroyer' %} "https://hikari-resource.oss-cn-shanghai.aliyuncs.com/shipType_Icon/icon_sunk_destroyer.png"
									{% elif data['shipData'][0]['shipInfo']['shipInfo']['shipType'] == 'Cruiser' or data['shipData'][0]['rankSolo']['shipInfo']['shipType'] == 'Cruiser' %} "https://hikari-resource.oss-cn-shanghai.aliyuncs.com/shipType_Icon/icon_sunk_cruiser.png"
									{% elif data['shipData'][0]['shipInfo']['shipInfo']['shipType'] == 'Battleship' or data['shipData'][0]['rankSolo']['shipInfo']['shipType'] == 'Battleship' %} "https://hikari-resource.oss-cn-shanghai.aliyuncs.com/shipType_Icon/icon_sunk_battleship.png"
									{% elif data['shipData'][0]['shipInfo']['shipInfo']['shipType'] == 'AirCarrier' or data['shipData'][0]['rankSolo']['shipInfo']['shipType'] == 'AirCarrier' %} "https://hikari-resource.oss-cn-shanghai.aliyuncs.com/shipType_Icon/icon_sunk_aircarrier.png"
									{% else %} "https://hikari-resource.oss-cn-shanghai.aliyuncs.com/shipType_Icon/icon_sunk_submarine.png"
									{% endif %} />
					</div>
				</div>

				<div class="pr">
					<!-- 动态设置长度及颜色，填写PR即可 -->
					<div class="pr-bar-bg">
						{% if data['pvpInfo']['pr']['color'] and data['pvpInfo']['pr']['color'] != '#828282' %}
						<span class="pr-number">{{ data['pvpInfo']['pr']['value'] }} &nbsp;&nbsp;&nbsp;&nbsp;<span class="pr-text"></span></span>
						{% else %}
						<span class="pr-number">{{ data['rankInfo']['pr']['value'] }} &nbsp;&nbsp;&nbsp;&nbsp;<span class="pr-text"></span></span>
						{% endif %}
						<div class="pr-bar"></div>
					</div>
				</div>

				<div class="recnet-time">
					<span>记录时间：</span><span>{{ time.strftime('%Y-%m-%d %H:%M',time.localtime(int(abs(data['shipData'][0]['recordDateTime']/1000)))) }}—{{ time.strftime('%Y-%m-%d %H:%M',time.localtime(time.time())) }}</span>
				</div>

				{% if data['pvpInfo']['battles'] %}
				<div class="overview-change">
					<div class="overview-change-item left-item">
						<div class="left-item-top item-top">
							<div class="overview-count-title item-top-top">场次</div>
							<div class="overview-count item-top-bottom">{{ data['pvpInfo']['battles'] }}</div>
						</div>
						<div class="left-item-bottom item-bottom">
							<div class="change-pr-title">
								<div class="change-pr-title-left">PR</div>
								<div class="change-pr-title-right">较上周</div>
							</div>
							<div class="change-pr">暂不可用</div>
						</div>
					</div>
					<div class="overview-change-item mid-item">
						<div class="mid-item-top item-top">
							<div class="overview-win-title item-top-top">胜率</div>
							<div class="overview-win item-top-bottom" style="color: {{ data['pvpInfo']['winsData']['color'] }}">{{ data['pvpInfo']['wins'] }}%</div>
						</div>
						<div class="mid-item-bottom item-bottom">
							<div class="change-avgdmg-box bottom-mini-item-left">
								<div class="mini-item-top">场均</div>
								<div class="mini-item-bottom change-avgdmg">暂不可用</div>
							</div>
							<div class="change-win-box bottom-mini-item-right">
								<div class="mini-item-top">胜率</div>
								<div class="mini-item-bottom change-win">暂不可用</div>
							</div>
						</div>
					</div>
					<div class="overview-change-item right-item">
						<div class="right-item-top item-top">
							<div class="overview-avgdmg-title item-top-top">场均</div>
							<div class="overview-avgdmg item-top-bottom" style="color: {{ data['pvpInfo']['damageData']['color'] }};">{{ data['pvpInfo']['damage'] }}</div>
						</div>
						<div class="right-item-bottom item-bottom">
							<div class="overview-kd-box bottom-mini-item-left">
								<div class="mini-item-top">击杀</div>
								<div class="mini-item-bottom">{{ '%.2f' | format(data['pvpInfo']['frags']) }}</div>
							</div>
							<div class="overview-hit-box bottom-mini-item-right">
								<div class="mini-item-top">命中</div>
								<div class="mini-item-bottom">{{ data['pvpInfo']['hit'] }}%</div>
							</div>
						</div>
					</div>
				</div>
				{% endif %}

				<div class="information-header">总体战绩</div>

				<div class="information-body">
					<div class="information-col information-table-header">
						<div class="information-col-item">类型</div>
						<div class="information-col-item">场次</div>
						<div class="information-col-item">胜率</div>
						<div class="information-col-item">PR</div>
						<div class="information-col-item">场均</div>
						<div class="information-col-item">击杀</div>
					</div>
					
					{% if data['pvpSoloInfo']['battles'] %}
					<div class="information-col">
						<div class="information-col-item information-type">单野</div>
						<div class="information-col-item">{{ data['pvpSoloInfo']['battles'] }}</div>
						<div class="information-col-item" style="color: {{ data['pvpSoloInfo']['winsData']['color'] }};">{{ data['pvpSoloInfo']['wins'] }}%</div>
						<div class="information-col-item" style="color: {{ data['pvpSoloInfo']['pr']['color'] }};">{{ data['pvpSoloInfo']['pr']['value'] }}</div>
						<div class="information-col-item" style="color: {{ data['pvpSoloInfo']['damageData']['color'] }};">{{ data['pvpSoloInfo']['damage'] }}</div>
						<div class="information-col-item">{{ '%.2f' | format(data['pvpSoloInfo']['frags']) }}</div>
					</div>
					{% endif %}

					{% if data['pvpTwoInfo']['battles'] %}
					<div class="information-col">
						<div class="information-col-item information-type">自行车</div>
						<div class="information-col-item">{{ data['pvpTwoInfo']['battles'] }}</div>
						<div class="information-col-item" style="color: {{ data['pvpTwoInfo']['winsData']['color'] }};">{{ data['pvpTwoInfo']['wins'] }}%</div>
						<div class="information-col-item" style="color: {{ data['pvpTwoInfo']['pr']['color'] }};">{{ data['pvpTwoInfo']['pr']['value'] }}</div>
						<div class="information-col-item" style="color: {{ data['pvpTwoInfo']['damageData']['color'] }};">{{ data['pvpTwoInfo']['damage'] }}</div>
						<div class="information-col-item">{{ '%.2f' | format(data['pvpTwoInfo']['frags']) }}</div>
					</div>
					{% endif %}


					{% if data['pvpThreeInfo']['battles'] %}
					<div class="information-col">
						<div class="information-col-item information-type">三轮车</div>
						<div class="information-col-item">{{ data['pvpThreeInfo']['battles'] }}</div>
						<div class="information-col-item" style="color: {{ data['pvpThreeInfo']['winsData']['color'] }};">{{ data['pvpThreeInfo']['wins'] }}%</div>
						<div class="information-col-item" style="color: {{ data['pvpThreeInfo']['pr']['color'] }};">{{ data['pvpThreeInfo']['pr']['value'] }}</div>
						<div class="information-col-item" style="color: {{ data['pvpThreeInfo']['damageData']['color'] }};">{{ data['pvpThreeInfo']['damage'] }}</div>
						<div class="information-col-item">{{ '%.2f' | format(data['pvpThreeInfo']['frags']) }}</div>
					</div>
					{% endif %}


					{% if data['rankInfo']['battles'] %}
					<div class="information-col">
						<div class="information-col-item information-type">排位</div>
						<div class="information-col-item">{{ data['rankInfo']['battles'] }}</div>
						<div class="information-col-item" style="color: {{ data['rankInfo']['winsData']['color'] }};">{{ data['rankInfo']['wins'] }}%</div>
						<div class="information-col-item" style="color: {{ data['rankInfo']['pr']['color'] }};">{{ data['rankInfo']['pr']['value'] }}</div>
						<div class="information-col-item" style="color: {{ data['rankInfo']['damageData']['color'] }};">{{ data['rankInfo']['damage'] }}</div>
						<div class="information-col-item">{{ '%.2f' | format(data['rankInfo']['frags']) }}</div>
					</div>
					{% endif %}

				</div>

				<div class="day-header">每日战绩</div>

				<div class="day-body">
					<div class="day-table-header">
						<div class="day-col-item">类型</div>
						<div class="day-col-item">场次</div>
						<div class="day-col-item">胜率</div>
						<div class="day-col-item">PR</div>
						<div class="day-col-item">场均</div>
						<div class="day-col-item">击杀</div>
					</div>


						<div class="data-item">
							{% for eachShipData in data['shipData'] %}
							    {% if eachShipData['shipInfo']['battles'] or eachShipData['rankSolo']['battles'] %}
								<div class="date">{{ time.strftime('%Y-%m-%d',time.localtime(int(abs(eachShipData['recordDateTime']/1000)))) }}</div>
									{% for each in eachShipData %}
										{% for index,value in enumerate(['shipSolo','shipTwo','shipThree','rankSolo']) %}
											{% if each|string == value and eachShipData[each]['battles'] %}
											<div class="day-data">
												<div class="day-col">
													<div class="day-col-item" style="color: #606266;;">{{ ['单野','自行车','三轮车','排位'][index] }}</div>
													<div class="day-col-item">{{ eachShipData[each]['battles'] }}</div>
													<div class="day-col-item" style="color: {{ eachShipData[each]['winsData']['color'] }};">{{ eachShipData[each]['wins'] }}%</div>
													<div class="day-col-item" style="color: {{ eachShipData[each]['pr']['color'] }};">{{ eachShipData[each]['pr']['value'] }}</div>
													<div class="day-col-item" style="color: {{ eachShipData[each]['damageData']['color'] }};">{{ eachShipData[each]['damage'] }}</div>
													<div class="day-col-item">{{ '%.2f' | format(eachShipData[each]['frags']) }}</div>
												</div>
											</div>
											{% endif %}
										{% endfor %}
									{% endfor %}
								{% endif %}
							{% endfor %}
						</div>

					<div class="footer">
						<p>©西行寺雨季&nbsp;&nbsp;©本心</p>
						<p>https://github.com/benx1n/HikariBot</p>
						<p>QQ频道搜索”yuyuko”即可使用稳定的腾讯官方机器人~</p>
						<p>Design By 冷眠 H5 Converted By C1ystal</p>
						<p>赞助鸣谢：科长、男人们的定远号、海上最速暴毙传说</p>
					</div>

				</div>



			</div>
		</div>
	</body>
	<script>
		// PR条颜色动态变化
		let bar_bg_width = document.querySelector('.pr-bar-bg').clientWidth;
		let pr_number = document.querySelector('.pr-number').innerText;
		pr_number = parseInt(pr_number);
		if (pr_number == 0) {
			document.querySelector(".pr-bar").style.backgroundColor = "#828282";
			document.querySelector(".pr-text").innerText = "暂无数据";
		} else if (pr_number < 750) {
			document.querySelector(".pr-bar").style.backgroundColor = "#F44336";
			document.querySelector(".pr-text").innerText = "还需努力";
		} else if (pr_number < 1100) {
			document.querySelector(".pr-bar").style.backgroundColor = "#FF9800";
			document.querySelector(".pr-text").innerText = "低于平均";
		} else if (pr_number < 1350) {
			document.querySelector(".pr-bar").style.backgroundColor = "#FFC107";
			document.querySelector(".pr-text").innerText = "平均水平";
			document.querySelector(".pr-number").style.color = "#303133";
		} else if (pr_number < 1550) {
			document.querySelector(".pr-bar").style.backgroundColor = "#8BC34A";
			document.querySelector(".pr-text").innerText = "好";
		} else if (pr_number < 1750) {
			document.querySelector(".pr-bar").style.backgroundColor = "#4CAF50";
			document.querySelector(".pr-text").innerText = "很好";
		} else if (pr_number < 2100) {
			document.querySelector(".pr-bar").style.backgroundColor = "#00BCD4";
			document.querySelector(".pr-text").innerText = "非常好";
		} else if (pr_number < 2450) {
			document.querySelector(".pr-bar").style.backgroundColor = "#9C27B0";
			document.querySelector(".pr-text").innerText = "大佬水平";
		} else {
			document.querySelector(".pr-bar").style.backgroundColor = "#673AB7";
			document.querySelector(".pr-text").innerText = "神佬水平";
			pr_number = 2450; //防止pr条溢出
		}

		if (pr_number < 220 && pr_number > 0) {
			pr_number = 220; //防止pr过低导致圆角异常
		}
		// PR条动态长度
		let width = bar_bg_width * (pr_number / 2450);
		document.querySelector('.pr-bar').style.width = width + "px";
	</script>

	<script>
		// 服务器字体颜色自动填充
		let server_name = document.querySelector(".server").innerText;
		if (server_name == "亚服") {
			document.querySelector(".server").style.color = "#92D050";
		} else if (server_name == "国服") {
			document.querySelector(".server").style.color = "#BF9000";
		} else if (server_name == "欧服") {
			document.querySelector(".server").style.color = "#009664";
		} else if (server_name == "美服") {
			document.querySelector(".server").style.color = "#6872C4";
		} else if (server_name == "俄服") {
			document.querySelector(".server").style.color = "#FF0000";
		}
	</script>

	<script>
		// 数据变化动态颜色填充
		let change_avgdmg = document.querySelector(".change-avgdmg").innerText;
		change_avgdmg = parseInt(change_avgdmg);

		let change_win = document.querySelector(".change-win").innerText;
		change_win = change_win.split("%", 1);
		change_win = parseFloat(change_win);

		let change_pr = document.querySelector(".change-pr").innerText;
		change_pr = parseInt(change_pr);

		if (change_avgdmg > 0) {
			document.querySelector(".change-avgdmg").style.color = "#70AD47";
		} else {
			document.querySelector(".change-avgdmg").style.color = "#FF0000";
		}

		if (change_win > 0) {
			document.querySelector(".change-win").style.color = "#70AD47";
		} else {
			document.querySelector(".change-win").style.color = "#FF0000";
		}

		if (change_pr > 0) {
			document.querySelector(".change-pr").style.color = "#70AD47";
		} else {
			document.querySelector(".change-pr").style.color = "#FF0000";
		}
	</script>

	<script>
		let ship_level = document.querySelector(".ship-level").innerText;
		let level_number = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"];
		let level_roma = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "★"];
		let ship_level_roma = level_roma[level_number.indexOf(ship_level)]
		document.querySelector(".ship-level").innerText = ship_level_roma;
	</script>

	<script>
		let arr_information = document.getElementsByClassName('information-col');
		for (let i = 0; i < arr_information.length; i++) {
			if (i % 2 != 0 && i == (arr_information.length - 1)) {
				arr_information[i].style.backgroundColor = "#E4E4E4";
				arr_information[i].style.borderBottomLeftRadius = "16px";
				arr_information[i].style.borderBottomRightRadius = "16px";
			} else if (i % 2 != 0) {
				arr_information[i].style.backgroundColor = "#E4E4E4";
			}
		}
	</script>
</html>
