add color

This commit is contained in:
紫云徽 2024-08-12 16:00:55 +08:00
parent a8857e40d4
commit 107dc62e40
2 changed files with 13 additions and 1 deletions

View File

@ -54,6 +54,14 @@
background-color: #dfdfdf; background-color: #dfdfdf;
} }
.device {
background-color: #ffff00;
}
.online {
color: #00ff00;
}
.btn:hover { .btn:hover {
background-color: #b9b9b9; background-color: #b9b9b9;
} }
@ -144,7 +152,9 @@
tb.append(trn); tb.append(trn);
for (let i in list) { for (let i in list) {
trn = document.createElement('tr'); trn = document.createElement('tr');
trn.setAttribute('class', list[i].device === true ? 'device' : '');
td1 = document.createElement('td'); td1 = document.createElement('td');
td1.setAttribute('class', list[i].status === 'bound' ? 'online' : '');
td2 = document.createElement('td'); td2 = document.createElement('td');
td3 = document.createElement('td'); td3 = document.createElement('td');
td4 = document.createElement('td'); td4 = document.createElement('td');
@ -158,7 +168,7 @@
btn2.setAttribute('cidrgroup', 'proxy'); btn2.setAttribute('cidrgroup', 'proxy');
btn2.setAttribute('deviceid', list[i].id); btn2.setAttribute('deviceid', list[i].id);
btn2.append('切换至Proxy'); btn2.append('切换至Proxy');
td1.append(list[i].host); td1.append(list[i].comment === '' ? list[i].host : list[i].comment);
td2.append(list[i].address); td2.append(list[i].address);
td3.append(list[i].mac); td3.append(list[i].mac);
td4.append(btn1); td4.append(btn1);

View File

@ -148,9 +148,11 @@ async function getDHCPList(addr: string | null) {
status: result[eq]['status'], status: result[eq]['status'],
host: result[eq]['host-name'], host: result[eq]['host-name'],
comment: result[eq]['comment'], comment: result[eq]['comment'],
device: false,
}; };
if (addr !== null || addr !== undefined || addr !== '') { if (addr !== null || addr !== undefined || addr !== '') {
if (addr === format.address) { if (addr === format.address) {
format.device = true;
list.unshift(format); list.unshift(format);
} else { } else {
list.push(format); list.push(format);