2024-03-30 06:04:17 +08:00
|
|
|
|
<!DOCTYPE html>
|
2024-03-31 06:22:53 +08:00
|
|
|
|
<html lang="en">
|
2024-03-30 06:04:17 +08:00
|
|
|
|
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
2024-03-31 06:22:53 +08:00
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
<title>Document</title>
|
|
|
|
|
<link rel="stylesheet" href="css/fonts.css">
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
|
|
body {
|
|
|
|
|
font-family: 'MiSans', serif;
|
|
|
|
|
background-repeat: repeat-y;
|
|
|
|
|
background-size: cover;
|
|
|
|
|
background-position: center;
|
|
|
|
|
background-image: url('img/bg1.jpg');
|
|
|
|
|
color: white;
|
|
|
|
|
// 上10px,左右10px,下0px
|
2024-04-03 01:03:25 +08:00
|
|
|
|
margin: 24px;
|
2024-03-31 06:22:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.info-box {
|
2024-04-03 01:03:25 +08:00
|
|
|
|
border-radius: 30px;
|
|
|
|
|
padding: 30px;
|
2024-03-31 06:22:53 +08:00
|
|
|
|
backdrop-filter: blur(30px);
|
|
|
|
|
background-color: rgba(0, 0, 0, 0.3);
|
|
|
|
|
display: flex;
|
2024-04-03 01:03:25 +08:00
|
|
|
|
margin: 0 24px 24px;
|
2024-03-31 06:22:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#cpu-chart, #mem-chart, #swap-chart {
|
2024-04-03 01:03:25 +08:00
|
|
|
|
height: 240px;
|
|
|
|
|
width: 240px;
|
|
|
|
|
margin-bottom: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#cpu-info, #mem-info, #swap-info {
|
|
|
|
|
margin: 0 40px;
|
|
|
|
|
align-items: center;
|
2024-03-31 06:22:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#bot-info {
|
2024-04-03 01:03:25 +08:00
|
|
|
|
margin-top: 24px;
|
2024-03-31 06:22:53 +08:00
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#hardware-info {
|
|
|
|
|
justify-content: center;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#bot-icon {
|
|
|
|
|
border-radius: 50%;
|
2024-04-03 01:03:25 +08:00
|
|
|
|
height: 200px;
|
2024-03-31 06:22:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#bot-name, #bot-tag {
|
|
|
|
|
margin-left: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#bot-name {
|
2024-04-03 01:03:25 +08:00
|
|
|
|
font-size: 42px;
|
2024-03-31 06:22:53 +08:00
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#bot-tag {
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.chart-label {
|
2024-04-03 01:03:25 +08:00
|
|
|
|
font-size: 30px;
|
|
|
|
|
max-width: 240px;
|
2024-03-31 06:22:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.tag {
|
2024-04-03 01:03:25 +08:00
|
|
|
|
font-size: 27px;
|
2024-03-31 06:22:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.tag::after {
|
|
|
|
|
content: "|";
|
|
|
|
|
display: inline-block;
|
|
|
|
|
margin: 0 5px;
|
2024-04-02 08:51:34 +08:00
|
|
|
|
height: 50%;
|
|
|
|
|
line-height: 50%;
|
2024-03-31 06:22:53 +08:00
|
|
|
|
color: #aaa;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</style>
|
2024-03-31 07:25:29 +08:00
|
|
|
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@4.3.0/dist/echarts.min.js"></script>
|
2024-03-30 06:04:17 +08:00
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body>
|
2024-03-31 06:22:53 +08:00
|
|
|
|
|
|
|
|
|
<div class="info-box" id="bot-info">
|
|
|
|
|
<span>
|
|
|
|
|
<img id="bot-icon" src="https://q.qlogo.cn/g?b=qq&nk={{BOT_ID}}}&s=640" alt="BotIcon">
|
|
|
|
|
</span>
|
|
|
|
|
<span>
|
|
|
|
|
<span id="bot-name">
|
|
|
|
|
{{ BOT_NAME }}
|
|
|
|
|
</span>
|
|
|
|
|
<div id="bot-tag"></div>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="info-box" id="hardware-info">
|
|
|
|
|
<div id="cpu-info">
|
|
|
|
|
<div id="cpu-chart"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="mem-info">
|
|
|
|
|
<div id="mem-chart"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="swap-info">
|
|
|
|
|
<div id="swap-chart"></div>
|
|
|
|
|
</div>
|
2024-03-30 06:04:17 +08:00
|
|
|
|
</div>
|
2024-03-31 06:22:53 +08:00
|
|
|
|
|
|
|
|
|
<div id="cpuData" style="display: none;">{{ CPUDATA | tojson }}</div>
|
|
|
|
|
<div id="memData" style="display: none;">{{ MEMDATA | tojson }}</div>
|
|
|
|
|
<div id="swapData" style="display: none;">{{ SWAPDATA | tojson }}</div>
|
|
|
|
|
<div id="botTag" style="display: none;">{{ BOT_TAGS | tojson }}</div>
|
|
|
|
|
<div id="cpuTag" style="display: none;">{{ CPU_TAGS | tojson }}</div>
|
|
|
|
|
<div id="memTag" style="display: none;">{{ MEM_TAGS | tojson }}</div>
|
|
|
|
|
<div id="swapTag" style="display: none;">{{ SWAP_TAGS | tojson }}</div>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
// 环形图
|
|
|
|
|
{
|
|
|
|
|
let bgs = ["bg1.jpg"]
|
|
|
|
|
// 随机选择背景图片
|
|
|
|
|
document.body.style.backgroundImage = `url(./img/${bgs[Math.floor(Math.random() * bgs.length)]})`;
|
|
|
|
|
|
|
|
|
|
let botTags = JSON.parse(document.getElementById('botTag').innerText);
|
2024-04-02 08:51:34 +08:00
|
|
|
|
|
2024-03-31 06:22:53 +08:00
|
|
|
|
botTags.forEach(tag => {
|
|
|
|
|
let tagSpan = document.createElement('span');
|
|
|
|
|
tagSpan.innerText = tag;
|
|
|
|
|
tagSpan.className = 'tag';
|
|
|
|
|
document.getElementById('bot-tag').appendChild(tagSpan);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let cpuInfo = echarts.init(document.getElementById('cpu-chart'));
|
|
|
|
|
let memInfo = echarts.init(document.getElementById('mem-chart'));
|
|
|
|
|
let swapInfo = echarts.init(document.getElementById('swap-chart'));
|
|
|
|
|
let cpuData = JSON.parse(document.getElementById('cpuData').innerText);
|
|
|
|
|
let memData = JSON.parse(document.getElementById('memData').innerText);
|
|
|
|
|
let swapData = JSON.parse(document.getElementById('swapData').innerText);
|
|
|
|
|
|
|
|
|
|
sub_tag_data = {
|
|
|
|
|
cpu: JSON.parse(document.getElementById('cpuTag').innerText),
|
|
|
|
|
mem: JSON.parse(document.getElementById('memTag').innerText),
|
|
|
|
|
swap: JSON.parse(document.getElementById('swapTag').innerText)
|
|
|
|
|
}
|
|
|
|
|
// 遍历key和value,key是cpu,mem,swap,value是对应的tag数组,添加div标签class为chart-label
|
|
|
|
|
for (let key in sub_tag_data) {
|
|
|
|
|
let infoDiv = document.getElementById(key + '-info');
|
|
|
|
|
sub_tag_data[key].forEach(tag => {
|
|
|
|
|
let tagSpan = document.createElement('div');
|
|
|
|
|
tagSpan.innerText = tag;
|
|
|
|
|
tagSpan.className = 'chart-label';
|
|
|
|
|
infoDiv.appendChild(tagSpan);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getOption(title, data) {
|
|
|
|
|
return {
|
|
|
|
|
animation: false,
|
|
|
|
|
title: {
|
|
|
|
|
text: title,
|
|
|
|
|
left: 'center',
|
|
|
|
|
top: 'center',
|
|
|
|
|
textStyle: {
|
|
|
|
|
//文字颜色
|
|
|
|
|
color: '#fff',
|
2024-04-03 01:03:25 +08:00
|
|
|
|
fontSize: 30
|
2024-03-31 06:22:53 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
tooltip: {
|
|
|
|
|
show: true,
|
|
|
|
|
trigger: "item",
|
|
|
|
|
backgroundColor: "#ffffff00",
|
|
|
|
|
// {a}(系列名称),{b}(数据项名称),{c}(数值), {d}(百分比)
|
|
|
|
|
},
|
|
|
|
|
color: ['#a2d8f4', "#ffffff44", '#00a6ff'],
|
|
|
|
|
series: [
|
|
|
|
|
{
|
|
|
|
|
name: 'info',
|
|
|
|
|
type: 'pie',
|
|
|
|
|
radius: ['80%', '100%'],
|
|
|
|
|
center: ['50%', '50%'],
|
|
|
|
|
itemStyle: {
|
|
|
|
|
normal: {
|
|
|
|
|
label: {
|
|
|
|
|
show: false
|
|
|
|
|
},
|
|
|
|
|
labelLine: {
|
|
|
|
|
show: false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
emphasis: {
|
|
|
|
|
label: {
|
|
|
|
|
show: true,
|
|
|
|
|
textStyle: {
|
2024-04-03 01:03:25 +08:00
|
|
|
|
fontSize: '50',
|
2024-03-31 06:22:53 +08:00
|
|
|
|
fontWeight: 'bold'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data: data
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cpuInfo.setOption(getOption("{{ CPU }}", cpuData));
|
|
|
|
|
memInfo.setOption(getOption('{{ MEM }}', memData));
|
|
|
|
|
swapInfo.setOption(getOption('{{ SWAP }}', swapData));
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|