Compare commits

...

4 Commits

6 changed files with 189 additions and 68 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "nazhua", "name": "nazhua",
"version": "0.6.0", "version": "0.6.1",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@ -26,6 +26,7 @@ window.$$nazhuaConfig = {
// hideListItemStatusDonut: false, // 隐藏列表项的饼图 // hideListItemStatusDonut: false, // 隐藏列表项的饼图
// hideListItemStat: false, // 隐藏列表项的统计信息 // hideListItemStat: false, // 隐藏列表项的统计信息
// hideListItemBill: false, // 隐藏列表项的账单信息 // hideListItemBill: false, // 隐藏列表项的账单信息
hideListItemLink: true, // 隐藏列表项的购买链接
// hideFilter: false, // 隐藏筛选 // hideFilter: false, // 隐藏筛选
// hideTag: false, // 隐藏标签 // hideTag: false, // 隐藏标签
// hideDotBG: true, // 隐藏框框里面的点点背景 // hideDotBG: true, // 隐藏框框里面的点点背景

View File

@ -78,8 +78,27 @@
class="server-info-item" class="server-info-item"
:class="`temperature--${ttItem.type}`" :class="`temperature--${ttItem.type}`"
> >
<span class="server-info-item-label"> <span class="server-info-item-icon">
{{ ttItem.label }} <i
v-if="ttItem.type === 'cpu' || ttItem.label.toLowerCase().includes('cpu')"
class="ri-cpu-line"
/>
<i
v-else-if="ttItem.type === 'gpu' || ttItem.label.toLowerCase().includes('gpu')"
class="ri-gamepad-line"
/>
<i
v-else-if="ttItem.type === 'nvme' || ttItem.label.toLowerCase().includes('nvme')"
class="ri-hard-drive-3-line"
/>
<i
v-else-if="ttItem.type === 'motherboard'"
class="ri-instance-line"
/>
<i
v-else
class="ri-temp-hot-line"
/>
</span> </span>
<span class="server-info-item-value"> <span class="server-info-item-value">
{{ ttItem.value }} {{ ttItem.value }}
@ -326,102 +345,157 @@ const temperatureData = computed(() => {
const acpitz = []; const acpitz = [];
const coretemp_package_id = []; const coretemp_package_id = [];
const coretemp_core = []; const coretemp_core = [];
const nvme = [];
const k10temp = [];
const amdgpu = [];
const other = []; const other = [];
//
props.info.State.Temperatures.forEach((item) => { props.info.State.Temperatures.forEach((item) => {
if (item.Name.indexOf('acpitz') === 0) { const name = item.Name.toLowerCase();
acpitz.push(item.Temperature); const temp = item.Temperature;
if (name.startsWith('acpitz')) {
acpitz.push(temp);
return; return;
} }
if (item.Name.indexOf('coretemp_package_id_') === 0) { if (name.startsWith('coretemp_package_id_')) {
const coreIndex = parseInt(item.Name.replace('coretemp_package_id_', ''), 10); const coreIndex = parseInt(name.replace('coretemp_package_id_', ''), 10);
coretemp_package_id.push({ coretemp_package_id.push({
index: coreIndex, index: coreIndex,
value: `${item.Temperature}`, value: temp,
}); });
return; return;
} }
if (item.Name.indexOf('coretemp_core_') === 0) { if (name.startsWith('coretemp_core_')) {
const coreIndex = parseInt(item.Name.replace('coretemp_core_', ''), 10); const coreIndex = parseInt(name.replace('coretemp_core_', ''), 10);
coretemp_core.push({ coretemp_core.push({
index: coreIndex, index: coreIndex,
value: item.Temperature, value: temp,
});
return;
}
if (name.includes('nvme')) {
nvme.push({
name: item.Name,
value: temp,
});
return;
}
if (name.includes('k10temp')) {
k10temp.push({
name: item.Name,
value: temp,
});
return;
}
if (name.includes('amdgpu')) {
amdgpu.push({
name: item.Name,
value: temp,
});
return;
}
if (name.includes('motherboard') || name.includes('mainboard') || name.includes('board')) {
other.push({
label: '主板',
value: temp,
type: 'motherboard',
}); });
return; return;
} }
// console.log(item);
other.push({ other.push({
label: item.Name, label: item.Name,
value: `${item.Temperature}`, value: temp,
type: 'other',
}); });
}); });
//
if (acpitz.length) { if (acpitz.length) {
const acpitzMean = (acpitz.reduce((a, b) => a + b, 0) / acpitz.length).toFixed(1);
data.push({ data.push({
label: '主板', label: '主板',
value: `${acpitz[0]}`, value: `${acpitzMean}`,
type: 'acpitz', title: acpitz.map((i, index) => `传感器${index + 1}: ${parseFloat(i).toFixed(1)}`).join('\n'),
type: 'motherboard',
}); });
if (acpitz.length) { }
const acpitzMean = (acpitz.reduce((a, b) => a + b, 0) / acpitz.length).toFixed(1) * 1;
// CPU
if (coretemp_package_id.length || coretemp_core.length) {
const temps = [];
const details = [];
// CPU
if (coretemp_package_id.length) {
const cpuTemps = coretemp_package_id.map((i) => `${parseFloat(i.value).toFixed(1)}`);
temps.push(cpuTemps.join(', '));
details.push(...coretemp_package_id.map((i) => `CPU.${i.index + 1}: ${parseFloat(i.value).toFixed(1)}`));
}
//
if (coretemp_core.length) {
const coreMean = (coretemp_core.reduce((a, b) => a + b.value, 0) / coretemp_core.length).toFixed(1);
temps.push(`${parseFloat(coreMean).toFixed(1)}`);
details.push(...coretemp_core.map((i) => `核心${i.index + 1}: ${parseFloat(i.value).toFixed(1)}`));
}
data.push({
label: 'CPU',
value: temps.join(' / '),
title: details.join('\n'),
type: 'cpu',
});
}
// AMD CPU
if (k10temp.length) {
const tctl = k10temp.find((i) => i.name.includes('tctl'));
if (tctl) {
data.push({ data.push({
label: '主板平均', label: 'AMD CPU',
value: `${acpitzMean}`, value: `${parseFloat(tctl.value).toFixed(1)}`,
title: acpitz.map((i, index) => `传感器${index + 1}: ${i}`).join('\n'), title: k10temp.map((i) => `${i.name}: ${parseFloat(i.value).toFixed(1)}`).join('\n'),
type: 'acpitz-mean', type: 'cpu',
}); });
} }
} }
if (coretemp_package_id.length) {
data.push({ // AMD GPU
label: 'CPU温度', if (amdgpu.length) {
value: coretemp_package_id.map((i) => i.value).join(', '), const edge = amdgpu.find((i) => i.name.includes('edge'));
title: coretemp_package_id.length > 1 if (edge) {
? coretemp_package_id.map((i) => `CPU.${i.index + 1}: ${i.value}`).join('\n')
: '',
type: 'coretemp-package',
});
}
if (coretemp_core.length) {
const coretempCoreMean = (coretemp_core.reduce((a, b) => a + b.value, 0) / coretemp_core.length).toFixed(1) * 1;
data.push({
label: '核心平均',
value: `${coretempCoreMean}`,
title: coretemp_core.map((i) => `核心${i.index + 1}: ${i.value}`).join('\n'),
type: 'coretemp-core',
});
//
let max;
let maxCore;
coretemp_core.forEach((i) => {
if (max === undefined || i.value > max) {
max = i.value;
maxCore = i.index;
}
});
// 20%
if (max / coretempCoreMean > 1.2) {
data.push({ data.push({
label: `最热核心.${maxCore + 1}`, label: 'AMD GPU',
value: `${max}`, value: `${parseFloat(edge.value).toFixed(1)}`,
type: 'coretemp-max-core', title: amdgpu.map((i) => `${i.name}: ${parseFloat(i.value).toFixed(1)}`).join('\n'),
type: 'gpu',
}); });
} }
} }
if (other.length) {
// data.push({ // NVME
// type: 'other', if (nvme.length) {
// label: '', const composite = nvme.find((i) => i.name.includes('composite'));
// value: '...', if (composite) {
// title: other.map((i) => `${i.label}: ${i.value}`).join('\n'),
// });
other.forEach((i) => {
data.push({ data.push({
label: i.label, label: 'NVME',
value: i.value, value: `${parseFloat(composite.value).toFixed(1)}`,
type: 'other', title: nvme.map((i) => `${i.name}: ${parseFloat(i.value).toFixed(1)}`).join('\n'),
type: 'nvme',
}); });
}); }
} }
//
other.forEach((i) => {
data.push({
label: i.label,
value: `${parseFloat(i.value).toFixed(1)}`,
type: i.type || 'other',
});
});
} }
return { return {
list: data, list: data,
@ -571,6 +645,17 @@ const processCount = computed(() => props.info?.State?.ProcessCount);
.server-info-item { .server-info-item {
display: flex; display: flex;
gap: 0.2em; gap: 0.2em;
align-items: center;
.server-info-item-icon {
width: 24px;
height: 16px;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
color: #ccc;
}
} }
.server-info-item-value { .server-info-item-value {

View File

@ -82,6 +82,9 @@
'--cate-color': cateItem.color, '--cate-color': cateItem.color,
}" }"
@click="toggleShowCate(cateItem.id)" @click="toggleShowCate(cateItem.id)"
@touchstart="handleTouchStart(cateItem.id)"
@touchend="handleTouchEnd(cateItem.id)"
@touchmove="handleTouchMove(cateItem.id)"
> >
<span class="cate-legend" /> <span class="cate-legend" />
<span <span
@ -169,8 +172,8 @@ const minutes = [{
const refreshData = ref(true); const refreshData = ref(true);
const peakShaving = ref(false); const peakShaving = ref(false);
const showCates = ref({}); const showCates = ref({});
const monitorData = ref([]); const monitorData = ref([]);
const longPressTimer = ref(null);
const now = ref(Date.now()); const now = ref(Date.now());
const accpetShowTime = computed(() => now.value - (minute.value * 60 * 1000)); const accpetShowTime = computed(() => now.value - (minute.value * 60 * 1000));
@ -317,9 +320,32 @@ function toggleMinute(value) {
} }
function toggleShowCate(id) { function toggleShowCate(id) {
if (window.innerWidth < 768) {
return;
}
showCates.value[id] = !showCates.value[id]; showCates.value[id] = !showCates.value[id];
} }
function handleTouchStart(id) {
longPressTimer.value = setTimeout(() => {
showCates.value[id] = !showCates.value[id];
}, 500);
}
function handleTouchEnd() {
if (longPressTimer.value) {
clearTimeout(longPressTimer.value);
longPressTimer.value = null;
}
}
function handleTouchMove() {
if (longPressTimer.value) {
clearTimeout(longPressTimer.value);
longPressTimer.value = null;
}
}
async function loadMonitor() { async function loadMonitor() {
await request({ await request({
url: ( url: (
@ -548,6 +574,10 @@ onUnmounted(() => {
border-radius: 4px; border-radius: 4px;
cursor: pointer; cursor: pointer;
@media screen and (max-width: 768px) {
cursor: default;
}
.cate-legend { .cate-legend {
width: 0.5em; width: 0.5em;
height: 0.5em; height: 0.5em;

View File

@ -108,7 +108,12 @@ const buyBtnText = computed(() => {
} }
return config.nazhua.buyBtnText || '购买'; return config.nazhua.buyBtnText || '购买';
}); });
const showBuyBtn = computed(() => !!props.info?.PublicNote?.customData?.orderLink); const showBuyBtn = computed(() => {
if (config.nazhua.hideListItemLink === true) {
return false;
}
return !!props.info?.PublicNote?.customData?.orderLink;
});
function toBuy() { function toBuy() {
const decodeUrl = decodeURIComponent(props.info?.PublicNote?.customData?.orderLink); const decodeUrl = decodeURIComponent(props.info?.PublicNote?.customData?.orderLink);

View File

@ -229,7 +229,7 @@ const filterServerList = computed(() => {
if (validate.isSet(planDataMod?.bandwidth)) { if (validate.isSet(planDataMod?.bandwidth)) {
fields.bandwidth = true; fields.bandwidth = true;
} }
if (validate.isSet(customData?.orderLink)) { if (validate.isSet(customData?.orderLink) && config.nazhua.hideListItemLink !== true) {
fields.orderLink = true; fields.orderLink = true;
} }
} }