zhao/views/home.pug
2022-09-07 16:10:22 +08:00

201 lines
8.2 KiB
Plaintext

extends layout
block main
.container
.row.row-cols-md-2
section.table-responsive.text-center
table.table.table-bordered
thead.table-light
tr
th.table-primary(scope="col") 弟弟
th.table-light(scope="col") 周一
th.table-light(scope="col") 周二
th.table-light(scope="col") 周三
th.table-light(scope="col") 周四
th.table-light(scope="col") 周五
tbody
tr
th.table-light(scope="row") 第1节
td 数学
td 语文
td 研学
td 数学
td 语文
tr
th.table-light(scope="row") 第2节
td 语文
td 数学
td 语文
td 语文
td 数学
tr
th.table-light(scope="row") 第3节
td 语文
td 体育
td 科学
td 音乐
td 美术
tr
th.table-light(scope="row") 第4节
td 音乐
td 综实
td 科学
td 语文
td 劳动
tr.table-light
th(scope="row") 午休
td 🍚🥢
td 🍚🥢
td 🍚🥢
td 🍚🥢
td 🍚🥢
tr
th.table-light(scope="row") 第5节
td 英语
td 英语
td 德法
td 体育
td 叮当
tr
th.table-light(scope="row") 第6节
td 班会
td 信息
td 美术
td 德法
td 体育
section.table-responsive.text-center
table.table.table-bordered.align-middle
thead.table-light
tr
th.table-danger(scope="col") 姐姐
th.table-light(scope="col") 周一
th.table-light(scope="col") 周二
th.table-light(scope="col") 周三
th.table-light(scope="col") 周四
th.table-light(scope="col") 周五
tbody
tr
th.table-light(scope="row") 第1节
td 语文
td 语文
td 研学
td 数学
td 语文
tr
th.table-light(scope="row") 第2节
td 数学
td 数学
td 语文
td 美术
td 数学
tr
th.table-light(scope="row") 第3节
td 体育
td 英语
td 科学
td 语文
td 德法
tr
th.table-light(scope="row") 第4节
td 英语
td 体育
td 科学
td 语文
td 数学
tr.table-light
th(scope="row") 午休
td 🍚🥢
td 🍚🥢
td 🍚🥢
td 🍚🥢
td 🍚🥢
tr
th.table-light(scope="row") 第5节
td 德法
td 美术
td 综实
td 体育
td 信息
tr
th.table-light(scope="row") 第6节
td 班会
td 音乐
td 英语
td 劳动
td 音乐
script.
const now = new Date()
const tomorrow = now.getDay() + 1
if (tomorrow >= 1 && tomorrow <= 5)
document.querySelectorAll(`th:nth-child(${tomorrow + 1})`).forEach(cell => {
cell.style.fontWeight = 900
cell.classList.add('table-active')
})
document.querySelectorAll(`tr td:nth-child(${tomorrow + 1})`).forEach(cell => {
cell.style.fontWeight = 900
cell.classList.add('table-warning')
})
.container
.row.row-cols-md-2
.col(style="min-width:15rem;")
.card.border-danger
.card-header
img(src='/images/raspberry.png', height='32')
.card-body
p.card-text 主机名称:
code zhao
p.card-text 网络地址:
code 10.10.10.80
p.card-text
| 核心温度:
code#zhao_temp
| ℃
p.card-text
| 系统负载:
code#zhao_cpu
| %
p.card-text
| 内存剩余:
code#zhao_mem
| MB
.col(style="min-width:15rem;")
.card.border-danger
.card-header
img(src='/images/raspberry.png', height='32')
.card-body
p.card-text 主机名称:
code pi
p.card-text 网络地址:
code 10.10.10.42
p.card-text
| 核心温度:
code#pi_temp
| ℃
p.card-text
| 系统负载:
code#pi_cpu
| %
p.card-text
| 内存剩余:
code#pi_mem
| MB
script.
function get_rpis_status() {
fetch(new Request('http://zhao/status'))
.then(resp => resp.json())
.then(data => {
zhao_temp.innerText = data.cpu.temperature.toFixed(2)
zhao_cpu.innerText = (data.cpu.load * 100).toFixed(2)
zhao_mem.innerText = data.memory.available.toFixed(2)
})
fetch(new Request('http://pi/status'))
.then(resp => resp.json())
.then(data => {
pi_temp.innerText = data.cpu.temperature.toFixed(2)
pi_cpu.innerText = (data.cpu.load * 100).toFixed(2)
pi_mem.innerText = data.memory.available.toFixed(2)
})
}
setInterval(get_rpis_status, 1000)