From 81b99b435e4cf7be0388f5efdcdc0e0b4adce406 Mon Sep 17 00:00:00 2001 From: Zyy955 <1072411694@qq.com> Date: Sat, 7 Oct 2023 00:33:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8B=AC=E7=AB=8B`=E6=A4=B0=E5=A5=B6=E7=8A=B6?= =?UTF-8?q?=E6=80=81`=E8=83=8C=E6=99=AFapi=EF=BC=8C=E9=98=B2=E6=AD=A2api?= =?UTF-8?q?=E5=A4=B1=E6=95=88=E6=97=B6=E6=97=A0=E6=B3=95=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/state.js | 3 ++- config/default_config/state.yaml | 3 +++ resources/state/state.css | 1 - resources/state/state.html | 6 ++++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/state.js b/apps/state.js index c88156c..e1c5910 100644 --- a/apps/state.js +++ b/apps/state.js @@ -60,7 +60,8 @@ export class NewState extends plugin { // 网络测试 let psTest = [] - let { psTestSites, psTestTimeout } = Config.state + let { psTestSites, psTestTimeout, backdrop } = Config.state + State.chartData.backdrop = backdrop psTestSites && promiseTaskList.push(...psTestSites?.map(i => State.getNetworkLatency(i.url, psTestTimeout).then(res => psTest.push({ first: i.name, tail: res diff --git a/config/default_config/state.yaml b/config/default_config/state.yaml index e12785d..6af84be 100644 --- a/config/default_config/state.yaml +++ b/config/default_config/state.yaml @@ -16,3 +16,6 @@ statusTask: true #如果出现内存异常的情况可将此配置项开启,如果打开后报错请将监控任务关闭 statusPowerShellStart: false + +# 背景图片api "https://t.mwm.moe/mp/" +backdrop: "https://t.mwm.moe/mp/" \ No newline at end of file diff --git a/resources/state/state.css b/resources/state/state.css index 62fdf11..3607085 100644 --- a/resources/state/state.css +++ b/resources/state/state.css @@ -11,7 +11,6 @@ } .container { - background-image: url("https://t.mwm.moe/mp/"); background-color: white; background-position: center top; background-repeat: no-repeat; diff --git a/resources/state/state.html b/resources/state/state.html index 269fe53..70ca221 100644 --- a/resources/state/state.html +++ b/resources/state/state.html @@ -66,6 +66,12 @@ const chart = echarts.init(document.getElementById('Chart'), 'westeros', { renderer: 'svg' }) + const backdrop = chartData.backdrop + // 背景api + if (backdrop) { + var container = document.getElementById('container') + container.style.backgroundImage = 'url(' + backdrop + ')' + } const by = (value) => { value = value?.value ?? value let units = ['B', 'KB', 'MB', 'GB', 'TB'] // 定义单位数组