From ee2baad3ae0b18da09b4435e244967fb4bdd6d81 Mon Sep 17 00:00:00 2001 From: ngfchl Date: Mon, 5 Dec 2022 14:21:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=AD=94=E5=8A=9B=E7=A7=AF?= =?UTF-8?q?=E5=88=86=E6=98=BE=E7=A4=BA=E4=B8=BA=E4=B8=87=E3=80=81=E4=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/utils.js | 33 ++++ templates/auto_pt/status.html | 303 ++++++++++++++++------------------ 2 files changed, 177 insertions(+), 159 deletions(-) create mode 100644 static/js/utils.js diff --git a/static/js/utils.js b/static/js/utils.js new file mode 100644 index 0000000..2466e1d --- /dev/null +++ b/static/js/utils.js @@ -0,0 +1,33 @@ +function renderSize(value) { + if (null == value || value == '') { + return 0; + } + var unitArr = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; + var index = 0; + var srcsize = parseFloat(value); + index = Math.floor(Math.log(srcsize) / Math.log(1024)); + var size = srcsize / Math.pow(1024, index); + size = size.toFixed(2);//保留的小数位数 + return size + ' ' + unitArr[index]; +} + +function shuffle() { + return Math.random() > 0.5 ? -1 : 1; +} + +function numberFormat(value) { + let param = {} + let k = 10000 + let sizes = ['', 'W', 'E'] + let i + if (value < k) { + param.value = value + param.unit = '' + } else { + i = Math.floor(Math.log(value) / Math.log(k)); + param.value = ((value / Math.pow(k, i))).toFixed(2); + param.unit = sizes[i]; + } + console.log(param) + return `${param.value}${param.unit}`; +} diff --git a/templates/auto_pt/status.html b/templates/auto_pt/status.html index bc6e566..d5aa79d 100644 --- a/templates/auto_pt/status.html +++ b/templates/auto_pt/status.html @@ -147,10 +147,10 @@
魔力/积分:
-

@@ -217,8 +217,8 @@ 更新 - 编辑 - + {# 编辑#} + {# #} 历史 @@ -253,7 +253,7 @@
魔力/积分:
{% include 'admin/includes/js-part.html' %} +