️ 细节优化

This commit is contained in:
yeyang
2024-05-15 19:03:06 +08:00
parent a981ded0a2
commit b37e6de2d2
2 changed files with 14 additions and 11 deletions

View File

@@ -1,8 +1,5 @@
import plugin from "../../../lib/plugins/plugin.js"
import { Config } from "../components/index.js"
import Monitor from "../model/State/Monitor.js"
import { getBackground } from "../model/State/style.js"
import { getData, getChartCfg } from "../model/State/index.js"
import { getMonitorData, getData } from "../model/State/index.js"
import { si } from "../model/State/utils.js"
import { puppeteer } from "../model/index.js"
@@ -33,11 +30,8 @@ export class NewState extends plugin {
}
async monitor(e) {
await puppeteer.render("state/monitor", {
chartData: JSON.stringify(Monitor.chartData),
backdrop: await getBackground(),
chartCfg: JSON.stringify(getChartCfg())
}, {
const data = await getMonitorData()
await puppeteer.render("state/monitor", data, {
e,
scale: 1.4
})

View File

@@ -13,7 +13,7 @@ import getNode from "./NodeInfo.js"
import getOtherInfo, { getCopyright } from "./OtherInfo.js"
import getRAM from "./RAM.js"
import getSWAP from "./SWAP.js"
import getStyle from "./style.js"
import getStyle, { getBackground } from "./style.js"
export async function getData(e) {
e.isPro = e.msg.includes("pro")
@@ -68,7 +68,16 @@ export async function getData(e) {
chartCfg: JSON.stringify(getChartCfg())
}
}
export function getChartCfg() {
export async function getMonitorData() {
return {
chartData: JSON.stringify(Monitor.chartData),
backdrop: await getBackground(),
chartCfg: JSON.stringify(getChartCfg())
}
}
function getChartCfg() {
const echarts_theme = Data.readJSON("resources/state/theme_westeros.json")
return {