This commit is contained in:
haoouba 2021-05-24 21:37:56 +08:00
parent effff92797
commit 231289a9e2
5 changed files with 19 additions and 5 deletions

View File

@ -8,6 +8,11 @@ document.addEventListener('DOMContentLoaded', () => {
i = Math.floor(Math.log(bytes) / Math.log(k)); i = Math.floor(Math.log(bytes) / Math.log(k));
return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i]; return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
}; };
/* 转换内存 */
const megaknotsToSize = (limit) => {
if (limit < 1024) return parseInt(limit) + ' MB'
return parseInt(limit / 1024) + ' GB'
}
const categories = []; const categories = [];
const upSeries = []; const upSeries = [];
const downSeries = []; const downSeries = [];
@ -27,6 +32,8 @@ document.addEventListener('DOMContentLoaded', () => {
success(res) { success(res) {
if (!res.status) Qmsg.warning('服务器接口异常!'); if (!res.status) Qmsg.warning('服务器接口异常!');
{ {
$('.joe_census__server-item .count .core').html(`${res.cpu[1]}`);
$('.joe_census__server-item .count .ram').html(`${megaknotsToSize(res.memory.memTotal)}`);
$('.joe_census__server-item .count .up').html(`总发送:${bytesToSize(res.upTotal)}`); $('.joe_census__server-item .count .up').html(`总发送:${bytesToSize(res.upTotal)}`);
$('.joe_census__server-item .count .down').html(`总接收:${bytesToSize(res.downTotal)}`); $('.joe_census__server-item .count .down').html(`总接收:${bytesToSize(res.downTotal)}`);
const stamp = new Date(); const stamp = new Date();

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
<?php $this->need('public/include.php'); ?> <?php $this->need('public/include.php'); ?>
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.census.min.css?v=20210524'); ?>"> <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.census.min.css?v=20210524'); ?>">
<script src="https://cdn.jsdelivr.net/npm/echarts@5.1.1/dist/echarts.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/echarts@5.1.1/dist/echarts.min.js"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.census.min.js?v=20210524'); ?>"></script> <script src="<?php $this->options->themeUrl('assets/js/joe.census.min.js?v=202105242137'); ?>"></script>
</head> </head>
<body> <body>
@ -86,7 +86,14 @@
<?php if ($this->options->JBTPanel && $this->options->JBTKey) : ?> <?php if ($this->options->JBTPanel && $this->options->JBTKey) : ?>
<div class="joe_census__server"> <div class="joe_census__server">
<div class="joe_census__server-item"> <div class="joe_census__server-item">
<div class="title">实时负载</div> <div class="title">
<span>实时负载</span>
<div class="count">
<span class="core">0 </span>
<span class="split">/</span>
<span class="ram">0 MB</span>
</div>
</div>
<div class="content"> <div class="content">
<div id="work"></div> <div id="work"></div>
</div> </div>

View File

@ -2,7 +2,7 @@
/* 获取主题当前版本号 */ /* 获取主题当前版本号 */
function _getVersion() function _getVersion()
{ {
return "7.1.1"; return "7.1.2";
}; };
/* 判断是否是手机 */ /* 判断是否是手机 */

View File

@ -1,6 +1,6 @@
{ {
"name": "typecho-joe-next", "name": "typecho-joe-next",
"version": "7.1.1", "version": "7.1.2",
"description": "A Theme Of Typecho", "description": "A Theme Of Typecho",
"main": "index.php", "main": "index.php",
"keywords": [ "keywords": [