💄 improve(ui): hotaru 主题底部进度条数据融合

This commit is contained in:
naiba
2020-12-20 21:47:12 +08:00
parent b46827f244
commit e912578723
3 changed files with 35 additions and 18 deletions

View File

@@ -98,7 +98,6 @@
delimiters: ['@#', '#@'],
data: {
servers: initData,
pulled: false,
cache: [],
},
mounted() {
@@ -168,14 +167,13 @@
ws.onmessage = function (evt) {
const oldServers = statusCards.servers
statusCards.servers = JSON.parse(evt.data)
statusCards.pulled++
const keys = Object.keys(statusCards.servers)
for (let i = 0; i < keys.length; i++) {
const ns = statusCards.servers[keys[i]];
if (!ns.Host) ns.live = false
else {
const lastActive = new Date(ns.LastActive).getTime()
if (statusCards.pulled > 3 && Date.now() - lastActive > 5 * 1000) {
if (Date.now() - lastActive > 5 * 1000) {
ns.live = false
} else {
ns.live = true